diff options
| author | Aymeric Augustin | 2013-10-16 22:29:51 +0200 |
|---|---|---|
| committer | Aymeric Augustin | 2013-10-17 18:24:57 +0200 |
| commit | eacf116d61f0e3f47a7c581275a18b3aec8548b1 (patch) | |
| tree | 87674c6ea964f9404eb3d646c518a3ecd54cce4b /debug_toolbar/utils/sqlparse/__init__.py | |
| parent | c1f39b1a168d535e0b90d3c69273e391adf22637 (diff) | |
| download | django-debug-toolbar-eacf116d61f0e3f47a7c581275a18b3aec8548b1.tar.bz2 | |
Switch to an external version of sqlparse.
Diffstat (limited to 'debug_toolbar/utils/sqlparse/__init__.py')
| -rw-r--r-- | debug_toolbar/utils/sqlparse/__init__.py | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/debug_toolbar/utils/sqlparse/__init__.py b/debug_toolbar/utils/sqlparse/__init__.py deleted file mode 100644 index 99db30e..0000000 --- a/debug_toolbar/utils/sqlparse/__init__.py +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright (C) 2008 Andi Albrecht, albrecht.andi@gmail.com -# -# This module is part of python-sqlparse and is released under -# the BSD License: http://www.opensource.org/licenses/bsd-license.php. - -"""Parse SQL statements.""" - - -__version__ = '0.1.3' - - -class SQLParseError(Exception): - """Base class for exceptions in this module.""" - - -# Setup namespace -from debug_toolbar.utils.sqlparse import engine -from debug_toolbar.utils.sqlparse import filters -from debug_toolbar.utils.sqlparse import formatter - - -def parse(sql): - """Parse sql and return a list of statements. - - *sql* is a single string containting one or more SQL statements. - - Returns a tuple of :class:`~sqlparse.sql.Statement` instances. - """ - stack = engine.FilterStack() - stack.full_analyze() - return tuple(stack.run(sql)) - - -def format(sql, **options): - """Format *sql* according to *options*. - - Available options are documented in :ref:`formatting`. - - Returns the formatted SQL statement as string. - """ - stack = engine.FilterStack() - options = formatter.validate_options(options) - stack = formatter.build_filter_stack(stack, options) - stack.postprocess.append(filters.SerializerUnicode()) - return ''.join(stack.run(sql)) - - -def split(sql): - """Split *sql* into single statements. - - Returns a list of strings. - """ - stack = engine.FilterStack() - stack.split_statements = True - return [unicode(stmt) for stmt in stack.run(sql)] |
