Pascal Data Objects

function IPDOStatement.errorInfo: PDO_errorInfoRecord;

This function fetches extended error information associated with the last operation on the statement handle, consisting of the following fields:

  PDO_errorInfoRecord = record
        SQLState:    AnsiString;   {SQLSTATE error code}
        Error_code:  Integer;      {Driver-specific error code}
        Error_msg:   AnsiString;   {Driver-specific error message}
  end;

Example

  stmt := db.prepare_as_is ('INSERT INTO bones(skull) VALUES (''lucy'')');
  stmt.execute();
  writeln ('IPDOStatement.errorInfo(): ');
  writeln ('SQLState:   ' + stmt.errorInfo.SQLState);
  writeln ('Error Code: ' + stmt.errorInfo.Error_code);
  writeln ('Error Msg:  ' + stmt.errorInfo.Error_msg);

The above example will output:

IPDOStatement.errorInfo():
SQLState:   42S02
Error Code: -204
Error Msg:  [IBM][CLI Driver][DB2/LINUX] SQL0204N  "DANIELS.BONES" is an undefined name.  SQLSTATE=42704