summaryrefslogtreecommitdiff
path: root/sqlparse/utils.py
diff options
context:
space:
mode:
authorVictor Uriarte <victor.m.uriarte@intel.com>2016-06-11 16:43:31 -0700
committerVictor Uriarte <victor.m.uriarte@intel.com>2016-06-12 12:32:57 -0700
commitb04b5d326175da6267817faca6239bf02a6e5931 (patch)
tree63e997d31562cb75ec15fe38c5f422217fd490c3 /sqlparse/utils.py
parentc4954af15bbcb93a61d111a218c2d9ba2aa7ea3a (diff)
downloadsqlparse-b04b5d326175da6267817faca6239bf02a6e5931.tar.gz
Refactor raw conversion on split_unquoted_newlines
Diffstat (limited to 'sqlparse/utils.py')
-rw-r--r--sqlparse/utils.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/sqlparse/utils.py b/sqlparse/utils.py
index 8253e0b..4a8646d 100644
--- a/sqlparse/utils.py
+++ b/sqlparse/utils.py
@@ -9,6 +9,7 @@ import itertools
import re
from collections import deque
from contextlib import contextmanager
+from sqlparse.compat import text_type
# This regular expression replaces the home-cooked parser that was here before.
# It is much faster, but requires an extra post-processing step to get the
@@ -33,11 +34,12 @@ SPLIT_REGEX = re.compile(r"""
LINE_MATCH = re.compile(r'(\r\n|\r|\n)')
-def split_unquoted_newlines(text):
+def split_unquoted_newlines(stmt):
"""Split a string on all unquoted newlines.
Unlike str.splitlines(), this will ignore CR/LF/CR+LF if the requisite
character is inside of a string."""
+ text = text_type(stmt)
lines = SPLIT_REGEX.split(text)
outputlines = ['']
for line in lines: