diff options
author | Przemek Szalko <p.szalko@gmail.com> | 2019-02-15 15:19:23 +0100 |
---|---|---|
committer | Przemek Szalko <p.szalko@gmail.com> | 2019-02-15 15:19:23 +0100 |
commit | ef95576797473973d159e662303cbc3df048302d (patch) | |
tree | a729a6615951edf6982ffe2ac6d8e514edb8117b /tests | |
parent | 457d094e9333dc83e2867032db2ffca894066b29 (diff) | |
download | sql-parser-ef95576797473973d159e662303cbc3df048302d.zip sql-parser-ef95576797473973d159e662303cbc3df048302d.tar.gz sql-parser-ef95576797473973d159e662303cbc3df048302d.tar.bz2 |
Fixed statements INSERT and REPLACE + options.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Builder/InsertStatementTest.php | 11 | ||||
-rw-r--r-- | tests/Builder/ReplaceStatementTest.php | 12 |
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/Builder/InsertStatementTest.php b/tests/Builder/InsertStatementTest.php index 84daf3a..cf46143 100644 --- a/tests/Builder/InsertStatementTest.php +++ b/tests/Builder/InsertStatementTest.php @@ -63,5 +63,16 @@ class InsertStatementTest extends TestCase 'INSERT INTO tbl SELECT * FROM bar ON DUPLICATE KEY UPDATE baz = 1', $stmt->build() ); + + /* Assertion 6 */ + /* INSERT [OPTIONS] INTO ... */ + $parser = new Parser( + 'INSERT DELAYED IGNORE INTO tbl SELECT * FROM bar' + ); + $stmt = $parser->statements[0]; + $this->assertEquals( + 'INSERT DELAYED IGNORE INTO tbl SELECT * FROM bar', + $stmt->build() + ); } } diff --git a/tests/Builder/ReplaceStatementTest.php b/tests/Builder/ReplaceStatementTest.php index ad0c141..ee5b95a 100644 --- a/tests/Builder/ReplaceStatementTest.php +++ b/tests/Builder/ReplaceStatementTest.php @@ -43,4 +43,16 @@ class ReplaceStatementTest extends TestCase $stmt->build() ); } + + public function testBuilderSelectDelayed() + { + $parser = new Parser( + 'REPLACE DELAYED INTO tbl(col1, col2, col3) SELECT col1, col2, col3 FROM tbl2' + ); + $stmt = $parser->statements[0]; + $this->assertEquals( + 'REPLACE DELAYED INTO tbl(`col1`, `col2`, `col3`) SELECT col1, col2, col3 FROM tbl2', + $stmt->build() + ); + } } |