Database system messages and warnings are sent using the global structure sqlca (SQL Communication Area). The precompiler includes this structure automatically in every MaxDB application program. At runtime of the application program, the database saves information on the execution of the last embedded SQL statement in the structure components, for example, information on any errors that occurred.
Query the structure component sqlcodeafter every SQL statement.
The sqlca components have the following meaning:
sqlcaid |
char [8] Contains the character string sqlca and is used to find the sqlca when analyzing a memory dump |
sqlcabc |
integer (4 byte) Specifies the length of the sqlca in bytes |
sqlcode |
integer (4 byte) Contains the message code of the database system message sqlcode = 0 indicates that a statement was executed successfully. sqlcode > 0 indicates problems that must be handled in the program. sqlcode < 0 indicates errors that terminated the program. For descriptions of all the messages, see Messages. |
sqlerrml |
integer (2 byte) Specifies the current length of sqlerrmc |
sqlerrmc |
char [70] Contains an explanation of the message if sqlcode ? 0 |
sqlerrd |
Array of six 4 byte integer numbers
sqlerrd [2]
specifies how many table rows were processed by the SQL statement.
-1 indicates
that the number of processed rows is unknown. sqlerrd [5] specifies the runtime of the statement in the database kernel (in seconds). sqlerrd [6] specifies the position in the SQL statement at which a syntax error was found. This value is undefined for array statements. If the SQL statement did not have any errors, then sqlerrd [6] = 0. |
sqlwarn0 |
char [1] sqlwarn0 = W specifies that the SQL statement generated at least one of the warnings sqlwarn1..sqlwarnc. If no warning exists, then sqlwarn0 contains a blank character. |
sqlwarn1..sqlwarnc |
|
sqlresn |
char [18] Contains the name of the result table after a SELECT statement is called sqlresn contains a blank character after all other calls |
sqldatetime |
integer (2 byte) Specifies which date and time format the data types DATE, TIME und TIMESTAMP have. 1 INTERNAL |
All other sqlca components are used for internal purposes.