外部前置过滤器必须实现以便为全文索引填充或更新执行文档前置过滤的接口。
typedef struct a_text_source { a_sql_uint32 ( SQL_CALLBACK *begin_document )( a_text_source *This ); a_sql_uint32 ( SQL_CALLBACK *get_next_piece )( a_text_source *This , unsigned char ** buffer , a_sql_uint32* len ); a_sql_uint32 ( SQL_CALLBACK *end_document )( a_text_source *This); a_sql_uint64 ( SQL_CALLBACK *get_document_size )( a_text_source *This ); a_sql_uint32 ( SQL_CALLBACK *fini_all )( a_text_source *This ); a_server_context *_context; // Only one of the following two members can have a valid pointer in a given implementation. // These members point to the current module's producer a_text_source *_my_text_producer; a_word_source *_my_word_source; // Following members have been reserved for // future use ONLY a_text_source *_my_text_consumer; a_word_source *_my_word_consumer; } a_text_source; |
成员 | 类型 | 说明 |
---|---|---|
begin_document | a_sql_uint32 |
执行处理文档所需的必要设置步骤。该方法成功时返回 0,发生错误或没有可用文档时返回 1。 |
get_next_piece | a_sql_uint32 |
返回已过滤输入字节流的碎片以及碎片的长度。将为给定的文档多次调用该方法,每次调用时该方法都应返回后续文档块,直到文档的所有输入数据消耗完或发生错误。 buffer 是由前置过滤器填充的,指向已产生数据的 OUT 参数。内存由前置过滤器管理。 len 是表明已产生数据长度的 OUT 参数。 |
end_document | a_sql_uint32 |
标记给定文档过滤完成,并在需要时执行文档特定的清除。 |
get_document_size | a_sql_uint64 |
返回前置过滤器产生的文档的总长度(以字节为单位)。a_text_source 对象必须记录目前为止为当前文档产生的总字节数的当前计数。 |
fini_all | a_sql_uint32 |
由数据库服务器在处理完所有文档且即将关闭管道时调用。fini_all 执行最终清除步骤。 |
_context | a_server_context * |
使用该成员保留数据库服务器环境(将在 a_init_prefilter 结构中提供给入口点函数)。前置过滤器模块使用该环境建立与数据库服务器的直接通信。 |
_my_text_producer | a_text_source * |
使用该成员存储指向前置过滤器的 a_text_source 创建器的指针(将在 a_init_prefilter 结构中提供给入口点函数)。如果需要字符集转换,则该指针可能会在执行入口点函数后被数据库服务器替换。因此,前置过滤器只能使用指向文本创建器的该指针。 |
_my_word_producer | a_word_source * |
留作将来使用并且应该初始化为 NULL。 |
_my_text_consumer | a_text_source * |
留作将来使用并且应该初始化为 NULL。 |
_my_word_consumer | a_word_source * |
留作将来使用并且应该初始化为 NULL。 |
a_text_source 接口是 stream-based-data。数据按顺序从创建器中取出,每个字节仅出现一次。
a_text_source 接口由 SQL Anywhere 安装目录 SDK\Include 子目录中名为 extpfapiv1.h 的头文件定义。
外部库不应保有函数调用间的任何操作系统同步基元。
![]() |
使用DocCommentXchange 讨论此页。
|
版权 © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |