summaryrefslogtreecommitdiffstats
path: root/examples/examples.php
diff options
context:
space:
mode:
Diffstat (limited to 'examples/examples.php')
-rw-r--r--examples/examples.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/examples/examples.php b/examples/examples.php
index f8bf524..869be4a 100644
--- a/examples/examples.php
+++ b/examples/examples.php
@@ -38,4 +38,31 @@ foreach($statements as $sql) {
echo "<hr />";
echo SqlFormatter::highlight($sql);
}
+
+
+$split_statements = array(
+ 'DROP TABLE IF EXISTS MyTable;
+ CREATE TABLE MyTable ( id int );
+ INSERT INTO MyTable (id)
+ VALUES
+ (1),(2),(3),(4);
+ SELECT * FROM MyTable;',
+
+ 'SELECT ";"; SELECT ";\"; a;";
+ SELECT ";
+ abc";
+ SELECT a,b #comment;
+ FROM test;'
+);
+
+echo "<h1>Splitting Queries</h1>";
+foreach($split_statements as $sql) {
+ echo "<hr />";
+ $queries = SqlFormatter::splitQuery($sql);
+ echo "<ol>";
+ foreach($queries as $query) {
+ echo "<li>".SqlFormatter::highlight($query)."</li>";
+ }
+ echo "</ol>";
+}
?>