Skip to content

Commit 6ccc924

Browse files
committed
Merge #382 - Fix #351 Support the compression options in CREATE TABLE statements
Fixes: #351 Pull-request: #382 Signed-off-by: William Desportes <[email protected]>
2 parents e9fa3d2 + 1266ad5 commit 6ccc924

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

src/Statements/CreateStatement.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,14 @@ class CreateStatement extends Statement
211211
21,
212212
'var',
213213
],
214+
'PAGE_COMPRESSED' => [
215+
22,
216+
'var',
217+
],
218+
'PAGE_COMPRESSION_LEVEL' => [
219+
23,
220+
'var',
221+
],
214222
];
215223

216224
/**

tests/Builder/AlterStatementTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,12 @@ public function testBuilder(): void
2020

2121
$this->assertEquals($query, $stmt->build());
2222
}
23+
24+
public function testBuilderCompressed(): void
25+
{
26+
$query = 'ALTER TABLE `user` CHANGE `message` `message` TEXT COMPRESSED';
27+
$parser = new Parser($query);
28+
$stmt = $parser->statements[0];
29+
$this->assertEquals($query, $stmt->build());
30+
}
2331
}

tests/Builder/CreateStatementTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,16 @@ public function testBuilderDefaultInt(): void
7070
);
7171
}
7272

73+
public function testBuilderCompressed(): void
74+
{
75+
$parser = new Parser('CREATE TABLE users ( user_id int ) PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;');
76+
$stmt = $parser->statements[0];
77+
$this->assertEquals(
78+
"CREATE TABLE users (\n `user_id` int\n) PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9",
79+
$stmt->build()
80+
);
81+
}
82+
7383
public function testBuilderCollate(): void
7484
{
7585
$parser = new Parser(

0 commit comments

Comments
 (0)