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
bc238319
Unverified
Commit
bc238319
authored
Jan 04, 2018
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented Statement::fetch(PDO::FETCH_COLUMN) in non-PDO driveres
Fixes #2953.
parent
8575c255
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
2 deletions
+29
-2
DB2Statement.php
lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
+3
-0
MysqliStatement.php
lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
+6
-2
OCI8Statement.php
lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
+4
-0
SQLAnywhereStatement.php
...Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php
+3
-0
SQLSrvStatement.php
lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
+4
-0
StatementTest.php
tests/Doctrine/Tests/DBAL/Functional/StatementTest.php
+9
-0
No files found.
lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
View file @
bc238319
...
...
@@ -216,6 +216,9 @@ class DB2Statement implements \IteratorAggregate, Statement
$fetchMode
=
$fetchMode
?:
$this
->
_defaultFetchMode
;
switch
(
$fetchMode
)
{
case
\PDO
::
FETCH_COLUMN
:
return
$this
->
fetchColumn
();
case
\PDO
::
FETCH_BOTH
:
return
db2_fetch_both
(
$this
->
_stmt
);
case
\PDO
::
FETCH_ASSOC
:
...
...
lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
View file @
bc238319
...
...
@@ -272,6 +272,12 @@ class MysqliStatement implements \IteratorAggregate, Statement
return
false
;
}
$fetchMode
=
$fetchMode
?:
$this
->
_defaultFetchMode
;
if
(
$fetchMode
===
PDO
::
FETCH_COLUMN
)
{
return
$this
->
fetchColumn
();
}
$values
=
$this
->
_fetch
();
if
(
null
===
$values
)
{
return
false
;
...
...
@@ -281,8 +287,6 @@ class MysqliStatement implements \IteratorAggregate, Statement
throw
new
MysqliException
(
$this
->
_stmt
->
error
,
$this
->
_stmt
->
sqlstate
,
$this
->
_stmt
->
errno
);
}
$fetchMode
=
$fetchMode
?:
$this
->
_defaultFetchMode
;
switch
(
$fetchMode
)
{
case
PDO
::
FETCH_NUM
:
return
$values
;
...
...
lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
View file @
bc238319
...
...
@@ -387,6 +387,10 @@ class OCI8Statement implements IteratorAggregate, Statement
$fetchMode
=
$fetchMode
?:
$this
->
_defaultFetchMode
;
if
(
$fetchMode
===
PDO
::
FETCH_COLUMN
)
{
return
$this
->
fetchColumn
();
}
if
(
PDO
::
FETCH_OBJ
==
$fetchMode
)
{
return
oci_fetch_object
(
$this
->
_sth
);
}
...
...
lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php
View file @
bc238319
...
...
@@ -203,6 +203,9 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
$fetchMode
=
$fetchMode
?:
$this
->
defaultFetchMode
;
switch
(
$fetchMode
)
{
case
PDO
::
FETCH_COLUMN
:
return
$this
->
fetchColumn
();
case
PDO
::
FETCH_ASSOC
:
return
sasql_fetch_assoc
(
$this
->
result
);
case
PDO
::
FETCH_BOTH
:
...
...
lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
View file @
bc238319
...
...
@@ -315,6 +315,10 @@ class SQLSrvStatement implements IteratorAggregate, Statement
$args
=
func_get_args
();
$fetchMode
=
$fetchMode
?:
$this
->
defaultFetchMode
;
if
(
$fetchMode
===
PDO
::
FETCH_COLUMN
)
{
return
$this
->
fetchColumn
();
}
if
(
isset
(
self
::
$fetchMap
[
$fetchMode
]))
{
return
sqlsrv_fetch_array
(
$this
->
stmt
,
self
::
$fetchMap
[
$fetchMode
])
?:
false
;
}
...
...
tests/Doctrine/Tests/DBAL/Functional/StatementTest.php
View file @
bc238319
...
...
@@ -282,4 +282,13 @@ EOF
),
);
}
public
function
testFetchInColumnMode
()
:
void
{
$platform
=
$this
->
_conn
->
getDatabasePlatform
();
$query
=
$platform
->
getDummySelectSQL
();
$result
=
$this
->
_conn
->
executeQuery
(
$query
)
->
fetch
(
\PDO
::
FETCH_COLUMN
);
self
::
assertEquals
(
1
,
$result
);
}
}
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