chriskl Mon Jul 4 01:01:29 2005 EDT
Modified files: /phpdoc/en/reference/pgsql/functions pg-pconnect.xml pg-send-query.xml Log: Document pg_pconnect. Make fix similar to jsgoupil's but in pg_send_query. http://cvs.php.net/diff.php/phpdoc/en/reference/pgsql/functions/pg-pconnect.xml?r1=1.7&r2=1.8&ty=u Index: phpdoc/en/reference/pgsql/functions/pg-pconnect.xml diff -u phpdoc/en/reference/pgsql/functions/pg-pconnect.xml:1.7 phpdoc/en/reference/pgsql/functions/pg-pconnect.xml:1.8 --- phpdoc/en/reference/pgsql/functions/pg-pconnect.xml:1.7 Fri Mar 11 11:03:26 2005 +++ phpdoc/en/reference/pgsql/functions/pg-pconnect.xml Mon Jul 4 01:01:28 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 --> <refentry id="function.pg-pconnect"> <refnamediv> @@ -20,8 +20,11 @@ needed by other PostgreSQL functions. </para> <para> - For a description of the <parameter>connection_string</parameter> - parameter, see <function>pg_connect</function>. + If a second call is made to <function>pg_pconnect</function> with + the same <parameter>connection_string</parameter> as an existing connection, the + existing connection will be returned unless you pass + <constant>PGSQL_CONNECT_FORCE_NEW</constant> as + <parameter>connect_type</parameter>. </para> <para> To enable persistent connection, the <link @@ -40,6 +43,82 @@ </para> </refsect1> + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>connection_string</parameter></term> + <listitem> + <para> + The <parameter>connection_string</parameter> can be empty to use all default parameters, or it + can contain one or more parameter settings separated by whitespace. + Each parameter setting is in the form <literal>keyword = value</literal>. Spaces around + the equal sign are optional. To write an empty value or a value + containing spaces, surround it with single quotes, e.g., <literal>keyword = + 'a value'</literal>. Single quotes and backslashes within the value must be + escaped with a backslash, i.e., \' and \\. + </para> + <para> + The currently recognized parameter keywords are: + <parameter>host</parameter>, <parameter>hostaddr</parameter>, <parameter>port</parameter>, + <parameter>dbname</parameter>, <parameter>user</parameter>, + <parameter>password</parameter>, <parameter>connect_timeout</parameter>, + <parameter>options</parameter>, <parameter>tty</parameter> (ignored), <parameter>sslmode</parameter>, + <parameter>requiressl</parameter> (deprecated in favor of <parameter>sslmode</parameter>), and + <parameter>service</parameter>. Which of these arguments exist depends + on your PostgreSQL version. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>connect_type</parameter></term> + <listitem> + <para> + If <constant>PGSQL_CONNECT_FORCE_NEW</constant> is passed, then a new connection + is created, even if the <parameter>connection_string</parameter> is identical to + an existing connection. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + PostgreSQL connection resource on success, &false; on failure. + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Using <function>pg_pconnect</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +$dbconn = pg_pconnect("dbname=mary"); +//connect to a database named "mary" + +$dbconn2 = pg_pconnect("host=localhost port=5432 dbname=mary"); +// connect to a database named "mary" on "localhost" at port "5432" + +$dbconn3 = pg_pconnect("host=sheep port=5432 dbname=mary user=lamb password=foo"); +//connect to a database named "mary" on the host "sheep" with a username and password + +$conn_string = "host=sheep port=5432 dbname=test user=lamb password=bar"; +$dbconn4 = pg_pconnect($conn_string); +//connect to a database named "test" on the host "sheep" with a username and password +?> +]]> + </programlisting> + </example> + </para> + </refsect1> + <refsect1 role="seealso"> &reftitle.seealso; <para> http://cvs.php.net/diff.php/phpdoc/en/reference/pgsql/functions/pg-send-query.xml?r1=1.11&r2=1.12&ty=u Index: phpdoc/en/reference/pgsql/functions/pg-send-query.xml diff -u phpdoc/en/reference/pgsql/functions/pg-send-query.xml:1.11 phpdoc/en/reference/pgsql/functions/pg-send-query.xml:1.12 --- phpdoc/en/reference/pgsql/functions/pg-send-query.xml:1.11 Mon Apr 4 21:47:56 2005 +++ phpdoc/en/reference/pgsql/functions/pg-send-query.xml Mon Jul 4 01:01:28 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 --> <refentry id='function.pg-send-query'> <refnamediv> @@ -59,7 +59,7 @@ echo "$res1 has $rows1 records\n\n"; $res2 = pg_get_result($dbconn); - echo "second call to pg_get_result(): $res2\n"; + echo "Second call to pg_get_result(): $res2\n"; $rows2 = pg_num_rows($res2); echo "$res2 has $rows2 records\n"; ?> @@ -68,10 +68,10 @@ &example.outputs; <screen> <![CDATA[ -first call to pg_get_result(): Resource id #3 +First call to pg_get_result(): Resource id #3 Resource id #3 has 3 records -second call to pg_get_result(): Resource id #4 +Second call to pg_get_result(): Resource id #4 Resource id #4 has 1 records ]]> </screen>