The best method for retrieving error information is through the function get_sql_err(), which returns extended error information, as well as the standard error message (see description in API). It is recommended that you call get_sql_err() rather than accessing EUSQL_ERR_MSG (see below), since you'll get a more detailed description of the error.
EuSQL has predefined error strings, which can be accessed through EUSQL_ERR_MSG:
global constant
EUSQL_ERR_MSG = {
"EuSQL Error: OPERATION FAILED",
"EuSQL Error: ERROR IN 'WHERE' CLAUSE",
"EuSQL Error: INVALID FIELD",
"EuSQL Error: JOIN ERROR",
"EuSQL Error: INVALID TABLE",
"EuSQL Error: SYNTAX ERROR"
}
ex:
object sql
sql = "SELECT ID FROM EMPLOYEES;"
sql = parse_sql( sql )
if atom(sql) then
puts(1, get_sql_err( sql ) )
abort(1)
end if
Variables of type EUSQLRESULT are sequences, unless there is an error, at which point the variable will contain a positive integer. If 'with type' is specified, typechecking will fail, and the error will be output to either a user specified routine or to the output stream specified by eusql_err_out(). If you call eusql_true_typecheck( 0 ), then your program will not crash when a EUSQLRESULT is an integer. EuSQL will pass control back to you. If 'without type' is specified, EuSQL will not automatically catch errors.
See Also: eusql_err_out, eusql_true_typecheck, get_sql_err
Redirects EuSQL typecheck errors. If fn is positive, then errors are output to file number fn. If fn is negative, then -fn is the routine id of a user specified callback procedure. EuSQL will call this procedure if a typecheck fails. The parameter will be the integer EUSQL_ERR_ code. When the callback procedure returns, the typecheck will fail unless typechecking was previously turned off using eusql_true_typecheck(). The default value is 1, which ouputs error messages to the console.
See Also: EUSQLRESULT, eusql_true_typecheck, get_sql_err
Indicates whether typechecks for variables of type EUSQLRESULT will return a value of zero. This is independent of any calls to 'with type' or 'without type'. new_setting should be a boolean value. If set to 0, EUSQLRESULT typechecks that fail will not crash if typechecking is on.
See Also: EUSQLRESULT, eusql_err_out, get_sql_err
Use this to get a text representation of the error returned. It also includes any extended error information beyond the standard error.
See Also: EUSQLRESULT, eusql_err_out, eusql_true_typecheck