reference/pdo/pdostatement/setfetchmode.xml
b4756524479423ee3118adec1effa89171a9ffda
...
...
@@ -9,27 +9,28 @@
9
9
</refnamediv>
10
10
<refsect1 role="description">
11
11
&reftitle.description;
12
-
<methodsynopsis>
12
+

13
+
<methodsynopsis role="PDOStatement">
13
14
<modifier>public</modifier> <type>bool</type><methodname>PDOStatement::setFetchMode</methodname>
14
15
<methodparam><type>int</type><parameter>mode</parameter></methodparam>
15
16
</methodsynopsis>
16
17

17
-
<methodsynopsis>
18
+
<methodsynopsis role="PDOStatement">
18
19
<modifier>public</modifier> <type>bool</type><methodname>PDOStatement::setFetchMode</methodname>
19
-
<methodparam><type>int</type><parameter>PDO::FETCH_COLUMN</parameter></methodparam>
20
+
<methodparam><type>int</type><parameter>mode</parameter><initializer>PDO::FETCH_COLUMN</initializer></methodparam>
20
21
<methodparam><type>int</type><parameter>colno</parameter></methodparam>
21
22
</methodsynopsis>
22
23

23
-
<methodsynopsis>
24
+
<methodsynopsis role="PDOStatement">
24
25
<modifier>public</modifier> <type>bool</type><methodname>PDOStatement::setFetchMode</methodname>
25
-
<methodparam><type>int</type><parameter>PDO::FETCH_CLASS</parameter></methodparam>
26
-
<methodparam><type>string</type><parameter>classname</parameter></methodparam>
27
-
<methodparam><type>array</type><parameter>ctorargs</parameter></methodparam>
26
+
<methodparam><type>int</type><parameter>mode</parameter><initializer>PDO::FETCH_CLASS</initializer></methodparam>
27
+
<methodparam><type>string</type><parameter>class</parameter></methodparam>
28
+
<methodparam><type class="union"><type>array</type><type>null</type></type><parameter>constructorArgs</parameter><initializer>&null;</initializer></methodparam>
28
29
</methodsynopsis>
29
30

30
-
<methodsynopsis>
31
+
<methodsynopsis role="PDOStatement">
31
32
<modifier>public</modifier> <type>bool</type><methodname>PDOStatement::setFetchMode</methodname>
32
-
<methodparam><type>int</type><parameter>PDO::FETCH_INTO</parameter></methodparam>
33
+
<methodparam><type>int</type><parameter>mode</parameter><initializer>PDO::FETCH_INTO</initializer></methodparam>
33
34
<methodparam><type>object</type><parameter>object</parameter></methodparam>
34
35
</methodsynopsis>
35
36

...
...
@@ -42,7 +43,9 @@
42
43
<term><parameter>mode</parameter></term>
43
44
<listitem>
44
45
<para>
45
-
The fetch mode must be one of the <literal>PDO::FETCH_*</literal> constants.
46
+
The fetch mode must be one of the
47
+
<link linkend="pdo.constants"><constant>PDO::FETCH_<replaceable>*</replaceable></constant></link>
48
+
constants.
46
49
</para>
47
50
</listitem>
48
51
</varlistentry>
...
...
@@ -55,7 +58,7 @@
55
58
</listitem>
56
59
</varlistentry>
57
60
<varlistentry>
58
-
<term><parameter>classname</parameter></term>
61
+
<term><parameter>class</parameter></term>
59
62
<listitem>
60
63
<para>
61
64
Class name.
...
...
@@ -63,7 +66,7 @@
63
66
</listitem>
64
67
</varlistentry>
65
68
<varlistentry>
66
-
<term><parameter>ctorargs</parameter></term>
69
+
<term><parameter>constructorArgs</parameter></term>
67
70
<listitem>
68
71
<para>
69
72
Constructor arguments.
...
...
@@ -96,27 +99,20 @@
96
99
<title>Setting the fetch mode</title>
97
100
<para>
98
101
The following example demonstrates how
99
-
<function>PDOStatement::setFetchMode</function> changes the default fetch
102
+
<methodname>PDOStatement::setFetchMode</methodname> changes the default fetch
100
103
mode for a PDOStatement object.
101
104
</para>
102
105
<programlisting role="php">
103
106
<![CDATA[
104
107
<?php
105
-
$sql = 'SELECT name, colour, calories FROM fruit';
106
-
try {
107
-
$stmt = $dbh->query($sql);
108
-
$result = $stmt->setFetchMode(PDO::FETCH_NUM);
109
-
while ($row = $stmt->fetch()) {
108
+
$stmt = $dbh->query('SELECT name, colour, calories FROM fruit');
109
+
$stmt->setFetchMode(PDO::FETCH_NUM);
110
+
foreach ($stmt as $row) {
110
111
print $row[0] . "\t" . $row[1] . "\t" . $row[2] . "\n";
111
-
}
112
-
}
113
-
catch (PDOException $e) {
114
-
print $e->getMessage();
115
112
}
116
-
?>
117
113
]]>
118
114
</programlisting>
119
-
&example.outputs;
115
+
&example.outputs.similar;
120
116
<screen>
121
117
<![CDATA[
122
118
apple red 150
...
...
@@ -125,7 +121,6 @@ orange orange 300
125
121
kiwi brown 75
126
122
lemon yellow 25
127
123
pear green 150
128
-
watermelon pink 90
129
124
]]>
130
125
</screen>
131
126
</example>
...
...
@@ -137,7 +132,7 @@ watermelon pink 90
137
132
&reftitle.seealso;
138
133
<para>
139
134
<simplelist>
140
-
<member><function></function></member>
135
+
<member><methodname></methodname></member>
141
136
<member>Or <link linkend="somethingelse">something else</link></member>
142
137
</simplelist>
143
138
</para>
...
...
@@ -146,7 +141,6 @@ watermelon pink 90
146
141

147
142

148
143
</refentry>
149
-

150
144
<!-- Keep this comment at the end of the file
151
145
Local variables:
152
146
mode: sgml
153
147