Commit ca4a7b82 authored by alexpott's avatar alexpott
Browse files

Issue #2370801 by chx: Fixed Deleting nothing from K-V DB is broken.

parent 1d8f7c54
...@@ -150,13 +150,12 @@ public function rename($key, $new_key) { ...@@ -150,13 +150,12 @@ public function rename($key, $new_key) {
*/ */
public function deleteMultiple(array $keys) { public function deleteMultiple(array $keys) {
// Delete in chunks when a large array is passed. // Delete in chunks when a large array is passed.
do { while ($keys) {
$this->connection->delete($this->table) $this->connection->delete($this->table)
->condition('name', array_splice($keys, 0, 1000)) ->condition('name', array_splice($keys, 0, 1000))
->condition('collection', $this->collection) ->condition('collection', $this->collection)
->execute(); ->execute();
} }
while (count($keys));
} }
/** /**
......
...@@ -121,6 +121,8 @@ public function testCRUD() { ...@@ -121,6 +121,8 @@ public function testCRUD() {
$this->assertFalse($stores[0]->get('foo')); $this->assertFalse($stores[0]->get('foo'));
$this->assertFalse($stores[0]->get('bar')); $this->assertFalse($stores[0]->get('bar'));
$this->assertFalse($stores[0]->getMultiple(array('foo', 'bar'))); $this->assertFalse($stores[0]->getMultiple(array('foo', 'bar')));
// Verify that deleting no items does not cause an error.
$stores[0]->deleteMultiple(array());
// Verify that the item in the other collection still exists. // Verify that the item in the other collection still exists.
$this->assertIdenticalObject($this->objects[5], $stores[1]->get('foo')); $this->assertIdenticalObject($this->objects[5], $stores[1]->get('foo'));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment