File tree Expand file tree Collapse file tree 4 files changed +18
-1
lines changed
Expand file tree Collapse file tree 4 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ Bug Fixes
2121* Improved parsing of IN(...) statements (issue566, pr567 by hurcy).
2222* Preserve line breaks when removing comments (issue484).
2323* Fix parsing error when using square bracket notation (issue583).
24+ * Fix splitting when using DECLARE ... HANDLER (issue581).
2425
2526
2627Release 0.3.1 (Feb 29, 2020)
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ def is_keyword(value):
8484 (r'DOUBLE\s+PRECISION\b' , tokens .Name .Builtin ),
8585 (r'GROUP\s+BY\b' , tokens .Keyword ),
8686 (r'ORDER\s+BY\b' , tokens .Keyword ),
87+ (r'HANDLER\s+FOR\b' , tokens .Keyword ),
8788 (r'(LATERAL\s+VIEW\s+)'
8889 r'(EXPLODE|INLINE|PARSE_URL_TUPLE|POSEXPLODE|STACK)\b' ,
8990 tokens .Keyword ),
@@ -294,7 +295,6 @@ def is_keyword(value):
294295 'GRANTED' : tokens .Keyword ,
295296 'GROUPING' : tokens .Keyword ,
296297
297- 'HANDLER' : tokens .Keyword ,
298298 'HAVING' : tokens .Keyword ,
299299 'HIERARCHY' : tokens .Keyword ,
300300 'HOLD' : tokens .Keyword ,
Original file line number Diff line number Diff line change 1+ create procedure proc1()
2+ begin
3+ declare handler for foo begin end;
4+ select 1 ;
5+ end;
6+
7+ create procedure proc2()
8+ begin
9+ select 1 ;
10+ end;
Original file line number Diff line number Diff line change @@ -154,3 +154,9 @@ def test_split_quotes_with_new_line():
154154 stmts = sqlparse .split ("select 'foo\n \b ar'" )
155155 assert len (stmts ) == 1
156156 assert stmts [0 ] == "select 'foo\n \b ar'"
157+
158+
159+ def test_split_mysql_handler_for (load_file ):
160+ # see issue581
161+ stmts = sqlparse .split (load_file ('mysql_handler.sql' ))
162+ assert len (stmts ) == 2
You can’t perform that action at this time.
0 commit comments