]> git.phdru.name Git - sqlconvert.git/blobdiff - demo/demo-process.py
Build(setup.py): Use setuptools instead of distutils
[sqlconvert.git] / demo / demo-process.py
index 5bce038a454f66183174ef2c7343e3292e285629..a81f93ef1787cf1bae3658fa1a82a1ac757e8365 100755 (executable)
@@ -2,7 +2,6 @@
 from __future__ import print_function
 
 import argparse
-import sys
 from sqlconvert.process_mysql import process_statement
 from sqlconvert.print_tokens import print_tokens
 from sqlconvert.process_tokens import find_error, StatementGrouper
@@ -12,16 +11,15 @@ def process_lines(*lines):
     grouper = StatementGrouper(encoding='utf-8')
     for line in lines:
         grouper.process_line(line)
-        if grouper.statements:
-            for statement in grouper.get_statements():
-                print("----------")
-                if find_error(statement):
-                    print("ERRORS IN QUERY")
-                process_statement(statement)
+        for statement in grouper.get_statements():
+            print("----- -----")
+            if find_error(statement):
+                print("ERRORS IN QUERY")
+            for statement in process_statement(statement):
                 print_tokens(statement, encoding='utf-8')
                 print()
                 statement._pprint_tree()
-            print("----------")
+            print("-----/-----")
     tokens = grouper.close()
     if tokens:
         for token in tokens: