]> git.phdru.name Git - sqlconvert.git/commitdiff
Set encoding to utf-8 for demo scripts
authorOleg Broytman <phd@phdru.name>
Mon, 5 Sep 2016 19:15:38 +0000 (22:15 +0300)
committerOleg Broytman <phd@phdru.name>
Mon, 5 Sep 2016 19:15:38 +0000 (22:15 +0300)
demo/group-file.py
demo/group-sql.py
demo/parse-file.py
demo/parse-sql.py

index b8a70214a2f475d41f8ef3907c53ea90275b782e..8d00507f1a34c9e7a1712e8df0d9a434135e7b82 100755 (executable)
@@ -8,7 +8,7 @@ from sqlconvert.process_tokens import find_error, StatementGrouper
 
 
 def main(filename):
-    grouper = StatementGrouper()
+    grouper = StatementGrouper(encoding='utf-8')
     with open(filename) as infile:
         for line in infile:
             grouper.process_line(line)
@@ -18,14 +18,14 @@ def main(filename):
                     if find_error(statement):
                         print("ERRORS IN QUERY")
                     process_statement(statement)
-                    print_tokens(statement)
+                    print_tokens(statement, encoding='utf-8')
                     print()
                     statement._pprint_tree()
                 print("----------")
     tokens = grouper.close()
     if tokens:
         for token in tokens:
-            print_tokens(token)
+            print_tokens(token, encoding='utf-8')
             print(repr(token))
 
 
index c0bf2d29a49c8c110ac25ea4537169362c4f37b8..101ab4a2a4b12c52d979808d963d7cf81fedd5bc 100755 (executable)
@@ -8,7 +8,7 @@ from sqlconvert.process_tokens import find_error, StatementGrouper
 
 
 def main(*queries):
-    grouper = StatementGrouper()
+    grouper = StatementGrouper(encoding='utf-8')
     for query in queries:
         grouper.process_line(query)
         if grouper.statements:
@@ -17,14 +17,14 @@ def main(*queries):
                 if find_error(statement):
                     print("ERRORS IN QUERY")
                 process_statement(statement)
-                print_tokens(statement)
+                print_tokens(statement, encoding='utf-8')
                 print()
                 statement._pprint_tree()
             print("----------")
     tokens = grouper.close()
     if tokens:
         for token in tokens:
-            print_tokens(token)
+            print_tokens(token, encoding='utf-8')
             print(repr(token))
 
 
index e19bde2f6b87dde3bca869dc35783285134c0d56..bba609618fb1c168940c120de826176b19137276 100755 (executable)
@@ -11,12 +11,12 @@ from sqlconvert.process_tokens import find_error
 def main(filename):
     with open(filename) as infile:
         for query in infile:
-            for parsed in parse(query):
+            for parsed in parse(query, encoding='utf-8'):
                 print("----------")
                 if find_error(parsed):
                     print("ERRORS IN QUERY")
                 process_statement(parsed)
-                print_tokens(parsed)
+                print_tokens(parsed, encoding='utf-8')
                 print()
                 parsed._pprint_tree()
     print("----------")
index e4be365fc8eed012ea8cda8b490d91f4ff7651d8..99f8678e9aded727593f96a35bec129cce7dc3f3 100755 (executable)
@@ -10,12 +10,12 @@ from sqlconvert.process_tokens import find_error
 
 def main(*queries):
     for query in queries:
-        for parsed in parse(query):
+        for parsed in parse(query, encoding='utf-8'):
             print("----------")
             if find_error(parsed):
                 print("ERRORS IN QUERY")
             process_statement(parsed)
-            print_tokens(parsed)
+            print_tokens(parsed, encoding='utf-8')
             print()
             parsed._pprint_tree()
         print("----------")