File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ public function testPhpTypeCast(): void
3535 'blob_col ' => "\x10\x11\x12" ,
3636 'timestamp_col ' => '2023-07-11 14:50:23 ' ,
3737 'bool_col ' => false ,
38+ 'bit_col ' => 0b0110_0110 , // 102
3839 ]
3940 );
4041 $ command ->execute ();
@@ -49,6 +50,7 @@ public function testPhpTypeCast(): void
4950 $ blobColPhpType = $ tableSchema ->getColumn ('blob_col ' )?->phpTypecast($ query ['blob_col ' ]);
5051 $ timestampColPhpType = $ tableSchema ->getColumn ('timestamp_col ' )?->phpTypecast($ query ['timestamp_col ' ]);
5152 $ boolColPhpType = $ tableSchema ->getColumn ('bool_col ' )?->phpTypecast($ query ['bool_col ' ]);
53+ $ bitColPhpType = $ tableSchema ->getColumn ('bit_col ' )?->phpTypecast($ query ['bit_col ' ]);
5254
5355 $ this ->assertSame (1 , $ intColPhpType );
5456 $ this ->assertSame (str_repeat ('x ' , 100 ), $ charColPhpType );
@@ -57,6 +59,7 @@ public function testPhpTypeCast(): void
5759 $ this ->assertSame ("\x10\x11\x12" , $ blobColPhpType );
5860 $ this ->assertSame ('2023-07-11 14:50:23 ' , $ timestampColPhpType );
5961 $ this ->assertFalse ($ boolColPhpType );
62+ $ this ->assertSame (0b0110_0110 , $ bitColPhpType );
6063
6164 $ db ->close ();
6265 }
Original file line number Diff line number Diff line change @@ -209,6 +209,19 @@ public static function columns(): array
209209 'scale ' => null ,
210210 'defaultValue ' => new Expression ('CURRENT_TIMESTAMP ' ),
211211 ],
212+ 'bit_col ' => [
213+ 'type ' => 'smallint ' ,
214+ 'dbType ' => 'bit(8) ' ,
215+ 'phpType ' => 'integer ' ,
216+ 'primaryKey ' => false ,
217+ 'allowNull ' => false ,
218+ 'autoIncrement ' => false ,
219+ 'enumValues ' => null ,
220+ 'size ' => 8 ,
221+ 'precision ' => 8 ,
222+ 'scale ' => null ,
223+ 'defaultValue ' => 0b1000_0010 , // 130
224+ ],
212225 ],
213226 'tableName ' => 'type ' ,
214227 ],
Original file line number Diff line number Diff line change @@ -131,7 +131,8 @@ CREATE TABLE "type" (
131131 timestamp_col timestamp NOT NULL DEFAULT ' 2002-01-01 00:00:00' ,
132132 bool_col tinyint (1 ) NOT NULL ,
133133 bool_col2 tinyint (1 ) DEFAULT ' 1' ,
134- ts_default TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
134+ ts_default TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
135+ bit_col BIT (8 ) NOT NULL DEFAULT 130 -- 0b1000_0010
135136);
136137
137138CREATE TABLE "type_bit " (
You can’t perform that action at this time.
0 commit comments