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
Show 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
...
@@ -58,14 +58,15 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement
public
function
getIterator
()
public
function
getIterator
()
{
{
$data
=
$this
->
fetchAll
(
$this
->
defaultFetchStyle
);
$data
=
$this
->
fetchAll
();
return
new
\ArrayIterator
(
$data
);
return
new
\ArrayIterator
(
$data
);
}
}
public
function
fetch
(
$fetchStyle
=
PDO
::
FETCH_BOTH
)
public
function
fetch
(
$fetchStyle
=
null
)
{
{
if
(
isset
(
$this
->
data
[
$this
->
num
]))
{
if
(
isset
(
$this
->
data
[
$this
->
num
]))
{
$row
=
$this
->
data
[
$this
->
num
++
];
$row
=
$this
->
data
[
$this
->
num
++
];
$fetchStyle
=
$fetchStyle
?:
$this
->
defaultFetchStyle
;
if
(
$fetchStyle
===
PDO
::
FETCH_ASSOC
)
{
if
(
$fetchStyle
===
PDO
::
FETCH_ASSOC
)
{
return
$row
;
return
$row
;
}
else
if
(
$fetchStyle
===
PDO
::
FETCH_NUM
)
{
}
else
if
(
$fetchStyle
===
PDO
::
FETCH_NUM
)
{
...
@@ -81,7 +82,7 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement
...
@@ -81,7 +82,7 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement
return
false
;
return
false
;
}
}
public
function
fetchAll
(
$fetchStyle
=
PDO
::
FETCH_BOTH
)
public
function
fetchAll
(
$fetchStyle
=
null
)
{
{
$rows
=
array
();
$rows
=
array
();
while
(
$row
=
$this
->
fetch
(
$fetchStyle
))
{
while
(
$row
=
$this
->
fetch
(
$fetchStyle
))
{
...
...
lib/Doctrine/DBAL/Cache/ResultCacheStatement.php
View file @
d2655e48
...
@@ -139,7 +139,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
...
@@ -139,7 +139,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
public
function
getIterator
()
public
function
getIterator
()
{
{
$data
=
$this
->
fetchAll
(
$this
->
defaultFetchStyle
);
$data
=
$this
->
fetchAll
();
return
new
\ArrayIterator
(
$data
);
return
new
\ArrayIterator
(
$data
);
}
}
...
@@ -153,7 +153,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
...
@@ -153,7 +153,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
*
*
* @return mixed
* @return mixed
*/
*/
public
function
fetch
(
$fetchStyle
=
PDO
::
FETCH_BOTH
)
public
function
fetch
(
$fetchStyle
=
null
)
{
{
if
(
$this
->
data
===
null
)
{
if
(
$this
->
data
===
null
)
{
$this
->
data
=
array
();
$this
->
data
=
array
();
...
@@ -163,6 +163,8 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
...
@@ -163,6 +163,8 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
if
(
$row
)
{
if
(
$row
)
{
$this
->
data
[]
=
$row
;
$this
->
data
[]
=
$row
;
$fetchStyle
=
$fetchStyle
?:
$this
->
defaultFetchStyle
;
if
(
$fetchStyle
==
PDO
::
FETCH_ASSOC
)
{
if
(
$fetchStyle
==
PDO
::
FETCH_ASSOC
)
{
return
$row
;
return
$row
;
}
else
if
(
$fetchStyle
==
PDO
::
FETCH_NUM
)
{
}
else
if
(
$fetchStyle
==
PDO
::
FETCH_NUM
)
{
...
@@ -188,7 +190,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
...
@@ -188,7 +190,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
*
*
* @return array
* @return array
*/
*/
public
function
fetchAll
(
$fetchStyle
=
PDO
::
FETCH_BOTH
)
public
function
fetchAll
(
$fetchStyle
=
null
)
{
{
$rows
=
array
();
$rows
=
array
();
while
(
$row
=
$this
->
fetch
(
$fetchStyle
))
{
while
(
$row
=
$this
->
fetch
(
$fetchStyle
))
{
...
...
lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
View file @
d2655e48
...
@@ -158,7 +158,7 @@ class DB2Statement implements \IteratorAggregate, Statement
...
@@ -158,7 +158,7 @@ class DB2Statement implements \IteratorAggregate, Statement
*/
*/
public
function
getIterator
()
public
function
getIterator
()
{
{
$data
=
$this
->
fetchAll
(
$this
->
_defaultFetchStyle
);
$data
=
$this
->
fetchAll
();
return
new
\ArrayIterator
(
$data
);
return
new
\ArrayIterator
(
$data
);
}
}
...
@@ -185,7 +185,6 @@ class DB2Statement implements \IteratorAggregate, Statement
...
@@ -185,7 +185,6 @@ class DB2Statement implements \IteratorAggregate, Statement
*/
*/
public
function
fetchAll
(
$fetchStyle
=
null
)
public
function
fetchAll
(
$fetchStyle
=
null
)
{
{
$fetchStyle
=
$fetchStyle
?:
$this
->
_defaultFetchStyle
;
$rows
=
array
();
$rows
=
array
();
while
(
$row
=
$this
->
fetch
(
$fetchStyle
))
{
while
(
$row
=
$this
->
fetch
(
$fetchStyle
))
{
$rows
[]
=
$row
;
$rows
[]
=
$row
;
...
...
lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
View file @
d2655e48
...
@@ -253,18 +253,18 @@ class MysqliStatement implements \IteratorAggregate, Statement
...
@@ -253,18 +253,18 @@ class MysqliStatement implements \IteratorAggregate, Statement
{
{
$fetchStyle
=
$fetchStyle
?:
$this
->
_defaultFetchStyle
;
$fetchStyle
=
$fetchStyle
?:
$this
->
_defaultFetchStyle
;
$
a
=
array
();
$
rows
=
array
();
if
(
PDO
::
FETCH_COLUMN
==
$fetchStyle
)
{
if
(
PDO
::
FETCH_COLUMN
==
$fetchStyle
)
{
while
((
$
value
=
$this
->
fetchColumn
())
!==
false
)
{
while
((
$
row
=
$this
->
fetchColumn
())
!==
false
)
{
$
a
[]
=
$value
;
$
rows
[]
=
$row
;
}
}
}
else
{
}
else
{
while
((
$row
=
$this
->
fetch
(
$fetchStyle
))
!==
null
)
{
while
((
$row
=
$this
->
fetch
(
$fetchStyle
))
!==
null
)
{
$
a
[]
=
$row
;
$
rows
[]
=
$row
;
}
}
}
}
return
$
a
;
return
$
rows
;
}
}
/**
/**
...
@@ -336,7 +336,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
...
@@ -336,7 +336,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
*/
*/
public
function
getIterator
()
public
function
getIterator
()
{
{
$data
=
$this
->
fetchAll
(
$this
->
_defaultFetchStyle
);
$data
=
$this
->
fetchAll
();
return
new
\ArrayIterator
(
$data
);
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
...
@@ -79,7 +79,7 @@ class OCI8Connection implements \Doctrine\DBAL\Driver\Connection
{
{
$args
=
func_get_args
();
$args
=
func_get_args
();
$sql
=
$args
[
0
];
$sql
=
$args
[
0
];
//$fetch
Mod
e = $args[1];
//$fetch
Styl
e = $args[1];
$stmt
=
$this
->
prepare
(
$sql
);
$stmt
=
$this
->
prepare
(
$sql
);
$stmt
->
execute
();
$stmt
->
execute
();
return
$stmt
;
return
$stmt
;
...
...
lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
View file @
d2655e48
...
@@ -200,7 +200,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
...
@@ -200,7 +200,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
*/
*/
public
function
getIterator
()
public
function
getIterator
()
{
{
$data
=
$this
->
fetchAll
(
$this
->
_defaultFetchStyle
);
$data
=
$this
->
fetchAll
();
return
new
\ArrayIterator
(
$data
);
return
new
\ArrayIterator
(
$data
);
}
}
...
...
lib/Doctrine/DBAL/Driver/ResultStatement.php
View file @
d2655e48
...
@@ -64,7 +64,7 @@ interface ResultStatement extends \Traversable
...
@@ -64,7 +64,7 @@ interface ResultStatement extends \Traversable
*
*
* @return mixed
* @return mixed
*/
*/
function
fetch
(
$fetchStyle
=
PDO
::
FETCH_BOTH
);
function
fetch
(
$fetchStyle
=
null
);
/**
/**
* Returns an array containing all of the result set rows
* Returns an array containing all of the result set rows
...
@@ -75,7 +75,7 @@ interface ResultStatement extends \Traversable
...
@@ -75,7 +75,7 @@ interface ResultStatement extends \Traversable
*
*
* @return array
* @return array
*/
*/
function
fetchAll
(
$fetchStyle
=
PDO
::
FETCH_BOTH
);
function
fetchAll
(
$fetchStyle
=
null
);
/**
/**
* fetchColumn
* fetchColumn
...
...
lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
View file @
d2655e48
...
@@ -185,7 +185,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
...
@@ -185,7 +185,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
*/
*/
public
function
getIterator
()
public
function
getIterator
()
{
{
$data
=
$this
->
fetchAll
(
$this
->
defaultFetchStyle
);
$data
=
$this
->
fetchAll
();
return
new
\ArrayIterator
(
$data
);
return
new
\ArrayIterator
(
$data
);
}
}
...
@@ -194,7 +194,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
...
@@ -194,7 +194,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
*/
*/
public
function
fetch
(
$fetchStyle
=
null
)
public
function
fetch
(
$fetchStyle
=
null
)
{
{
$fetchStyle
=
(
$fetchStyle
)
?:
$this
->
defaultFetchStyle
;
$fetchStyle
=
$fetchStyle
?:
$this
->
defaultFetchStyle
;
if
(
isset
(
self
::
$fetchMap
[
$fetchStyle
]))
{
if
(
isset
(
self
::
$fetchMap
[
$fetchStyle
]))
{
return
sqlsrv_fetch_array
(
$this
->
stmt
,
self
::
$fetchMap
[
$fetchStyle
]);
return
sqlsrv_fetch_array
(
$this
->
stmt
,
self
::
$fetchMap
[
$fetchStyle
]);
}
else
if
(
$fetchStyle
==
PDO
::
FETCH_OBJ
||
$fetchStyle
==
PDO
::
FETCH_CLASS
)
{
}
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
...
@@ -109,12 +109,14 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
public
function
getIterator
()
public
function
getIterator
()
{
{
$data
=
$this
->
fetchAll
(
$this
->
defaultFetchStyle
);
$data
=
$this
->
fetchAll
();
return
new
\ArrayIterator
(
$data
);
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
->
stmt
->
fetch
(
$fetchStyle
);
$row
=
$this
->
fixRow
(
$row
,
$row
=
$this
->
fixRow
(
$row
,
...
@@ -125,8 +127,10 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
...
@@ -125,8 +127,10 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
return
$row
;
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
)
{
if
(
$columnIndex
!=
0
)
{
$rows
=
$this
->
stmt
->
fetchAll
(
$fetchStyle
,
$columnIndex
);
$rows
=
$this
->
stmt
->
fetchAll
(
$fetchStyle
,
$columnIndex
);
}
else
{
}
else
{
...
...
lib/Doctrine/DBAL/Statement.php
View file @
d2655e48
...
@@ -201,7 +201,7 @@ class Statement implements \IteratorAggregate, DriverStatement
...
@@ -201,7 +201,7 @@ class Statement implements \IteratorAggregate, DriverStatement
* @return mixed The return value of this function on success depends on the fetch type.
* @return mixed The return value of this function on success depends on the fetch type.
* In all cases, FALSE is returned on failure.
* 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
);
return
$this
->
stmt
->
fetch
(
$fetchStyle
);
}
}
...
@@ -213,7 +213,7 @@ class Statement implements \IteratorAggregate, DriverStatement
...
@@ -213,7 +213,7 @@ class Statement implements \IteratorAggregate, DriverStatement
* @param mixed $fetchArgument
* @param mixed $fetchArgument
* @return array An array containing all of the remaining rows in the result set.
* @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
)
{
if
(
$fetchArgument
!==
0
)
{
return
$this
->
stmt
->
fetchAll
(
$fetchStyle
,
$fetchArgument
);
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