Commit f1dd83e2 by Nikitin Vitaly Committed by Carsten Brandt

Added test that are making sure batchInsert boolean values in PostgreSQL isn't failing with errors

close #4655
parent 70e0115d
...@@ -16,6 +16,7 @@ DROP TABLE IF EXISTS "profile" CASCADE; ...@@ -16,6 +16,7 @@ DROP TABLE IF EXISTS "profile" CASCADE;
DROP TABLE IF EXISTS "type" CASCADE; DROP TABLE IF EXISTS "type" CASCADE;
DROP TABLE IF EXISTS "null_values" CASCADE; DROP TABLE IF EXISTS "null_values" CASCADE;
DROP TABLE IF EXISTS "constraints" CASCADE; DROP TABLE IF EXISTS "constraints" CASCADE;
DROP TABLE IF EXISTS "bool_values" CASCADE;
CREATE TABLE "constraints" CREATE TABLE "constraints"
( (
...@@ -113,6 +114,11 @@ CREATE TABLE "type" ( ...@@ -113,6 +114,11 @@ CREATE TABLE "type" (
bit_col BIT(8) NOT NULL DEFAULT B'10000010' bit_col BIT(8) NOT NULL DEFAULT B'10000010'
); );
CREATE TABLE "bool_values" (
id serial not null primary key,
bool_col bool
);
INSERT INTO "profile" (description) VALUES ('profile customer 1'); INSERT INTO "profile" (description) VALUES ('profile customer 1');
INSERT INTO "profile" (description) VALUES ('profile customer 3'); INSERT INTO "profile" (description) VALUES ('profile customer 3');
......
...@@ -19,4 +19,18 @@ class PostgreSQLCommandTest extends CommandTest ...@@ -19,4 +19,18 @@ class PostgreSQLCommandTest extends CommandTest
$command = $db->createCommand($sql); $command = $db->createCommand($sql);
$this->assertEquals('SELECT "id", "t"."name" FROM "customer" t', $command->sql); $this->assertEquals('SELECT "id", "t"."name" FROM "customer" t', $command->sql);
} }
public function testBatchInsert()
{
parent::testBatchInsert();
$command = $this->getConnection()->createCommand();
$command->batchInsert('bool_values',
['bool_col'], [
[true],
[false],
]
);
$this->assertEquals(2, $command->execute());
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment