summaryrefslogtreecommitdiff
path: root/sqlparse
diff options
context:
space:
mode:
Diffstat (limited to 'sqlparse')
-rw-r--r--sqlparse/filters.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/sqlparse/filters.py b/sqlparse/filters.py
index 6bb3415..3d2355a 100644
--- a/sqlparse/filters.py
+++ b/sqlparse/filters.py
@@ -218,10 +218,11 @@ class StripWhitespaceFilter(Filter):
tlist.tokens.pop(-2)
self._stripws_default(tlist)
- def process(self, stack, stmt):
- [self.process(stack, sgroup) for sgroup in stmt.get_sublists()]
+ def process(self, stack, stmt, depth=0):
+ [self.process(stack, sgroup, depth+1)
+ for sgroup in stmt.get_sublists()]
self._stripws(stmt)
- if stmt.tokens[-1].is_whitespace():
+ if depth == 0 and stmt.tokens[-1].is_whitespace():
stmt.tokens.pop(-1)
@@ -610,4 +611,4 @@ class Limit(Filter):
if index and token_type in Keyword and value == 'LIMIT':
return stream[4 - index][1]
- return -1 \ No newline at end of file
+ return -1