Platforms to show: All Mac Windows Linux Cross-Platform
Back to SQLErrorExceptionMBS class.
SQLErrorExceptionMBS.ErrorClass as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | SQL | MBS SQL Plugin | 13.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Returns one of the following values:
SA_No_Error | 0 | No error occurred. |
SA_UserGenerated_Error | 1 | User-generated error. |
SA_Library_Error | 2 | The Library error occurred. |
SA_DBMS_API_Error | 3 | DBMS API error occurred. |
A SQLErrorExceptionMBS object handles the next error classes:
- User-generated errors
- Library errors
- DBMS API errors
The Library errors are generated by the Library itself. It can be like detecting some mistake in passing arguments to the function or referencing the parameter with an inappropriate name. To get a Library-defined error text call ErrorMessage method.
The DBMS API errors come to the Library from the DBMS Client or Server. In this case the Library returns an error code and text Client- or Server-defined. To get error code and error text returned by the server call NativeError and ErrorMessage methods.
The User-generated exception is "SQLAPI++ compatible" exception thrown by the user. To throw user exception use throwUserException method.
(Read only property)
Some examples using this property:
SQLErrorExceptionMBS.ErrorMessage as String
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | SQL | MBS SQL Plugin | 13.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
A error text depends on a class of error.
If error class is Library error the ErrorMessage method returns Library-defined error text. If error class is DBMS API error the ErrorMessage method returns an error text gotten from DBMS Server or Client. If error class is User-defined error the ErrorMessage method returns an error text specified by user (see throwUserException method).
To get the error class call ErrorClass method.
(same as Message property)
(Read only property)
SQLErrorExceptionMBS.ErrorPosition as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | SQL | MBS SQL Plugin | 13.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Returns an integer value representing error position.
Not all DBMS servers allow to get error position. See Server specific notes to get detailed information about returned value.
If a command object's associated SQL statement contains any syntax errors, an exception will be thrown when you try to compile. ErrorPosition method returns the error position within the command string.
Server specific notes
DBMS server | ErrorPosition method returned value |
Oracle | ErrorPosition returns parse error offset. |
SQL Server | ErrorPosition returns the number of line within SQL statement where error occurred. |
Sybase | ErrorPosition returns the number of line within SQL statement where error occurred. |
DB2 | ErrorPosition returns -1. DB2 does not support this function. |
Informix | ErrorPosition returns -1. Informix does not support this function. |
InterBase | ErrorPosition returns -1. InterBase does not support this function. |
SQLBase | ErrorPosition returns character position of the syntax error within an SQL statement. The first character is position 0. |
MySQL | ErrorPosition returns -1. MySQL does not support this function. |
PostgreSQL | ErrorPosition returns -1. PostgreSQL does not support this function. |
ODBC | ErrorPosition returns -1. ODBC does not support this function. |
Some examples using this property:
SQLErrorExceptionMBS.NativeError as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | SQL | MBS SQL Plugin | 13.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Returns an integer value represents a native code associated with current error.
If error class is DBMS API error the NativeError method returns error code received from DBMS Server or Client. If error class is User-defined error the NativeError method returns an error code specified by user (see throwUserException method). If error class is Library error the NativeError method returns -1.
To get the error class call ErrorClass method.
See server specific documentation to get more information about DBMS API error code.
(same as ErrorNumber property)
(Read only property)
Some examples using this property:
SQLErrorExceptionMBS.SQL as String
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | SQL | MBS SQL Plugin | 19.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
(Read only property)
The items on this page are in the following plugins: MBS SQL Plugin.