生成delete SQL
@access public

@param array $options 表达式

@return string
@throws Exception
@throws \ErrorException
@throws \tpr\db\exception\BindParamException
@throws \tpr\db\exception\PDOException
437546
public function delete($options)
    {
        $sql = str_replace(
            ['%TABLE%', '%USING%', '%JOIN%', '%WHERE%', '%ORDER%', '%LIMIT%', '%LOCK%', '%COMMENT%'],
            [
                $this->parseTable($options['table'], $options),
                !empty($options['using']) ? ' USING ' . $this->parseTable($options['using'], $options) . ' ' : '',
                $this->parseJoin($options['join'], $options),
                $this->parseWhere($options['where'], $options),
                $this->parseOrder($options['order'], $options),
                $this->parseLimit($options['limit']),
                $this->parseLock($options['lock']),
                $this->parseComment($options['comment']),
            ], $this->deleteSql);

        return $sql;
    }
741680
public static function Delete ($values, $options = []) {
		if (!static::InTransaction()) {
			throw CoreException::RaiseSystemError('トランザクションが展開されていません。');
		}
		$options += $options + static::GetDefaultOptions();
		return DBI::Delete(static::GetName(), $values, $options);
	}
1032665
public static function doDelete(array $options=array(), $instance=null, $IDField=null) {
		self::prepareQuery($options, $instance, $IDField);
		return self::$instances[$instance]->delete($options);
	}
772359
public function delete($table, $condition = [], array $options = [])
    {
        $query = $this->createQuery('delete', $table, $options)->where($condition);

        return $this->createRequest($query);
    }
45527
public function getRealSql($sql, array $bind = [])
    {
        if (is_array($sql)) {
            $sql = implode(';', $sql);
        }

        foreach ($bind as $key => $val) {
            $value = is_array($val) ? $val[0] : $val;
            $type  = is_array($val) ? $val[1] : PDO::PARAM_STR;

            if (PDO::PARAM_INT == $type || self::PARAM_FLOAT == $type) {
                $value = (float) $value;
            } elseif (PDO::PARAM_STR == $type) {
                $value = '\'' . addslashes($value) . '\'';
            }

            // 判断占位符
            $sql = is_numeric($key) ?
            substr_replace($sql, $value, strpos($sql, '?'), 1) :
            str_replace(':' . $key, $value, $sql);
        }

        return rtrim($sql);
    }
543810
public static function delete($id, $options = [])
    {
        $url = static::classUrl() . '/' . $id;
        return static::_directRequest('delete', $url, null, $options);
    }
1281400
protected function getDeleteStatement(): string
    {
        $statement = '';
        if (!$this->isDelete()) {
            return $statement;
        }

        // delete语句
        $statement .= $this->getDeleteString();

        // from语句
        if ($this->builder->getFrom()) {
            $statement .= ' ' . $this->getFromString();
        }

        // where语句
        if ($this->builder->getWhere()) {
            $statement .= ' ' . $this->getWhereString();
        }

        // orderBy语句
        if ($this->builder->getOrderBy()) {
            $statement .= ' ' . $this->getOrderByString();
        }

        // limit语句
        if ($this->builder->getLimit()) {
            $statement .= ' ' . $this->getLimitString();
        }

        return $statement;
    }
697606
public function delete(array $options = [])
    {
        return $this->connection->deleteSession($options + [
            'name' => $this->name(),
            'database' => $this->database
        ]);
    }
226173
private function generateQueryString($options)
    {
        //query parameters
        $queryStringParams = array();
        if (isset($options[self::OSS_QUERY_STRING])) {
            $queryStringParams = array_merge($queryStringParams, $options[self::OSS_QUERY_STRING]);
        }
        return OssUtil::toQueryString($queryStringParams);
    }
131127
public function deleteSql(): string
    {
//        if ($this->filterHasJoin()) {
//            $this->prepareConditions();
//            return $this->createCommand()->delete($tableName, [
//                $this->getPrimaryKeyName() => $this->valuesList(['pk'], true)
//            ], $this->params);
//        }

        return $this
            ->getQueryBuilder()
            ->delete()
            ->table($this->getModel()->tableName())
            ->setAlias(null)
            ->toSQL();
    }
740140
protected function parseData($data, $options)
    {
        if (empty($data)) {
            return [];
        }

        // 获取绑定信息
        $bind = $this->query->getFieldsBind($options['table']);
        if ('*' == $options['field']) {
            $fields = array_keys($bind);
        } else {
            $fields = $options['field'];
        }

        $result = [];
        foreach ($data as $key => $val) {
            $item = $this->parseKey($key, $options);
            if (is_object($val) && method_exists($val, '__toString')) {
                // 对象数据写入
                $val = $val->__toString();
            }
            if (false === strpos($key, '.') && !in_array($key, $fields, true)) {
                if ($options['strict']) {
                    throw new Exception('fields not exists:[' . $key . ']');
                }
            } elseif (is_null($val)) {
                $result[$item] = 'NULL';
            } elseif (isset($val[0]) && 'exp' == $val[0]) {
                $result[$item] = $val[1];
            } elseif (is_scalar($val)) {
                // 过滤非标量数据
                if (0 === strpos($val, ':') && $this->query->isBind(substr($val, 1))) {
                    $result[$item] = $val;
                } else {
                    $key = str_replace('.', '_', $key);
                    $this->query->bind('__data__' . $key, $val, isset($bind[$key]) ? $bind[$key] : PDO::PARAM_STR);
                    $result[$item] = ':__data__' . $key;
                }
            }
        }
        return $result;
    }
695766
public function delete(array $options=array()) {
		$options += self::$deleteDefaults;
		if( empty($options['table']) ) {
			throw new Exception('Empty table option');
		}
		$OPTIONS	= '';
		$OPTIONS	.= (!empty($options['lowpriority'])) ? ' LOW_PRIORITY' : '';
		$OPTIONS	.= (!empty($options['quick'])) ? ' QUICK' : '';
		$OPTIONS	.= (!empty($options['ignore'])) ? ' IGNORE' : '';
		$WC			= ( !empty($options['where']) ) ? 'WHERE '.$options['where'] : '';
		$ORDERBY	= ( !empty($options['orderby']) ) ? 'ORDER BY '.$options['orderby'] : '';
		$LIMIT		= ( $options['number'] > 0 ) ? 'LIMIT '.
			( ($options['offset'] > 0) ? $options['offset'].', ' : '' ).$options['number'] : '';
		$TABLE		= static::escapeIdentifier($options['table']);
		
		$QUERY		= "DELETE {$OPTIONS} FROM {$TABLE} {$WC} {$ORDERBY} {$LIMIT}";
		if( $options['output'] == static::SQLQUERY ) {
			return $QUERY;
		}
		return $this->query($QUERY, PDOEXEC);
	}
1153763
public function select($options=array()) {
        if(isset($options['table'])) {
            $this->switchCollection($options['table'],'',false);
        }
        $this->model  =   $options['model'];
        $this->queryTimes++;
        N('db_query',1); // 兼容代码        
        $query  =  $this->parseWhere(isset($options['where'])?$options['where']:array());
        $field  =  $this->parseField(isset($options['field'])?$options['field']:array());
        try{
            if($this->config['debug']) {
                $this->queryStr   =  $this->_dbName.'.'.$this->_collectionName.'.find(';
                $this->queryStr  .=  $query? json_encode($query):'{}';
                if(is_array($field) && count($field)) {
                    foreach ($field as $f=>$v)
                        $_field_array[$f] = $v ? 1 : 0;

                    $this->queryStr  .=  $field? ', '.json_encode($_field_array):', {}';
                }
                $this->queryStr  .=  ')';
            }
            $this->debug(true);
            $_cursor   = $this->_collection->find($query,$field);
            if(!empty($options['order'])) {
                $order   =  $this->parseOrder($options['order']);
                if($this->config['debug']) {
                    $this->queryStr .= '.sort('.json_encode($order).')';
                }
                $_cursor =  $_cursor->sort($order);
            }
            if(isset($options['page'])) { // 根据页数计算limit
                list($page,$length)   =   $options['page'];
                $page    =  $page>0 ? $page : 1;
                $length  =  $length>0 ? $length : (is_numeric($options['limit'])?$options['limit']:20);
                $offset  =  $length*((int)$page-1);
                $options['limit'] =  $offset.','.$length;
            }
            if(isset($options['limit'])) {
                list($offset,$length) =  $this->parseLimit($options['limit']);
                if(!empty($offset)) {
                    if($this->config['debug']) {
                        $this->queryStr .= '.skip('.intval($offset).')';
                    }
                    $_cursor =  $_cursor->skip(intval($offset));
                }
                if($this->config['debug']) {
                    $this->queryStr .= '.limit('.intval($length).')';
                }
                $_cursor =  $_cursor->limit(intval($length));
            }
            $this->debug(false);
            $this->_cursor =  $_cursor;
            $resultSet  =  iterator_to_array($_cursor);
            return $resultSet;
        } catch (\MongoCursorException $e) {
            E($e->getMessage());
        }
    }
161395
public function deleteByQuery($options = [])
    {
        if (!isset($this->queryParts['query'])) {
            throw new InvalidCallException('Can not call deleteByQuery when no query is given.');
        }
        $query = [
            'query' => $this->queryParts['query'],
        ];
        if (isset($this->queryParts['filter'])) {
            $query['filter'] = $this->queryParts['filter'];
        }
        $query = Json::encode($query);
        $url = [$this->index !== null ? $this->index : '_all'];
        if ($this->type !== null) {
            $url[] = $this->type;
        }
        $url[] = '_query';

        return $this->db->delete($url, array_merge($this->options, $options), $query);
    }
599589
public function connect(array $options = array())
    {
        $host = $port = null;
        
        if (!is_null($this->host)) {
            $host = 'host='.$this->host.';';
            if (!is_null($this->port)) {
                $port = 'port='.$this->port.';';
            }
        }
        
        $connection = 'mysql:'.$host.$port.'dbname='.$this->name;
        
        $this->connection = new \PDO($connection, $this->user, $this->pass, $options);
        
        $this->trigger('mysql-connect');
        
        return $this;
    }
1178324
public function delete($index, $type, $id, $options = [])
    {
        return $this->db->delete([$index, $type, $id], $options);
    }
1131911
public static function deleteBySql($sql)
    {
        if (is_array($sql)) {
            $bind = $sql;
            unset($bind[0]);
            $sql = $sql[0];
        } else {
            $bind = [];
        }

        $model = new static;

        $table = $model->getSource($bind);
        return $model->getConnection($bind)->deleteBySql('DELETE' . " FROM [$table] WHERE " . $sql, $bind);
    }