#5135: Unicode-branch merge broke insertion of binary data
--------------------------------------+-------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: adrian
Status: new | Component: Database wrapper
Version: SVN | Resolution:
Keywords: binary blob unicode | Stage: Unreviewed
Has_patch: 0 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
--------------------------------------+-------------------------------------
Changes (by [EMAIL PROTECTED]):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Sorry about the formating.. here we go again
Does not work (custom SQL)
{{{
#!python
def create_xbt_file(info_hash, timestamp):
query = "INSERT INTO xbt_files (info_hash, mtime, ctime) VALUES (%s, %s,
%s)"
from django.db import connection
cursor = connection.cursor()
cursor.execute(query, [info_hash, timestamp, timestamp])
}}}
Does work (MySQLdb)
{{{
#!python
def create_xbt_file(info_hash, timestamp):
import MySQLdb
db = MySQLdb.connect("localhost", DATABASE_USER, DATABASE_PASSWORD,
DATABASE_NAME)
cursor = db.cursor()
query = "INSERT INTO xbt_files (info_hash, mtime, ctime) VALUES (%s, %s,
%s)"
cursor.execute(query, [info_hash, timestamp, timestamp])
db.close()
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/5135#comment:1>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---