Is it possible to return more detailed error message from Firebird?

The offical for ZeosLib 7.3 Report problems, ask for help, post proposals for the new version of Zeoslib 7.3/v8
Quick Info:
-We made two new drivers: odbc(raw and unicode version) and oledb
-GUID domain/field-defined support for FB
-extended error infos of Firebird
-performance ups are still in queue
In future some more feature will arrive, so stay tuned and don't hassitate to help
Locked
L_VV
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 30.03.2021, 18:42

Is it possible to return more detailed error message from Firebird?

Post by L_VV »

Good day,

Sorry if I just did not figure it out, I work with Zeoslib relatively short time.

Can you tell me, please, is it possible to return all the error messages from the Firebird, when an error occurs, and not just a one element from FB status vector?
If there is no such feature, is it possible to implement it?

For example, a such error occurs:

Code: Select all

Unsuccessful execution caused by a system error that precludes successful execution of subsequent statements.
Your user name and password are not defined. Ask your database administrator to set up a Firebird login.
SQLCODE: -902
SQLSTATE: 28000
GDSCODE: 225544472
But from the ZDbcFirebird unit only part of it is returned:

Code: Select all

Unsuccessful execution caused by a system error that precludes successful execution of subsequent statements
Code: -902 Message: Connect to "localhost/3050:Test.db" as user "TEST_APPSRV".
From this error message is completely incomprehensible what happened.


Fragment of code from the ZDbcFirebird module:

Code: Select all

    if FAttachment = nil then begin
      PrepareDPB;
      FLogMessage := Format(SConnect2AsUser, [ConnectionString, URL.UserName]);;
      FAttachment := FProvider.attachDatabase(FStatus, @FByteBuffer[0], Length(DPB), Pointer(DPB));
      
      vvvvv
      if ((Fstatus.getState and {$IFDEF WITH_CLASS_CONST}IStatus.STATE_ERRORS{$ELSE}IStatus_STATE_ERRORS{$ENDIF}) <> 0) then
        HandleErrorOrWarning(lcConnect, PARRAY_ISC_STATUS(FStatus.getErrors),
          FLogMessage, IImmediatelyReleasable(FWeakImmediatRelPtr));
      ^^^^^

      { Logging connection action }
      if DriverManager.HasLoggingListener then
        DriverManager.LogMessage(lcConnect, URL.Protocol, FLogMessage);
    end;
Although the function is named FStatus.getErrors (in plural), only one error from the Firebird status vector is returned.

Now I am developing an application using ZeosLib and mORMot2, and to the client is returned such an error:

Code: Select all

{
"errorCode":500,
"error":
{"EZIBSQLException":
{
        "ClassName": "EZIBSQLException",
        "Address": "7ffff5e9e000",
        "Message": "SQL Error: Unsuccessful execution caused by a system error that precludes successful execution of subsequent statements \nCode: -902 Message: Connect to \"localhost/3050:Test.db\" as user \"TEST_APPSRV\""
}}
This is not a very informative message.
And more detailed information is not saved even into the log...
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1918
Joined: 17.01.2011, 14:17

Re: Is it possible to return more detailed error message from Firebird?

Post by marsupilami »

Locked because it is a duplicate of viewtopic.php?f=50&t=137609
Locked