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
ab9f8160
Commit
ab9f8160
authored
Jan 04, 2014
by
Steve Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix sqlsrv driver functional test suite
parent
7bcfaba6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
15 deletions
+42
-15
SQLSrvStatement.php
lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
+40
-14
DataAccessTest.php
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
+2
-1
No files found.
lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
View file @
ab9f8160
...
...
@@ -70,6 +70,20 @@ class SQLSrvStatement implements IteratorAggregate, Statement
PDO
::
FETCH_NUM
=>
SQLSRV_FETCH_NUMERIC
,
);
/**
* The name of the default class to instantiate when fetch mode is \PDO::FETCH_CLASS.
*
* @var string
*/
private
$defaultFetchClass
=
'\stdClass'
;
/**
* The constructor arguments for the default class to instantiate when fetch mode is \PDO::FETCH_CLASS.
*
* @var string
*/
private
$defaultFetchClassCtorArgs
=
array
();
/**
* The fetch style.
*
...
...
@@ -201,6 +215,8 @@ class SQLSrvStatement implements IteratorAggregate, Statement
public
function
setFetchMode
(
$fetchMode
,
$arg2
=
null
,
$arg3
=
null
)
{
$this
->
defaultFetchMode
=
$fetchMode
;
$this
->
defaultFetchClass
=
$arg2
?:
$this
->
defaultFetchClass
;
$this
->
defaultFetchClassCtorArgs
=
$arg3
?
(
array
)
$arg3
:
$this
->
defaultFetchClassCtorArgs
;
return
true
;
}
...
...
@@ -225,8 +241,8 @@ class SQLSrvStatement implements IteratorAggregate, Statement
if
(
isset
(
self
::
$fetchMap
[
$fetchMode
]))
{
return
sqlsrv_fetch_array
(
$this
->
stmt
,
self
::
$fetchMap
[
$fetchMode
]);
}
elseif
(
$fetchMode
==
PDO
::
FETCH_OBJ
||
$fetchMode
==
PDO
::
FETCH_CLASS
)
{
$className
=
null
;
$ctorArgs
=
null
;
$className
=
$this
->
defaultFetchClass
;
$ctorArgs
=
$this
->
defaultFetchClassCtorArgs
;
if
(
count
(
$args
)
>=
2
)
{
$className
=
$args
[
1
];
$ctorArgs
=
(
isset
(
$args
[
2
]))
?
$args
[
2
]
:
array
();
...
...
@@ -242,18 +258,24 @@ class SQLSrvStatement implements IteratorAggregate, Statement
*/
public
function
fetchAll
(
$fetchMode
=
null
)
{
$className
=
null
;
$ctorArgs
=
null
;
if
(
func_num_args
()
>=
2
)
{
$args
=
func_get_args
();
$className
=
$args
[
1
];
$ctorArgs
=
(
isset
(
$args
[
2
]))
?
$args
[
2
]
:
array
();
}
$rows
=
array
();
while
(
$row
=
$this
->
fetch
(
$fetchMode
,
$className
,
$ctorArgs
))
{
switch
(
$fetchMode
)
{
case
PDO
::
FETCH_CLASS
:
while
(
$row
=
call_user_func_array
(
array
(
$this
,
'fetch'
),
func_get_args
()))
{
$rows
[]
=
$row
;
}
break
;
case
PDO
::
FETCH_COLUMN
:
while
(
$row
=
$this
->
fetchColumn
())
{
$rows
[]
=
$row
;
}
break
;
default
:
while
(
$row
=
$this
->
fetch
(
$fetchMode
))
{
$rows
[]
=
$row
;
}
}
return
$rows
;
}
...
...
@@ -265,9 +287,13 @@ class SQLSrvStatement implements IteratorAggregate, Statement
{
$row
=
$this
->
fetch
(
PDO
::
FETCH_NUM
);
if
(
$row
&&
isset
(
$row
[
$columnIndex
]))
{
return
$row
[
$columnIndex
];
}
return
false
;
}
/**
* {@inheritdoc}
*/
...
...
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
View file @
ab9f8160
...
...
@@ -212,7 +212,8 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
*/
public
function
testFetchAllWithMissingTypes
()
{
if
(
$this
->
_conn
->
getDriver
()
instanceof
\Doctrine\DBAL\Driver\Mysqli\Driver
)
{
if
(
$this
->
_conn
->
getDriver
()
instanceof
\Doctrine\DBAL\Driver\Mysqli\Driver
||
$this
->
_conn
->
getDriver
()
instanceof
\Doctrine\DBAL\Driver\SQLSrv\Driver
)
{
$this
->
markTestSkipped
(
'mysqli actually supports this'
);
}
...
...
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