MySQLdb warnings ... what caused them?
Sheila King
sheila at spamcop.net
Tue May 13 15:12:12 EDT 2003
OK, let's just say I "solved" this problem, and would like to crawl into a
hole now and hide.
However, in fairness to the newsgroup, I will show the problem that caused
the warning (it was a data truncation problem):
mysql> DESCRIBE test
-> ;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| ID | varchar(4) | YES | | NULL | |
| name | varchar(8) | YES | | NULL | |
| phone | varchar(10) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
c.executemany("""INSERT INTO test (ID, name, phone) VALUES (%s, %s, %s)""",
[ (1, "mary", "111-222-3333"),
(2, "john", "444-555-6666"),
(3, "steve", "777-888-9999")] )
Notice that the phone field only allows for 10 characters to be stored, but
I'm trying to insert data into that field that is longer than 10
characters.
Oy!
/me goes into hiding mode.
--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/
More information about the Python-list
mailing list