Re: Informix and Delphi
Posted in 1996
In article <4km05o$17c@geraldo.cc.utexas.edu>,
jfalck@pobox.com (Jay Falck) wrote:
>kerry@kcbbs.gen.nz (Kerry Sainsbury) wrote:
>
>>We've built a simple stored procedure which just returns the appropriate
>>SQLCA element via a call to DBINFO, then I have a little Delphi routine
>>(called "updated") that executes the stored procedure and returns the
>>value.
>
>>Not as nice as an imbedded SQLCA record, but not bad either.
>Is there a chance I could some more information on this. I think not
>having SQLCA available is a REALLY bad thing.
This stored procedure, for example, returns the serial number of the
most recently inserted row:
create procedure GetSerialNumber() returning integer; return dbinfo('sqlca.sqlerrd1');
end procedure
So you'd write Delphi code looking something like:
SQL.Add('insert into sometable(serial_id, description)');
SQL.Add('values(0, "Hello")');
ExecSQL;
SQL.Clear;
Close
SQL.Add('select GetSerialNumber from systables where tabid=1');
Open;
MessageDlg('Rowid inserted was ' + intToStr(Fields[0].AsInteger), ...
Actually you'd stick the select into a function (or a method in your
own TQuery descendant), but you get the idea.
Good luck,
Kerry S
------------------------------------,------------------------------------------
Kerry Sainsbury, kerry@kcbbs.gen.nz | THE INFORMIX FAQ v2.4 Oct 95
Quanta Systems, Auckland | http://www.iiug.org/techinfo/faq/
New Zealand. Work: +64 9 377-4473 | ftp://ftp.iiug.org/pub/informix/faq
Home: +64 9 279-3571 | ftp://kcbbs.gen.nz:/pub/informix/