Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
e0421d15
Unverified
Commit
e0421d15
authored
May 09, 2020
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update documentation to use the new fetch API
parent
256cefa6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
18 deletions
+18
-18
caching.rst
docs/en/reference/caching.rst
+1
-1
data-retrieval-and-manipulation.rst
docs/en/reference/data-retrieval-and-manipulation.rst
+17
-17
No files found.
docs/en/reference/caching.rst
View file @
e0421d15
...
...
@@ -42,7 +42,7 @@ object is closed:
<?php
$stmt = $conn->executeCacheQuery($query, $params, $types, new QueryCacheProfile(0, "some key"));
$data = $stmt->fetchAll();
$data = $stmt->fetchAll
Associative
();
$stmt->closeCursor(); // at this point the result is cached
.. warning::
...
...
docs/en/reference/data-retrieval-and-manipulation.rst
View file @
e0421d15
...
...
@@ -41,7 +41,7 @@ the query until there are no more rows:
<?php
while (
$row = $stmt->fetch()
) {
while (
($row = $stmt->fetchAssociative()) !== false
) {
echo $row['headline'];
}
...
...
@@ -308,7 +308,7 @@ Prepare a given SQL statement and return the
<?php
$statement = $conn->prepare('SELECT * FROM user');
$statement->execute();
$users = $statement->fetchAll();
$users = $statement->fetchAll
Associative
();
/*
array(
...
...
@@ -346,7 +346,7 @@ parameters to the execute method, then returning the statement:
<?php
$statement = $conn->executeQuery('SELECT * FROM user WHERE username = ?', array('jwage'));
$user = $statement->fetch();
$user = $statement->fetch
Associative
();
/*
array(
...
...
@@ -360,15 +360,15 @@ to perform necessary type conversions between actual input
parameters and expected database values. See the
:ref:`Types <mappingMatrix>` section for more information.
fetchAll()
~~~~~~~~~~
fetchAll
Associative
()
~~~~~~~~~~
~~~~~~~~~~~
Execute the query and fetch all results into an array:
.. code-block:: php
<?php
$users = $conn->fetchAll('SELECT * FROM user');
$users = $conn->fetchAll
Associative
('SELECT * FROM user');
/*
array(
...
...
@@ -379,15 +379,15 @@ Execute the query and fetch all results into an array:
)
*/
fetch
Array
()
~~~~~~~~~~~~
fetch
Numeric
()
~~~~~~~~~~~~
~~
Numeric index retrieval of first result row of the given query:
.. code-block:: php
<?php
$user = $conn->fetch
Array
('SELECT * FROM user WHERE username = ?', array('jwage'));
$user = $conn->fetch
Numeric
('SELECT * FROM user WHERE username = ?', array('jwage'));
/*
array(
...
...
@@ -396,26 +396,26 @@ Numeric index retrieval of first result row of the given query:
)
*/
fetch
Column
()
~~~~~~~~~~
~~~
fetch
One
()
~~~~~~~~~~
Retrieve only the
given
column of the first result row.
Retrieve only the
value of the first
column of the first result row.
.. code-block:: php
<?php
$username = $conn->fetch
Column
('SELECT username FROM user WHERE id = ?', array(1), 0);
$username = $conn->fetch
One
('SELECT username FROM user WHERE id = ?', array(1), 0);
echo $username; // jwage
fetchAssoc()
~~~~~~~~~~~~
fetchAssoc
iative
()
~~~~~~~~~~~~
~~~~~~
Retrieve assoc
row
of the first result row.
Retrieve assoc
iative array
of the first result row.
.. code-block:: php
<?php
$user = $conn->fetchAssoc('SELECT * FROM user WHERE username = ?', array('jwage'));
$user = $conn->fetchAssoc
iative
('SELECT * FROM user WHERE username = ?', array('jwage'));
/*
array(
'username' => 'jwage',
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment