From aa9fa3408deb0b9976c64af21d33688f2e84e577 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Wed, 21 Dec 2005 02:56:08 +0000 Subject: [PATCH] magic-removal: Removed unnecessary comments from sqlite backend base.py git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1756 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/backends/sqlite3/base.py | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py index 1ab9f835e6..a5bc6a4149 100644 --- a/django/db/backends/sqlite3/base.py +++ b/django/db/backends/sqlite3/base.py @@ -4,17 +4,14 @@ SQLite3 backend for django. Requires pysqlite2 (http://pysqlite.org/). from django.db.backends import util from pysqlite2 import dbapi2 as Database -DatabaseError = Database.DatabaseError -# Register adaptors ########################################################### +DatabaseError = Database.DatabaseError Database.register_converter("bool", lambda s: str(s) == '1') Database.register_converter("time", util.typecast_time) Database.register_converter("date", util.typecast_date) Database.register_converter("datetime", util.typecast_timestamp) -# Database wrapper ############################################################ - def utf8rowFactory(cursor, row): def utf8(s): if type(s) == unicode: @@ -54,15 +51,6 @@ class DatabaseWrapper: self.connection.close() self.connection = None -def quote_name(name): - if name.startswith('"') and name.endswith('"'): - return name # Quoting once is enough. - return '"%s"' % name - -dictfetchone = util.dictfetchone -dictfetchmany = util.dictfetchmany -dictfetchall = util.dictfetchall - class SQLiteCursorWrapper(Database.Cursor): """ Django uses "format" style placeholders, but pysqlite2 uses "qmark" style. @@ -82,7 +70,14 @@ class SQLiteCursorWrapper(Database.Cursor): # XXX this seems too simple to be correct... is this right? return query % tuple("?" * num_params) -# Helper functions ############################################################ +def quote_name(name): + if name.startswith('"') and name.endswith('"'): + return name # Quoting once is enough. + return '"%s"' % name + +dictfetchone = util.dictfetchone +dictfetchmany = util.dictfetchmany +dictfetchall = util.dictfetchall def get_last_insert_id(cursor, table_name, pk_name): return cursor.lastrowid @@ -126,8 +121,6 @@ def _sqlite_date_trunc(lookup_type, dt): elif lookup_type == 'day': return "%i-%02i-%02i 00:00:00" % (dt.year, dt.month, dt.day) -# Operators and fields ######################################################## - # SQLite requires LIKE statements to include an ESCAPE clause if the value # being escaped has a percent or underscore in it. # See http://www.sqlite.org/lang_expr.html for an explanation.