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 a class of error.

Returns one of the following values:

SA_No_Error0No error occurred.
SA_UserGenerated_Error1User-generated error.
SA_Library_Error2The Library error occurred.
SA_DBMS_API_Error3DBMS 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
Gets an error text.

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
Gets an error position in SQL statement.

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 serverErrorPosition method returned value
OracleErrorPosition returns parse error offset.
SQL ServerErrorPosition returns the number of line within SQL statement where error occurred.
SybaseErrorPosition returns the number of line within SQL statement where error occurred.
DB2ErrorPosition returns -1. DB2 does not support this function.
InformixErrorPosition returns -1. Informix does not support this function.
InterBaseErrorPosition returns -1. InterBase does not support this function.
SQLBaseErrorPosition returns character position of the syntax error within an SQL statement. The first character is position 0.
MySQLErrorPosition returns -1. MySQL does not support this function.
PostgreSQLErrorPosition returns -1. PostgreSQL does not support this function.
ODBCErrorPosition returns -1. ODBC does not support this function.
(Read only property)

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
Gets a native code associated with current error.

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
The SQL string set when this error occurred.

(Read only property)

The items on this page are in the following plugins: MBS SQL Plugin.


The biggest plugin in space...