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

SQL Anywhere 11.0.1 (中文) » SQL Anywhere 服务器 - 编程 » SQL Anywhere 数据访问 API » SQL Anywhere PHP API » SQL Anywhere PHP API 参考 » 不建议使用 PHP 函数

 

sqlanywhere_errorcode(不建议使用)

原型
bool sqlanywhere_errorcode( [ resource link_identifier ] )
说明

不建议使用此函数。应该改用以下 PHP 函数: sasql_errorcode.

返回最近执行的 SQL Anywhere PHP 函数的错误代码。错误代码按连接进行存储。如果未指定 link_identifier,则 sqlanywhere_errorcode 返回没有可用连接的最后一个错误代码。例如,如果您调用 sqlanywhere_connect,但连接失败,则可调用不含 link_identifier 参数的 sqlanywhere_errorcode 以获取错误代码。如果要获取相应的错误消息,请使用 sqlanywhere_error 函数。

参数

link_identifier   sqlanywhere_connect 或 sqlanywhere_pconnect 返回的链接标识符。

返回值

一个整数,表示 SQL Anywhere 错误代码。错误代码 0 表示成功。正的错误代码表示成功但有警告。负的错误代码表示失败。

示例

本示例说明如何从失败的 SQL Anywhere PHP 调用检索最后一个错误代码。

$result = sqlanywhere_query( $conn, "SELECT * from table_that_does_not_exist" );
   if( ! $result ) {
       $error_code = sqlanywhere_errorcode( $conn );
       echo "Query failed: Error code: $error_code";
   }
相关函数