reference/pgsql/functions/pg-fetch-object.xml
39bb8a868935a56cfce438b0169e13c02c93211c
...
...
@@ -1,7 +1,7 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
3
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
4
-
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.pg-fetch-object">
4
+
<refentry xml:id="function.pg-fetch-object" xmlns="http://docbook.org/ns/docbook">
5
5
<refnamediv>
6
6
<refname>pg_fetch_object</refname>
7
7
<refpurpose>Fetch a row as an object</refpurpose>
...
...
@@ -10,17 +10,11 @@
10
10
<refsect1 role="description">
11
11
&reftitle.description;
12
12
<methodsynopsis>
13
-
<type>object</type><methodname>pg_fetch_object</methodname>
14
-
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
15
-
<methodparam choice="opt"><type>int</type><parameter>row</parameter></methodparam>
16
-
<methodparam choice="opt"><type>int</type><parameter>result_type</parameter><initializer>PGSQL_ASSOC</initializer></methodparam>
17
-
</methodsynopsis>
18
-
<methodsynopsis>
19
-
<type>object</type><methodname>pg_fetch_object</methodname>
20
-
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
21
-
<methodparam choice="opt"><type>int</type><parameter>row</parameter></methodparam>
22
-
<methodparam choice="opt"><type>string</type><parameter>class_name</parameter></methodparam>
23
-
<methodparam choice="opt"><type>array</type><parameter>params</parameter></methodparam>
13
+
<type class="union"><type>object</type><type>false</type></type><methodname>pg_fetch_object</methodname>
14
+
<methodparam><type>PgSql\Result</type><parameter>result</parameter></methodparam>
15
+
<methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>row</parameter><initializer>&null;</initializer></methodparam>
16
+
<methodparam choice="opt"><type>string</type><parameter>class</parameter><initializer>"stdClass"</initializer></methodparam>
17
+
<methodparam choice="opt"><type>array</type><parameter>constructor_args</parameter><initializer>[]</initializer></methodparam>
24
18
</methodsynopsis>
25
19
<para>
26
20
<function>pg_fetch_object</function> returns an object with
...
...
@@ -44,11 +38,7 @@
44
38
<varlistentry>
45
39
<term><parameter>result</parameter></term>
46
40
<listitem>
47
-
<para>
48
-
PostgreSQL query result resource, returned by <function>pg_query</function>,
49
-
<function>pg_query_params</function> or <function>pg_execute</function>
50
-
(among others).
51
-
</para>
41
+
&pgsql.parameter.result;
52
42
</listitem>
53
43
</varlistentry>
54
44
<varlistentry>
...
...
@@ -61,15 +51,7 @@
61
51
</listitem>
62
52
</varlistentry>
63
53
<varlistentry>
64
-
<term><parameter>result_type</parameter></term>
65
-
<listitem>
66
-
<para>
67
-
Ignored and deprecated.
68
-
</para>
69
-
</listitem>
70
-
</varlistentry>
71
-
<varlistentry>
72
-
<term><parameter>class_name</parameter></term>
54
+
<term><parameter>class</parameter></term>
73
55
<listitem>
74
56
<para>
75
57
The name of the class to instantiate, set the properties of and return.
...
...
@@ -78,11 +60,11 @@
78
60
</listitem>
79
61
</varlistentry>
80
62
<varlistentry>
81
-
<term><parameter>params</parameter></term>
63
+
<term><parameter>constructor_args</parameter></term>
82
64
<listitem>
83
65
<para>
84
66
An optional <type>array</type> of parameters to pass to the constructor
85
-
for <parameter>class_name</parameter> objects.
67
+
for <parameter>class</parameter> objects.
86
68
</para>
87
69
</listitem>
88
70
</varlistentry>
...
...
@@ -103,6 +85,39 @@
103
85
</para>
104
86
</refsect1>
105
87

88
+
<refsect1 role="errors">
89
+
&reftitle.errors;
90
+
<para>
91
+
A <classname>ValueError</classname> is thrown when
92
+
the <parameter>constructor_args</parameter> is non-empty with the class not having constructor.
93
+
</para>
94
+
</refsect1>
95
+

96
+
<refsect1 role="changelog">
97
+
&reftitle.changelog;
98
+
<informaltable>
99
+
<tgroup cols="2">
100
+
<thead>
101
+
<row>
102
+
<entry>&Version;</entry>
103
+
<entry>&Description;</entry>
104
+
</row>
105
+
</thead>
106
+
<tbody>
107
+
<row>
108
+
<entry>8.3.0</entry>
109
+
<entry>
110
+
Now throws a <classname>ValueError</classname> exception when
111
+
the <parameter>constructor_args</parameter> is non-empty with the class not having constructor;
112
+
previously an <classname>Exception</classname> was thrown.
113
+
</entry>
114
+
</row>
115
+
&pgsql.changelog.result-object;
116
+
</tbody>
117
+
</tgroup>
118
+
</informaltable>
119
+
</refsect1>
120
+

106
121
<refsect1 role="examples">
107
122
&reftitle.examples;
108
123
<para>
...
...
@@ -152,7 +167,6 @@ pg_close($db_conn);
152
167
</para>
153
168
</refsect1>
154
169
</refentry>
155
-

156
170
<!-- Keep this comment at the end of the file
157
171
Local variables:
158
172
mode: sgml
159
173