选择语言 :

 Module_Database_QueryBuilder::reset

重设数据

Database Module_Database_QueryBuilder::reset( [ $key $key = null ] )

参数列表

参数 类型 描述 默认值
$key $key 不传则全部清除,可选参数 select,select_adv,from,join,where,group_by,having,parameters,set,columns,values,where,index,order_by,distinct,limit,offset,table,last_join,join,on null
返回值
  • Database
File: ./modules/database/querybuilder.class.php
public function reset($key = null)
{
    if ($key)
    {
        foreach ((array)$key as $item)
        {
            $key = strtolower($key);
            switch ($key)
            {
                case 'distinct':
                    $this->_builder['distinct'] = false;
                    break;
                case 'limit':
                case 'offset':
                case 'table':
                    $this->_builder[$key] = null;
                    break;
                case 'last_join':
                case 'join':
                case 'on':
                    $this->_builder['last_join'] = null;
                    break;
                default:
                    if (isset($this->_builder[$key]))
                    {
                        $this->_builder[$key] = array();
                    }
                    break;
            }
        }
    }
    else
    {
        $this->_builder_bak           = $this->_builder;

        $this->_builder['select']     =
        $this->_builder['select_adv'] =
        $this->_builder['from']       =
        $this->_builder['join']       =
        $this->_builder['where']      =
        $this->_builder['group_by']   =
        $this->_builder['having']     =
        $this->_builder['parameters'] =
        $this->_builder['set']        =
        $this->_builder['columns']    =
        $this->_builder['values']     =
        $this->_builder['where']      =
        $this->_builder['index']      =
        $this->_builder['order_by']   = array();

        $this->_builder['distinct']   = false;

        $this->_builder['limit']      =
        $this->_builder['offset']     =
        $this->_builder['table']      =
        $this->_builder['last_join']  = null;
    }

    return $this;
}