File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ def is_keyword(value):
6464 (r'-?\d+(?![_A-ZÀ-Ü])' , tokens .Number .Integer ),
6565 (r"'(''|\\\\|\\'|[^'])*'" , tokens .String .Single ),
6666 # not a real string literal in ANSI SQL:
67+ (r'"(""|\\\\|\\"|[^"])*"' , tokens .String .Symbol ),
6768 (r'(""|".*?[^\\]")' , tokens .String .Symbol ),
6869 # sqlite names can be escaped with [square brackets]. left bracket
6970 # cannot be preceded by word character or a right bracket --
Original file line number Diff line number Diff line change @@ -139,3 +139,13 @@ def test_split_simple():
139139 assert len (stmts ) == 2
140140 assert stmts [0 ] == 'select * from foo;'
141141 assert stmts [1 ] == 'select * from bar;'
142+
143+
144+ def test_split_quotes_with_new_line ():
145+ stmts = sqlparse .split ('select "foo\n bar"' )
146+ assert len (stmts ) == 1
147+ assert stmts [0 ] == 'select "foo\n bar"'
148+
149+ stmts = sqlparse .split ("select 'foo\n \b ar'" )
150+ assert len (stmts ) == 1
151+ assert stmts [0 ] == "select 'foo\n \b ar'"
You can’t perform that action at this time.
0 commit comments