reference/pdo/pdo/exec.xml
28529d3539b850e870e3aa97570f4db0e53daa03
...
...
@@ -9,23 +9,23 @@
9
9
</refnamediv>
10
10
<refsect1 role="description">
11
11
&reftitle.description;
12
-
<methodsynopsis>
13
-
<modifier>public</modifier> <type>int</type><methodname>PDO::exec</methodname>
12
+
<methodsynopsis role="PDO">
13
+
<modifier>public</modifier> <type class="union"><type>int</type><type>false</type></type><methodname>PDO::exec</methodname>
14
14
<methodparam><type>string</type><parameter>statement</parameter></methodparam>
15
15
</methodsynopsis>
16
16

17
17
<para>
18
-
<function>PDO::exec</function> executes an SQL statement in
18
+
<methodname>PDO::exec</methodname> executes an SQL statement in
19
19
a single function call, returning the number of rows affected by the
20
20
statement.
21
21
</para>
22
22
<para>
23
-
<function>PDO::exec</function> does not return results from a SELECT
23
+
<methodname>PDO::exec</methodname> does not return results from a SELECT
24
24
statement. For a SELECT statement that you only need to issue once
25
-
during your program, consider issuing <function>PDO::query</function>.
25
+
during your program, consider issuing <methodname>PDO::query</methodname>.
26
26
For a statement that you need to issue multiple times, prepare
27
-
a PDOStatement object with <function>PDO::prepare</function> and issue
28
-
the statement with <function>PDOStatement::execute</function>.
27
+
a PDOStatement object with <methodname>PDO::prepare</methodname> and issue
28
+
the statement with <methodname>PDOStatement::execute</methodname>.
29
29
</para>
30
30

31
31
</refsect1>
...
...
@@ -40,8 +40,7 @@
40
40
The SQL statement to prepare and execute.
41
41
</para>
42
42
<para>
43
-
Data inside the query should be <link
44
-
linkend="pdo.quote">properly escaped</link>.
43
+
Data inside the query should be <link linkend="pdo.quote">properly escaped</link>.
45
44
</para>
46
45
</listitem>
47
46
</varlistentry>
...
...
@@ -51,15 +50,15 @@
51
50
<refsect1 role="returnvalues">
52
51
&reftitle.returnvalues;
53
52
<para>
54
-
<function>PDO::exec</function> returns the number of rows that were modified
53
+
<methodname>PDO::exec</methodname> returns the number of rows that were modified
55
54
or deleted by the SQL statement you issued. If no rows were affected,
56
-
<function>PDO::exec</function> returns <literal>0</literal>.
55
+
<methodname>PDO::exec</methodname> returns <literal>0</literal>.
57
56
</para>
58
57

59
58
&return.falseproblem;
60
59
<para>
61
60
The following example incorrectly relies on the return value of
62
-
<function>PDO::exec</function>, wherein a statement that affected 0 rows
61
+
<methodname>PDO::exec</methodname>, wherein a statement that affected 0 rows
63
62
results in a call to <function>die</function>:
64
63
<programlisting role="php">
65
64
<![CDATA[
...
...
@@ -72,6 +71,11 @@ $db->exec() or die(print_r($db->errorInfo(), true)); // incorrect
72
71

73
72
</refsect1>
74
73

74
+
<refsect1 role="errors">
75
+
&reftitle.errors;
76
+
&pdo.errors;
77
+
</refsect1>
78
+

75
79
<refsect1 role="examples">
76
80
&reftitle.examples;
77
81
<para>
...
...
@@ -90,7 +94,7 @@ $dbh = new PDO('odbc:sample', 'db2inst1', 'ibmdb2');
90
94
$count = $dbh->exec("DELETE FROM fruit");
91
95

92
96
/* Return number of rows that were deleted */
93
-
print("Deleted $count rows.\n");
97
+
print "Deleted $count rows.\n";
94
98
?>
95
99
]]>
96
100
</programlisting>
...
...
@@ -109,16 +113,15 @@ Deleted 1 rows.
109
113
&reftitle.seealso;
110
114
<para>
111
115
<simplelist>
112
-
<member><function>PDO::prepare</function></member>
113
-
<member><function>PDO::query</function></member>
114
-
<member><function>PDOStatement::execute</function></member>
116
+
<member><methodname>PDO::prepare</methodname></member>
117
+
<member><methodname>PDO::query</methodname></member>
118
+
<member><methodname>PDOStatement::execute</methodname></member>
115
119
</simplelist>
116
120
</para>
117
121
</refsect1>
118
122

119
123

120
124
</refentry>
121
-

122
125
<!-- Keep this comment at the end of the file
123
126
Local variables:
124
127
mode: sgml
125
128