Is it possible to perform an update on a row with .doInsert() if the new
record would cause a duplicate value for the primary key?
Basically I want to do something like this:
If you specify the ON DUPLICATE KEY UPDATE clause (new in MySQL 4.1.0), and
a row is inserted that would cause a duplicate value in a UNIQUE index or
PRIMARY KEY, an UPDATE of the old row is performed. For example, if column a
is declared as UNIQUE and contains the value 1, the following two statements
have identical effect:
mysql> INSERT INTO table (a,b,c) VALUES (1,2,3)
-> ON DUPLICATE KEY UPDATE c=c+1;
mysql> UPDATE table SET c=c+1 WHERE a=1;
http://dev.mysql.com/doc/mysql/en/insert.html
- Aaron
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]