mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-10 10:29:17 +02:00
fcl-db: interbase: SQLState must be obtained before isc_interprete is called.
git-svn-id: trunk@29165 -
This commit is contained in:
parent
628d6243be
commit
6b0cd8bb0e
@ -152,27 +152,25 @@ const
|
|||||||
|
|
||||||
procedure TIBConnection.CheckError(ProcName : string; Status : PISC_STATUS);
|
procedure TIBConnection.CheckError(ProcName : string; Status : PISC_STATUS);
|
||||||
var
|
var
|
||||||
Err : longint;
|
ErrorCode : longint;
|
||||||
Msg : string;
|
Msg, SQLState : string;
|
||||||
Buf : array [0..1023] of char;
|
Buf : array [0..1023] of char;
|
||||||
E : EIBDatabaseError;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if ((Status[0] = 1) and (Status[1] <> 0)) then
|
if ((Status[0] = 1) and (Status[1] <> 0)) then
|
||||||
begin
|
begin
|
||||||
Err := Status[1];
|
ErrorCode := Status[1];
|
||||||
Msg := '';
|
|
||||||
while isc_interprete(Buf, @Status) > 0 do
|
|
||||||
Msg := Msg + LineEnding + ' -' + StrPas(Buf);
|
|
||||||
E := EIBDatabaseError.CreateFmt('%s : %s', [ProcName,Msg], Self, Err, '');
|
|
||||||
{$IFDEF LinkDynamically}
|
{$IFDEF LinkDynamically}
|
||||||
if assigned(fb_sqlstate) then // >= Firebird 2.5
|
if assigned(fb_sqlstate) then // >= Firebird 2.5
|
||||||
begin
|
begin
|
||||||
fb_sqlstate(Buf, Status);
|
fb_sqlstate(Buf, Status);
|
||||||
E.SQLState := StrPas(Buf);
|
SQLState := StrPas(Buf);
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Raise E;
|
Msg := '';
|
||||||
|
while isc_interprete(Buf, @Status) > 0 do
|
||||||
|
Msg := Msg + LineEnding + ' -' + StrPas(Buf);
|
||||||
|
raise EIBDatabaseError.CreateFmt('%s : %s', [ProcName,Msg], Self, ErrorCode, SQLState);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user