I am using Delphi 7, UniDAC 2.7.0.8, PostgreSQL 8.3.7
EDAError(E).ErrorCode not reporting the error code.
For example:
var
aQuery: TUniQuery;
begin
aQuery:= TUniQuery.Create( nil );
aQuery.sql.add( 'select log(-1)' );
try
aQuery.Execute;
except
on E: EDAError do
ShowMessage( IntToStr( E.ErrorCode ) + ' ' + E.Message );
end;
end;
E.ErrorCode = 0, it should be 2201E according to the PostgreSQL Error Code table
http://www.postgresql.org/docs/8.3/inte ... endix.html
E.ErrorMessage = cannot take logarithm of a negative number
Thank you
Alan
EDAError not always showing correct error code
-
- Devart Team
- Posts: 925
- Joined: Thu 17 Nov 2005 10:53
This is because PostgreSql unlike other Database servers has string error code. Try the following code:
Code: Select all
ShowMessage (EPgError(EUniError(E).InnerError).ErrorCode);