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 结构公开的方法时,外部库不应使用任何操作系统同步基元。