-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test to verify null cast in boolean type #632
Merged
Merged
Changes from 7 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
f624876
add test to verify null cast in boolean type
031f38c
resolves #632 Fix null cast in boolean type in Postgres platform
43d13fc
refs #632 Remove is_null to be consistent with doctrine coding standard
4ebdb8c
Update PostgreSqlPlatform.php
24bf3bc
Merge pull request #1 from doctrine/master
fd3b116
Test to check null conversion with boolean type
1a7fa0c
Merge pull request #2 from doctrine/master
7b29bd5
refs #632 check boolean conversion with and without PDO type value
907513f
Merge pull request #3 from doctrine/master
598503d
Fix boolean conversion with php 5.6
e8d7820
Revert change to fix php 5.6
8065c83
Change assertEquals to assertSame
8eb2ddc
Merge pull request #4 from doctrine/master
9c91857
Merge pull request #5 from doctrine/master
1f5456a
Merge pull request #6 from doctrine/master
f2aa22c
Merge pull request #7 from doctrine/master
e2b1177
Merge pull request #8 from doctrine/master
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,4 +88,31 @@ public function testBooleanConversionBoolParamEmulatedPrepares() | |
|
||
$this->assertFalse($row['bool_col']); | ||
} | ||
|
||
public function testBooleanConversionNullParamEmulatedPrepares() | ||
{ | ||
$this->_conn->exec('CREATE TABLE dbal630_allow_nulls (id SERIAL, bool_col BOOLEAN);'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure but I think you have to move the table creation statement to the |
||
|
||
$this->_conn->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); | ||
|
||
// PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT is deprecated in php 5.6. PDO::ATTR_EMULATE_PREPARES should | ||
// be used instead. so should only it be set when it is supported. | ||
if (PHP_VERSION_ID < 50600) { | ||
$this->_conn->getWrappedConnection()->setAttribute(PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, true); | ||
} | ||
|
||
$platform = $this->_conn->getDatabasePlatform(); | ||
|
||
$stmt = $this->_conn->prepare('INSERT INTO dbal630_allow_nulls (bool_col) VALUES(?)'); | ||
$stmt->bindValue(1, $platform->convertBooleansToDatabaseValue(null)); | ||
$stmt->execute(); | ||
|
||
$id = $this->_conn->lastInsertId('dbal630_id_seq'); | ||
|
||
$this->assertNotEmpty($id); | ||
|
||
$row = $this->_conn->fetchAssoc('SELECT bool_col FROM dbal630_allow_nulls WHERE id = ?', array($id)); | ||
|
||
$this->assertNull($row['bool_col']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty newline before this line