Link to home
Start Free TrialLog in
Avatar of LeTay
LeTay

asked on

Delphi XE10.1 IBX TStoredProc crashes : index XSQLDA out of range...

I succeeded to migrated my large Delphi application from XE2 to XE10.1 Berlin
I use the IBX component
It works fine, except (not yet tested everything) for some TStoredProc (on XE2, everything was fine)
For example, I have this stored procedure in the Firebird database :

create procedure BriTay010 (Modele integer)
                   returns (Mini integer,
                            Maxi integer)
as
begin
 select min(Numero),max(Numero)
 from   Articles
 where  Modele_No = :Modele
 into   :Mini,:Maxi;
 Mini = nullif(Mini,0);
 Maxi = nullif(Maxi,0);
end^

Open in new window


And the code at execution  (F01 is a TForm, IBSP a TStoredProc object on it)

 F01.IBSP.Params.Clear;
 F01.IBSP.StoredProcName := 'BRITAY010';
 F01.IBSP.Params.CreateParam(ftInteger,'Modele',ptInput);
 F01.IBSP.Params.CreateParam(ftInteger,'Mini',ptOutput);
 F01.IBSP.Params.CreateParam(ftInteger,'Maxi',ptOutput);
 F01.IBSP.Params.ParamByName('Modele').AsInteger := someIntegerValue...;
 F01.IBSP.Prepare;
 F01.IBSP.ExecProc;

Open in new window


It crashed on the ExecProc :
Index XSQLDA out of range

No idea why, the parameters looks ok
Avatar of Geert G
Geert G
Flag of Belgium image

are you sure the mini and maxi are integers of range ?
integer = number(9)
Avatar of LeTay
LeTay

ASKER

The "Numero" column in teh "Articles" table is integer
What is strange is that this works fine compiled on Delphi XE2 (and not XE10.1)
Avatar of LeTay

ASKER

So to answer your question, this field is integer, yes
But it seems that the same error occur for all (around 70, grrr) other stored procedure I have in that database !
Seems to be one single problem for all of them, since XE10 as for XE2 it runs fine
i mean in the database ... your column is it also integer ?
or a number(x) where x should be at least 9

a workaround is to use a query component instead of stored proc component
on oracle it's actually faster, dunno about ib
Avatar of LeTay

ASKER

In the database, the column is integer
Continuing to test my migrated application, I discover now that many (maybe all ?) stored procedures generates the same exception at execution.
For example this one, where no parameter is  integer :
set term ^;
create procedure BriTay003 (Section varchar(40),
                            Clef    varchar(80))
                           returns (Valeur varchar(200))
as
begin
 select Valeur
 from   Constantes
 where  Section = :Section
 and    Clef    = :Clef
 into   :Valeur;
end^
set term ;^

Open in new window


I have a total of 74 stored procedures
I have already "converted" 3 of them to other stuff than stored procedures (direct queries with TIBQuery)
For me, it seems to be a bug in the TIBStoredProc or something like that ...
Avatar of LeTay

ASKER

Well, it is not a bug in the TIBStoredProc, it is in my program !
When the TIBStoredProc object, named SP is to be used, it is initialised in a procedure, here it is :
procedure BTSQLSPSetup(var SP:TIBStoredProc;Numero:integer);
var
Temp:string;
begin
 Temp := '000' + IntToStr(Numero);
 Temp := Copy(Temp,Length(Temp) -2,3);
 SP := TIBStoredProc.Create(Application);
 SP.StoredProcName := 'BRITAY' + Temp;
 SP.Params.Clear;
 SP.Database    := F01.IBDB;
 SP.Transaction := F01.IBTransMain;
end;

Open in new window


The caller code looks like this :
BTSQLSPSetup(SP,someinteger);
SP.Params.CreateParam(...etc...

Open in new window


I have discovered (this was not the case with Delphi XE2) that the SP.Params.Count is NOT zero just after the execution of BTSQLSPSetup.
The SP.Params.Clear in the called procedure show (debug mode) a Count of zero inside it, but not when exiting !
Strange behavior now with XE10 or abnormal behavior with XE2, corrected with XE10 ?
ASKER CERTIFIED SOLUTION
Avatar of Geert G
Geert G
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LeTay

ASKER

Indeed I pass a nil as storedproc
I modified the code and now the Params is cleared in the caller
So in fact the question can be closed as it was a bug in my application