File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed
Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ Enhancements
66* Add STRAIGHT_JOIN statement (by Yago Riveiro).
77* Function.get_parameters() now returns the parameter if only one parameter is
88 given (issue94, by wayne.wuw).
9+ * sqlparse.split() now removes leading and trailing whitespaces from splitted
10+ statements.
911
1012
1113Release 0.1.7 (Apr 06, 2013)
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ def split(sql, encoding=None):
6767 """
6868 stack = engine .FilterStack ()
6969 stack .split_statements = True
70- return [unicode (stmt ) for stmt in stack .run (sql , encoding )]
70+ return [unicode (stmt ). strip () for stmt in stack .run (sql , encoding )]
7171
7272
7373from sqlparse .engine .filter import StatementFilter
Original file line number Diff line number Diff line change @@ -131,3 +131,10 @@ def test_encoding_parsestream(self):
131131 stream = StringIO ("SELECT 1; SELECT 2;" )
132132 stmts = list (sqlparse .parsestream (stream ))
133133 self .assertEqual (type (stmts [0 ].tokens [0 ].value ), unicode )
134+
135+
136+ def test_split_simple ():
137+ stmts = sqlparse .split ('select * from foo; select * from bar;' )
138+ assert len (stmts ) == 2
139+ assert stmts [0 ] == 'select * from foo;'
140+ assert stmts [1 ] == 'select * from bar;'
You can’t perform that action at this time.
0 commit comments