Skip to content

Commit 7100dbf

Browse files
committed
Fixed IBM DB2 tests
1 parent 61cd986 commit 7100dbf

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function lastInsertId(?string $name = null) : string
134134
*/
135135
public function beginTransaction() : bool
136136
{
137-
db2_autocommit($this->conn, DB2_AUTOCOMMIT_OFF);
137+
return db2_autocommit($this->conn, DB2_AUTOCOMMIT_OFF);
138138
}
139139

140140
/**
@@ -145,7 +145,8 @@ public function commit() : bool
145145
if (! db2_commit($this->conn)) {
146146
throw new DB2Exception(db2_conn_errormsg($this->conn));
147147
}
148-
db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON);
148+
149+
return db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON);
149150
}
150151

151152
/**
@@ -156,7 +157,8 @@ public function rollBack() : bool
156157
if (! db2_rollback($this->conn)) {
157158
throw new DB2Exception(db2_conn_errormsg($this->conn));
158159
}
159-
db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON);
160+
161+
return db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON);
160162
}
161163

162164
/**

lib/Doctrine/DBAL/Platforms/DB2Platform.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ public function getListTableColumnsSQL(string $table, ?string $database = null)
291291
c.scale,
292292
c.identity,
293293
tc.type AS tabconsttype,
294-
c.remarks AS comment,
294+
COALESCE(c.remarks, '') AS comment,
295295
k.colseq,
296296
CASE
297297
WHEN c.generated = 'D' THEN 1
@@ -528,7 +528,7 @@ public function getAlterTableSQL(TableDiff $diff)
528528

529529
$comment = $this->getColumnComment($column);
530530

531-
if ($comment === null || $comment === '') {
531+
if ($comment === '') {
532532
continue;
533533
}
534534

lib/Doctrine/DBAL/Schema/DB2SchemaManager.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,10 @@ protected function _getPortableTableColumnDefinition(array $tableColumn) : Colum
8484
'fixed' => (bool) $fixed,
8585
'default' => $default,
8686
'autoincrement' => (bool) $tableColumn['autoincrement'],
87-
'notnull' => (bool) ($tableColumn['nulls'] === 'N'),
87+
'notnull' => $tableColumn['nulls'] === 'N',
8888
'scale' => null,
8989
'precision' => null,
90-
'comment' => isset($tableColumn['comment']) && $tableColumn['comment'] !== ''
91-
? $tableColumn['comment']
92-
: null,
90+
'comment' => $tableColumn['comment'],
9391
'platformOptions' => [],
9492
];
9593

tests/Doctrine/Tests/DBAL/Functional/Schema/Db2SchemaManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function testGetBooleanColumn() : void
2323
self::assertInstanceOf(BooleanType::class, $columns['bool']->getType());
2424
self::assertInstanceOf(BooleanType::class, $columns['bool_commented']->getType());
2525

26-
self::assertNull($columns['bool']->getComment());
26+
self::assertSame('', $columns['bool']->getComment());
2727
self::assertSame("That's a comment", $columns['bool_commented']->getComment());
2828
}
2929

0 commit comments

Comments
 (0)