def get_typecast(self): """Returns the typecast or ``None`` of this object as a string.""" marker = self.token_next_match(0, T.Punctuation, '::') if marker is None: return None next_ = self.token_next(self.token_index(marker), False) if next_ is None: return None return u(next_)
def split(sql, encoding=None): """Split *sql* into single statements. :param sql: A string containting one or more SQL statements. :param encoding: The encoding of the statement (optional). :returns: A list of strings. """ stack = engine.FilterStack() stack.split_statements = True return [u(stmt).strip() for stmt in stack.run(sql, encoding)]
def _get_repr_value(self): raw = u(self) if len(raw) > 7: raw = raw[:6] + u'...' return re.sub('\s+', ' ', raw)
def __str__(self): if sys.version_info[0] == 3: return self.value else: return u(self).encode('utf-8')
def _to_string(self): if sys.version_info[0] == 3: return ''.join(x.value for x in self.flatten()) else: return ''.join(u(x) for x in self.flatten())