删除一条数据主键为$id的记录，
@param $id
@param $where string 指定匹配字段，默认为主键
@return true/false
172547
public function del($id, $where=null)
	{
        if ($where == null)
        {
            $where = $this->primary;
        }
        return $this->db->delete($id, $this->table, $where);
	}
1206169
private static function parseWhere(IQuery $query, $where)
    {
        if(null === $where)
        {
            return $query;
        }
        if(is_callable($where))
        {
            // 回调传入条件
            call_user_func($where, $query);
        }
        else
        {
            foreach($where as $k => $v)
            {
                if(is_array($v))
                {
                    $operation = array_shift($v);
                    $query->where($k, $operation, $v[0]);
                }
                else
                {
                    $query->where($k, '=', $v);
                }
            }
        }
        return $query;
    }
1335369
public function has($table, $join, $where = null)
    {
        $column = null;

        $query = $this->query('SELECT EXISTS('.$this->selectContext($table, $join, $column, $where, 1).')');

        if ($query && 1 === intval($query->fetchColumn())) {
            return true;
        }

        return false;
    }
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;
    }
1276259
public function delete($table, $where)
    {
        $context = $this->getCommandContext();
        $context->table    = $table;
        $context->data    = null;
        $context->where    = $where;
        $context->operation    = AnDatabase::OPERATION_DELETE;

        //Excute the delete operation
        if ($this->getCommandChain()->run('before.delete', $context) !== false) {
            //Create query statement
            $context->query = 'DELETE FROM '.$this->quoteName($this->getTableNeedle().$context->table)
                  .' '.$context->where
            ;

            //Execute the query
            $context->result = $this->execute($context->query);

            $context->affected = $this->_affected_rows;
            $this->getCommandChain()->run('after.delete', $context);
        }

        return $context->affected;
    }
593685
public function delete($post_id, string $key, $where = '')
    {
        $post_id = (int) ($post_id ?? get_the_ID());

        if (!$post_id || !$key) {
            return; // Not possible.
        }
        delete_post_meta($post_id, $this->key($key), $where);
    }
560182
public function has( $id )
	{
		return \DB::select( $this->table )
			->where( 'id', $id )
			->column( 'id', $this->database ) == $id;
	}
451815
public function delete($id = NULL, $all = false)
    {
        $params = array();
        // 如果有指定id
        if (!is_null($id)) {
            $where = $this->key . ' = ?';
            $params = array($id);
        } elseif (isset($this->options['where']['0'])) { // 或者有设置where
            $where = $this->options['where']['0'];
            if (isset($this->options['where']['1'])) $params = $this->options['where']['1'];
        } elseif ($all) // 删除所有数据，慎用！
            $where = '1 = 1';
        else
            return NULL;

        $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE ' . $where;
        if ($statement = $this->execute($sql, $params))
            return $statement->rowCount();
        else
            return NULL;
    }
399146
public static function q_check(string $table, string $where = ''): bool
    {
        return (bool)self::getInstance()->sql_query('SELECT NULL FROM `' . $table . '`' . ($where ? ' WHERE ' . $where : '') . ' LIMIT 1')->rowCount();
    }
1229439
public function checkExistsWithMultipleWhere($whereValue = '', $whereField = 'id', $select = '*')
    {
        if (is_array($whereValue) && count($whereValue) > 0) {
            foreach ($whereValue as $key => $value) {
                if (is_array($value['value'])) {
                    $this->db->where($value['field'], $value['value'], self::OPERATOR_IS_IN);
                } else {
                    $this->db->where($value['field'], $value['value'], $value['operator']);
                }
            }
        } else {
            $this->db->where($whereField, $whereValue, self::OPERATOR_EQUAL_TO);
        }
        $this->db->get($this->table, NULL, $select);

        return (int) $this->db->count;
    }
833787
public function load($where)
    {
        $where = self::processWhere($where);

        $old_primary_key = $this->getPrimaryKey();

        $database = self::getDatabase();
        $data = $database->get(static::TABLE, static::COLUMNS, $where);
        if ($data) {
            $this->reset();
            $this->data = $data;
            if ($old_primary_key) {
                $this->managerUpdate($old_primary_key);
            } else {
                $this->managerExport();
            }
            return true;
        }

        return false;
    }
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();
    }
745452
public function delete($id = null)
    {
        // If an ID is passed to the method, we will set the where clause to check
        // the ID to allow developers to simply and quickly remove a single row
        // from their database without manually specifying the where clauses.
        if (!is_null($id)) {
            $this->where('_id', '=', $id);
        }

        $wheres = $this->compileWheres();
        $result = $this->collection->deleteMany($wheres);

        if (1 == (int) $result->isAcknowledged()) {
            return $result->getDeletedCount();
        }

        return 0;
    }
706838
public static function find_by_id($id)
	{
		$row = self::oneOrNew($id);

		if (!$row->get('id'))
		{
			return false;
		}

		return $row;
	}
845760
final public function doShow($id)
    {
        $this->db->query('SELECT * FROM '.$this->table.' WHERE id = :id', [':id'=>$id]);
        $result = $this->db->result();
        return $result ? $result : false;
    }
31985
public function id($id, $like = false)
    {
        /* @var $this ActiveQuery */
        $model = $this->noInitModel;
        return $this->likeCondition($id, $model->idAttribute, $like);
    }
1052198
public function wherePK($id): self
    {
        if (empty($this->loader->primaryKey())) {
            //This MUST never happen due ORM requires PK now for every entity
            throw new SelectorException("Unable to set wherePK condition, no proper PK were defined");
        }

        //Adding condition to initial query
        $this->loader->initialQuery()->where([
            //Must be already aliased
            $this->loader->primaryKey() => $id
        ]);

        return $this;
    }