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
This commit is contained in:
parent
f7e66f038d
commit
aa9fa3408d
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue