]> git.phdru.name Git - sqlconvert.git/commitdiff
Move requote_names from process_tokens.py to process_mysql.py
authorOleg Broytman <phd@phdru.name>
Sun, 4 Sep 2016 13:36:12 +0000 (16:36 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 4 Sep 2016 13:36:12 +0000 (16:36 +0300)
demo/group-file.py
demo/group-sql.py
demo/parse-file.py
demo/parse-sql.py
scripts/mysql2sql
sqlconvert/process_mysql.py [new file with mode: 0644]
sqlconvert/process_tokens.py
tests/test_stgrouper.py
tests/test_tokens.py

index 54d1cc26795f2ecd4df8422a94c9595351741b54..e59ff45dd8b707292d4c07bad6c0f348fa8759a9 100755 (executable)
@@ -3,8 +3,8 @@ from __future__ import print_function
 
 import sys
 from sqlconvert.print_tokens import print_tokens
-from sqlconvert.process_tokens import requote_names, find_error, \
-    StatementGrouper
+from sqlconvert.process_mysql import requote_names
+from sqlconvert.process_tokens import find_error, StatementGrouper
 
 
 def main(filename):
index 25493d5b381d0bf5441b00d207127d2de150e650..854a0d135ec3124b0a6de9e0f06072b8132d2144 100755 (executable)
@@ -3,8 +3,8 @@ from __future__ import print_function
 
 import sys
 from sqlconvert.print_tokens import print_tokens
-from sqlconvert.process_tokens import requote_names, find_error, \
-    StatementGrouper
+from sqlconvert.process_mysql import requote_names
+from sqlconvert.process_tokens import find_error, StatementGrouper
 
 
 def main(*queries):
index 34a99b727226706194157a3625e2bb797bb02a37..bf65eec3f61e620ce79aa1416ddd3d78eeaa3780 100755 (executable)
@@ -4,7 +4,8 @@ from __future__ import print_function
 import sys
 from sqlparse import parse
 from sqlconvert.print_tokens import print_tokens
-from sqlconvert.process_tokens import requote_names, find_error
+from sqlconvert.process_mysql import requote_names
+from sqlconvert.process_tokens import find_error
 
 
 def main(filename):
index cb3f1656f3ebb182e7adbd4a8845701245fe3750..1cbe0a11e8632f35c6a986db3a9acbe53f24b5d2 100755 (executable)
@@ -4,7 +4,8 @@ from __future__ import print_function
 import sys
 from sqlparse import parse
 from sqlconvert.print_tokens import print_tokens
-from sqlconvert.process_tokens import requote_names, find_error
+from sqlconvert.process_mysql import requote_names
+from sqlconvert.process_tokens import find_error
 
 
 def main(*queries):
index d3178e9936219dc0b4d1acb7faf0c3ce27adfcb1..5ba8fd741e1f021e7133aa9f79393c108f161505 100755 (executable)
@@ -8,7 +8,8 @@ import sys
 
 from sqlparse.compat import text_type
 from sqlconvert.print_tokens import print_tokens
-from sqlconvert.process_tokens import requote_names, StatementGrouper
+from sqlconvert.process_mysql import requote_names
+from sqlconvert.process_tokens import StatementGrouper
 
 from m_lib.defenc import default_encoding
 from m_lib.pbar.tty_pbar import ttyProgressBar
diff --git a/sqlconvert/process_mysql.py b/sqlconvert/process_mysql.py
new file mode 100644 (file)
index 0000000..b11eccb
--- /dev/null
@@ -0,0 +1,15 @@
+
+from sqlparse.tokens import Name
+
+
+def requote_names(token_list):
+    """Remove backticks, quote non-lowercase identifiers"""
+    for token in token_list.flatten():
+        if token.ttype is Name:
+            value = token.value
+            if (value[0] == "`") and (value[-1] == "`"):
+                value = value[1:-1]
+            if value.islower():
+                token.normalized = token.value = value
+            else:
+                token.normalized = token.value = '"%s"' % value
index 1e74ac9b69a5a416bb6cf8b0418219095b73b357..0bbf94cb703ecb8963d93eeac147ecff0c19f1d4 100644 (file)
@@ -1,21 +1,7 @@
 
 from sqlparse import parse
 from sqlparse.compat import PY3
-from sqlparse.tokens import Name, Error, Punctuation, Comment, Newline, \
-    Whitespace
-
-
-def requote_names(token_list):
-    """Remove backticks, quote non-lowercase identifiers"""
-    for token in token_list.flatten():
-        if token.ttype is Name:
-            value = token.value
-            if (value[0] == "`") and (value[-1] == "`"):
-                value = value[1:-1]
-            if value.islower():
-                token.normalized = token.value = value
-            else:
-                token.normalized = token.value = '"%s"' % value
+from sqlparse.tokens import Error, Punctuation, Comment, Newline, Whitespace
 
 
 def find_error(token_list):
index 3354b02e1ab2948530d00cd5db0d14e40721553c..299ea6cd1ec87224f1a9f51510285f6e9c650f0a 100755 (executable)
@@ -4,7 +4,8 @@
 import unittest
 
 from sqlconvert.print_tokens import tlist2str
-from sqlconvert.process_tokens import requote_names, StatementGrouper
+from sqlconvert.process_mysql import requote_names
+from sqlconvert.process_tokens import StatementGrouper
 from tests import main
 
 
index da62e43293938814d983e9e444d7a49995a9756c..692121ed321a84613e731b270ba8246997e9e587 100755 (executable)
@@ -4,8 +4,8 @@
 import unittest
 from sqlparse import parse
 
-from sqlconvert.process_tokens import requote_names
 from sqlconvert.print_tokens import tlist2str
+from sqlconvert.process_mysql import requote_names
 from tests import main