I tried this:

import MySQLdb
db = MySQLdb.connect(...)
c = db.cursor()
c.execute("create table mtest (pk int not null auto_increment primary
key, s varchar(5)) type=InnoDB")

print c.execute("insert into mtest values (null,'12345')")
print c.messages
print c.lastrowid

print c.execute("insert into mtest values (null,'123456789')")
print c.messages
print c.lastrowid

And I got this:

1
[]
21

1
[(<class '_mysql_exceptions.Warning'>, ('Warning', 1265L, "Data
truncated for column 's' at row 1"))]
22

So it seems to my MySQLdb actually returns primary key for INSERT that
causes Warning.

One thing that is different here from Django scenario is that Warning
is not being thrown,
does someone know how to turn on raising Warning exceptions in
MySQLdb?

--
Tomasz Zieliński
http://pyconsultant.eu
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to