diff --git a/functions/pgsql.xml b/functions/pgsql.xml index 8e274a23a5..5b919c8ba2 100644 --- a/functions/pgsql.xml +++ b/functions/pgsql.xml @@ -1,5 +1,5 @@ - + PostgreSQL functions PostgreSQL @@ -225,42 +225,6 @@ export PGHOST PGPORT PGDATABASE PGUSER PGPASSWORD PGDATESTYLE PGTZ PGCLIENTENCOD - - - pg_close - Close a PostgreSQL connection - - - Description - - boolpg_close - resourceconnection - - - pg_close closes down the non-persistent - connection to a PostgreSQL database associated with the given - connection resource. It returns &true;, if - connection is a valid connection resource, - otherwise it return &false;. - - - - pg_close is not usually necessary, as - non-persistent open links are automatically closed at the end of - the script's execution. pg_close will not - close persistent links generated by - pg_pconnect. - - - - If there is open large object resource on the connection, do not - close the connection before closing all large object resources. - - - - - - pg_affected_rows @@ -376,22 +340,258 @@ $dbconn4 = pg_connect ($conn_string); - + - pg_dbname - Get the database name + pg_pconnect + Open a persistent PostgreSQL connection Description - stringpg_dbname + intpg_pconnect + stringconnection_string + + + pg_pconnect opens a connection to a + PostgreSQL database. It returns a connection resource that is + needed by other PostgreSQL functions. + + + It returns a connection resource on success, or &false; if the + connection could not be made. The arguments should be within a + quoted string. The arguments available include + host, port, + tty, options, + dbname, user, and + password. + + + Using pg_pconnect + + +]]> + + + + If a second call is made to pg_pconnect with + the same arguments, no new connection will be established, but + instead, the connection resource of the already opened connection + will be returned. You can have multiple connections to the same + database if you use different connection string. + + + Multiple parameters syntax for pg_pconnect + $conn = pg_pconnect ("host", "port", "options", "tty", + "dbname") + + has been deprecated. + + + To enable persistent connection, pgsql.allow_persistent + &php.ini; directive must be set to "On". (Default is On) + Max number of persistent connection can be defined by pgsql.max_persistent + &php.ini; directive. (Default is -1 which is no limit) Total number + of connection can be set by pgsql.max_links + &php.ini; directive. + + + pg_close will not close persistent links + generated by pg_pconnect. + + + See also pg_connect. + + + + + + + + + pg_connection_busy + + Get connection is busy or not + + + + Description + + boolpg_connection_busy resourceconnection - pg_dbname returns the name of the database - that the given PostgreSQL connection - resource. It returns &false;, if connection - is not a valid PostgreSQL connection resource. + pg_connection_busy returns &true; if + connection busy. If connection is busy, previously sent query to + PostgreSQL server is still executing. If + pg_get_result is called, + pg_get_result will block. + + + See also pg_connection_status and + pg_get_result + + + + + + + + + pg_connection_reset + + Reset connection (reconnect) + + + + Description + + boolpg_connection_reset + resourceconnection + + + pg_connection_reset reset connection with + the same parameter when connection is made. It is useful for + error recovery. It returns &true; if it resets connection + successfully, otherwise returns &false;. + + + See also pg_connect, + pg_pconnect and + pg_connection_status + + + + + + + + + pg_connection_status + + Get connection status + + + + Description + + intpg_connection_status + resourceconnection + + + pg_connection_status returns a connection + status. Possible status is PGSQL_CONNECTION_OK + or PGSQL_CONNECTION_BAD. + + + See also pg_connection_busy + + + + + + + + + pg_close + Close a PostgreSQL connection + + + Description + + boolpg_close + resourceconnection + + + pg_close closes down the non-persistent + connection to a PostgreSQL database associated with the given + connection resource. It returns &true;, if + connection is a valid connection resource, + otherwise it return &false;. + + + + pg_close is not usually necessary, as + non-persistent open links are automatically closed at the end of + the script's execution. pg_close will not + close persistent links generated by + pg_pconnect. + + + + If there is open large object resource on the connection, do not + close the connection before closing all large object resources. + + + + + + + + + pg_copy_from + + Copy table from array + + + + Description + + intpg_copy_from + intconnection + stringtable_name + arrayrows + stringdelimiter + stringnull_as + + + pg_copy_from copy table from array. It + return &true; for success, otherwise &false;. + + + See also pg_copy_to + + + + + + + + + pg_copy_to + + Copy table to array + + + + Description + + intpg_copy_to + intconnection + stringtable_name + stringdelimiter + stringnull_as + + + pg_copy_to copy table to array. The result + array is returned if it success to copy. Otherwise it returns + &false;. + + + See also pg_copy_from @@ -427,6 +627,57 @@ $dbconn4 = pg_connect ($conn_string); + + + pg_put_line + Send a NULL-terminated string to PostgreSQL backend + + + Description + + boolpg_put_line + resourceconnection + stringdata + + + pg_put_line sends a NULL-terminated string + to the PostgreSQL backend server. This is useful for example for + very high-speed inserting of data into a table, initiated by + starting a PostgreSQL copy-operation. That final NULL-character + is added automatically. It returns &true; if successful, &false; + otherwise. + + + + Note the application must explicitly send the two characters "\." + on a final line to indicate to the backend that it has finished + sending its data. + + + + See also pg_end_copy. + + High-speed insertion of data into a table + + +]]> + + + + + + + + pg_last_error @@ -461,6 +712,97 @@ $dbconn4 = pg_connect ($conn_string); + + + + + pg_last_notice + + Returns the last notice message from PostgreSQL server + + + + Description + + stringpg_last_notice + resourceconnection + + + pg_last_notice returns the last notice + message from the PostgreSQL server specified by + connection. The PostgreSQL server sends notice + messages in several cases, e.g. if the transactions can't be continued. + With pg_last_notice, you can avoid issuing useless + queries, by checking whether the notice is related to the transaction + or not. + + + + This function is EXPERIMENTAL and it is not fully implemented + yet. pg_last_notice was added in PHP + 4.0.6. However, PHP 4.0.6 has problem with notice message + handling. Use of the PostgreSQL module with PHP 4.0.6 is not + recommended even if you are not using + pg_last_notice. + + + This function is fully implemented in PHP 4.3.0. PHP earlier than + PHP 4.3.0 ignores database connection parameter. + + + + Notice message tracking can be set to optional by setting 1 for + pgsql.ignore_notice ini from PHP 4.3.0. + + + Notice message logging can be set to optional by setting 0 for + pgsql.log_notice ini from PHP 4.3.0. Unless + pgsql.ignore_notice is set to 0, notice message + cannot be logged. + + + See also pg_query and + pg_last_error. + + + + + + + + + pg_last_oid + Returns the last object's oid + + + Description + + intpg_last_oid + resourceresult + + + pg_last_oid is used to retrieve the + oid assigned to an inserted tuple (record) if + the result resource is used from the last command sent via + pg_query and was an SQL INSERT. Returns a + positive integer if there was a valid oid. It + returns &false; if an error occurs or the last command sent via + pg_query was not an INSERT or INSERT is + failed. + + + + This function used called pg_getlastoid(). + + + + See also pg_query. + + + + + + pg_query @@ -725,6 +1067,50 @@ pg_close ($db_conn); + + + pg_fetch_result + Returns values from a result resource + + + Description + + mixedpg_fetch_result + resourceresult + introw_number + mixedfield + + + pg_fetch_result returns values from a + result resource returned by + pg_query. row_number + is integer. field is field name(string) + or field index (integer). The row_number + and field specify what cell in the table + of results to return. Row numbering starts from 0. Instead of + naming the field, you may use the field index as an unquoted + number. Field indices start from 0. + + + PostgreSQL has many built in types and only the basic ones are + directly supported here. All forms of integer, + boolean and void + + + types are + returned as integer values. All forms of float, and + real types are returned as float values. All other + types, including arrays are returned as strings formatted in the + same default PostgreSQL manner that you would see in the + psql program. + + + + + + pg_fetch_row @@ -1027,122 +1413,6 @@ for ($i=0; $i < $num; $i++) { - - - pg_last_oid - Returns the last object's oid - - - Description - - intpg_last_oid - resourceresult - - - pg_last_oid is used to retrieve the - oid assigned to an inserted tuple (record) if - the result resource is used from the last command sent via - pg_query and was an SQL INSERT. Returns a - positive integer if there was a valid oid. It - returns &false; if an error occurs or the last command sent via - pg_query was not an INSERT or INSERT is - failed. - - - - This function used called pg_getlastoid(). - - - - See also pg_query. - - - - - - - - - pg_host - - Returns the host name associated with the connection - - - - Description - - stringpg_host - resourceconnection - - - pg_host returns the host name of the given - PostgreSQL connection resource is - connected to. - - - See also pg_connect and - pg_pconnect. - - - - - - - - - pg_last_notice - - Returns the last notice message from PostgreSQL server - - - - Description - - stringpg_last_notice - resourceconnection - - - pg_last_notice returns the last notice - message from the PostgreSQL server specified by - connection. The PostgreSQL server sends notice - messages in several cases, e.g. if the transactions can't be continued. - With pg_last_notice, you can avoid issuing useless - queries, by checking whether the notice is related to the transaction - or not. - - - - This function is EXPERIMENTAL and it is not fully implemented - yet. pg_last_notice was added in PHP - 4.0.6. However, PHP 4.0.6 has problem with notice message - handling. Use of the PostgreSQL module with PHP 4.0.6 is not - recommended even if you are not using - pg_last_notice. - - - This function is fully implemented in PHP 4.3.0. PHP earlier than - PHP 4.3.0 ignores database connection parameter. - - - - Notice message tracking can be set to optional by setting 1 for - pgsql.ignore_notice ini from PHP 4.3.0. - - - Notice message logging can be set to optional by setting 0 for - pgsql.log_notice ini from PHP 4.3.0. Unless - pgsql.ignore_notice is set to 0, notice message - cannot be logged. - - - See also pg_query and - pg_last_error. - - - - - - pg_lo_close @@ -1603,99 +1873,27 @@ for ($i=0; $i < $num; $i++) { - + - pg_options - Get the options associated with the connection + pg_host + + Returns the host name associated with the connection + Description - stringpg_options + stringpg_host resourceconnection - pg_options will return a string containing - the options specified on the given PostgreSQL - connection resource. - - - - - - - pg_pconnect - Open a persistent PostgreSQL connection - - - Description - - intpg_pconnect - stringconnection_string - - - pg_pconnect opens a connection to a - PostgreSQL database. It returns a connection resource that is - needed by other PostgreSQL functions. + pg_host returns the host name of the given + PostgreSQL connection resource is + connected to. - It returns a connection resource on success, or &false; if the - connection could not be made. The arguments should be within a - quoted string. The arguments available include - host, port, - tty, options, - dbname, user, and - password. - - - Using pg_pconnect - - -]]> - - - - If a second call is made to pg_pconnect with - the same arguments, no new connection will be established, but - instead, the connection resource of the already opened connection - will be returned. You can have multiple connections to the same - database if you use different connection string. - - - Multiple parameters syntax for pg_pconnect - $conn = pg_pconnect ("host", "port", "options", "tty", - "dbname") - - has been deprecated. - - - To enable persistent connection, pgsql.allow_persistent - &php.ini; directive must be set to "On". (Default is On) - Max number of persistent connection can be defined by pgsql.max_persistent - &php.ini; directive. (Default is -1 which is no limit) Total number - of connection can be set by pgsql.max_links - &php.ini; directive. - - - pg_close will not close persistent links - generated by pg_pconnect. - - - See also pg_connect. + See also pg_connect and + pg_pconnect. @@ -1725,95 +1923,43 @@ $dbconn4 = pg_connect ($conn_string); - + - pg_put_line - Send a NULL-terminated string to PostgreSQL backend + pg_dbname + Get the database name Description - boolpg_put_line - resourceconnection - stringdata + stringpg_dbname + resourceconnection - pg_put_line sends a NULL-terminated string - to the PostgreSQL backend server. This is useful for example for - very high-speed inserting of data into a table, initiated by - starting a PostgreSQL copy-operation. That final NULL-character - is added automatically. It returns &true; if successful, &false; - otherwise. - - - - Note the application must explicitly send the two characters "\." - on a final line to indicate to the backend that it has finished - sending its data. - - - - See also pg_end_copy. - - High-speed insertion of data into a table - - -]]> - - + pg_dbname returns the name of the database + that the given PostgreSQL connection + resource. It returns &false;, if connection + is not a valid PostgreSQL connection resource. - + - pg_fetch_result - Returns values from a result resource + pg_options + Get the options associated with the connection Description - mixedpg_fetch_result - resourceresult - introw_number - mixedfield + stringpg_options + resourceconnection - pg_fetch_result returns values from a - result resource returned by - pg_query. row_number - is integer. field is field name(string) - or field index (integer). The row_number - and field specify what cell in the table - of results to return. Row numbering starts from 0. Instead of - naming the field, you may use the field index as an unquoted - number. Field indices start from 0. - - - PostgreSQL has many built in types and only the basic ones are - directly supported here. All forms of integer, - boolean and void - - - types are - returned as integer values. All forms of float, and - real types are returned as float values. All other - types, including arrays are returned as strings formatted in the - same default PostgreSQL manner that you would see in the - psql program. + pg_options will return a string containing + the options specified on the given PostgreSQL + connection resource. @@ -1907,6 +2053,29 @@ $dbconn4 = pg_connect ($conn_string); + + + pg_tty + + Return the tty name associated with the connection + + + + Description + + stringpg_tty + resourceconnection + + + pg_tty returns the tty name that server + side debugging output is sent to on the given PostgreSQL + connection resource. + + + + + + pg_trace @@ -1952,29 +2121,6 @@ $dbconn4 = pg_connect ($conn_string); - - - pg_tty - - Return the tty name associated with the connection - - - - Description - - stringpg_tty - resourceconnection - - - pg_tty returns the tty name that server - side debugging output is sent to on the given PostgreSQL - connection resource. - - - - - - pg_untrace @@ -2029,6 +2175,37 @@ $dbconn4 = pg_connect ($conn_string); + + + pg_result_error + + Get error message associated with result + + + + Description + + stringpg_result_error + resourceresult + + + pg_result_error returns error message + associated with result resource. Therefore, + user has better chance to get better error message than + pg_last_error. + + + See also pg_query, + pg_send_query, + pg_get_result, + pg_last_error and + pg_last_notice + + + + + + pg_result_status @@ -2131,148 +2308,6 @@ $dbconn4 = pg_connect ($conn_string); - - - pg_connection_busy - - Get connection is busy or not - - - - Description - - boolpg_connection_busy - resourceconnection - - - pg_connection_busy returns &true; if - connection busy. If connection is busy, previously sent query to - PostgreSQL server is still executing. If - pg_get_result is called, - pg_get_result will block. - - - See also pg_connection_status and - pg_get_result - - - - - - - - - pg_connection_reset - - Reset connection (reconnect) - - - - Description - - boolpg_connection_reset - resourceconnection - - - pg_connection_reset reset connection with - the same parameter when connection is made. It is useful for - error recovery. It returns &true; if it resets connection - successfully, otherwise returns &false;. - - - See also pg_connect, - pg_pconnect and - pg_connection_status - - - - - - - - - pg_connection_status - - Get connection status - - - - Description - - intpg_connection_status - resourceconnection - - - pg_connection_status returns a connection - status. Possible status is PGSQL_CONNECTION_OK - or PGSQL_CONNECTION_BAD. - - - See also pg_connection_busy - - - - - - - - - pg_copy_from - - Copy table from array - - - - Description - - intpg_copy_from - intconnection - stringtable_name - arrayrows - stringdelimiter - stringnull_as - - - pg_copy_from copy table from array. It - return &true; for success, otherwise &false;. - - - See also pg_copy_to - - - - - - - - - pg_copy_to - - Copy table to array - - - - Description - - intpg_copy_to - intconnection - stringtable_name - stringdelimiter - stringnull_as - - - pg_copy_to copy table to array. The result - array is returned if it success to copy. Otherwise it returns - &false;. - - - See also pg_copy_from - - - - - - pg_escape_bytea @@ -2350,37 +2385,6 @@ $dbconn4 = pg_connect ($conn_string); - - - pg_result_error - - Get error message associated with result - - - - Description - - stringpg_result_error - resourceresult - - - pg_result_error returns error message - associated with result resource. Therefore, - user has better chance to get better error message than - pg_last_error. - - - See also pg_query, - pg_send_query, - pg_get_result, - pg_last_error and - pg_last_notice - - - - - - pg_metadata