summaryrefslogtreecommitdiff
path: root/django/db/backends/sqlite3/base.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-07-04 12:11:04 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-07-04 12:11:04 +0000
commit953badbea5a04159adbfa970f5805c0232b6a401 (patch)
tree9569f74b5d382b222613a1085efd0de21937e95f /django/db/backends/sqlite3/base.py
parent4c958b15b250866b70ded7d82aa532f1e57f96ae (diff)
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes. Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702 git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/backends/sqlite3/base.py')
-rw-r--r--django/db/backends/sqlite3/base.py19
1 files changed, 6 insertions, 13 deletions
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index c4ecf5f578..a0b1341b53 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -34,14 +34,6 @@ Database.register_converter("TIMESTAMP", util.typecast_timestamp)
Database.register_converter("decimal", util.typecast_decimal)
Database.register_adapter(decimal.Decimal, util.rev_typecast_decimal)
-def utf8rowFactory(cursor, row):
- def utf8(s):
- if type(s) == unicode:
- return s.encode("utf-8")
- else:
- return s
- return [utf8(r) for r in row]
-
try:
# Only exists in Python 2.4+
from threading import local
@@ -69,7 +61,6 @@ class DatabaseWrapper(local):
self.connection.create_function("django_date_trunc", 2, _sqlite_date_trunc)
self.connection.create_function("regexp", 2, _sqlite_regexp)
cursor = self.connection.cursor(factory=SQLiteCursorWrapper)
- cursor.row_factory = utf8rowFactory
if settings.DEBUG:
return util.CursorDebugWrapper(cursor, self)
else:
@@ -85,8 +76,9 @@ class DatabaseWrapper(local):
def close(self):
from django.conf import settings
- # If database is in memory, closing the connection destroys the database.
- # To prevent accidental data loss, ignore close requests on an in-memory db.
+ # If database is in memory, closing the connection destroys the
+ # database. To prevent accidental data loss, ignore close requests on
+ # an in-memory db.
if self.connection is not None and settings.DATABASE_NAME != ":memory:":
self.connection.close()
self.connection = None
@@ -181,10 +173,10 @@ def get_autoinc_sql(table):
return None
def get_sql_flush(style, tables, sequences):
- """Return a list of SQL statements required to remove all data from
+ """
+ Return a list of SQL statements required to remove all data from
all tables in the database (without actually removing the tables
themselves) and put the database in an empty 'initial' state
-
"""
# NB: The generated SQL below is specific to SQLite
# Note: The DELETE FROM... SQL generated below works for SQLite databases
@@ -241,3 +233,4 @@ OPERATOR_MAPPING = {
'istartswith': "LIKE %s ESCAPE '\\'",
'iendswith': "LIKE %s ESCAPE '\\'",
}
+