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
2f0eb0d7
Commit
2f0eb0d7
authored
May 05, 2012
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DBAL-257] Fix fetchColumn() on empty result for OCI8 to return false
parent
c3626225
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
5 deletions
+40
-5
OCI8Statement.php
lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
+1
-1
DataAccessTest.php
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
+39
-4
No files found.
lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
View file @
2f0eb0d7
...
...
@@ -245,7 +245,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
public
function
fetchColumn
(
$columnIndex
=
0
)
{
$row
=
oci_fetch_array
(
$this
->
_sth
,
OCI_NUM
|
OCI_RETURN_NULLS
|
OCI_RETURN_LOBS
);
return
$row
[
$columnIndex
]
;
return
isset
(
$row
[
$columnIndex
])
?
$row
[
$columnIndex
]
:
false
;
}
/**
...
...
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
View file @
2f0eb0d7
...
...
@@ -407,9 +407,7 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
*/
public
function
testFetchAllSupportFetchClass
()
{
if
(
isset
(
$GLOBALS
[
'db_type'
])
&&
$GLOBALS
[
'db_type'
]
==
"oci8"
)
{
$this
->
markTestSkipped
(
"Not supported by OCI8"
);
}
$this
->
skipOci8AndMysqli
();
$this
->
_conn
->
executeQuery
(
'DELETE FROM fetch_table'
)
->
execute
();
$this
->
_conn
->
insert
(
'fetch_table'
,
array
(
...
...
@@ -432,7 +430,44 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this
->
assertEquals
(
1
,
$results
[
0
]
->
test_int
);
$this
->
assertEquals
(
'foo'
,
$results
[
0
]
->
test_string
);
$this
->
assertEquals
(
'2010-01-01 10:10:10'
,
$results
[
0
]
->
test_datetime
);
$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
);
}
/**
* @group DBAL-257
*/
public
function
testEmptyFetchColumnReturnsFalse
()
{
$this
->
_conn
->
executeQuery
(
'DELETE FROM fetch_table'
)
->
execute
();
$this
->
assertFalse
(
$this
->
_conn
->
fetchColumn
(
'SELECT test_int FROM fetch_table'
));
$this
->
assertFalse
(
$this
->
_conn
->
query
(
'SELECT test_int FROM fetch_table'
)
->
fetchColumn
());
}
private
function
skipOci8AndMysqli
()
{
if
(
isset
(
$GLOBALS
[
'db_type'
])
&&
$GLOBALS
[
'db_type'
]
==
"oci8"
)
{
$this
->
markTestSkipped
(
"Not supported by OCI8"
);
}
if
(
'mysqli'
==
$this
->
_conn
->
getDriver
()
->
getName
())
{
$this
->
markTestSkipped
(
'Mysqli driver dont support this feature.'
);
}
}
}
...
...
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