基本上,我想在MySQL中实现与ON DUPLICATE KEY相同的功能.
这是一个人为的例子:
$rec = array('Foo' => array(
'id' => 999, // Assume there isn't already a record with this id
'website' => 'google'
));
$this->Foo->save($rec);
// save with different 'website' value
$rec['Foo']['website'] = 'stackoverflow';
$this->Foo->save($rec);
最后一行是否更新了几行创建的记录?