位置: 编程技术 - 正文
推荐整理分享PHP:pg_result_error_field()的用法_PostgreSQL函数,希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:,内容如对您有帮助,希望把文章链接给更多的朋友!
(PHP 5 >= 5.1.0)
pg_result_error_field — Returns an individual field of an error report.
说明 string pg_result_error_field ( resource $result , int $fieldcode )pg_result_error_field() returns one of the detailed error message fields associated with result resource. It is only available against a PostgreSQL 7.4 or above server. The error field is specified by the fieldcode.
Because pg_query() and pg_query_params() return FALSE if the query fails, you must use pg_send_query() and pg_get_result() to get the result handle.
If you need to get additional error information from failed pg_query() queries, use pg_set_error_verbosity() and pg_last_error() and then parse the result.
参数result
A PostgreSQL query result resource from a previously executed statement.
fieldcodePossible fieldcode values are: PGSQL_DIAG_SEVERITY, PGSQL_DIAG_SQLSTATE, PGSQL_DIAG_MESSAGE_PRIMARY, PGSQL_DIAG_MESSAGE_DETAIL, PGSQL_DIAG_MESSAGE_HINT, PGSQL_DIAG_STATEMENT_POSITION, PGSQL_DIAG_INTERNAL_POSITION (PostgreSQL 8.0+ only), PGSQL_DIAG_INTERNAL_QUERY (PostgreSQL 8.0+ only), PGSQL_DIAG_CONTEXT, PGSQL_DIAG_SOURCE_FILE, PGSQL_DIAG_SOURCE_LINE or PGSQL_DIAG_SOURCE_FUNCTION.
返回值A string containing the contents of the error field, NULL if the field does not exist or FALSE on failure.
范例
Example #1 pg_result_error_field() example
<?php$dbconn=pg_connect("dbname=publisher")ordie("Couldnotconnect");if(!pg_connection_busy($dbconn)){pg_send_query($dbconn,"select*fromdoesnotexist;");}$res1=pg_get_result($dbconn);echopg_result_error_field($res1,PGSQL_DIAG_SQLSTATE);?> 参见pg_result_error() - 获得查询结果的错误信息
PHP:pg_query()的用法_PostgreSQL函数 pg_query(PHP4=4.2.0,PHP5)pg_query执行查询说明resourcepg_query(resource$connection,string$query)pg_query()在查询可以执行时返回查询结果资源号。如果查询失败或者提供的
PHP:pg_query_params()的用法_PostgreSQL函数 pg_query_params(PHP5=5.1.0)pg_query_paramsSubmitsacommandtotheserverandwaitsfortheresult,withtheabilitytopassparametersseparatelyfromtheSQLcommandtext.说明resourcepg_query_params([resource$connectio
PHP:pg_put_line()的用法_PostgreSQL函数 pg_put_line(PHP4=4.0.3,PHP5)pg_put_line向PostgreSQL后端发送以NULL结尾的字符串说明boolpg_put_line([resource$connection],string$data)pg_put_line()向PostgreSQL后端服务器发送以NULL
标签: PHP:pg_result_error_field()的用法_PostgreSQL函数
本文链接地址:https://www.jiuchutong.com/biancheng/281453.html 转载请保留说明!友情链接: 武汉网站建设