diff options
-rw-r--r-- | src/Components/Expression.php | 3 | ||||
-rw-r--r-- | tests/Builder/CreateStatementTest.php | 19 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/Components/Expression.php b/src/Components/Expression.php index 0b9f215..8d6471c 100644 --- a/src/Components/Expression.php +++ b/src/Components/Expression.php @@ -254,6 +254,9 @@ class Expression extends Component continue; } $isExpr = true; + } elseif ($brackets === 0 && count($ret->expr) > 0) { + /* End of expression */ + break; } } diff --git a/tests/Builder/CreateStatementTest.php b/tests/Builder/CreateStatementTest.php index 2318a46..6e41d5d 100644 --- a/tests/Builder/CreateStatementTest.php +++ b/tests/Builder/CreateStatementTest.php @@ -42,6 +42,25 @@ class CreateStatementTest extends TestCase ); } + public function testBuilderDefaultComment() + { + $parser = new Parser( + "CREATE TABLE `wp_audio` (" . + " `somedata` int(11) DEFAULT NULL COMMENT 'ma data', " . + " `someinfo` int(11) DEFAULT NULL COMMENT 'ma info' ". + " )" + ); + $stmt = $parser->statements[0]; + + $this->assertEquals( + "CREATE TABLE `wp_audio` (\n" . + " `somedata` int(11) DEFAULT NULL COMMENT 'ma data',\n" . + " `someinfo` int(11) DEFAULT NULL COMMENT 'ma info'\n". + ") ", + $stmt->build() + ); + } + public function testBuilderTable() { $stmt = new CreateStatement(); |