Board index » off-topic » Trap Informix Error in BDE

Trap Informix Error in BDE


2004-09-26 02:14:47 AM
off-topic8
In database application I've the following stored procedure
create procedure ErrorProc(ErrDesc char(500))
raise exception -746,0,ErrDesc;
end procedure
In Delphi code:
try
...........
execpt
e : exception ....
end;
How could I get through BDE the string ErrDesc? Or other error information
(for example for error -206 the unknown table name)?
--
Using Opera's revolutionary e-mail client: www.opera.com/m2/
 
 

Re:Trap Informix Error in BDE

See the Errors property of EDBEngineError in the Delphi on-line help.
--
Bill (TeamB)
TeamB cannot answer questions received via email
Juhász Lajos wrote:
Quote
In database application I've the following stored procedure

create procedure ErrorProc(ErrDesc char(500))
raise exception -746,0,ErrDesc;
end procedure

In Delphi code:

try
...........
execpt
e : exception ....
end;

How could I get through BDE the string ErrDesc? Or other error
information (for example for error -206 the unknown table name)?
 

Re:Trap Informix Error in BDE

On 25 Sep 2004 13:28:44 -0700, Bill Todd < XXXX@XXXXX.COM >wrote:
Quote
See the Errors property of EDBEngineError in the Delphi on-line help.

I've tried that and for the following select:
select * from ddd
The Errors property contains(ErrorCode, message):
(10024) Table does not exist.
(13059) Unknown error message number '-206'
(13059) Unknown error message number '-111'
From this text I can only see that select containts an unknown table and
in some situations it is
hard to find what is wrong with the statement .... The main problem is
when the stored procedure raises an error with an error message and I only
get back the error number without the description text.
--
Using Opera's revolutionary e-mail client: www.opera.com/m2/
 

{smallsort}

Re:Trap Informix Error in BDE

Since the BDE is no longer being developed and the SQL Links drivers
have been deprecated you should not use the BDE for any new development.
The information in the Errors property is all that is available. I have
no idea why you are getting error codes with no messages..
--
Bill (TeamB)
TeamB cannot answer questions received via email
 

Re:Trap Informix Error in BDE

After some seeking I've found out that I should use the DbiGetErrorContext
in order to get the information I need. According to BDE help file in the
following code ctxt should contain the offending table name. Only in my
case it returns an empty string (I've tried with informix databes and
DBDemos).
Can anyone tell what am I doing wrong?
///
var
ltable : TTable;
Ctxt: string;
begin
lTable:=TTable.Create(application); // create a table
ltable.databasename:='DBDEmos'; // use alias
ltable.TableName:='bambula121'; // this table doesn't exists
try
ltable.open; // DbiOpenTable (help file)
except
on e : EDBEngineError do
begin
SetLength(Ctxt, DBIMAXMSGLEN+1);
DbiGetErrorContext(ecTABLENAME, PCHAR(Ctxt)); // In this case I
need the tablename
SetLength(Ctxt, StrLen(PChar(Ctxt)));
if Ctxt <>'' then
ShowMessage(format('Error context string: %s',[Ctxt]));
end;
end;
 

Re:Trap Informix Error in BDE

I think you will find that DbiGetError contest is the call that is used
to populate the Errors property of EDBEngineError so I do not expect
you to see anything new.
--
Bill (TeamB)
TeamB cannot answer questions received via email
 

Re:Trap Informix Error in BDE

Sorry. That should have been DbiGetErrorContext.
--
Bill (TeamB)
TeamB cannot answer questions received via email
Bill Todd wrote:
Quote
I think you will find that DbiGetError contest is the call that is
used to populate the Errors property of EDBEngineError so I do not
expect you to see anything new.