diff options
Diffstat (limited to 'sqlparse')
| -rw-r--r-- | sqlparse/filters.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sqlparse/filters.py b/sqlparse/filters.py index 9ee2ce0..8430687 100644 --- a/sqlparse/filters.py +++ b/sqlparse/filters.py @@ -93,6 +93,9 @@ class IncludeStatement: """Filter that enable a INCLUDE statement""" def __init__(self, dirpath=".", maxRecursive=10): + if maxRecursive <= 0: + raise ValueError('Max recursion limit reached') + self.dirpath = abspath(dirpath) self.maxRecursive = maxRecursive @@ -131,7 +134,8 @@ class IncludeStatement: # and add all its tokens to the main stack recursively # [ToDo] Add maximum recursive iteration value stack = FilterStack() - stack.preprocess.append(IncludeStatement(self.dirpath)) + stack.preprocess.append(IncludeStatement(self.dirpath, + self.maxRecursive - 1)) for tv in stack.run(raw_sql): yield tv |
