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
def638ff
Commit
def638ff
authored
Mar 24, 2012
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DBAL-241] Added platform independent test for Statement#fetchAll(PDO::FETCH_COLUMN)
parent
118e36f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
15 deletions
+26
-15
OCI8Statement.php
lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
+9
-15
DataAccessTest.php
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
+17
-0
No files found.
lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
View file @
def638ff
...
...
@@ -226,7 +226,6 @@ class OCI8Statement implements \IteratorAggregate, Statement
if
(
!
isset
(
self
::
$fetchStyleMap
[
$fetchStyle
]))
{
throw
new
\InvalidArgumentException
(
"Invalid fetch style: "
.
$fetchStyle
);
}
<<<<<<<
HEAD
$result
=
array
();
if
(
self
::
$fetchStyleMap
[
$fetchStyle
]
===
OCI_BOTH
)
{
...
...
@@ -234,22 +233,17 @@ class OCI8Statement implements \IteratorAggregate, Statement
$result
[]
=
$row
;
}
}
else
{
oci_fetch_all
(
$this
->
_sth
,
$result
,
0
,
-
1
,
self
::
$fetchStyleMap
[
$fetchStyle
]
|
OCI_RETURN_NULLS
|
OCI_FETCHSTATEMENT_BY_ROW
|
OCI_RETURN_LOBS
);
=======
$fetchStructure
=
OCI_FETCHSTATEMENT_BY_ROW
;
if
(
$fetchStyle
==
PDO
::
FETCH_COLUMN
)
{
$fetchStructure
=
OCI_FETCHSTATEMENT_BY_COLUMN
;
}
$fetchStructure
=
OCI_FETCHSTATEMENT_BY_ROW
;
if
(
$fetchStyle
==
PDO
::
FETCH_COLUMN
)
{
$fetchStructure
=
OCI_FETCHSTATEMENT_BY_COLUMN
;
}
$result
=
array
();
oci_fetch_all
(
$this
->
_sth
,
$result
,
0
,
-
1
,
self
::
$fetchStyleMap
[
$fetchStyle
]
|
OCI_RETURN_NULLS
|
$fetchStructure
|
OCI_RETURN_LOBS
);
oci_fetch_all
(
$this
->
_sth
,
$result
,
0
,
-
1
,
self
::
$fetchStyleMap
[
$fetchStyle
]
|
OCI_RETURN_NULLS
|
$fetchStructure
|
OCI_RETURN_LOBS
);
if
(
$fetchStyle
==
PDO
::
FETCH_COLUMN
)
{
$result
=
$result
[
0
];
>>>>>>>
Adding
PDO
::
FETCH_COLUMN
support
to
OCI8
fetchAll
method
using
the
fetch
structure
OCI_FETCHSTATEMENT_BY_COLUMN
.
if
(
$fetchStyle
==
PDO
::
FETCH_COLUMN
)
{
$result
=
$result
[
0
];
}
}
return
$result
;
...
...
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
View file @
def638ff
...
...
@@ -434,6 +434,23 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this
->
assertEquals
(
'foo'
,
$results
[
0
]
->
test_string
);
$this
->
assertStringStartsWith
(
'2010-01-01 10:10:10'
,
$results
[
0
]
->
test_datetime
);
}
/**
* @group DBAL-241
*/
public
function
testFetchAllStyleColumn
()
{
$sql
=
"DELETE FROM fetch_table"
;
$this
->
_conn
->
executeUpdate
(
$sql
);
$this
->
_conn
->
insert
(
'fetch_table'
,
array
(
'test_int'
=>
1
,
'test_string'
=>
'foo'
));
$this
->
_conn
->
insert
(
'fetch_table'
,
array
(
'test_int'
=>
10
,
'test_string'
=>
'foo'
));
$sql
=
"SELECT test_int FROM fetch_table"
;
$rows
=
$this
->
_conn
->
query
(
$sql
)
->
fetchAll
(
\PDO
::
FETCH_COLUMN
);
$this
->
assertEquals
(
array
(
1
,
10
),
$rows
);
}
}
class
MyFetchClass
...
...
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