From dc3cf08731a4d13266c2eab69b1d1a97f644813e Mon Sep 17 00:00:00 2001 From: Christopher Kings-Lynne Date: Mon, 4 Jul 2005 09:00:59 +0000 Subject: [PATCH] Another three pgsql functions. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@189864 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/pgsql/functions/pg-select.xml | 78 +++++++++++++++++-- .../functions/pg-set-client-encoding.xml | 57 +++++++++++--- .../pgsql/functions/pg-unescape-bytea.xml | 69 +++++++++++++--- 3 files changed, 174 insertions(+), 30 deletions(-) diff --git a/reference/pgsql/functions/pg-select.xml b/reference/pgsql/functions/pg-select.xml index 4a5ce789b5..2d27adb1ce 100644 --- a/reference/pgsql/functions/pg-select.xml +++ b/reference/pgsql/functions/pg-select.xml @@ -1,5 +1,5 @@ - + @@ -21,18 +21,80 @@ pg_select selects records specified by assoc_array which has - field=>value. For successful query, it returns - array contains all records and fields that match the condition - specified by assoc_array. If - options is specified, + field=>value. For a successful query, it returns an + array containing all records and fields that match the condition + specified by assoc_array. + + If options is specified, pg_convert is applied to - assoc_array with specified option. - If PGSQL_DML_STRING is part of the - options then query string is returned. + assoc_array with the specified flags. &warn.experimental.func; + + &reftitle.parameters; + + + + connection + + + PostgreSQL database connection resource. + + + + + table_name + + + Name of the table from which to select rows. + + + + + assoc_array + + + An array whose keys are field names in the table table_name, + and whose values are what matched rows are to be updated to. + + + + + condition + + + An array whose keys are field names in the table table_name, + and whose values are the conditions that a row must meet to be retrieved. + + + + + options + + + Any number of PGSQL_CONV_FORCE_NULL, + PGSQL_DML_NO_CONV, + PGSQL_DML_EXEC, + PGSQL_DML_ASYNC or + PGSQL_DML_STRING combined. If PGSQL_DML_STRING is part of the + options then query string is returned. + + + + + + + + + &reftitle.returnvalues; + + &return.success; Returns string if PGSQL_DML_STRING is passed + via options. + + + &reftitle.examples; diff --git a/reference/pgsql/functions/pg-set-client-encoding.xml b/reference/pgsql/functions/pg-set-client-encoding.xml index 2a3313fff1..0c85cfec64 100644 --- a/reference/pgsql/functions/pg-set-client-encoding.xml +++ b/reference/pgsql/functions/pg-set-client-encoding.xml @@ -1,5 +1,5 @@ - + @@ -25,19 +25,10 @@ encoding and returns 0 if success or -1 if error. - encoding is the client encoding and can be - either : SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW, UNICODE, - MULE_INTERNAL, LATINX (X=1...9), KOI8, WIN, ALT, SJIS, BIG5, - WIN1250. Available encoding depends on your PostgreSQL and libpq - version. Refer to PostgreSQL manual for supported encodings for - your PostgreSQL. + PostgreSQL will automatically convert data in the backend database + encoding into the frontend encoding. - - This function requires PHP-4.0.3 or higher and PostgreSQL-7.0 or - higher. Supported encoding depends on PostgreSQL version. Refer - to PostgreSQL manual for details. - The function used to be called pg_setclientencoding. @@ -45,6 +36,48 @@ + + &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. + + + + + encoding + + + The required client encoding. One of SQL_ASCII, EUC_JP, + EUC_CN, EUC_KR, EUC_TW, + UNICODE, MULE_INTERNAL, LATINX (X=1...9), + KOI8, WIN, ALT, SJIS, + BIG5 or WIN1250. + + + The exact list of available encodings depends on your PostgreSQL version, so check your + PostgreSQL manual for a more specific list. + + + + + + + + + &reftitle.returnvalues; + + Returns 0 on success or -1 on error. + + + &reftitle.seealso; diff --git a/reference/pgsql/functions/pg-unescape-bytea.xml b/reference/pgsql/functions/pg-unescape-bytea.xml index 7694fbbafb..f55eb797d6 100644 --- a/reference/pgsql/functions/pg-unescape-bytea.xml +++ b/reference/pgsql/functions/pg-unescape-bytea.xml @@ -1,5 +1,5 @@ - + @@ -16,27 +16,76 @@ stringdata - pg_unescape_bytea unescapes string from - bytea datatype. It returns unescaped string (binary). + pg_unescape_bytea unescapes PostgreSQL bytea data + values. It returns the unescaped string, possibly containing binary data. - When you SELECT bytea type, PostgreSQL returns octal byte value - prefixed by \ (e.g. \032). Users are supposed to convert back to - binary format by yourself. + When you SELECT a bytea type, PostgreSQL returns octal byte values + prefixed with '\' (e.g. \032). Users are supposed to convert back to + binary format manually. This function requires PostgreSQL 7.2 or later. With PostgreSQL - 7.2.0 and 7.2.1, bytea type must be casted when you enable + 7.2.0 and 7.2.1, bytea values must be cast when you enable multi-byte support. i.e. INSERT INTO test_table (image) VALUES ('$image_escaped'::bytea); PostgreSQL 7.2.2 or - later does not need cast. Exception is when client and backend - character encoding does not match, there may be multi-byte - stream error. User must cast to bytea to avoid this error. + later does not need a cast. The exception is when the client and backend + character encoding does not match, and there may be multi-byte + stream error. User must then cast to bytea to avoid this error. + + &reftitle.parameters; + + + + data + + + A string containing PostgreSQL bytea data to be converted into + a PHP binary string. + + + + + + + + + &reftitle.returnvalues; + + A string containing the unescaped data. + + + + + &reftitle.examples; + + + <function>pg_unescape_bytea</function> example + + +]]> + + + + + &reftitle.seealso;