Retrieve and delete the all records matching input parameters.

@param array $where

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

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

        return $query->delete();
    }
723968
public function deleteWhere($where, array $values = [])
    {
        if (!$where instanceof Where) {
            $where = new Where($where, $values);
        }

        $sql = strtr(
            "delete from :relation where :condition returning :projection",
            [
                ':relation'   => $this->getStructure()->getRelation(),
                ':condition'  => (string) $where,
                ':projection' => $this->createProjection()->formatFieldsWithFieldAlias(),
            ]
        );

        $collection = $this->query($sql, $where->getValues());
        foreach ($collection as $entity) {
            $entity->status(FlexibleEntityInterface::STATUS_NONE);
        }
        $collection->rewind();

        return $collection;
    }
1087814
public function where($where)
    {
        $where = LambdaUtils::toConditionCallable($where);
        $collection = $this->newInstance();
        foreach($this as $record)
        {
            if(call_user_func($where, $record))
            {
                $collection->add($record);
            }
        }
        return $collection;
    }
851460
public function getNextSortOrder (array $where = []) : int
    {
        $queryBuild = $this->repository->createQueryBuilder("t")
            ->select("MAX(t.sortOrder)");

        // apply the where clauses
        if (0 < \count($completeWhere = $this->getCompleteWhere($where)))
        {
            $queryParts = [];
            $index = 0;

            foreach ($completeWhere as $key => $value)
            {
                if (null === $value)
                {
                    $queryParts[] = "t.{$key} IS NULL";
                }
                else
                {
                    $queryParts[] = "t.{$key} = :where_value_{$index}";
                    $queryBuild->setParameter("where_value_{$index}", $value);
                }

                ++$index;
            }

            $queryBuild->where(\implode(" AND ", $queryParts));
        }

        $currentMaxValue = $queryBuild
            ->getQuery()
            ->getSingleScalarResult();

        return null !== $currentMaxValue
            ? 1 + (int) $currentMaxValue
            : 0;
    }
273577
function delete( $table, $where = array(), $params = array() ) {

        if ( !is_array( $where ) ) $where = array( $where );
        if ( !is_array( $params ) ) $params = array_slice( func_get_args(), 2 );

        $table = $this->rewriteTable( $table );
        $query = "DELETE FROM " . $this->quoteIdentifier( $table );
        $query .= $this->getSuffix( $where );

        $this->onQuery( $query, $params );

        $statement = $this->prepare( $query );
        $statement->execute( $params );

        return $statement;

    }
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);
    }
346112
protected function resolveModel(array $where)
    {
        $model = $this->fieldData->query()->where($where)->first();
        return (is_null($model)) ? $this->fieldData->newInstance($where) : $model;
    }
1024001
public function where($where, &$params)
    {
        if (!is_array($where)) {
            throw new \Exception("Invalid where clause specified, must be an array");
        }

        $params = Helper::toArray($params);

        $query = "";

        $andFlag = false;

        foreach ($where as $field => $value) {

            # Add the and flag if this isn't the first field
            if ($andFlag) {
                $query .= "AND ";
            } else {
                $andFlag = true;
            }

            # Add the field name to the query
            $query .= $this->quoteField($field);

            # Convert arrays to use the in helper
            if (is_array($value)) {
                $helperMap = [
                    "<"     =>  "lessThan",
                    "<="    =>  "lessThanOrEqualTo",
                    ">"     =>  "greaterThan",
                    ">="    =>  "greaterThanOrEqualTo",
                    "="     =>  "equals",
                    "<>"    =>  "notEqualTo",
                ];
                $clause = (string) reset($value);
                if (count($value) === 2 && isset($helperMap[$clause])) {
                    $method = $helperMap[$clause];
                    $val = next($value);
                    trigger_error("Using arrays for complex where clauses is deprecated in favour of the helper methods, eg Sql::" . $method . "(" . $val . ")", E_USER_DEPRECATED);
                    $value = static::$method($val);
                } else {
                    $value = static::in($value);
                }
            }

            # Any parameters not using a helper should use the standard equals helper
            if (!is_object($value)) {
                $value = static::equals($value);
            }

            $query .= " " . $value->getClause() . " ";
            foreach ($value->getValues() as $val) {
                $params[] = $val;
            }
        }

        return $query;
    }
342076
public function countBy(array $where = [])
    {
        $query = $this->make();

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

        return $query->count();
    }
141557
public function delete($table, $where = '')
    {
        $where = $this->_whereExpr($where);

        /**
         * Build the DELETE statement
         */
        $sql = "DELETE FROM "
             . $this->quoteIdentifier($table, true)
             . (($where) ? " WHERE $where" : '');

        /**
         * Execute the statement and return the number of affected rows
         */
        $stmt = $this->query($sql);
        $result = $stmt->rowCount();
        return $result;
    }
1292686
public function delete($where = [], $limit = null)
    {
        $this->where($where);

        if (isset($limit)) {
            $this->limit($limit);
        }

        return $this->platformDeleteHandler($this->builderCache);
    }
1063562
public function deleteFrom($table, $where = null)
    {
        $this->clear();

        if (isset($where)) {
            $this->where = "WHERE\n\t(" . $where . ")";
        }

        $this->start = "DELETE";
        $this->from($table);
        return $this;
    }
99367
public function delete( $table, $where ) {
		if ( ! isset( $this->table_defines[ $table ] ) ) {
			return false;
		}

		if ( $this->is_logical( $this->table_defines[ $table ] ) ) {
			$data = $this->set_update_params( [], false, false, true );

			return $this->update( $table, $data, $where );
		}

		/** @var \wpdb $wpdb */
		global $wpdb;
		$columns = $this->table_defines[ $table ]['columns'];

		list ( $_where, $_where_format ) = $this->filter( $where, $columns );

		return $wpdb->delete( $this->get_table( $table ), $_where, $_where_format );
	}
146078
public static function find(array $where) {
        $model = get_called_class();
        /* @var $t Record */
        $t = new $model;
        /* @var $db_cache DBCache */
        $db_cache = Ioc::get(DBCache::class);
        $data = $db_cache->recordWhereCache($model, $where);
        if ($data) {
            return $data;
        }
        /* @var $data Record */
        $select = DB::select($t->getTable())->where($where)->setRecord($model);
        Event::trigger('record_before_select', [$t, $select]);
        $data = $select->find();
        $db_cache->recordWhereCacheSave($model, $where, $data->_db_data);
        return $data;
    }
1269011
public function delete($table, $where = '', array $whereBind = [])
    {
        return $this->query('DELETE FROM ' . $this->prepareTable($table) . ' ' . $where, $whereBind)
                ->rowCount();
    }
555146
public function delete($table, $where, $bind = "")
    {
        $sql = "DELETE FROM " . $table . " WHERE " . $where . ";";
        return $this->run($sql, $bind);
    }
159809
private function getSearchQueryWhere($query, $where)
	{
		foreach ($where as $key => $value) {
			$query->where($value[0], $value[1], $value[2]);
		}

		return $query;
	}