reference/pgsql/functions/pg-pconnect.xml
3b2503bdcbbffc9bd1381078ee06c298d4f8a49a
...
...
@@ -10,13 +10,13 @@
10
10
<refsect1 role="description">
11
11
&reftitle.description;
12
12
<methodsynopsis>
13
-
<type>resource</type><methodname>pg_pconnect</methodname>
13
+
<type class="union"><type>PgSql\Connection</type><type>false</type></type><methodname>pg_pconnect</methodname>
14
14
<methodparam><type>string</type><parameter>connection_string</parameter></methodparam>
15
-
<methodparam choice="opt"><type>int</type><parameter>connect_type</parameter></methodparam>
15
+
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>0</initializer></methodparam>
16
16
</methodsynopsis>
17
17
<para>
18
18
<function>pg_pconnect</function> opens a connection to a
19
-
PostgreSQL database. It returns a connection resource that is
19
+
PostgreSQL database. It returns a <classname>PgSql\Connection</classname> instance that is
20
20
needed by other PostgreSQL functions.
21
21
</para>
22
22
<para>
...
...
@@ -24,17 +24,17 @@
24
24
the same <parameter>connection_string</parameter> as an existing connection, the
25
25
existing connection will be returned unless you pass
26
26
<constant>PGSQL_CONNECT_FORCE_NEW</constant> as
27
-
<parameter>connect_type</parameter>.
27
+
<parameter>flags</parameter>.
28
28
</para>
29
29
<para>
30
-
To enable persistent connection, the <link
31
-
linkend="ini.pgsql.allow-persistent">pgsql.allow_persistent</link>
32
-
&php.ini; directive must be set to &quot;On&quot; (which is the default).
33
-
The maximum number of persistent connection can be defined with the <link
34
-
linkend="ini.pgsql.max-persistent">pgsql.max_persistent</link>
35
-
&php.ini; directive (defaults to -1 for no limit). The total number
36
-
of connections can be set with the <link
37
-
linkend="ini.pgsql.max-links">pgsql.max_links</link>
30
+
To enable persistent connections, the
31
+
<link linkend="ini.pgsql.allow-persistent">pgsql.allow_persistent</link>
32
+
&php.ini; directive must be set to <literal>"On"</literal> (which is the default).
33
+
The maximum number of persistent connections can be defined with the
34
+
<link linkend="ini.pgsql.max-persistent">pgsql.max_persistent</link>
35
+
&php.ini; directive (defaults to <literal>-1</literal> for no limit).
36
+
The total number of connections can be set with the
37
+
<link linkend="ini.pgsql.max-links">pgsql.max_links</link>
38
38
&php.ini; directive.
39
39
</para>
40
40
<para>
...
...
@@ -57,7 +57,7 @@
57
57
the equal sign are optional. To write an empty value or a value
58
58
containing spaces, surround it with single quotes, e.g., <literal>keyword =
59
59
'a value'</literal>. Single quotes and backslashes within the value must be
60
-
escaped with a backslash, i.e., \' and \\.
60
+
escaped with a backslash, i.e., <literal>\'</literal> and <literal>\\</literal>.
61
61
</para>
62
62
<para>
63
63
The currently recognized parameter keywords are:
...
...
@@ -66,13 +66,13 @@
66
66
<parameter>password</parameter>, <parameter>connect_timeout</parameter>,
67
67
<parameter>options</parameter>, <parameter>tty</parameter> (ignored), <parameter>sslmode</parameter>,
68
68
<parameter>requiressl</parameter> (deprecated in favor of <parameter>sslmode</parameter>), and
69
-
<parameter>service</parameter>. Which of these arguments exist depends
70
-
on your PostgreSQL version.
69
+
<parameter>service</parameter>.
70
+
Which of these arguments exist depends on the PostgreSQL version.
71
71
</para>
72
72
</listitem>
73
73
</varlistentry>
74
74
<varlistentry>
75
-
<term><parameter>connect_type</parameter></term>
75
+
<term><parameter>flags</parameter></term>
76
76
<listitem>
77
77
<para>
78
78
If <constant>PGSQL_CONNECT_FORCE_NEW</constant> is passed, then a new connection
...
...
@@ -88,10 +88,33 @@
88
88
<refsect1 role="returnvalues">
89
89
&reftitle.returnvalues;
90
90
<para>
91
-
PostgreSQL connection resource on success, &false; on failure.
91
+
Returns a <classname>PgSql\Connection</classname> instance on success, &return.falseforfailure;.
92
92
</para>
93
93
</refsect1>
94
94

95
+
<refsect1 role="changelog">
96
+
&reftitle.changelog;
97
+
<informaltable>
98
+
<tgroup cols="2">
99
+
<thead>
100
+
<row>
101
+
<entry>&Version;</entry>
102
+
<entry>&Description;</entry>
103
+
</row>
104
+
</thead>
105
+
<tbody>
106
+
<row>
107
+
<entry>8.1.0</entry>
108
+
<entry>
109
+
Returns a <classname>PgSql\Connection</classname> instance now;
110
+
previously, a &resource; was returned.
111
+
</entry>
112
+
</row>
113
+
</tbody>
114
+
</tgroup>
115
+
</informaltable>
116
+
</refsect1>
117
+
95
118
<refsect1 role="examples">
96
119
&reftitle.examples;
97
120
<para>
...
...
@@ -100,18 +123,18 @@
100
123
<programlisting role="php">
101
124
<![CDATA[
102
125
<?php
126
+
// Connect to a database named "mary"
103
127
$dbconn = pg_pconnect("dbname=mary");
104
-
//connect to a database named "mary"
105
128

129
+
// Connect to a database named "mary" on "localhost" at port "5432"
106
130
$dbconn2 = pg_pconnect("host=localhost port=5432 dbname=mary");
107
-
// connect to a database named "mary" on "localhost" at port "5432"
108
131

132
+
// Connect to a database named "mary" on the host "sheep" with a username and password
109
133
$dbconn3 = pg_pconnect("host=sheep port=5432 dbname=mary user=lamb password=foo");
110
-
//connect to a database named "mary" on the host "sheep" with a username and password
111
134

135
+
// Connect to a database named "test" on the host "sheep" with a username and password
112
136
$conn_string = "host=sheep port=5432 dbname=test user=lamb password=bar";
113
137
$dbconn4 = pg_pconnect($conn_string);
114
-
//connect to a database named "test" on the host "sheep" with a username and password
115
138
?>
116
139
]]>
117
140
</programlisting>
...
...
@@ -132,7 +155,6 @@ $dbconn4 = pg_pconnect($conn_string);
132
155
</para>
133
156
</refsect1>
134
157
</refentry>
135
-

136
158
<!-- Keep this comment at the end of the file
137
159
Local variables:
138
160
mode: sgml
139
161