]> git.phdru.name Git - sqlconvert.git/commitdiff
Fix a bug: do not add additional newlines
authorOleg Broytman <phd@phdru.name>
Sat, 27 Aug 2016 19:19:05 +0000 (22:19 +0300)
committerOleg Broytman <phd@phdru.name>
Sat, 27 Aug 2016 19:19:05 +0000 (22:19 +0300)
As the package doesn't strip newlines from the input string
(to preserve original newlines) there is no need to separate lines
with additional newlines.

mysql2sql/process_tokens.py

index 7e323543f81f9baa5f65444e7edc8327e16d7eb7..9e1e760a3e4e65461511457f1994275b0339c4e7 100644 (file)
@@ -42,7 +42,7 @@ class StatementGrouper(object):
         self.process_lines()
 
     def process_lines(self):
-        statements = parse('\n'.join(self.lines))
+        statements = parse(''.join(self.lines))
         last_stmt = statements[-1]
         for i in xrange(len(last_stmt.tokens) - 1, 0, -1):
             token = last_stmt.tokens[i]
@@ -64,7 +64,7 @@ class StatementGrouper(object):
     def close(self):
         if not self.lines:
             return
-        tokens = parse('\n'.join(self.lines))
+        tokens = parse(''.join(self.lines))
         for token in tokens:
             if (token.ttype not in (Comment.Single, Comment.Multiline,
                                     Newline, Whitespace)):