summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichal Čihař <michal@cihar.com>2017-10-10 14:54:29 +0200
committerMichal Čihař <michal@cihar.com>2017-10-10 14:55:39 +0200
commitc87678cf410ac2f9f399788a5dff59f8d65c531b (patch)
treedf8b48948bc347736c3297dbc49af20d9b98a22e /tests
parentd5592264c2422cd4694d6d23f25faa5469cd1a0d (diff)
downloadsql-parser-c87678cf410ac2f9f399788a5dff59f8d65c531b.zip
sql-parser-c87678cf410ac2f9f399788a5dff59f8d65c531b.tar.gz
sql-parser-c87678cf410ac2f9f399788a5dff59f8d65c531b.tar.bz2
Fixed build CREATE TABLE query with PARTITIONS having ENGINE but not VALUES.
Fixes #174 Signed-off-by: Michal Čihař <michal@cihar.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/Builder/CreateStatementTest.php34
1 files changed, 31 insertions, 3 deletions
diff --git a/tests/Builder/CreateStatementTest.php b/tests/Builder/CreateStatementTest.php
index 7b0b03c..abe219a 100644
--- a/tests/Builder/CreateStatementTest.php
+++ b/tests/Builder/CreateStatementTest.php
@@ -183,9 +183,11 @@ class CreateStatementTest extends TestCase
$this->assertEquals($query, $parser->statements[0]->build());
}
- public function testBuilderPartitionsEngine()
+ public function partitionQueries()
{
- $query = <<<EOT
+ return array(
+ array(
+ 'subparts' => <<<EOT
CREATE TABLE `ts` (
`id` int(11) DEFAULT NULL,
`purchased` date DEFAULT NULL
@@ -206,7 +208,33 @@ SUBPARTITION s4 ENGINE=InnoDB,
SUBPARTITION s5 ENGINE=InnoDB
)
)
-EOT;
+EOT
+ ),
+ array(
+ 'parts' => <<<EOT
+CREATE TABLE ptest (
+ `event_date` date NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+PARTITION BY HASH (TO_DAYS(event_date))
+(
+PARTITION p0 ENGINE=InnoDB,
+PARTITION p1 ENGINE=InnoDB,
+PARTITION p2 ENGINE=InnoDB,
+PARTITION p3 ENGINE=InnoDB,
+PARTITION p4 ENGINE=InnoDB
+)
+EOT
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider partitionQueries
+ *
+ * @param string $query
+ */
+ public function testBuilderPartitionsEngine($query)
+ {
$parser = new Parser($query);
$stmt = $parser->statements[0];