diff options
author | Amjith Ramanujam <amjith.r@gmail.com> | 2018-11-25 20:08:22 -0800 |
---|---|---|
committer | Amjith Ramanujam <amjith.r@gmail.com> | 2018-11-25 20:08:22 -0800 |
commit | a4b137f551f85c8267b921fb9ffb2b276109f78a (patch) | |
tree | a69bd0694cf80f364260cadf1cd29c1746926871 | |
parent | 0dac3632acfe4c26aca75a0e0c2d83e75bdec0fd (diff) |
Remove the StopIteration bug.
-rw-r--r-- | litecli/packages/parseutils.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/litecli/packages/parseutils.py b/litecli/packages/parseutils.py index 274ef7f..92fe365 100644 --- a/litecli/packages/parseutils.py +++ b/litecli/packages/parseutils.py @@ -87,11 +87,11 @@ def extract_from_part(parsed, stop_at_punctuation=True): for x in extract_from_part(item, stop_at_punctuation): yield x elif stop_at_punctuation and item.ttype is Punctuation: - raise StopIteration + return # An incomplete nested select won't be recognized correctly as a # sub-select. eg: 'SELECT * FROM (SELECT id FROM user'. This causes # the second FROM to trigger this elif condition resulting in a - # StopIteration. So we need to ignore the keyword if the keyword + # `return`. So we need to ignore the keyword if the keyword # FROM. # Also 'SELECT * FROM abc JOIN def' will trigger this elif # condition. So we need to ignore the keyword JOIN and its variants @@ -101,7 +101,7 @@ def extract_from_part(parsed, stop_at_punctuation=True): and (not item.value.upper() == "FROM") and (not item.value.upper().endswith("JOIN")) ): - raise StopIteration + return else: yield item elif ( |