From c598ae36df49cfd3ecd55c79661dfb7df1e002c0 Mon Sep 17 00:00:00 2001 From: Christopher Kings-Lynne Date: Sun, 3 Apr 2005 07:21:50 +0000 Subject: [PATCH] - Update several PostgreSQL functions to the new doc style git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@183467 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/pgsql/functions/pg-execute.xml | 113 ++++++++++------- .../pgsql/functions/pg-parameter-status.xml | 109 +++++++++++++--- reference/pgsql/functions/pg-prepare.xml | 119 ++++++++++-------- reference/pgsql/functions/pg-query-params.xml | 92 ++++++++++---- .../pgsql/functions/pg-result-error-field.xml | 58 ++++++--- reference/pgsql/functions/pg-send-execute.xml | 82 ++++++++---- reference/pgsql/functions/pg-send-prepare.xml | 82 ++++++++---- .../pgsql/functions/pg-send-query-params.xml | 76 +++++++---- .../functions/pg-set-error-verbosity.xml | 74 +++++++---- .../pgsql/functions/pg-transaction-status.xml | 62 +++++---- 10 files changed, 603 insertions(+), 264 deletions(-) diff --git a/reference/pgsql/functions/pg-execute.xml b/reference/pgsql/functions/pg-execute.xml index f009384fdd..d7c071e730 100644 --- a/reference/pgsql/functions/pg-execute.xml +++ b/reference/pgsql/functions/pg-execute.xml @@ -1,62 +1,87 @@ - + pg_execute - Execute a previously prepared query + Sends a request to execute a prepared statement with given parameters, and waits for the result. &reftitle.description; resourcepg_execute - stringstmtname - arrayparams - - - resourcepg_execute - resourceconnection + resourceconnection stringstmtname arrayparams - pg_execute returns a query result resource if - the named prepared query could be executed with the given parameters. - It returns &false; on failure or if - connection is not a valid connection. Details about the error can - be retrieved using the pg_last_error - function if connection is valid. - pg_execute executes a previously prepared - query on the - connection resource with the specified - parameters. It is identical to pg_query_params - except that it takes the name of a previously prepared query instead - of an actual query. The - connection must be a valid connection that - was returned by pg_connect or - pg_pconnect. The return value of this - function is an query result resource to be used to access the - results from other PostgreSQL functions such as - pg_fetch_array. - - - connection is an optional parameter for - pg_execute. If - connection is not set, default - connection is used. Default connection is the last connection - made by pg_connect or - pg_pconnect. - - - Although connection can be omitted, it - is not recommended, since it could be a cause of hard to find - bug in script. - - + Sends a request to execute a prepared statement with given parameters, and + waits for the result. + + + pg_execute is like pg_query_params, + but the command to be executed is + specified by naming a previously-prepared statement, instead of giving a + query string. This feature allows commands that will be used repeatedly to + be parsed and planned just once, rather than each time they are executed. + The statement must have been prepared previously in the current session. + pg_execute is supported only against PostgreSQL 7.4 or + higher connections; it will fail when using earlier versions. + + + The parameters are identical to pg_query_params, except that the name of a + prepared statement is given instead of a query string. + + &reftitle.parameters; + + + + connection + + + PostgreSQL database connection resource. When + connection is not present, the default connection + is used. The default connection is the last connection made by + pg_connect or pg_pconnect. + + + + + stmtname + + + The name of the prepared statement to execute. if + "" is specified, then the unnamed statement is executed. The name must have + been previously prepared using pg_prepare, + pg_send_prepare or a PREPARE SQL + command. + + + + + params + + + An array of parameter values to substitute for the $1, $2, etc. placeholders + in the original prepared query string. The number of elements in the array + must match the number of placeholders. + + + + + + + + + &reftitle.returnvalues; + + A query result resource on success, or &false; on failure. + + &reftitle.examples; @@ -89,11 +114,9 @@ $result = pg_execute($dbconn, "my_query", array("Clothes Clothes Clothes")); &reftitle.seealso; - pg_connect - pg_pconnect pg_prepare - pg_send_execute - + pg_send_prepare + pg_query_params diff --git a/reference/pgsql/functions/pg-parameter-status.xml b/reference/pgsql/functions/pg-parameter-status.xml index 2bd3938439..4637672213 100644 --- a/reference/pgsql/functions/pg-parameter-status.xml +++ b/reference/pgsql/functions/pg-parameter-status.xml @@ -1,11 +1,9 @@ - + pg_parameter_status - - Returns the value of a server parameter - + Looks up a current parameter setting of the server. @@ -16,19 +14,100 @@ stringparam_name - pg_parameter_status returns a string with the - current param_name value. Returns &false; on - failure. + Looks up a current parameter setting of the server. - The parameters currently available include: server_version, - server_encoding, client_encoding, - is_superuser, session_authorization, - DateStyle, TimeZone - and integer_datetimes. (server_encoding, - TimeZone and integer_datetimes were - not reported before PostgreSQL 8.0.) - + Certain parameter values are reported by the server automatically at + connection startup or whenever their values change. pg_parameter_status can be + used to interrogate these settings. It returns the current value of a + parameter if known, or &false; if the parameter is not known. + + + Parameters reported as of PostgreSQL 8.0 include server_version, + server_encoding, client_encoding, + is_superuser, session_authorization, + DateStyle, TimeZone, and integer_datetimes. + (server_encoding, TimeZone, and + integer_datetimes were not reported by releases before 8.0.) Note that + server_version, server_encoding and integer_datetimes + cannot change after PostgreSQL startup. + + + PostgreSQL 7.3 or lower servers do not report parameter settings, + pg_parameter_status + includes logic to obtain values for server_version and + client_encoding + anyway. Applications are encouraged to use pg_parameter_status rather than ad + hoc code to determine these values. + + + + On a pre-7.4 + PostgreSQL server, changing client_encoding via SET after connection startup will + not be reflected by pg_parameter_status. + + + + + + &reftitle.parameters; + + + + connection + + + PostgreSQL database connection resource. When + connection is not present, the default connection + is used. The default connection is the last connection made by + pg_connect or pg_pconnect. + + + + + param_name + + + Possible param_name values include server_version, + server_encoding, client_encoding, + is_superuser, session_authorization, + DateStyle, TimeZone, and + integer_datetimes. + + + + + + + + + &reftitle.returnvalues; + A &string; containing the value of the parameter, &false; on failure or invalid + param_name. + + + + &reftitle.examples; + + + <function>pg_parameter_status</function> example + + +]]> + + &example.outputs; + + + + + diff --git a/reference/pgsql/functions/pg-prepare.xml b/reference/pgsql/functions/pg-prepare.xml index cff4de9f33..a47d86068d 100644 --- a/reference/pgsql/functions/pg-prepare.xml +++ b/reference/pgsql/functions/pg-prepare.xml @@ -1,72 +1,92 @@ - + pg_prepare - Prepares a query for future execution + Submits a request to create a prepared statement with the + given parameters, and waits for completion. &reftitle.description; resourcepg_prepare - stringstmtname - stringquery - - - resourcepg_prepare - resourceconnection + resourceconnection stringstmtname stringquery - pg_prepare returns a query result resource if - query could be prepared. It returns &false; on failure or if - connection is not a valid connection. Details about the error can - be retrieved using the pg_last_error - function if connection is valid. - pg_prepare prepares an SQL statement for - the PostgreSQL database connection specified by the - connection resource. The - connection must be a valid connection that - was returned by pg_connect or - pg_pconnect. The return value of this - function is an query result resource. The stmtname - is the name of the prepared query, for future use with - pg_execute or pg_send_execute. - - - connection is an optional parameter for - pg_prepare. If - connection is not set, default - connection is used. Default connection is the last connection - made by pg_connect or - pg_pconnect. - - - Although connection can be omitted, it - is not recommended, since it could be a cause of hard to find - bug in script. - - + pg_prepare creates a prepared statement for later execution with + pg_execute or pg_send_execute. + This feature allows commands that will be used repeatedly to + be parsed and planned just once, rather than each time they are executed. + pg_prepare is supported only against PostgreSQL 7.4 or + higher connections; it will fail when using earlier versions. - Parameters to pg_prepare are specified - using placeholders in the query. It is not necessary to quote - parameters as quoting and escaping is done automatically. - Placeholders are indicated in the query - by $1, $2, $3 and so on. + The function creates a prepared statement named stmtname from the query + string, which must contain a single SQL command. stmtname may be "" to + create an unnamed statement, in which case any pre-existing unnamed + statement is automatically replaced; otherwise it is an error if the + statement name is already defined in the current session. If any parameters + are used, they are referred to in the query as $1, $2, etc. - Using prepared queries means you can prepare one and - then execute many times, with different parameters. PostgreSQL - will cache the query plan on the prepare, then re-use it for - each execute, resulting in speed improvements. There is no - need to use a prepared query if it will only be executed once. - In this case, it is simpler to use pg_query_params. + + Prepared statements for use with pg_prepare can also be created by + executing SQL PREPARE statements. (But pg_prepare is more flexible since it + does not require parameter types to be pre-specified.) Also, although there + is no PHP function for deleting a prepared statement, the SQL DEALLOCATE + statement can be used for that purpose. + + &reftitle.parameters; + + + + connection + + + PostgreSQL database connection resource. When + connection is not present, the default connection + is used. The default connection is the last connection made by + pg_connect or pg_pconnect. + + + + + stmtname + + + The name to give the prepared statement. Must be unique per-connection. If + "" is specified, then an unnamed statement is created, overwriting any + previously defined unnamed statement. + + + + + query + + + The parameterised SQL statement. Must contain only a single statement. + (multiple statements separated by semi-colons are not allowed.) If any parameters + are used, they are referred to as $1, $2, etc. + + + + + + + + + &reftitle.returnvalues; + + A query result resource on success, or &false; on failure. + + + &reftitle.examples; @@ -99,11 +119,8 @@ $result = pg_execute($dbconn, "my_query", array("Clothes Clothes Clothes")); &reftitle.seealso; - pg_connect - pg_pconnect pg_execute pg_send_execute - pg_query_params diff --git a/reference/pgsql/functions/pg-query-params.xml b/reference/pgsql/functions/pg-query-params.xml index 61e84e3de5..778177f206 100644 --- a/reference/pgsql/functions/pg-query-params.xml +++ b/reference/pgsql/functions/pg-query-params.xml @@ -1,45 +1,93 @@ - + pg_query_params - Execute a query, specifying query variables as separate parameters + Submits a command to the server and waits for the result, with the ability to pass parameters separately from the SQL command text. &reftitle.description; resourcepg_query_params - stringquery - arrayparams - - - resourcepg_query_params - resourceconnection + resourceconnection stringquery arrayparams - pg_query_params works identically to - pg_query, except that instead of putting - query parameters directly into the query - string, placeholders are used and the parameters are - passed in separately. Unlike pg_query, - only one non-empty SQL statement can be executed at a time. + Submits a command to the server and waits for the result, with the ability + to pass parameters separately from the SQL command text. - Parameters passed in this way are automatically quoted and escaped - if necessary. This is an effective way of improving the security - of your scripts and eliminating the need for manual quoting and - escaping of parameters. + pg_query_params is like pg_query, + but offers additional functionality: parameter + values can be specified separately from the command string proper. + pg_query_params is supported only against PostgreSQL 7.4 or + higher connections; it will fail when using earlier versions. - Placeholders are indicated in the query - by $1, $2, $3 and so on. The first parameter will be substituted for - $1, the second for $2, the third for $3. + + If parameters are used, they are referred to in the query + string as $1, $2, etc. params specifies the actual values of the + parameters. A &null; value in this array means the corresponding parameter is SQL + NULL. + + + The primary advantage of pg_query_params over pg_query + is that parameter values + may be separated from the query string, thus avoiding the need for tedious + and error-prone quoting and escaping. Unlike pg_query, + pg_query_params allows at + most one SQL command in the given string. (There can be semicolons in it, + but not more than one nonempty command.) + + &reftitle.parameters; + + + + connection + + + PostgreSQL database connection resource. When + connection is not present, the default connection + is used. The default connection is the last connection made by + pg_connect or pg_pconnect. + + + + + query + + + The parameterised SQL statement. Must contain only a single statement. + (multiple statements separated by semi-colons are not allowed.) If any parameters + are used, they are referred to as $1, $2, etc. + + + + + params + + + An array of parameter values to substitute for the $1, $2, etc. placeholders + in the original prepared query string. The number of elements in the array + must match the number of placeholders. + + + + + + + + + &reftitle.returnvalues; + + A query result resource on success, or &false; on failure. + + &reftitle.examples; @@ -71,8 +119,6 @@ $result = pg_query($dbconn, "SELECT * FROM shops WHERE name = '{$str}'"); pg_query - pg_connect - pg_escape_string diff --git a/reference/pgsql/functions/pg-result-error-field.xml b/reference/pgsql/functions/pg-result-error-field.xml index 68f6452948..515331ac5d 100644 --- a/reference/pgsql/functions/pg-result-error-field.xml +++ b/reference/pgsql/functions/pg-result-error-field.xml @@ -1,18 +1,16 @@ - + pg_result_error_field - - Get error message field associated with result - + Returns an individual field of an error report. &reftitle.description; - stringpg_result_error_field + mixedpg_result_error_field resourceresult intfieldcode @@ -27,19 +25,47 @@ you must use pg_send_query and pg_get_result to get the result handle. - - Possible 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. - + + &reftitle.parameters; + + + + result + + + A PostgreSQL query result resource from a previously executed + statement. + + + + + fieldcode + + + Possible 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. + + + + + + + + + &reftitle.returnvalues; + A &string; containing the contents of the error field, &null; if the field does not exist or &false; + on failure. + + &reftitle.examples; diff --git a/reference/pgsql/functions/pg-send-execute.xml b/reference/pgsql/functions/pg-send-execute.xml index 1c04d2db27..442f5944bd 100644 --- a/reference/pgsql/functions/pg-send-execute.xml +++ b/reference/pgsql/functions/pg-send-execute.xml @@ -1,41 +1,80 @@ - + pg_send_execute - Asynchronously execute a previously prepared query + Sends a request to execute a prepared statement with given parameters, without waiting for the result(s). &reftitle.description; - resourcepg_send_execute - stringstmtname - arrayparams - - - resourcepg_send_execute - resourceconnection + boolpg_send_execute + resourceconnection stringstmtname arrayparams - pg_send_execute executes a previously prepared - named query on the connection, with the - specified parameters. Unlike pg_execute, script execution - is not blocked while the query is executing. + Sends a request to execute a prepared statement with given parameters, + without waiting for the result(s). - pg_send_execute returns a query result resource if - the named prepared query could be executed with the given parameters. - It returns &false; on failure or if connection is not a valid connection. - It is identical to pg_send_query_params - except that it takes the name of a previously prepared query instead - of an actual query. + This is similar to pg_send_query_params, but the command to be executed is specified + by naming a previously-prepared statement, instead of giving a query string. The + function's parameters are handled identically to pg_execute. + Like pg_execute, it will not work on pre-7.4 versions of + PostgreSQL. + + &reftitle.parameters; + + + + connection + + + PostgreSQL database connection resource. When + connection is not present, the default connection + is used. The default connection is the last connection made by + pg_connect or pg_pconnect. + + + + + stmtname + + + The name of the prepared statement to execute. if + "" is specified, then the unnamed statement is executed. The name must have + been previously prepared using pg_prepare, + pg_send_prepare or a PREPARE SQL + command. + + + + + params + + + An array of parameter values to substitute for the $1, $2, etc. placeholders + in the original prepared query string. The number of elements in the array + must match the number of placeholders. + + + + + + + + + &reftitle.returnvalues; + Returns &true; on success, &false; on failure. Use pg_get_result + to determine the query result. + + &reftitle.examples; @@ -76,12 +115,9 @@ &reftitle.seealso; - pg_connect - pg_pconnect pg_prepare pg_send_prepare - pg_execute - + pg_execute diff --git a/reference/pgsql/functions/pg-send-prepare.xml b/reference/pgsql/functions/pg-send-prepare.xml index 848a8eba5f..544bc3a540 100644 --- a/reference/pgsql/functions/pg-send-prepare.xml +++ b/reference/pgsql/functions/pg-send-prepare.xml @@ -1,47 +1,79 @@ - + pg_send_prepare - Asynchronously prepares a query for future execution + Sends a request to create a prepared statement with the given parameters, without waiting for completion. &reftitle.description; - resourcepg_send_prepare - stringstmtname - stringquery - - - resourcepg_send_prepare - resourceconnection + boolpg_send_prepare + resourceconnection stringstmtname stringquery - pg_send_prepare asynchronously prepares a query - on the connection. Unlike pg_prepare, - script execution is not blocked while the query is being prepared. It - behaves in the same fashion as pg_send_query. + Sends a request to create a prepared statement with the given parameters, + without waiting for completion. - Parameters to pg_prepare are specified - using placeholders in the query. It is not necessary to quote - parameters as quoting and escaping is done automatically. - Placeholders are indicated in the query - by $1, $2, $3 and so on. - - Using prepared queries means you can prepare one and - then execute many times, with different parameters. PostgreSQL - will cache the query plan on the prepare, then re-use it for - each execute, resulting in speed improvements. There is no - need to use a prepared query if it will only be executed once. - In this case, it is simpler to use pg_query_params. + This is an asynchronous version of pg_prepare: it returns &true; if it was able to + dispatch the request, and &false; if not. After a successful call, call + pg_get_result to determine whether the server successfully created the + prepared statement. The function's parameters are handled identically to + pg_prepare. Like pg_prepare, it will not work + on pre-7.4 versions of PostgreSQL. + + &reftitle.parameters; + + + + connection + + + PostgreSQL database connection resource. When + connection is not present, the default connection + is used. The default connection is the last connection made by + pg_connect or pg_pconnect. + + + + + stmtname + + + The name to give the prepared statement. Must be unique per-connection. If + "" is specified, then an unnamed statement is created, overwriting any + previously defined unnamed statement. + + + + + query + + + The parameterised SQL statement. Must contain only a single statement. + (multiple statements separated by semi-colons are not allowed.) If any parameters + are used, they are referred to as $1, $2, etc. + + + + + + + + + &reftitle.returnvalues; + Returns &true; on success, &false; on failure. Use pg_get_result + to determine the query result. + + &reftitle.examples; diff --git a/reference/pgsql/functions/pg-send-query-params.xml b/reference/pgsql/functions/pg-send-query-params.xml index 52178cd7be..011f2ffc9c 100644 --- a/reference/pgsql/functions/pg-send-query-params.xml +++ b/reference/pgsql/functions/pg-send-query-params.xml @@ -1,12 +1,10 @@ - + pg_send_query_params - - Sends asynchronous query, specifying query variables as separate parameters - + Submits a command and separate parameters to the server without waiting for the result(s). @@ -18,25 +16,61 @@ arrayparams - pg_send_query_params works identically to - pg_send_query, except that instead of putting - query parameters directly into the query - string, placeholders are used and the parameters are - passed in separately. Unlike pg_send_query, - only one non-empty SQL statement can be executed at a time. + Submits a command and separate parameters to the server without + waiting for the result(s). - Parameters passed in this way are automatically quoted and escaped - if necessary. This is an effective way of improving the security - of your scripts and eliminating the need for manual quoting and - escaping of parameters. - - Placeholders are indicated in the query - by $1, $2, $3 and so on. The first parameter will be substituted for - $1, the second for $2, the third for $3. - + This is equivalent to pg_send_query except that query + parameters can be specified separately from the + query string. The function's parameters are + handled identically to pg_query_params. Like + pg_query_params, it will not work on pre-7.4 PostgreSQL + connections, and it allows only one command in the query string. + - + + + &reftitle.parameters; + + + + connection + + + PostgreSQL database connection resource. + + + + + query + + + The parameterised SQL statement. Must contain only a single statement. + (multiple statements separated by semi-colons are not allowed.) If any parameters + are used, they are referred to as $1, $2, etc. + + + + + params + + + An array of parameter values to substitute for the $1, $2, etc. placeholders + in the original prepared query string. The number of elements in the array + must match the number of placeholders. + + + + + + + + + &reftitle.returnvalues; + Returns &true; on success, &false; on failure. Use pg_get_result + to determine the query result. + + &reftitle.examples; @@ -66,8 +100,6 @@ pg_send_query - pg_connect - pg_escape_string diff --git a/reference/pgsql/functions/pg-set-error-verbosity.xml b/reference/pgsql/functions/pg-set-error-verbosity.xml index e54676e90b..63c4710313 100644 --- a/reference/pgsql/functions/pg-set-error-verbosity.xml +++ b/reference/pgsql/functions/pg-set-error-verbosity.xml @@ -1,11 +1,12 @@ - + pg_set_error_verbosity - Set the error verbosity + Determines the verbosity of messages returned by pg_last_error + and pg_result_error. @@ -13,33 +14,62 @@ &reftitle.description; intpg_set_error_verbosity - intverbosity - - - intpg_set_error_verbosity - resourceconnection + resourceconnection intverbosity - pg_set_error_verbosity determines the verbosity - of messages returned by pg_last_error and - pg_result_error. The verbosity - can be one of three constants: PGSQL_ERRORS_TERSE, - PGSQL_ERRORS_DEFAULT - or PGSQL_ERRORS_VERBOSE. + Determines the verbosity of messages returned by pg_last_error + and pg_result_error. - pg_set_error_verbosity will return the - connection previous verbosity. + + pg_set_error_verbosity sets the verbosity mode, returning the connection's previous + setting. In TERSE mode, returned messages include severity, primary text, and + position only; this will normally fit on a single line. The default mode + produces messages that include the above plus any detail, hint, or context + fields (these may span multiple lines). The VERBOSE mode includes all available + fields. Changing the verbosity does not affect the messages available from + already-existing result objects, only subsequently-created ones. - - - This function requires PostgreSQL 7.4 or higher. Changing the - verbosity in this manner will only affect future results, existing - result objects will be unchanged. - - + + &reftitle.parameters; + + + + connection + + + PostgreSQL database connection resource. When + connection is not present, the default connection + is used. The default connection is the last connection made by + pg_connect or pg_pconnect. + + + + + verbosity + + + The required verbosity: PGSQL_ERRORS_TERSE, + PGSQL_ERRORS_DEFAULT + or PGSQL_ERRORS_VERBOSE. + + + + + + + + + &reftitle.returnvalues; + + The previous verbosity level: PGSQL_ERRORS_TERSE, + PGSQL_ERRORS_DEFAULT + or PGSQL_ERRORS_VERBOSE. + + + &reftitle.examples; diff --git a/reference/pgsql/functions/pg-transaction-status.xml b/reference/pgsql/functions/pg-transaction-status.xml index e6f6440fb8..534afcea74 100644 --- a/reference/pgsql/functions/pg-transaction-status.xml +++ b/reference/pgsql/functions/pg-transaction-status.xml @@ -1,12 +1,10 @@ - + pg_transaction_status - - Get transaction status - + Returns the current in-transaction status of the server. @@ -16,26 +14,46 @@ resourceconnection - pg_transaction_status returns the current in-transaction status - of the server. - The status can be PGSQL_TRANSACTION_IDLE (currently idle), - PGSQL_TRANSACTION_ACTIVE (a command is in progress), - PGSQL_TRANSACTION_INTRANS (idle, in a valid transaction block), - or PGSQL_TRANSACTION_INERROR (idle, in a failed transaction block). - PGSQL_TRANSACTION_UNKNOWN is reported if the connection is bad. - PGSQL_TRANSACTION_ACTIVE is reported only when a query - has been sent to the server and not yet completed. - - - - pg_transaction_status will give incorrect results when using - a PostgreSQL 7.3 server that has the parameter autocommit - set to off. The server-side autocommit feature has been - deprecated and does not exist in later server versions. - - + Returns the current in-transaction status of the server. + + + + pg_transaction_status will give incorrect results when using + a PostgreSQL 7.3 server that has the parameter autocommit + set to off. The server-side autocommit feature has been + deprecated and does not exist in later server versions. + + + + &reftitle.parameters; + + + + connection + + + PostgreSQL database connection resource. + + + + + + + + + &reftitle.returnvalues; + The status can be PGSQL_TRANSACTION_IDLE (currently idle), + PGSQL_TRANSACTION_ACTIVE (a command is in progress), + PGSQL_TRANSACTION_INTRANS (idle, in a valid transaction block), + or PGSQL_TRANSACTION_INERROR (idle, in a failed transaction block). + PGSQL_TRANSACTION_UNKNOWN is reported if the connection is bad. + PGSQL_TRANSACTION_ACTIVE is reported only when a query + has been sent to the server and not yet completed. + + + &reftitle.examples;