Advantage SQL Engine
The Advantage Query Engine maintains two categories of system variables. The first category of the system variable returns information about the current user connection or information about the current query handle. These variables are prefixed with the :: (double colons) followed by either "conn." or "stmt.", short hand for connection or statement (query handle) respectively. The variables in this category are:
::conn.name – Returns the name of the current user connection. The connection name is unique for each connection and it is used by the SQL debugger.
::stmt.name – Returns the name of the current query handle. The statement name is unique for each query handle and it stays unchanged as long as the query handle is valid regardless the number of individual statements executed on the query handle. This variable is used by the SQL debugger.
::stmt.UpdateCount – Returns the number of rows affected since the beginning of the current execution.
::stmt.TrigRecNo – This variable is only meaningful when accessed inside a trigger script. It returns the record number of the row that led to the firing of the trigger.
::conn.collation – Default collation for statements allocated on the current connection. The value is a character string. See SET <system variable>..
::stmt.collation – Collation language used when executing SQL statements on this statement handle. The value is a character string. See SET <system variable>.
The second category of the system variables are maintained by the SQL Script Execution Engine for the purpose of error handling. These variables are denoted by the double underscore-characters, "__", leading the variable name. The variables in this category are __errclass (String), __errcode (Integer), and __errtext (String). These three variables provide information about an exception in the script, either a raised exception or a runtime error. They are local to the current executing SQL script. They cannot be assigned values directly using assignment statements. Instead, their values are initialized when a RAISE statement is executed or when a runtime error is detected. If the exception originates from a RAISE statement, these three variables will be assigned the values provided by the RAISE statement. If the exception is caused by a runtime error, the __errclass variable will be initialized with string value "ADS_SCRIPT_EXCEPTION" and the __errcode and __errtext variables will contain the error code and error text that will be returned to the caller if the exception is not handled.