summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2020-09-30 09:31:40 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2020-09-30 09:31:40 +0200
commit990500a149920b02b2b6e5ffe6e747dea7c6739e (patch)
treeac08759cd29dc2fa388766c0fbdbb92d9528da59 /tests
parentcd4a723ee509437166b0f3e0fd62322ecc7bbd99 (diff)
downloadsqlparse-990500a149920b02b2b6e5ffe6e747dea7c6739e.tar.gz
Fix splitting when using DECLARE ... HANDLER (fixes #581).
Diffstat (limited to 'tests')
-rw-r--r--tests/files/mysql_handler.sql10
-rw-r--r--tests/test_split.py6
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/files/mysql_handler.sql b/tests/files/mysql_handler.sql
new file mode 100644
index 0000000..702374e
--- /dev/null
+++ b/tests/files/mysql_handler.sql
@@ -0,0 +1,10 @@
+create procedure proc1()
+begin
+ declare handler for foo begin end;
+ select 1;
+end;
+
+create procedure proc2()
+begin
+ select 1;
+end;
diff --git a/tests/test_split.py b/tests/test_split.py
index c073298..f69e3d2 100644
--- a/tests/test_split.py
+++ b/tests/test_split.py
@@ -154,3 +154,9 @@ def test_split_quotes_with_new_line():
stmts = sqlparse.split("select 'foo\n\bar'")
assert len(stmts) == 1
assert stmts[0] == "select 'foo\n\bar'"
+
+
+def test_split_mysql_handler_for(load_file):
+ # see issue581
+ stmts = sqlparse.split(load_file('mysql_handler.sql'))
+ assert len(stmts) == 2