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
c9fc68be
Commit
c9fc68be
authored
Oct 01, 2016
by
Javier Spagnoletti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Normalize method signatures for `ResultStatement::fetch()` and `ResultStatement::fetchAll()`
parent
476c2f97
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
41 deletions
+55
-41
ArrayStatement.php
lib/Doctrine/DBAL/Cache/ArrayStatement.php
+2
-2
ResultCacheStatement.php
lib/Doctrine/DBAL/Cache/ResultCacheStatement.php
+2
-2
OCI8Statement.php
lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
+2
-2
PDOStatement.php
lib/Doctrine/DBAL/Driver/PDOStatement.php
+7
-7
ResultStatement.php
lib/Doctrine/DBAL/Driver/ResultStatement.php
+33
-9
Statement.php
lib/Doctrine/DBAL/Portability/Statement.php
+4
-4
Statement.php
lib/Doctrine/DBAL/Statement.php
+5
-15
No files found.
lib/Doctrine/DBAL/Cache/ArrayStatement.php
View file @
c9fc68be
...
@@ -98,7 +98,7 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement
...
@@ -98,7 +98,7 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public
function
fetch
(
$fetchMode
=
null
)
public
function
fetch
(
$fetchMode
=
null
,
$cursorOrientation
=
\PDO
::
FETCH_ORI_NEXT
,
$cursorOffset
=
0
)
{
{
if
(
isset
(
$this
->
data
[
$this
->
num
]))
{
if
(
isset
(
$this
->
data
[
$this
->
num
]))
{
$row
=
$this
->
data
[
$this
->
num
++
];
$row
=
$this
->
data
[
$this
->
num
++
];
...
@@ -122,7 +122,7 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement
...
@@ -122,7 +122,7 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public
function
fetchAll
(
$fetchMode
=
null
)
public
function
fetchAll
(
$fetchMode
=
null
,
$fetchArgument
=
null
,
$ctorArgs
=
null
)
{
{
$rows
=
array
();
$rows
=
array
();
while
(
$row
=
$this
->
fetch
(
$fetchMode
))
{
while
(
$row
=
$this
->
fetch
(
$fetchMode
))
{
...
...
lib/Doctrine/DBAL/Cache/ResultCacheStatement.php
View file @
c9fc68be
...
@@ -147,7 +147,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
...
@@ -147,7 +147,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public
function
fetch
(
$fetchMode
=
null
)
public
function
fetch
(
$fetchMode
=
null
,
$cursorOrientation
=
\PDO
::
FETCH_ORI_NEXT
,
$cursorOffset
=
0
)
{
{
if
(
$this
->
data
===
null
)
{
if
(
$this
->
data
===
null
)
{
$this
->
data
=
array
();
$this
->
data
=
array
();
...
@@ -179,7 +179,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
...
@@ -179,7 +179,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public
function
fetchAll
(
$fetchMode
=
null
)
public
function
fetchAll
(
$fetchMode
=
null
,
$fetchArgument
=
null
,
$ctorArgs
=
null
)
{
{
$rows
=
array
();
$rows
=
array
();
while
(
$row
=
$this
->
fetch
(
$fetchMode
))
{
while
(
$row
=
$this
->
fetch
(
$fetchMode
))
{
...
...
lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
View file @
c9fc68be
...
@@ -378,7 +378,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
...
@@ -378,7 +378,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public
function
fetch
(
$fetchMode
=
null
)
public
function
fetch
(
$fetchMode
=
null
,
$cursorOrientation
=
\PDO
::
FETCH_ORI_NEXT
,
$cursorOffset
=
0
)
{
{
// do not try fetching from the statement if it's not expected to contain result
// do not try fetching from the statement if it's not expected to contain result
// in order to prevent exceptional situation
// in order to prevent exceptional situation
...
@@ -405,7 +405,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
...
@@ -405,7 +405,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public
function
fetchAll
(
$fetchMode
=
null
)
public
function
fetchAll
(
$fetchMode
=
null
,
$fetchArgument
=
null
,
$ctorArgs
=
null
)
{
{
$fetchMode
=
$fetchMode
?:
$this
->
_defaultFetchMode
;
$fetchMode
=
$fetchMode
?:
$this
->
_defaultFetchMode
;
...
...
lib/Doctrine/DBAL/Driver/PDOStatement.php
View file @
c9fc68be
...
@@ -111,18 +111,18 @@ class PDOStatement extends \PDOStatement implements Statement
...
@@ -111,18 +111,18 @@ class PDOStatement extends \PDOStatement implements Statement
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public
function
fetch
(
$fetchMode
=
null
,
$cursorOrientation
=
null
,
$cursorOffset
=
null
)
public
function
fetch
(
$fetchMode
=
null
,
$cursorOrientation
=
\PDO
::
FETCH_ORI_NEXT
,
$cursorOffset
=
0
)
{
{
try
{
try
{
if
(
$fetchMode
===
null
&&
$cursorOrientation
===
null
&&
$cursorOffset
===
null
)
{
if
(
$fetchMode
===
null
&&
\PDO
::
FETCH_ORI_NEXT
===
$cursorOrientation
&&
0
===
$cursorOffset
)
{
return
parent
::
fetch
();
return
parent
::
fetch
();
}
}
if
(
$cursorOrientation
===
null
&&
$cursorOffset
===
null
)
{
if
(
\PDO
::
FETCH_ORI_NEXT
===
$cursorOrientation
&&
0
===
$cursorOffset
)
{
return
parent
::
fetch
(
$fetchMode
);
return
parent
::
fetch
(
$fetchMode
);
}
}
if
(
$cursorOffset
===
null
)
{
if
(
0
===
$cursorOffset
)
{
return
parent
::
fetch
(
$fetchMode
,
$cursorOrientation
);
return
parent
::
fetch
(
$fetchMode
,
$cursorOrientation
);
}
}
...
@@ -138,15 +138,15 @@ class PDOStatement extends \PDOStatement implements Statement
...
@@ -138,15 +138,15 @@ class PDOStatement extends \PDOStatement implements Statement
public
function
fetchAll
(
$fetchMode
=
null
,
$fetchArgument
=
null
,
$ctorArgs
=
null
)
public
function
fetchAll
(
$fetchMode
=
null
,
$fetchArgument
=
null
,
$ctorArgs
=
null
)
{
{
try
{
try
{
if
(
$fetchMode
===
null
&&
$fetchArgument
===
null
&&
$ctorArgs
===
null
)
{
if
(
$fetchMode
===
null
&&
null
===
$fetchArgument
&&
null
===
$ctorArgs
)
{
return
parent
::
fetchAll
();
return
parent
::
fetchAll
();
}
}
if
(
$fetchArgument
===
null
&&
$ctorArgs
===
null
)
{
if
(
null
===
$fetchArgument
&&
null
===
$ctorArgs
)
{
return
parent
::
fetchAll
(
$fetchMode
);
return
parent
::
fetchAll
(
$fetchMode
);
}
}
if
(
$ctorArgs
===
null
)
{
if
(
null
===
$ctorArgs
)
{
return
parent
::
fetchAll
(
$fetchMode
,
$fetchArgument
);
return
parent
::
fetchAll
(
$fetchMode
,
$fetchArgument
);
}
}
...
...
lib/Doctrine/DBAL/Driver/ResultStatement.php
View file @
c9fc68be
...
@@ -58,29 +58,53 @@ interface ResultStatement extends \Traversable
...
@@ -58,29 +58,53 @@ interface ResultStatement extends \Traversable
/**
/**
* Returns the next row of a result set.
* Returns the next row of a result set.
*
*
* @param integer|null $fetchMode Controls how the next row will be returned to the caller.
* * @param int|null $fetchMode Controls how the next row will be returned to the caller.
* The value must be one of the PDO::FETCH_* constants,
* The value must be one of the \PDO::FETCH_* constants,
* defaulting to PDO::FETCH_BOTH.
* defaulting to \PDO::FETCH_BOTH.
* @param int $cursorOrientation For a ResultStatement object representing a scrollable cursor,
* this value determines which row will be returned to the caller.
* This value must be one of the \PDO::FETCH_ORI_* constants,
* defaulting to \PDO::FETCH_ORI_NEXT. To request a scrollable
* cursor for your ResultStatement object, you must set the \PDO::ATTR_CURSOR
* attribute to \PDO::CURSOR_SCROLL when you prepare the SQL statement with
* \PDO::prepare().
* @param int $cursorOffset For a ResultStatement object representing a scrollable cursor for which the
* cursorOrientation parameter is set to \PDO::FETCH_ORI_ABS, this value
* specifies the absolute number of the row in the result set that shall be
* fetched.
* For a ResultStatement object representing a scrollable cursor for which the
* cursorOrientation parameter is set to \PDO::FETCH_ORI_REL, this value
* specifies the row to fetch relative to the cursor position before
* ResultStatement::fetch() was called.
*
*
* @return mixed The return value of this method on success depends on the fetch mode. In all cases, FALSE is
* @return mixed The return value of this method on success depends on the fetch mode. In all cases, FALSE is
* returned on failure.
* returned on failure.
*
*
* @see PDO::FETCH_* constants.
* @see PDO::FETCH_* constants.
*/
*/
public
function
fetch
(
$fetchMode
=
null
);
public
function
fetch
(
$fetchMode
=
null
,
$cursorOrientation
=
\PDO
::
FETCH_ORI_NEXT
,
$cursorOffset
=
0
);
/**
/**
* Returns an array containing all of the result set rows.
* Returns an array containing all of the result set rows.
*
*
* @param integer|null $fetchMode Controls how the next row will be returned to the caller.
* @param int|null $fetchMode Controls how the next row will be returned to the caller.
* The value must be one of the PDO::FETCH_* constants,
* The value must be one of the \PDO::FETCH_* constants,
* defaulting to PDO::FETCH_BOTH.
* defaulting to \PDO::FETCH_BOTH.
* @param int|null $fetchArgument This argument has a different meaning depending on the value of the $fetchMode parameter:
* * \PDO::FETCH_COLUMN: Returns the indicated 0-indexed column.
* * \PDO::FETCH_CLASS: Returns instances of the specified class, mapping the columns of each
* row to named properties in the class.
* * \PDO::FETCH_FUNC: Returns the results of calling the specified function, using each row's
* columns as parameters in the call.
* @param array|null $ctorArgs Controls how the next row will be returned to the caller.
* The value must be one of the \PDO::FETCH_* constants,
* defaulting to \PDO::FETCH_BOTH.
*
*
* @return array
* @return array
*
*
* @see PDO::FETCH_* constants.
* @see
\
PDO::FETCH_* constants.
*/
*/
public
function
fetchAll
(
$fetchMode
=
null
);
public
function
fetchAll
(
$fetchMode
=
null
,
$fetchArgument
=
null
,
$ctorArgs
=
null
);
/**
/**
* Returns a single column from the next row of a result set or FALSE if there are no more rows.
* Returns a single column from the next row of a result set or FALSE if there are no more rows.
...
...
lib/Doctrine/DBAL/Portability/Statement.php
View file @
c9fc68be
...
@@ -142,7 +142,7 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
...
@@ -142,7 +142,7 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public
function
fetch
(
$fetchMode
=
null
)
public
function
fetch
(
$fetchMode
=
null
,
$cursorOrientation
=
\PDO
::
FETCH_ORI_NEXT
,
$cursorOffset
=
0
)
{
{
$fetchMode
=
$fetchMode
?:
$this
->
defaultFetchMode
;
$fetchMode
=
$fetchMode
?:
$this
->
defaultFetchMode
;
...
@@ -159,12 +159,12 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
...
@@ -159,12 +159,12 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public
function
fetchAll
(
$fetchMode
=
null
,
$
columnIndex
=
0
)
public
function
fetchAll
(
$fetchMode
=
null
,
$
fetchArgument
=
null
,
$ctorArgs
=
null
)
{
{
$fetchMode
=
$fetchMode
?:
$this
->
defaultFetchMode
;
$fetchMode
=
$fetchMode
?:
$this
->
defaultFetchMode
;
if
(
$
columnIndex
!=
0
)
{
if
(
$
fetchArgument
)
{
$rows
=
$this
->
stmt
->
fetchAll
(
$fetchMode
,
$
columnIndex
);
$rows
=
$this
->
stmt
->
fetchAll
(
$fetchMode
,
$
fetchArgument
);
}
else
{
}
else
{
$rows
=
$this
->
stmt
->
fetchAll
(
$fetchMode
);
$rows
=
$this
->
stmt
->
fetchAll
(
$fetchMode
);
}
}
...
...
lib/Doctrine/DBAL/Statement.php
View file @
c9fc68be
...
@@ -252,29 +252,19 @@ class Statement implements \IteratorAggregate, DriverStatement
...
@@ -252,29 +252,19 @@ class Statement implements \IteratorAggregate, DriverStatement
}
}
/**
/**
* Fetches the next row from a result set.
* {@inheritdoc}
*
* @param integer|null $fetchMode
*
* @return mixed The return value of this function on success depends on the fetch type.
* In all cases, FALSE is returned on failure.
*/
*/
public
function
fetch
(
$fetchMode
=
null
)
public
function
fetch
(
$fetchMode
=
null
,
$cursorOrientation
=
\PDO
::
FETCH_ORI_NEXT
,
$cursorOffset
=
0
)
{
{
return
$this
->
stmt
->
fetch
(
$fetchMode
);
return
$this
->
stmt
->
fetch
(
$fetchMode
);
}
}
/**
/**
* Returns an array containing all of the result set rows.
* {@inheritdoc}
*
* @param integer|null $fetchMode
* @param mixed $fetchArgument
*
* @return array An array containing all of the remaining rows in the result set.
*/
*/
public
function
fetchAll
(
$fetchMode
=
null
,
$fetchArgument
=
0
)
public
function
fetchAll
(
$fetchMode
=
null
,
$fetchArgument
=
null
,
$ctorArgs
=
null
)
{
{
if
(
$fetchArgument
!==
0
)
{
if
(
$fetchArgument
)
{
return
$this
->
stmt
->
fetchAll
(
$fetchMode
,
$fetchArgument
);
return
$this
->
stmt
->
fetchAll
(
$fetchMode
,
$fetchArgument
);
}
}
...
...
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