Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
数据库服务器支持几个回调,并通过 a_server_context 结构公开给全文外部库以执行以下任务:
错误报告
中断处理
消息登录
typedef struct a_server_context { void ( SQL_CALLBACK *set_error )( a_server_context *This , a_sql_uint32 error_code , const char* error_string , short str_len ); void ( SQL_CALLBACK *log_message )( a_server_context *This , const char* message , short msg_len ); a_sql_uint32 ( SQL_CALLBACK *get_is_cancelled )( a_server_context *This ); void *_context; } a_server_context;
void
该方法允许外部前置过滤器和术语断开器通过提供错误代码和错误字符串在数据库服务器中设置错误。数据库服务器回退当前操作,并按照如下格式将错误代码和字符串返回给用户:
"Error from external library: -<error_code>: <error_string>"
error_code 必须是大于 17000 的正整数值。
error_string 必须是空值终止的字符串。
str_len 是 error_string 的长度,以字节为单位。
该方法允许外部前置过滤器和术语断开器记录消息到数据库服务器日志。
message 必须是空值终止的字符串。
msg_len 是消息的长度,以字节为单位。
a_sql_uint32
外部前置过滤器和术语断开器必须定期调用该方法检查当前操作是否已中断。如果当前操作已中断,该方法将返回 1;如果未中断则返回 0。在返回 1 的情况下,调用方应停止进一步处理并立即返回。
供内部使用。指向数据库服务器环境的指针。
a_server_context 结构由 SQL Anywhere 安装目录 SDK\Include 子目录中名为 exttxtcmn.h 的头文件定义。
当调用 a_server_context 结构公开的方法时,外部库不应使用任何操作系统同步基元。