diff --git a/reference/pgsql/functions/pg-fetch-object.xml b/reference/pgsql/functions/pg-fetch-object.xml index 4ff65368ac..7043801ab4 100644 --- a/reference/pgsql/functions/pg-fetch-object.xml +++ b/reference/pgsql/functions/pg-fetch-object.xml @@ -1,5 +1,5 @@ - + @@ -92,7 +92,7 @@ The name of the class to instantiate, set the properties of and return. - If not specified, an unnamed object is returned. + If not specified, an stdClass object is returned. diff --git a/reference/pgsql/functions/pg-field-is-null.xml b/reference/pgsql/functions/pg-field-is-null.xml index a48276248b..39cf658fe0 100644 --- a/reference/pgsql/functions/pg-field-is-null.xml +++ b/reference/pgsql/functions/pg-field-is-null.xml @@ -1,10 +1,10 @@ - + pg_field_is_null - Test if a field is &null; + Test if a field is SQL NULL @@ -12,15 +12,12 @@ intpg_field_is_null resourceresult - introw + introw mixedfield - pg_field_is_null tests 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. + pg_field_is_null tests if a field in a PostgreSQL + result resource is SQL NULL or not. @@ -29,6 +26,50 @@ + + &reftitle.parameters; + + + + result + + + PostgreSQL query result resource, returned by pg_query, + pg_query_params or pg_execute + (among others). + + + + + row + + + Row number in result to fetch. Rows are numbered from 0 upwards. If omitted, + current row is fetched. + + + + + field + + + Field number (starting from 0) as an integer or + the field name as a string. + + + + + + + + + &reftitle.returnvalues; + + Returns 1 if the field in the given row is SQL NULL, 0 + if not. &false; is returned if the row is out of range, or upon any other error. + + + &reftitle.examples; diff --git a/reference/pgsql/functions/pg-field-name.xml b/reference/pgsql/functions/pg-field-name.xml index ac00d8cb98..50dac91d79 100644 --- a/reference/pgsql/functions/pg-field-name.xml +++ b/reference/pgsql/functions/pg-field-name.xml @@ -1,5 +1,5 @@ - + @@ -27,6 +27,39 @@ + + &reftitle.parameters; + + + + result + + + PostgreSQL query result resource, returned by pg_query, + pg_query_params or pg_execute + (among others). + + + + + field_number + + + Field number, starting from 0. + + + + + + + + + &reftitle.returnvalues; + + The field name, or &false; on error. + + + &reftitle.examples; diff --git a/reference/pgsql/functions/pg-field-num.xml b/reference/pgsql/functions/pg-field-num.xml index 31bc5c8763..c04f0e04f9 100644 --- a/reference/pgsql/functions/pg-field-num.xml +++ b/reference/pgsql/functions/pg-field-num.xml @@ -1,5 +1,5 @@ - + @@ -16,13 +16,9 @@ pg_field_num will return the number of the - column (field) slot that corresponds to the + field number that corresponds to the field_name in the given PostgreSQL - result resource. Field numbering starts - at 0. This function will return -1 on error. - - - See the example given at the pg_field_name page. + result resource. @@ -31,6 +27,65 @@ + + &reftitle.parameters; + + + + result + + + PostgreSQL query result resource, returned by pg_query, + pg_query_params or pg_execute + (among others). + + + + + field_name + + + The name of the field. + + + + + + + + + &reftitle.returnvalues; + + The field number (numbered from 0), or -1 on error. + + + + + &reftitle.examples; + + + Getting information about fields + + +]]> + + &example.outputs; + + + + + + + &reftitle.seealso; diff --git a/reference/pgsql/functions/pg-field-prtlen.xml b/reference/pgsql/functions/pg-field-prtlen.xml index e5bc3a930c..728908c233 100644 --- a/reference/pgsql/functions/pg-field-prtlen.xml +++ b/reference/pgsql/functions/pg-field-prtlen.xml @@ -1,5 +1,5 @@ - + @@ -37,6 +37,40 @@ + + &reftitle.parameters; + + + + result + + + PostgreSQL query result resource, returned by pg_query, + pg_query_params or pg_execute + (among others). + + + + + row + + + Row number in result. Rows are numbered from 0 upwards. If omitted, + current row is fetched. + + + + + + + + + &reftitle.returnvalues; + + The field name, or &false; on error. + + + &reftitle.seealso; diff --git a/reference/pgsql/functions/pg-field-size.xml b/reference/pgsql/functions/pg-field-size.xml index f57e165a33..124fad6774 100644 --- a/reference/pgsql/functions/pg-field-size.xml +++ b/reference/pgsql/functions/pg-field-size.xml @@ -1,5 +1,5 @@ - + @@ -19,12 +19,7 @@ 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. - - - See the example given at the pg_field_name page. + result. @@ -33,6 +28,89 @@ + + &reftitle.parameters; + + + + result + + + PostgreSQL query result resource, returned by pg_query, + pg_query_params or pg_execute + (among others). + + + + + field_number + + + Field number, starting from 0. + + + + + + + + + &reftitle.returnvalues; + + The internal field storage size (in bytes). -1 indicates a variable + length field. &false; is returned on error. + + + + + &reftitle.examples; + + + Getting information about fields + + +]]> + + &example.outputs; + + + + + + + &reftitle.seealso; diff --git a/reference/pgsql/functions/pg-field-type-oid.xml b/reference/pgsql/functions/pg-field-type-oid.xml index 744d2ead89..792022b8f3 100644 --- a/reference/pgsql/functions/pg-field-type-oid.xml +++ b/reference/pgsql/functions/pg-field-type-oid.xml @@ -1,5 +1,5 @@ - + pg_field_type_oid @@ -17,16 +17,84 @@ pg_field_type_oid returns an integer containing the - type ID the given field_number in the - given PostgreSQL result resource. Field - numbering starts at 0. + OID of the base type of the given field_number in the + given PostgreSQL result resource. - You can get more information about the field type by querying PostgreSQL - pg_type system table using the ID obtained with this function. + You can get more information about the field type by querying PostgreSQL's + pg_type system table using the OID obtained with this function. + The PostgreSQL format_type() function will convert a + type OID into an SQL standard type name. + + + + If the field uses a PostgreSQL domain (rather than a basic type), it is + the OID of the domain's underlying type that is returned, rather than the OID + of the domain itself. + + + + + + &reftitle.parameters; + + + + result + + + PostgreSQL query result resource, returned by pg_query, + pg_query_params or pg_execute + (among others). + + + + + field_number + + + Field number, starting from 0. + + + + + + &reftitle.returnvalues; + + The OID of the field's base type. &false; is returned on error. + + + + + &reftitle.examples; + + + Getting information about fields + + +]]> + + &example.outputs; + + + + + + + &reftitle.seealso; diff --git a/reference/pgsql/functions/pg-field-type.xml b/reference/pgsql/functions/pg-field-type.xml index cd8e84291a..f17cc8768f 100644 --- a/reference/pgsql/functions/pg-field-type.xml +++ b/reference/pgsql/functions/pg-field-type.xml @@ -1,5 +1,5 @@ - + @@ -18,13 +18,16 @@ 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. - - - See the example given at the pg_field_name page. + base type name of the given field_number in the + given PostgreSQL result resource. + + + If the field uses a PostgreSQL domain (rather than a basic type), it is + the name of the domain's underlying type that is returned, rather than the + name of the domain itself. + + This function used to be called pg_fieldtype(). @@ -32,6 +35,67 @@ + + &reftitle.parameters; + + + + result + + + PostgreSQL query result resource, returned by pg_query, + pg_query_params or pg_execute + (among others). + + + + + field_number + + + Field number, starting from 0. + + + + + + + + + &reftitle.returnvalues; + + A string containing the base name of the field's type, or &false; + on error. + + + + + &reftitle.examples; + + + Getting information about fields + + +]]> + + &example.outputs; + + + + + + + &reftitle.seealso; diff --git a/reference/pgsql/functions/pg-lo-close.xml b/reference/pgsql/functions/pg-lo-close.xml index 75ca69f9e1..67afba1e1b 100644 --- a/reference/pgsql/functions/pg-lo-close.xml +++ b/reference/pgsql/functions/pg-lo-close.xml @@ -1,5 +1,5 @@ - + @@ -14,12 +14,12 @@ resourcelarge_object - pg_lo_close closes a Large - Object. large_object is a resource for the + pg_lo_close closes a large + object. large_object is a resource for the large object from pg_lo_open. - To use the large object (lo) interface, it is necessary to + To use the large object interface, it is necessary to enclose it within a transaction block. @@ -29,6 +29,53 @@ + + &reftitle.parameters; + + + + result + + + PostgreSQL large object (LOB) resource, returned by pg_lo_open. + + + + + + + + + &reftitle.returnvalues; + + &return.success; + + + + + &reftitle.examples; + + + <function>pg_lo_close</function> example + + +]]> + + + + + &reftitle.seealso; diff --git a/reference/pgsql/functions/pg-lo-create.xml b/reference/pgsql/functions/pg-lo-create.xml index da7dc1b727..cfe64851ee 100644 --- a/reference/pgsql/functions/pg-lo-create.xml +++ b/reference/pgsql/functions/pg-lo-create.xml @@ -1,5 +1,5 @@ - + @@ -14,27 +14,80 @@ resourceconnection - 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 - pg_pconnect. PostgreSQL access modes - INV_READ, INV_WRITE, and INV_ARCHIVE are not supported, the + pg_lo_create creates a large + object and returns the OID of the large + object. PostgreSQL access modes + INV_READ, INV_WRITE, and + INV_ARCHIVE are not supported, the object is created always with both read and write - access. INV_ARCHIVE has been removed from PostgreSQL itself - (version 6.3 and above). It returns large object oid, - otherwise it returns &false; if an error occurred. + access. INV_ARCHIVE has been removed from PostgreSQL itself + (version 6.3 and above). - To use the large object (lo) interface, it is necessary to + To use the large object interface, it is necessary to enclose it within a transaction block. + + Instead of using the large object interface (which has no access controls + and is cumbersome to use), try PostgreSQL's bytea + column type and pg_escape_bytea. + This function used to be called pg_locreate(). + + + &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. + + + + + + + + + &reftitle.returnvalues; + + A large object OID or &false; on error. + + + + + &reftitle.examples; + + + <function>pg_lo_create</function> example + + +]]> + + + + + @@ -21,13 +21,12 @@ stringpathname - The oid argument specifies oid of the - large object to export and the pathname - argument specifies the pathname of the file. It returns &false; if - an error occurred, &true; otherwise. + pg_lo_export takes a large object in a + PostgreSQL database and saves its contents to a file on the local + filesystem. - To use the large object (lo) interface, it is necessary to + To use the large object interface, it is necessary to enclose it within a transaction block. @@ -37,6 +36,72 @@ + + &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. + + + + + oid + + + The OID of the large object in the database. + + + + + pathname + + + The full path and file name of the file in which to write the + large object on the client filesystem. + + + + + + + + + &reftitle.returnvalues; + + &return.success; + + + + + &reftitle.examples; + + + <function>pg_lo_export</function> example + + +]]> + + + + + &reftitle.seealso; diff --git a/reference/pgsql/functions/pg-lo-import.xml b/reference/pgsql/functions/pg-lo-import.xml index 9bb7d3ce12..34367273a7 100644 --- a/reference/pgsql/functions/pg-lo-import.xml +++ b/reference/pgsql/functions/pg-lo-import.xml @@ -1,5 +1,5 @@ - + @@ -28,13 +28,12 @@ resourceconnection - The pathname argument specifies the - pathname of the file to be imported as a large object. It returns - &false; if an error occurred, oid of the just created large - object otherwise. + pg_lo_import creates a new large object + in the database using a file on the filesystem as its data + source. - To use the large object (lo) interface, it is necessary to + To use the large object interface, it is necessary to enclose it within a transaction block. ¬e.sm.uidcheck; @@ -45,6 +44,61 @@ + + &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. + + + + + pathname + + + The full path and file name of the file on the client + filesystem from which to read the large object data. + + + + + + + + + &reftitle.returnvalues; + + The OID of the newly created large object, or + &false; on failure. + + + + + &reftitle.examples; + + + <function>pg_lo_import</function> example + + +]]> + + + + + &reftitle.seealso; diff --git a/reference/pgsql/reference.xml b/reference/pgsql/reference.xml index 1adadfe989..b930f1cf8b 100644 --- a/reference/pgsql/reference.xml +++ b/reference/pgsql/reference.xml @@ -1,5 +1,5 @@ - + PostgreSQL Functions PostgreSQL @@ -27,7 +27,7 @@ multibyte character encoding. The current version and more information about PostgreSQL is available at &url.pgsql; and - &url.pgsql.techdocs;. + the PostgreSQL Documentation.