Hey, it would be nice functionality to have native functionality in database for ON DUPLICATE KEY clause:
INSERT INTO tbl VALUES(array1) ON DUPLICATE KEY UPDATE array2
with notation like
$db->table('tbl')->upsert(array1,array2);
ON DUPLICATE KEY UPDATE is MySQL specific..