Delete a row or rowset

@param array $where Where conditions array
@return bool
174373
protected function _delete($where)
    {
        $params = array();
        $query = "DELETE FROM $this->_name";

        $iWhere = 0;
        $query .= " WHERE (";
        foreach ($where as $key => $value) {
            if (!is_int($key)) {
                $query .= "$key = :where$iWhere AND ";
                $params[":where$iWhere"] = $value;
                $iWhere++;
            } else {
                $query .= "$value AND";
            }
        }
        $query = substr($query, 0, -4);
        $query .= ")";

        $db = $this->db;
        $sth = $db->prepare($query);

        foreach ($params as $key => $val) {
            if (is_int($val)) {
                $sth->bindValue("$key", $val, $db::PARAM_INT);
            } else {
                $sth->bindValue("$key", $val);
            }
        }

        $response = $sth->execute();

        if ($response) {

            return true;
        }

        return false;
    }
36293
public function delete(string $from, $wheres, array $options = [])
    {
        if (!$wheres) {
            throw new \InvalidArgumentException('Safety considerations, where conditions can not be empty');
        }

        list($where, $bindings) = DBHelper::handleConditions($wheres, $this);

        $options['from'] = $this->qn($from);
        $options['where'] = $where;

        $statement = $this->compileDelete($options);

        if (isset($options['returnSql'])) {
            return [$statement, $bindings];
        }

        return $this->fetchAffected($statement, $bindings);
    }
1253809
public function delete($table, $where, $whereValue)
    {
        $query = $this->provider->buildDeleteQuery($table, $where, $whereValue);

        return $this->provider->query($query, null);
    }
910522
public function deletePDO($table, array $where = array(), $limit = 1)
    {
        $limit = (int)$limit;
        if (count($where) === 0) {
            return false;
        }
        $q = "DELETE FROM `$table` ";
        $q .= 'WHERE ';
        foreach ($where as $key => $val) {
            if (empty($val)) {
                continue;
            } else {
                $q .= "`$key`=? AND ";
            }
        }
        $q = rtrim($q, 'AND ');
        if ($limit > 0) {
            $q .= ' LIMIT ' . $limit . ' ;';
        } else {
            $q .= ' ;';
        }
        try {
            $this->_queryId = self::$_linkId->prepare($q);
            $i = 1;
            foreach ($where as $key => $val) {
                if (empty($val)) {
                    continue;
                } else {
                    $type = $this->getPDOConstantType($val);
                    $this->_queryId->bindValue($i, $val, $type);
                    ++$i;
                }
            }
            return $this->_queryId->execute();
        } catch (PDOException $e) {
            $this->_error = $e->getMessage();
            return false;
        }
    }
1078183
public function destroy(array $where) {
        $where = $this->_createWhereClause($where, 'AND', false);
        try {
            /**
             * First, see if the user is allowed to update everything
             */
            $this->_checkAcl('destroy');
            $this->_model->delete($where);
        } catch (Garp_Auth_Exception $e) {
            /**
             * If that fails, check if the user is allowed to update her own material
             * AND if the current item is hers.
             */
            $this->_checkAcl('destroy_own');

            /**
             * Good, the user is allowed to 'destroy_own'. In that case we have to check
             * if the current item is actually the user's.
             */
            $rows = $this->_model->fetchAll($where);
            foreach ($rows as $row) {
                if (!$this->_itemBelongsToUser($row->toArray())) {
                    throw new Garp_Auth_Exception(
                        'You are only allowed to delete your own material.'
                    );
                }
                $row->delete();
            }
        }
    }
1230807
public function delete(array $where, $tableName = null)
    {
        $tableName = $tableName ?: $this->getTableName();
        $sql = $this->getSql();
        $delete = $sql->delete($tableName);

        $delete->where($where);

        $statement = $sql->prepareStatementForSqlObject($delete);

        return $statement->execute();
    }
1335135
public function delete($table, $statements, $where)
    {
        $query = 'DELETE FROM `' . $table . '` ';

        $query .= (! is_null($where)) ? ' WHERE ' : '';

        $query .= (is_string($where)) ? $where . ' ' : '';

        if (is_array($where)) {
            foreach ($where as $clause) {
                $query .= $clause . ' AND ';
            }

            $query = rtrim(trim($query), 'AND');
        }

        if (! is_null($statements) && is_array($statements)) {
            return $this->statements($query, $statements);
        }

        return $this->query($query, 'INSERT');
    }
312928
public function disable($where=null)
    {
        $model = static::getQueryModel();
        
        $deletedField = isset($model['deleted_field']) ? $model['deleted_field'] : (isset($model['fields']['deleted']) ? 'deleted' : null);
        if (!$deletedField) {
            return ErrorInfo::error('deleted filed is not exists.');
        }
        
        $data[] = "$deletedField = ($deletedField + 1) % 2";
        $deleteTimeField = isset($model['fields']['delete_time']) ? 'delete_time' : null;
        if ($deleteTimeField) {
            $data[$deleteTimeField] = time();
        }
        if ($where) {
            $this->getQuery()->where($where);
        }
        $mwhere = $this->getQuery()->get('where');
        
        $res = $this->update()->set($data)->query();
        
        // cache flush current model, 当实际表的操作类不是当前类或和当前类是同一个表的类时才更新，避免了 getQueryModel()和this 是同一个类但实例化的表不一样
        if ($this['table_name'] == $model['table_name']) {
            if (is_numeric($where)) {
                $model->cacheFlushByRecord([$model['primary_key'] => $where]);
            } elseif ($mwhere) {
                $model->cacheFlushByRecord($mwhere);
            }
        }
        
        return ErrorInfo::instance($res === false ? -1 : 0);
    }
791592
public function deleteWhere(array $where)
    {
        $this->applyScope();

        $this->applyConditions($where);

        $deleted = $this->model->delete();

        event(new RepositoryEntityDeleted($this, $this->model->getModel()));

        $this->resetModel();

        return $deleted;
    }
640251
final public function delete( array $where, $table = '', $place_holders = [] ) {
		if ( ! $place_holders ) {
			try {
				$place_holders = $this->get_place_holders( $where );
			} catch ( \Exception $e ) {
				return false;
			}
		}
		return $this->db->delete( $table ?: $this->table, $where, $place_holders );
	}
353665
public function delete($table, $where)
    {
        $this->prepare("DELETE FROM $table WHERE $where");

        $this->execute();
        $num = $this->rowCount();

        if ($num < 1) {
            throw new NonExistentID('Cannot delete the record with that ID since it is non existent');
        }
    }
1278559
function delete($table, $where, $where_params)
    {
        $sql = "DELETE FROM " . $table . $this->buildWhere($where);
        $stmt = $this->executeQuery($sql, $where_params);

        return $stmt;
    }
178019
public function destroyBy(array $where)
    {
        $query = $this->make();

        $query = $this->applyWhere($query, $where);

        return $query->delete();
    }
815942
public function delete($where): Statement
    {
        $this->operation = 'delete';
        if ($where) {
            $this->where = $where;
        }
        return $this;
    }
1216589
public function remove($where=null)
    {
        $this->getQuery()->type('delete')->set('where', $where);
        
        $ret = $this->query();
        
        return $ret === false ? ErrorInfo::error('操作出错了') : ErrorInfo::success('删除成功', ['numberOfRows' => $ret]);
    }
321755
public function remove($where, $params = array())
    {
        if (empty($where)) {
            return false;
        }

        $query = "DELETE FROM {$this->getLibName()} WHERE {$where}";
        $statement = $this->pdo->prepare($query);
        $statement->execute($params);
        $this->lastSql = $query;
        return $statement->rowCount();
    }
1249912
public function delete(string $table, $where=''): ?PDOStatement
	{
		// Set the where clause
		if ( ! empty($where))
		{
			$this->where($where);
		}

		return $this->_run('delete', $table);
	}