@@ -89,7 +89,7 @@ are then replaced by their actual values in a second step (execute).
8989    $sql = "SELECT * FROM articles WHERE id = ?"; 
9090    $stmt = $conn->prepare($sql); 
9191    $stmt->bindValue(1, $id); 
92-     $stmt->execute (); 
92+     $resultSet = $ stmt->executeQuery (); 
9393
9494? ``) or named labels starting with
9595a colon (e.g. ``:name1 ``). You cannot mix the positional and the named approach. You have to bind a parameter
@@ -108,7 +108,7 @@ position of the variable to bind into the ``bindValue()`` method:
108108    $stmt = $conn->prepare($sql); 
109109    $stmt->bindValue(1, $id); 
110110    $stmt->bindValue(2, $status); 
111-     $stmt->execute (); 
111+     $resultSet = $ stmt->executeQuery (); 
112112
113113
114114
@@ -120,7 +120,7 @@ Named parameters have the advantage that their labels can be re-used and only ne
120120    $sql = "SELECT * FROM users WHERE name = :name OR username = :name"; 
121121    $stmt = $conn->prepare($sql); 
122122    $stmt->bindValue("name", $name); 
123-     $stmt->execute (); 
123+     $resultSet = $ stmt->executeQuery (); 
124124
125125
126126
@@ -159,17 +159,28 @@ and methods to retrieve data from a statement.
159159-   ``bindParam($pos, &$param, $type) `` - Bind a given reference to the positional or
160160    named parameter in the prepared statement.
161161
162- If you are finished with binding parameters you have to call ``execute () which 
163- will trigger a query to the database. After the query is finished you can access the results 
164- of this query using the fetch API of a statement :
162+ If you are finished with binding parameters you have to call ``executeQuery ()
163+ which  will trigger a query to the database. After the query is finished, a `` Doctrine\DBAL\Result `` 
164+ instance is returned and you can access the results  of this query using the fetch API of the result :
165165
166- -   ``fetch($fetchStyle) `` - Retrieves the next row from the statement or false if there are none.
166+ -   ``fetchNumeric() `` - Retrieves the next row from the statement or false if there are none.
167+     The row is fetched as an array with numeric keys where the columns appear in the same order as
168+     they were specified in the executed ``SELECT `` query.
167169    Moves the pointer forward one row, so that consecutive calls will always return the next row.
168- -   ``fetchColumn($column) `` - Retrieves only one column of the next row specified by column index.
170+ -   ``fetchAssociative() `` - Retrieves the next row from the statement or false if there are none.
171+     The row is fetched as an associative array where the keys represent the column names as
172+     specified in the executed ``SELECT `` query.
169173    Moves the pointer forward one row, so that consecutive calls will always return the next row.
170- -   ``fetchAll($fetchStyle) `` - Retrieves all rows from the statement.
174+ -   ``fetchOne() `` - Retrieves the value of the first column of the next row from the statement
175+     or false if there are none.
176+     Moves the pointer forward one row, so that consecutive calls will always return the next row.
177+ -   ``fetchAllNumeric() `` - Retrieves all rows from the statement as arrays with numeric keys.
178+ -   ``fetchAllAssociative() `` - Retrieves all rows from the statement as associative arrays.
179+ -   ``fetchFirstColumn() `` - Retrieves the value of the first column of all rows.
171180
172- The fetch API of a prepared statement obviously works only for ``SELECT `` queries.
181+ The fetch API of a prepared statement obviously works only for ``SELECT `` queries. If you want to
182+ execute a statement that does not yield a result set, like ``INSERT ``, ``UPDATE `` or ``DELETE ``
183+ for instance, you might want to call ``executeStatement() `` instead of ``executeQuery() ``.
173184
174185If you find it tedious to write all the prepared statement code you can alternatively use
175186the ``Doctrine\DBAL\Connection#executeQuery() `` and ``Doctrine\DBAL\Connection#executeStatement() ``
@@ -201,7 +212,7 @@ to the appropriate vendors database format:
201212    $date = new \DateTime("2011-03-05 14:00:21"); 
202213    $stmt = $conn->prepare("SELECT * FROM articles WHERE publish_date > ?"); 
203214    $stmt->bindValue(1, $date, "datetime"); 
204-     $stmt->execute (); 
215+     $resultSet = $ stmt->executeQuery (); 
205216
206217Doctrine\DBAL\Types\DateTimeType `` you will see that
207218parts of the conversion are delegated to a method on the current database platform,
@@ -238,7 +249,7 @@ Since you are using an ``IN`` expression you would really like to use it in the
238249    $stmt = $conn->prepare('SELECT * FROM articles WHERE id IN (?)'); 
239250    // THIS WILL NOT WORK: 
240251    $stmt->bindValue(1, array(1, 2, 3, 4, 5, 6)); 
241-     $stmt->execute (); 
252+     $resultSet = $ stmt->executeQuery (); 
242253
243254
244255developers fallback to inserting the parameters directly into the query, which can open
@@ -309,7 +320,7 @@ Prepare a given SQL statement and return the
309320
310321    <?php 
311322    $statement = $conn->prepare('SELECT * FROM user'); 
312-     $resultSet = $statement->execute (); 
323+     $resultSet = $statement->executeQuery (); 
313324    $users = $resultSet->fetchAllAssociative(); 
314325
315326    /* 
@@ -342,13 +353,13 @@ executeQuery()
342353~~~~~~~~~~~~~~ 
343354
344355Creates a prepared statement for the given SQL and passes the
345- parameters to the execute  method, then returning the statement :
356+ parameters to the executeQuery  method, then returning the result set :
346357
347358.. code-block :: php 
348359
349360    <?php 
350-     $statement  = $conn->executeQuery('SELECT * FROM user WHERE username = ?', array('jwage')); 
351-     $user = $statement ->fetchAssociative(); 
361+     $resultSet  = $conn->executeQuery('SELECT * FROM user WHERE username = ?', array('jwage')); 
362+     $user = $resultSet ->fetchAssociative(); 
352363
353364    /* 
354365    array( 
0 commit comments