Inserting empty string into auto_increment column in MySQL 5
Posted
by QmunkE
on Stack Overflow
See other posts from Stack Overflow
or by QmunkE
Published on 2010-06-07T12:34:20Z
Indexed on
2010/06/07
12:52 UTC
Read the original article
Hit count: 129
Hi,
I've inherited a project which we are trying to migrate to MySQL 5 from MySQL 4.0(!) and from myISAM to InnoDB. Queries are now falling down because they are being constructed using an ADODB connection's ->qstr() on all parameters, including ints. Where no value is provided I end up with:
INSERT INTO tablename VALUES ('', 'stuff'...)
where the first column is an auto_increment. This causes an error (fair enough since '' isn't an int). Is there a switch in MySQL to make it behave as it used to (I assume it just silently converted to 0?)
Thanks.
© Stack Overflow or respective owner