预定义常量

下列常量由此扩展定义,且仅在此扩展编译入 PHP 或在运行时动态载入时可用。

PGSQL_LIBPQ_VERSION (string)
仅包含数字和小数点的简短 libpq 版本号。
PGSQL_LIBPQ_VERSION_STR (string)
PHP 8.0.0 之前为包含编译信息的长 libpq 版本号。自 PHP 8.0.0 起,此值与 PGSQL_LIBPQ_VERSION 相同,并且弃用 PGSQL_LIBPQ_VERSION_STR
PGSQL_ASSOC (int)
传递给 pg_fetch_array()。返回字段名和值的关联数组。
PGSQL_NUM (int)
传递给 pg_fetch_array()。返回字段编号和值的数字索引数组。
PGSQL_BOTH (int)
传递给 pg_fetch_array()。返回字段值数组,这些字段值既有数字索引(按字段编号)也有关联索引(按字段名称)。
PGSQL_CONNECT_FORCE_NEW (int)
传递给 pg_connect() 以强制创建新连接,而不是重新使用现有的相同连接。
PGSQL_CONNECT_ASYNC (int)
传递给 pg_connect() 以创建异步连接。
PGSQL_CONNECTION_AUTH_OK (int)
PGSQL_CONNECTION_AWAITING_RESPONSE (int)
PGSQL_CONNECTION_BAD (int)
pg_connection_status() 返回,表示数据库连接处于无效状态。
PGSQL_CONNECTION_MADE (int)
PGSQL_CONNECTION_OK (int)
pg_connection_status() 返回,表示数据库连接处于有效状态。
PGSQL_CONNECTION_SETENV (int)
PGSQL_CONNECTION_SSL_STARTUP (int)
PGSQL_CONNECTION_STARTED (int)
PGSQL_SEEK_SET (int)
传递给 pg_lo_seek()。寻找操作是从对象的开头开始的。
PGSQL_SEEK_CUR (int)
传递给 pg_lo_seek()。寻找操作是从当前位置开始的。
PGSQL_SEEK_END (int)
传递给 pg_lo_seek()。寻找操作是从对象的末尾开始。
PGSQL_EMPTY_QUERY (int)
pg_result_status() 返回。发送到服务器的字符串为空。
PGSQL_COMMAND_OK (int)
pg_result_status() 返回。成功完成命令不返回任何数据。
PGSQL_TUPLES_OK (int)
pg_result_status() 返回。成功完成一个返回数据的命令(例如 SELECTSHOW)。
PGSQL_COPY_OUT (int)
pg_result_status() 返回。开始复制(从服务器)数据传输。
PGSQL_COPY_IN (int)
pg_result_status() 返回。开始复制(到服务器)数据传输。
PGSQL_BAD_RESPONSE (int)
pg_result_status() 返回。无法理解服务器的响应。
PGSQL_NONFATAL_ERROR (int)
pg_result_status() 返回。发生非致命错误(通知或警告)。
PGSQL_FATAL_ERROR (int)
pg_result_status() 返回。发生致命错误。
PGSQL_TRANSACTION_IDLE (int)
pg_transaction_status() 返回。当前连接处于空闲状态,不在事务中。
PGSQL_TRANSACTION_ACTIVE (int)
pg_transaction_status() 返回。连接正在执行命令。查询(query)已通过连接发送但尚未完成。
PGSQL_TRANSACTION_INTRANS (int)
pg_transaction_status() 返回。连接处于空闲状态且处于事务块中。
PGSQL_TRANSACTION_INERROR (int)
pg_transaction_status() 返回。连接处于空闲状态且处于失败的事务块中。
PGSQL_TRANSACTION_UNKNOWN (int)
pg_transaction_status() 返回。连接损坏。
PGSQL_DIAG_SEVERITY (int)
传递给 pg_result_error_field()。 严重程度;字段内容是 ERRORFATALPANIC(在 error 消息中)或 WARNINGNOTICEDEBUGINFOLOG(在 notice 消息中),或其中之一的本地化翻译。始终存在。
PGSQL_DIAG_SQLSTATE (int)
传递给 pg_result_error_field()。 error 的 SQLSTATE 代码。SQLSTATE 代码标识已发生的错误类型;前端应用程序可以使用它来执行特定操作(例如错误处理)以响应特定的数据库错误。该字段不可本地化,并且始终存在。
PGSQL_DIAG_MESSAGE_PRIMARY (int)
传递给 pg_result_error_field()。 人可读的主要错误消息(通常是一行)。始终存在。
PGSQL_DIAG_MESSAGE_DETAIL (int)
传递给 pg_result_error_field()。 详细信息:可选的次要错误消息,其中包含有关该问题的更多详细信息。可能会有多行。
PGSQL_DIAG_MESSAGE_HINT (int)
传递给 pg_result_error_field()。 提示:关于如何处理该问题的可选建议。这与细节不同,因为它提供建议(可能不合适)而不是确凿的事实。可能会有多行。
PGSQL_DIAG_STATEMENT_POSITION (int)
传递给 pg_result_error_field()。 包含十进制整数的字符串,指示错误游标位置作为原始语句字符串的索引。第一个字符的索引为 1,位置以字符而不是字节为单位进行测量。
PGSQL_DIAG_INTERNAL_POSITION (int)
传递给 pg_result_error_field()。 This is defined the same as the PG_DIAG_STATEMENT_POSITION field, but it is used when the cursor position refers to an internally generated command rather than the one submitted by the client. The PG_DIAG_INTERNAL_QUERY field will always appear when this field appears.
PGSQL_DIAG_INTERNAL_QUERY (int)
传递给 pg_result_error_field()。 失败的内部生成命令的文本。例如,这可能是由 PL/pgSQL 函数发出的 SQL 查询。
PGSQL_DIAG_CONTEXT (int)
传递给 pg_result_error_field()。 An indication of the context in which the error occurred. Presently this includes a call stack traceback of active procedural language functions and internally-generated queries. The trace is one entry per line, most recent first.
PGSQL_DIAG_SOURCE_FILE (int)
传递给 pg_result_error_field()。 报告错误的 PostgreSQL 源代码位置的文件名。
PGSQL_DIAG_SOURCE_LINE (int)
传递给 pg_result_error_field()。 报告错误的 PostgreSQL 源代码位置的行号。
PGSQL_DIAG_SOURCE_FUNCTION (int)
传递给 pg_result_error_field()。 报告错误的 PostgreSQL 源代码函数的名称。
PGSQL_DIAG_SCHEMA_NAME (string)
自 PHP 7.3.0 起可用。
PGSQL_DIAG_TABLE_NAME (string)
自 PHP 7.3.0 起可用。
PGSQL_DIAG_COLUMN_NAME (string)
自 PHP 7.3.0 起可用。
PGSQL_DIAG_DATATYPE_NAME (string)
自 PHP 7.3.0 起可用。
PGSQL_DIAG_CONSTRAINT_NAME (string)
自 PHP 7.3.0 起可用。
PGSQL_ERRORS_TERSE (int)
传递给 pg_set_error_verbosity()。指定返回的消息,仅包括严重性、主要文本和位置;通常适合单行。
PGSQL_ERRORS_DEFAULT (int)
传递给 pg_set_error_verbosity()。默认模式生成的消息包括上述内容以及所有的详细信息、提示或上下文字段(这些可能会有多行)。
PGSQL_ERRORS_VERBOSE (int)
传递给 pg_set_error_verbosity()。详细模式包括所有可用字段。
PGSQL_NOTICE_LAST (int)
用于 pg_last_notice()。自 PHP 7.1.0 起可用。
PGSQL_NOTICE_ALL (int)
用于 pg_last_notice()。自 PHP 7.1.0 起可用。
PGSQL_NOTICE_CLEAR (int)
用于 pg_last_notice()。自 PHP 7.1.0 起可用。
PGSQL_STATUS_LONG (int)
传递给 pg_result_status()。表示需要的数字结果代码。
PGSQL_STATUS_STRING (int)
传递给 pg_result_status()。表示需要的文本结果命令标记。
PGSQL_CONV_IGNORE_DEFAULT (int)
Passed to pg_convert(). Ignore default values in the table during conversion.
PGSQL_CONV_FORCE_NULL (int)
Passed to pg_convert(). Use SQL NULL in place of an empty string.
PGSQL_CONV_IGNORE_NOT_NULL (int)
Passed to pg_convert(). Ignore conversion of null into SQL NOT NULL columns.
PGSQL_DML_NO_CONV (int)
Passed to pg_insert(), pg_select(), pg_update() and pg_delete(). All parameters passed as is. Manual escape is required if parameters contain user supplied data. Use pg_escape_string() for it.
PGSQL_DML_EXEC (int)
Passed to pg_insert(), pg_select(), pg_update() and pg_delete(). Execute query by these functions.
PGSQL_DML_ASYNC (int)
Passed to pg_insert(), pg_select(), pg_update() and pg_delete(). Execute asynchronous query by these functions.
PGSQL_DML_STRING (int)
Passed to pg_insert(), pg_select(), pg_update() and pg_delete(). Return executed query string.
PGSQL_DML_ESCAPE (int)
Passed to pg_insert(), pg_select(), pg_update() and pg_delete(). Apply escape to all parameters instead of calling pg_convert() internally. This option omits meta data look up. Query could be as fast as pg_query() and pg_send_query().
PGSQL_POLLING_FAILED (int)
Returned by pg_connect_poll() to indicate that the connection attempt failed.
PGSQL_POLLING_READING (int)
Returned by pg_connect_poll() to indicate that the connection is waiting for the PostgreSQL socket to be readable.
PGSQL_POLLING_WRITING (int)
Returned by pg_connect_poll() to indicate that the connection is waiting for the PostgreSQL socket to be writable.
PGSQL_POLLING_OK (int)
Returned by pg_connect_poll() to indicate that the connection is ready to be used.
PGSQL_POLLING_ACTIVE (int)
Returned by pg_connect_poll() to indicate that the connection is currently active.
PGSQL_DIAG_SEVERITY_NONLOCALIZED (int)
The severity; the field contents are ERROR, FATAL, or PANIC (in an error message), or WARNING, NOTICE, DEBUG, INFO, or LOG (in a notice message). This is identical to the PG_DIAG_SEVERITY field except that the contents are never localized. This is present only in versions 9.6 and later / PHP 7.3.0 and later.
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top