mirror of
https://github.com/e107inc/e107.git
synced 2025-04-07 22:23:09 +02:00
pdo->insert() with DUPLICATE KEY detection.
This commit is contained in:
parent
1229f1e5c1
commit
d3919af819
@ -437,6 +437,18 @@
|
||||
);
|
||||
$actual = $this->db->retrieve('tmp', '*','tmp_ip = "127.0.0.1" AND tmp_time = 12345435');
|
||||
$this->assertEquals($expected, $actual, 'Inserted content doesn\'t match the retrieved content');
|
||||
|
||||
// Test with auto-update on duplicate key found.
|
||||
$insert = array(
|
||||
'media_cat_category' => '_common_image', // unique key.
|
||||
'media_cat_diz' => "modified by pdo->insert test",
|
||||
'_DUPLICATE_KEY_UPDATE' => true
|
||||
);
|
||||
|
||||
$this->db->insert('core_media_cat', $insert);
|
||||
$actual = $this->db->retrieve('core_media_cat', 'media_cat_diz','media_cat_category = "_common_image" ');
|
||||
$this->assertEquals("modified by pdo->insert test", $actual);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user