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
d2655e48
Commit
d2655e48
authored
Feb 17, 2012
by
Nicolas Grekas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix defaultFetchStyle not being considered everywhere
parent
d55b9fbb
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
31 additions
and
25 deletions
+31
-25
ArrayStatement.php
lib/Doctrine/DBAL/Cache/ArrayStatement.php
+4
-3
ResultCacheStatement.php
lib/Doctrine/DBAL/Cache/ResultCacheStatement.php
+5
-3
DB2Statement.php
lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
+1
-2
MysqliStatement.php
lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
+6
-6
OCI8Connection.php
lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php
+1
-1
OCI8Statement.php
lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
+1
-1
ResultStatement.php
lib/Doctrine/DBAL/Driver/ResultStatement.php
+2
-2
SQLSrvStatement.php
lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
+2
-2
Statement.php
lib/Doctrine/DBAL/Portability/Statement.php
+7
-3
Statement.php
lib/Doctrine/DBAL/Statement.php
+2
-2
No files found.
lib/Doctrine/DBAL/Cache/ArrayStatement.php
View file @
d2655e48
...
...
@@ -58,14 +58,15 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement
public
function
getIterator
()
{
$data
=
$this
->
fetchAll
(
$this
->
defaultFetchStyle
);
$data
=
$this
->
fetchAll
();
return
new
\ArrayIterator
(
$data
);
}
public
function
fetch
(
$fetchStyle
=
PDO
::
FETCH_BOTH
)
public
function
fetch
(
$fetchStyle
=
null
)
{
if
(
isset
(
$this
->
data
[
$this
->
num
]))
{
$row
=
$this
->
data
[
$this
->
num
++
];
$fetchStyle
=
$fetchStyle
?:
$this
->
defaultFetchStyle
;
if
(
$fetchStyle
===
PDO
::
FETCH_ASSOC
)
{
return
$row
;
}
else
if
(
$fetchStyle
===
PDO
::
FETCH_NUM
)
{
...
...
@@ -81,7 +82,7 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement
return
false
;
}
public
function
fetchAll
(
$fetchStyle
=
PDO
::
FETCH_BOTH
)
public
function
fetchAll
(
$fetchStyle
=
null
)
{
$rows
=
array
();
while
(
$row
=
$this
->
fetch
(
$fetchStyle
))
{
...
...
lib/Doctrine/DBAL/Cache/ResultCacheStatement.php
View file @
d2655e48
...
...
@@ -139,7 +139,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
public
function
getIterator
()
{
$data
=
$this
->
fetchAll
(
$this
->
defaultFetchStyle
);
$data
=
$this
->
fetchAll
();
return
new
\ArrayIterator
(
$data
);
}
...
...
@@ -153,7 +153,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
*
* @return mixed
*/
public
function
fetch
(
$fetchStyle
=
PDO
::
FETCH_BOTH
)
public
function
fetch
(
$fetchStyle
=
null
)
{
if
(
$this
->
data
===
null
)
{
$this
->
data
=
array
();
...
...
@@ -163,6 +163,8 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
if
(
$row
)
{
$this
->
data
[]
=
$row
;
$fetchStyle
=
$fetchStyle
?:
$this
->
defaultFetchStyle
;
if
(
$fetchStyle
==
PDO
::
FETCH_ASSOC
)
{
return
$row
;
}
else
if
(
$fetchStyle
==
PDO
::
FETCH_NUM
)
{
...
...
@@ -188,7 +190,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
*
* @return array
*/
public
function
fetchAll
(
$fetchStyle
=
PDO
::
FETCH_BOTH
)
public
function
fetchAll
(
$fetchStyle
=
null
)
{
$rows
=
array
();
while
(
$row
=
$this
->
fetch
(
$fetchStyle
))
{
...
...
lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
View file @
d2655e48
...
...
@@ -158,7 +158,7 @@ class DB2Statement implements \IteratorAggregate, Statement
*/
public
function
getIterator
()
{
$data
=
$this
->
fetchAll
(
$this
->
_defaultFetchStyle
);
$data
=
$this
->
fetchAll
();
return
new
\ArrayIterator
(
$data
);
}
...
...
@@ -185,7 +185,6 @@ class DB2Statement implements \IteratorAggregate, Statement
*/
public
function
fetchAll
(
$fetchStyle
=
null
)
{
$fetchStyle
=
$fetchStyle
?:
$this
->
_defaultFetchStyle
;
$rows
=
array
();
while
(
$row
=
$this
->
fetch
(
$fetchStyle
))
{
$rows
[]
=
$row
;
...
...
lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
View file @
d2655e48
...
...
@@ -253,18 +253,18 @@ class MysqliStatement implements \IteratorAggregate, Statement
{
$fetchStyle
=
$fetchStyle
?:
$this
->
_defaultFetchStyle
;
$
a
=
array
();
$
rows
=
array
();
if
(
PDO
::
FETCH_COLUMN
==
$fetchStyle
)
{
while
((
$
value
=
$this
->
fetchColumn
())
!==
false
)
{
$
a
[]
=
$value
;
while
((
$
row
=
$this
->
fetchColumn
())
!==
false
)
{
$
rows
[]
=
$row
;
}
}
else
{
while
((
$row
=
$this
->
fetch
(
$fetchStyle
))
!==
null
)
{
$
a
[]
=
$row
;
$
rows
[]
=
$row
;
}
}
return
$
a
;
return
$
rows
;
}
/**
...
...
@@ -336,7 +336,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
*/
public
function
getIterator
()
{
$data
=
$this
->
fetchAll
(
$this
->
_defaultFetchStyle
);
$data
=
$this
->
fetchAll
();
return
new
\ArrayIterator
(
$data
);
}
}
lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php
View file @
d2655e48
...
...
@@ -79,7 +79,7 @@ class OCI8Connection implements \Doctrine\DBAL\Driver\Connection
{
$args
=
func_get_args
();
$sql
=
$args
[
0
];
//$fetch
Mod
e = $args[1];
//$fetch
Styl
e = $args[1];
$stmt
=
$this
->
prepare
(
$sql
);
$stmt
->
execute
();
return
$stmt
;
...
...
lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
View file @
d2655e48
...
...
@@ -200,7 +200,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
*/
public
function
getIterator
()
{
$data
=
$this
->
fetchAll
(
$this
->
_defaultFetchStyle
);
$data
=
$this
->
fetchAll
();
return
new
\ArrayIterator
(
$data
);
}
...
...
lib/Doctrine/DBAL/Driver/ResultStatement.php
View file @
d2655e48
...
...
@@ -64,7 +64,7 @@ interface ResultStatement extends \Traversable
*
* @return mixed
*/
function
fetch
(
$fetchStyle
=
PDO
::
FETCH_BOTH
);
function
fetch
(
$fetchStyle
=
null
);
/**
* Returns an array containing all of the result set rows
...
...
@@ -75,7 +75,7 @@ interface ResultStatement extends \Traversable
*
* @return array
*/
function
fetchAll
(
$fetchStyle
=
PDO
::
FETCH_BOTH
);
function
fetchAll
(
$fetchStyle
=
null
);
/**
* fetchColumn
...
...
lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
View file @
d2655e48
...
...
@@ -185,7 +185,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
*/
public
function
getIterator
()
{
$data
=
$this
->
fetchAll
(
$this
->
defaultFetchStyle
);
$data
=
$this
->
fetchAll
();
return
new
\ArrayIterator
(
$data
);
}
...
...
@@ -194,7 +194,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
*/
public
function
fetch
(
$fetchStyle
=
null
)
{
$fetchStyle
=
(
$fetchStyle
)
?:
$this
->
defaultFetchStyle
;
$fetchStyle
=
$fetchStyle
?:
$this
->
defaultFetchStyle
;
if
(
isset
(
self
::
$fetchMap
[
$fetchStyle
]))
{
return
sqlsrv_fetch_array
(
$this
->
stmt
,
self
::
$fetchMap
[
$fetchStyle
]);
}
else
if
(
$fetchStyle
==
PDO
::
FETCH_OBJ
||
$fetchStyle
==
PDO
::
FETCH_CLASS
)
{
...
...
lib/Doctrine/DBAL/Portability/Statement.php
View file @
d2655e48
...
...
@@ -109,12 +109,14 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
public
function
getIterator
()
{
$data
=
$this
->
fetchAll
(
$this
->
defaultFetchStyle
);
$data
=
$this
->
fetchAll
();
return
new
\ArrayIterator
(
$data
);
}
public
function
fetch
(
$fetchStyle
=
PDO
::
FETCH_BOTH
)
public
function
fetch
(
$fetchStyle
=
null
)
{
$fetchStyle
=
$fetchStyle
?:
$this
->
defaultFetchStyle
;
$row
=
$this
->
stmt
->
fetch
(
$fetchStyle
);
$row
=
$this
->
fixRow
(
$row
,
...
...
@@ -125,8 +127,10 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
return
$row
;
}
public
function
fetchAll
(
$fetchStyle
=
PDO
::
FETCH_BOTH
,
$columnIndex
=
0
)
public
function
fetchAll
(
$fetchStyle
=
null
,
$columnIndex
=
0
)
{
$fetchStyle
=
$fetchStyle
?:
$this
->
defaultFetchStyle
;
if
(
$columnIndex
!=
0
)
{
$rows
=
$this
->
stmt
->
fetchAll
(
$fetchStyle
,
$columnIndex
);
}
else
{
...
...
lib/Doctrine/DBAL/Statement.php
View file @
d2655e48
...
...
@@ -201,7 +201,7 @@ class Statement implements \IteratorAggregate, DriverStatement
* @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
(
$fetchStyle
=
PDO
::
FETCH_BOTH
)
public
function
fetch
(
$fetchStyle
=
null
)
{
return
$this
->
stmt
->
fetch
(
$fetchStyle
);
}
...
...
@@ -213,7 +213,7 @@ class Statement implements \IteratorAggregate, DriverStatement
* @param mixed $fetchArgument
* @return array An array containing all of the remaining rows in the result set.
*/
public
function
fetchAll
(
$fetchStyle
=
PDO
::
FETCH_BOTH
,
$fetchArgument
=
0
)
public
function
fetchAll
(
$fetchStyle
=
null
,
$fetchArgument
=
0
)
{
if
(
$fetchArgument
!==
0
)
{
return
$this
->
stmt
->
fetchAll
(
$fetchStyle
,
$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