Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 (中文) » SQL Anywhere 服务器 - 编程 » 数据库工具接口 (DBTools)

 

DBTools 库初始化和终止化

在使用任何 DBTools 函数之前,您必须调用 DBToolsInit。使用完 DBTools 库后,您必须调用 DBToolsFini。

DBToolsInit 和 DBToolsFini 函数的主要用途是允许 DBTools 库装载和卸载 SQL Anywhere 消息库。消息库包含 DBTools 内部使用的所有本地化版本的错误消息和提示。如果未调用 DBToolsFini,消息库的引用计数不会减少,而且不会被卸载,因此请注意:一定要有一对匹配的 DBToolsInit/DBToolsFini 调用。

下列代码段阐释了如何初始化和完成 DBTools:



// Declarations
a_dbtools_info  info;
short           ret;

//Initialize the a_dbtools_info structure
memset( &info, 0, sizeof( a_dbtools_info) );
info.errorrtn = (MSG_CALLBACK)MyErrorRtn;

// initialize the DBTools library
ret = DBToolsInit( &info );
if( ret != EXIT_OKAY ) {
    // library initialization failed
    ...
}
// call some DBTools routines ...
...
// finalize the DBTools library
DBToolsFini( &info );