MatthiasMullie\Scrapbook\Adapters\SQL::deleteMulti PHP Метод

deleteMulti() публичный Метод

public deleteMulti ( array $keys )
$keys array
    public function deleteMulti(array $keys)
    {
        if (empty($keys)) {
            return array();
        }
        // we'll need these to figure out which could not be deleted...
        $items = $this->getMulti($keys);
        // escape input, can't bind multiple params for IN()
        $quoted = array();
        foreach ($keys as $key) {
            $quoted[] = $this->client->quote($key);
        }
        $statement = $this->client->query("DELETE FROM {$this->table}\n            WHERE k IN (" . implode(',', $quoted) . ')');
        /*
         * In case of connection problems, we may not have been able to delete
         * any. Otherwise, we'll use the getMulti() results to figure out which
         * couldn't be deleted because they didn't exist at that time.
         */
        $success = $statement->rowCount() !== 0;
        $success = array_fill_keys($keys, $success);
        foreach ($keys as $key) {
            if (!array_key_exists($key, $items)) {
                $success[$key] = false;
            }
        }
        return $success;
    }