[Zope] dtml Z SQL doubt

Paul Winkler pw_lists at slinkp.com
Thu Mar 22 11:18:02 EDT 2007


On Thu, Mar 22, 2007 at 08:11:21AM -0400, Allen Schmidt Sr. wrote:
> Just use REPLACE instead of INSERT.
> If REPLACE statement is able to determine a unique value for a row and 
> sees that that unique value exists for a row, the valued will be 
> updated. If it does not exist, a new row will be inserted. This is what 
> I use with MySQL.

Or, depending on what you want, the INSERT...ON DUPLICATE KEY UPDATE
syntax can be used.
http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html

Note that both of these idioms are specific to MySQL and not portable
to other databases.

-PW


-- 

Paul Winkler
http://www.slinkp.com


More information about the Zope mailing list