From 46d091e1a9d0746f55f3d2ad82dc61b722ef4a4d Mon Sep 17 00:00:00 2001 From: Yasuo Ohgaki Date: Sun, 7 Apr 2002 04:37:56 +0000 Subject: [PATCH] Update manual for new function names. Old names are mentioned also. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@76894 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/pgsql.xml | 532 ++++++++++++++++++++++++++------------------ 1 file changed, 321 insertions(+), 211 deletions(-) diff --git a/functions/pgsql.xml b/functions/pgsql.xml index 14af00d57b..3a2b9b744f 100644 --- a/functions/pgsql.xml +++ b/functions/pgsql.xml @@ -1,5 +1,5 @@ - + PostgreSQL functions PostgreSQL @@ -27,7 +27,7 @@ ]]> @@ -239,38 +239,43 @@ pg_loexport pg_lo_export - + - pg_cmdtuples + pg_affected_rows Returns number of affected records(tuples) Description - intpg_cmdtuples + intpg_affected_rows resourceresult - pg_cmdtuples returns the number of tuples + pg_affected_rows returns the number of tuples (instances/records/rows) affected by INSERT, UPDATE, and DELETE - queries executed by pg_exec. If no tuple is + queries executed by pg_query. If no tuple is affected by this function, it will return 0. - <function>pg_cmdtuples</function> + <function>pg_affected_rows</function> ]]> + + + This function used called pg_cmdtuples(). + + - See also pg_exec and - pg_numrows. + See also pg_query and + pg_num_rows. @@ -400,54 +405,59 @@ $dbconn4 = pg_connect ($conn_string); - + - pg_errormessage + pg_last_error Get the last error message string of a connection Description - stringpg_errormessage + stringpg_last_error resourceconnection - pg_errormessage returns a string containing + pg_last_error returns a string containing the last error message for given connection. It returns &false; on failure. - pg_errormessage returns the last error + pg_last_error returns the last error message for given connection and error message may be overwritten if other libpq functions are called on the connection. PostgreSQL functions calls libpq functions internally. Therefore, details about the error may not be - retrieved using the pg_errormessage + retrieved using the pg_last_error function. pg_result_error_message() will be added from 4.2.0 to get last error for the result resource. + + + This function used called pg_errormessage(). + + - + - pg_exec + pg_query Execute a query Description - resourcepg_exec + resourcepg_query resourceconnection stringquery - pg_exec returns a query result resource if + pg_query returns a query result resource if query could be executed. It returns &false; on failure or if connection is not a valid connection. Details about the error can - be retrieved using the pg_errormessage + be retrieved using the pg_last_error function if connection is valid. - pg_errormessage sends an SQL statement to + pg_last_error sends an SQL statement to the PostgreSQL database specified by the connection resource. The connection must be a valid connection that @@ -459,7 +469,7 @@ $dbconn4 = pg_connect ($conn_string); connection is a optional parameter for - pg_exec. If + pg_query. If connection is not used, default connection is used. Default connection is the last connection made by pg_connect or @@ -472,13 +482,18 @@ $dbconn4 = pg_connect ($conn_string); + + + This function used called pg_exec(). + + See also pg_connect, pg_pconnect, pg_fetch_array, pg_fetch_object, - pg_numrows, - and pg_cmdtuples. + pg_num_rows, + and pg_affected_rows. @@ -537,7 +552,7 @@ $dbconn4 = pg_connect ($conn_string); See also pg_fetch_row and pg_fetch_object and - pg_result. + pg_fetch_result. @@ -551,7 +566,7 @@ if (!$conn) { exit; } -$result = pg_exec ($conn, "SELECT * FROM authors"); +$result = pg_query ($conn, "SELECT * FROM authors"); if (!$result) { echo "An error occured.\n"; exit; @@ -626,8 +641,8 @@ echo $arr["author"] . " <- array\n"; insignificant). - See also pg_exec, pg_fetch_array, - pg_fetch_row and pg_result. + See also pg_query, pg_fetch_array, + pg_fetch_row and pg_fetch_result. @@ -642,7 +657,7 @@ if (!$db_conn): ?> exit; endif; -$qu = pg_exec ($db_conn, "SELECT * FROM verlag ORDER BY autor"); +$qu = pg_query ($db_conn, "SELECT * FROM verlag ORDER BY autor"); $row = 0; // postgres needs a row counter other dbs might not while ($data = pg_fetch_object ($qu, $row)) { @@ -671,7 +686,7 @@ echo "----------\n"; ?> ]]> @@ -712,10 +727,10 @@ pg_close ($db_conn); if there are no more rows. - See also: pg_exec, + See also: pg_query, pg_fetch_array, pg_fetch_object and - pg_result. + pg_fetch_result. @@ -729,13 +744,13 @@ if (!$conn) { exit; } -$result = pg_Exec ($conn, "SELECT * FROM authors"); +$result = pg_query ($conn, "SELECT * FROM authors"); if (!$result) { echo "An error occured.\n"; exit; } -$num = pg_numrows($result); +$num = pg_num_rows($result); for ($i=0; $i < $num; $i++) { $r = pg_fetch_row($result, $i); @@ -763,114 +778,134 @@ for ($i=0; $i < $num; $i++) { - + - pg_fieldisnull + pg_field_is_null Test if a field is &null; Description - intpg_fieldisnull + intpg_field_is_null resourceresult introw mixedfield - pg_fieldisnull test if a field is &null; or + pg_field_is_null test if a field is &null; or not. It returns 1 if the field in the given row is &null;. It returns 0 if the field in the given row is NOT &null;. Field can be specified as column index (number) or fieldname (string). Row numbering starts at 0. + + + This function used called pg_fieldisnull(). + + - + - pg_fieldname + pg_field_name Returns the name of a field Description - stringpg_fieldname + stringpg_field_name resourceresult intfield_number - pg_fieldname returns the name of the field + pg_field_name returns the name of the field occupying the given field_number in the given PostgreSQL result resource. Field numbering starts from 0. + + + This function used called pg_fieldname(). + + - See also pg_fieldnum. + See also pg_field_num. - + - pg_fieldnum + pg_field_num Returns the field number of the named field Description - intpg_fieldnum + intpg_field_num resourceresult stringfield_name - pg_fieldnum will return the number of the + pg_field_num will return the number of the column (field) slot that corresponds to the field_name in the given PostgreSQL result resource. Field numbering starts at 0. This function will return -1 on error. + + + This function used called pg_fieldnum(). + + - See also pg_fieldname. + See also pg_field_name. - + - pg_fieldprtlen + pg_field_prtlen Returns the printed length Description - intpg_fieldprtlen + intpg_field_prtlen resourceresult introw_number stringfield_name - pg_fieldprtlen returns the actual printed + pg_field_prtlen returns the actual printed length (number of characters) of a specific value in a PostgreSQL result. Row numbering starts at 0. This function will return -1 on an error. + + + This function used called pg_field_prtlen(). + + - See also pg_fieldsize. + See also pg_field_size. - + - pg_fieldsize + pg_field_size Returns the internal storage size of the named field @@ -878,28 +913,33 @@ for ($i=0; $i < $num; $i++) { Description - intpg_fieldsize + intpg_field_size resourceresult intfield_number - pg_fieldsize returns the internal storage + pg_field_size returns the internal storage size (in bytes) of the field number in the given PostgreSQL result. Field numbering starts at 0. A field size of -1 indicates a variable length field. This function will return &false; on error. + + + This function used called pg_fieldsize(). + + - See also pg_fieldlen and pg_fieldtype. + See also pg_field_len and pg_field_type. - + - pg_fieldtype + pg_field_type Returns the type name for the corresponding field number @@ -907,77 +947,92 @@ for ($i=0; $i < $num; $i++) { Description - stringpg_fieldtype + stringpg_field_type resourceresult intfield_number - pg_fieldtype returns a string containing the + pg_field_type returns a string containing the type name of the given field_number in the given PostgreSQL result resource. Field numbering starts at 0. + + + This function used called pg_field_type(). + + - See also pg_fieldlen and pg_fieldname. + See also pg_field_len and pg_field_name. - + - pg_freeresult + pg_free_result Free result memory Description - boolpg_freeresult + boolpg_free_result resourceresult - pg_freeresult only needs to be called if you + pg_free_result only needs to be called if you are worried about using too much memory while your script is running. All result memory will automatically be freed when the script is finished. But, if you are sure you are not going to need the result data anymore in a script, you may call - pg_freeresult with the + pg_free_result with the result resource as an argument and the associated result memory will be freed. It returns true on success and false if an error occurs. + + + This function used called pg_field_len(). + + - See also pg_exec. + See also pg_query. - + - pg_getlastoid + pg_last_oid Returns the last object's oid Description - intpg_getlastoid + intpg_last_oid resourceresult - pg_getlastoid is used to retrieve the + 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_exec and was an SQL INSERT. Returns a + 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_exec was not an INSERT or INSERT is + pg_query was not an INSERT or INSERT is failed. + + + This function used called pg_getlastoid(). + + - See also pg_exec. + See also pg_query. @@ -1044,56 +1099,61 @@ for ($i=0; $i < $num; $i++) { - See also pg_exec and pg_errormessage. + See also pg_query and pg_last_error. - + - pg_loclose + pg_lo_close Close a large object Description - boolpg_loclose + boolpg_lo_close resourcelarge_object - pg_loclose closes a Large + pg_lo_close closes a Large Object. large_object is a resource for the - large object from pg_loopen. + large object from pg_lo_open. To use the large object (lo) interface, it is necessary to enclose it within a transaction block. + + + This function used called pg_loclose(). + + - See also pg_loopen, - pg_locreate and - pg_loimport. + See also pg_lo_open, + pg_lo_create and + pg_lo_import. - + - pg_locreate + pg_lo_create Create a large object Description - intpg_locreate + intpg_lo_create resourceconnection - pg_locreate creates a Large + pg_lo_create creates a Large Object and returns the oid of the large object. connection specifies a valid database connection opened by pg_connect or @@ -1109,20 +1169,25 @@ for ($i=0; $i < $num; $i++) { To use the large object (lo) interface, it is necessary to enclose it within a transaction block. + + + This function used called pg_locreate(). + + - + - pg_loexport + pg_lo_export Export a large object to file Description - boolpg_loexport + boolpg_lo_export intoid stringpathname resourceconnection @@ -1137,23 +1202,28 @@ for ($i=0; $i < $num; $i++) { To use the large object (lo) interface, it is necessary to enclose it within a transaction block. + + + This function used called pg_loexport(). + + - See also pg_loimport. + See also pg_lo_import. - + - pg_loimport + pg_lo_import Import a large object from file Description - intpg_loimport + intpg_lo_import stringpathname resourceconnection @@ -1168,30 +1238,35 @@ for ($i=0; $i < $num; $i++) { enclose it within a transaction block. ¬e.sm.uidcheck; + + + This function used called pg_loimport(). + + - See also pg_loexport and - pg_loopen. + See also pg_lo_export and + pg_lo_open. - + - pg_loopen + pg_lo_open Open a large object Description - resourcepg_loopen + resourcepg_lo_open resourceconnection intoid stringmode - pg_loopen open a Large Object and + pg_lo_open open a Large Object and returns large object resource. The resource encapsulates information about the connection. oid specifies a valid large object oid and @@ -1208,29 +1283,34 @@ for ($i=0; $i < $num; $i++) { To use the large object (lo) interface, it is necessary to enclose it within a transaction block. + + + This function used called pg_loopen(). + + - See also pg_loclose and - pg_locreate. + See also pg_lo_close and + pg_lo_create. - + - pg_loread + pg_lo_read Read a large object Description - stringpg_loread + stringpg_lo_read resourcelarge_object intlen - pg_loread reads at most + pg_lo_read reads at most len bytes from a large object and returns it as a string. large_object specifies a valid large object resource andlen @@ -1241,17 +1321,75 @@ for ($i=0; $i < $num; $i++) { To use the large object (lo) interface, it is necessary to enclose it within a transaction block. + + + This function used called pg_loraed(). + + - See also pg_loreadall. + See also pg_lo_read_all. - + - pg_loreadall + pg_lo_seek + + Seeks position of large object + + + + Description + + boolpg_lo_seek + resourcelarge_object + intoffset + intwhence + + + pg_lo_seek seeks position of large object + resource. whence is PGSQL_SEEK_SET, + PGSQL_SEEK_CUR or PGSQL_SEEK_END. + + + See also pg_lo_tell. + + + + + + + + + pg_lo_tell + + Returns current position of large object + + + + Description + + intpg_lo_tell + resourcelarge_object + + + pg_lo_tell returns current position (offset + from the beginning of large object). + + + See also pg_lo_seek. + + + + + + + + + pg_lo_read_all Read a entire large object and send straight to browser @@ -1259,11 +1397,11 @@ for ($i=0; $i < $num; $i++) { Description - intpg_loreadall + intpg_lo_read_all resourcelarge_object - pg_loreadall reads a large object and passes + pg_lo_read_all reads a large object and passes it straight through to the browser after sending all pending headers. Mainly intended for sending binary data like images or sound. It returns number of bytes read. It returns &false;, if an @@ -1273,28 +1411,33 @@ for ($i=0; $i < $num; $i++) { To use the large object (lo) interface, it is necessary to enclose it within a transaction block. + + + This function used called pg_loreadall(). + + - See also pg_loread. + See also pg_lo_read. - + - pg_lounlink + pg_lo_unlink Delete a large object Description - boolpg_lounlink + boolpg_lo_unlink resourceconnection intoid - pg_lounlink deletes a large object with the + pg_lo_unlink deletes a large object with the oid. It returns &true; on success, otherwise returns &false;. @@ -1302,101 +1445,121 @@ for ($i=0; $i < $num; $i++) { To use the large object (lo) interface, it is necessary to enclose it within a transaction block. + + + This function used called pg_lo_unlink(). + + - See also pg_locreate and - pg_loimport. + See also pg_lo_create and + pg_lo_import. - + - pg_lowrite + pg_lo_write Write a large object Description - intpg_lowrite + intpg_lo_write resourcelarge_object stringdata - pg_lowrite writes at most to a large object + pg_lo_write writes at most to a large object from a variable data and returns the number of bytes actually written, or &false; in the case of an error. large_object is a large object resource - from pg_loopen. + from pg_lo_open. To use the large object (lo) interface, it is necessary to enclose it within a transaction block. + + + This function used called pg_lo_write(). + + - See also pg_locreate and - pg_loopen. + See also pg_lo_create and + pg_lo_open. - + - pg_numfields + pg_num_fields Returns the number of fields Description - intpg_numfields + intpg_num_fields resourceresult - pg_numfields returns the number of fields + pg_num_fields returns the number of fields (columns) in a PostgreSQL result. The argument is a result resource returned by - pg_exec. This function will return -1 on + pg_query. This function will return -1 on error. + + + This function used called pg_numfields(). + + - See also pg_numrows and - pg_cmdtuples. + See also pg_num_rows and + pg_affected_rows. - + - pg_numrows + pg_num_rows Returns the number of rows Description - intpg_numrows + intpg_num_rows resourceresult - pg_numrows will return the number of rows in + pg_num_rows will return the number of rows in a PostgreSQL result resource. result is a query result resource returned - by pg_exec. This function will return -1 on + by pg_query. This function will return -1 on error. - Use pg_cmdtuples to get number of rows + Use pg_affected_rows to get number of rows affected by INSERT, UPDATE and DELETE query. + + + This function used called pg_num_rows(). + + - See also pg_numfields and - pg_cmdtuples. + See also pg_num_fields and + pg_affected_rows. @@ -1560,8 +1723,8 @@ $dbconn4 = pg_connect ($conn_string); + - pg_result + pg_fetch_result Returns values from a result resource Description - mixedpg_result + mixedpg_fetch_result resourceresult introw_number mixedfield - pg_result returns values from a + pg_fetch_result returns values from a result resource returned by - pg_exec. row_number + 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 @@ -2133,59 +2296,6 @@ $dbconn4 = pg_connect ($conn_string); - - - pg_lo_seek - - Seeks position of large object - - - - Description - - boolpg_lo_seek - resourcelarge_object - intoffset - intwhence - - - pg_lo_seek seeks position of large object - resource. whence is PGSQL_SEEK_SET, - PGSQL_SEEK_CUR or PGSQL_SEEK_END. - - - See also pg_lo_tell. - - - - - - - - - pg_lo_tell - - Returns current position of large object - - - - Description - - intpg_lo_tell - resourcelarge_object - - - pg_lo_tell returns current position (offset - from the beginning of large object). - - - See also pg_lo_seek. - - - - - - pg_result_error