|
@@ 64-81 (lines=18) @@
|
| 61 |
|
self::assertFalse($row['bool_col']); |
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
public function testBooleanConversionBoolParamEmulatedPrepares() |
| 65 |
|
{ |
| 66 |
|
$this->_conn->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 67 |
|
|
| 68 |
|
$platform = $this->_conn->getDatabasePlatform(); |
| 69 |
|
|
| 70 |
|
$stmt = $this->_conn->prepare('INSERT INTO dbal630 (bool_col) VALUES(?)'); |
| 71 |
|
$stmt->bindValue(1, $platform->convertBooleansToDatabaseValue('false'), PDO::PARAM_BOOL); |
| 72 |
|
$stmt->execute(); |
| 73 |
|
|
| 74 |
|
$id = $this->_conn->lastInsertId('dbal630_id_seq'); |
| 75 |
|
|
| 76 |
|
self::assertNotEmpty($id); |
| 77 |
|
|
| 78 |
|
$row = $this->_conn->fetchAssoc('SELECT bool_col FROM dbal630 WHERE id = ?', array($id)); |
| 79 |
|
|
| 80 |
|
self::assertFalse($row['bool_col']); |
| 81 |
|
} |
| 82 |
|
|
| 83 |
|
/** |
| 84 |
|
* @dataProvider booleanTypeConversionWithoutPdoTypeProvider |
|
@@ 86-105 (lines=20) @@
|
| 83 |
|
/** |
| 84 |
|
* @dataProvider booleanTypeConversionWithoutPdoTypeProvider |
| 85 |
|
*/ |
| 86 |
|
public function testBooleanConversionNullParamEmulatedPrepares( |
| 87 |
|
$statementValue, |
| 88 |
|
$databaseConvertedValue |
| 89 |
|
) { |
| 90 |
|
$this->_conn->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 91 |
|
|
| 92 |
|
$platform = $this->_conn->getDatabasePlatform(); |
| 93 |
|
|
| 94 |
|
$stmt = $this->_conn->prepare('INSERT INTO dbal630_allow_nulls (bool_col) VALUES(?)'); |
| 95 |
|
$stmt->bindValue(1, $platform->convertBooleansToDatabaseValue($statementValue)); |
| 96 |
|
$stmt->execute(); |
| 97 |
|
|
| 98 |
|
$id = $this->_conn->lastInsertId('dbal630_allow_nulls_id_seq'); |
| 99 |
|
|
| 100 |
|
self::assertNotEmpty($id); |
| 101 |
|
|
| 102 |
|
$row = $this->_conn->fetchAssoc('SELECT bool_col FROM dbal630_allow_nulls WHERE id = ?', array($id)); |
| 103 |
|
|
| 104 |
|
self::assertSame($databaseConvertedValue, $row['bool_col']); |
| 105 |
|
} |
| 106 |
|
|
| 107 |
|
/** |
| 108 |
|
* @dataProvider booleanTypeConversionUsingBooleanTypeProvider |
|
@@ 110-129 (lines=20) @@
|
| 107 |
|
/** |
| 108 |
|
* @dataProvider booleanTypeConversionUsingBooleanTypeProvider |
| 109 |
|
*/ |
| 110 |
|
public function testBooleanConversionNullParamEmulatedPreparesWithBooleanTypeInBindValue( |
| 111 |
|
$statementValue, |
| 112 |
|
$databaseConvertedValue |
| 113 |
|
) { |
| 114 |
|
$this->_conn->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 115 |
|
|
| 116 |
|
$platform = $this->_conn->getDatabasePlatform(); |
| 117 |
|
|
| 118 |
|
$stmt = $this->_conn->prepare('INSERT INTO dbal630_allow_nulls (bool_col) VALUES(?)'); |
| 119 |
|
$stmt->bindValue(1, $platform->convertBooleansToDatabaseValue($statementValue), PDO::PARAM_BOOL); |
| 120 |
|
$stmt->execute(); |
| 121 |
|
|
| 122 |
|
$id = $this->_conn->lastInsertId('dbal630_allow_nulls_id_seq'); |
| 123 |
|
|
| 124 |
|
self::assertNotEmpty($id); |
| 125 |
|
|
| 126 |
|
$row = $this->_conn->fetchAssoc('SELECT bool_col FROM dbal630_allow_nulls WHERE id = ?', array($id)); |
| 127 |
|
|
| 128 |
|
self::assertSame($databaseConvertedValue, $row['bool_col']); |
| 129 |
|
} |
| 130 |
|
|
| 131 |
|
/** |
| 132 |
|
* Boolean conversion mapping provider |