reference/pgsql/functions/pg-convert.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.80 -->
4
-
<refentry xml:id='function.pg-convert' xmlns="http://docbook.org/ns/docbook">
4
+
<refentry xml:id="function.pg-convert" xmlns="http://docbook.org/ns/docbook">
5
5
<refnamediv>
6
6
<refname>pg_convert</refname>
7
7
<refpurpose>
...
...
@@ -12,20 +12,20 @@
12
12
<refsect1 role="description">
13
13
&reftitle.description;
14
14
<methodsynopsis>
15
-
<type>array</type><methodname>pg_convert</methodname>
16
-
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
15
+
<type class="union"><type>array</type><type>false</type></type><methodname>pg_convert</methodname>
16
+
<methodparam><type>PgSql\Connection</type><parameter>connection</parameter></methodparam>
17
17
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
18
-
<methodparam><type>array</type><parameter>assoc_array</parameter></methodparam>
19
-
<methodparam choice="opt"><type>int</type><parameter>options</parameter><initializer>0</initializer></methodparam>
18
+
<methodparam><type>array</type><parameter>values</parameter></methodparam>
19
+
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>0</initializer></methodparam>
20
20
</methodsynopsis>
21
21
<para>
22
22
<function>pg_convert</function> checks and converts the values in
23
-
<parameter>assoc_array</parameter> into suitable values for use in an SQL
23
+
<parameter>values</parameter> into suitable values for use in an SQL
24
24
statement. Precondition for <function>pg_convert</function> is the
25
25
existence of a table <parameter>table_name</parameter> which has at least
26
-
as many columns as <parameter>assoc_array</parameter> has elements. The
26
+
as many columns as <parameter>values</parameter> has elements. The
27
27
fieldnames in <parameter>table_name</parameter> must match the indices in
28
-
<parameter>assoc_array</parameter> and the corresponding datatypes must be
28
+
<parameter>values</parameter> and the corresponding datatypes must be
29
29
compatible. Returns an array with the converted values on success, &false;
30
30
otherwise.
31
31
</para>
...
...
@@ -45,9 +45,7 @@
45
45
<varlistentry>
46
46
<term><parameter>connection</parameter></term>
47
47
<listitem>
48
-
<para>
49
-
PostgreSQL database connection resource.
50
-
</para>
48
+
&pgsql.parameter.connection;
51
49
</listitem>
52
50
</varlistentry>
53
51
<varlistentry>
...
...
@@ -59,7 +57,7 @@
59
57
</listitem>
60
58
</varlistentry>
61
59
<varlistentry>
62
-
<term><parameter>assoc_array</parameter></term>
60
+
<term><parameter>values</parameter></term>
63
61
<listitem>
64
62
<para>
65
63
Data to be converted.
...
...
@@ -67,7 +65,7 @@
67
65
</listitem>
68
66
</varlistentry>
69
67
<varlistentry>
70
-
<term><parameter>options</parameter></term>
68
+
<term><parameter>flags</parameter></term>
71
69
<listitem>
72
70
<para>
73
71
Any number of <constant>PGSQL_CONV_IGNORE_DEFAULT</constant>,
...
...
@@ -83,10 +81,43 @@
83
81
<refsect1 role="returnvalues">
84
82
&reftitle.returnvalues;
85
83
<para>
86
-
An <type>array</type> of converted values, or &false; on error.
84
+
An <type>array</type> of converted values, &return.falseforfailure;.
87
85
</para>
88
86
</refsect1>
89
87

88
+
<refsect1 role="errors">
89
+
&reftitle.errors;
90
+
<para>
91
+
A <classname>ValueError</classname> or <classname>TypeError</classname> is thrown
92
+
when the value or type of field does not match properly with a PostgreSQL's type.
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> or <classname>TypeError</classname> error
111
+
when the value or type of field does not match properly with a PostgreSQL's type;
112
+
previously an <constant>E_WARNING</constant> was emitted.
113
+
</entry>
114
+
</row>
115
+
&pgsql.changelog.connection-object;
116
+
</tbody>
117
+
</tgroup>
118
+
</informaltable>
119
+
</refsect1>
120
+

90
121
<refsect1 role="examples">
91
122
&reftitle.examples;
92
123
<para>
...
...
@@ -124,7 +155,6 @@
124
155
</para>
125
156
</refsect1>
126
157
</refentry>
127
-

128
158
<!-- Keep this comment at the end of the file
129
159
Local variables:
130
160
mode: sgml
131
161