summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPrzemek Szalko <p.szalko@gmail.com>2019-02-15 15:19:23 +0100
committerPrzemek Szalko <p.szalko@gmail.com>2019-02-15 15:19:23 +0100
commitef95576797473973d159e662303cbc3df048302d (patch)
treea729a6615951edf6982ffe2ac6d8e514edb8117b /tests
parent457d094e9333dc83e2867032db2ffca894066b29 (diff)
downloadsql-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.php11
-rw-r--r--tests/Builder/ReplaceStatementTest.php12
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()
+ );
+ }
}