private function run($sql = NULL) { $_dbName = $this->_dbName; $_tableName = $this->_tableName; //分库预留 if (method_exists($this, 'getRealDbName')) { $_dbName = $this->getRealDbName($this); } //分表预留 if (method_exists($this, 'getRealTableName')) { $_tableName = $this->getRealTableName($this); } $_DT_ = "`{$_dbName}`.`{$_tableName}`"; //自动建库建库表 $this->autoCreateDb($_dbName); $this->autoCreateTable($_DT_, $this->_fields); $aOption = array('select' => $this->_select, 'groupby' => $this->_groupby, 'limit' => $this->_limit, 'orderby' => $this->_orderby); //执行方法 switch ($this->_operator) { case 'find': $res = parent::find($_DT_, $this->_where, $aOption); break; case 'findall': $res = parent::findAll($_DT_, $this->_where, $aOption); break; case 'insert': $res = parent::insert($_DT_, $this->_data); break; case 'delete': $res = parent::delete($_DT_, $this->_where, $aOption); break; case 'update': $res = parent::update($_DT_, $this->_data, $this->_where, $aOption); break; case 'execute': $res = parent::execute($sql); break; case 'query': $res = parent::query($sql); break; case 'count': $res = parent::count($_DT_, $this->_where, $aOption); break; case 'mapping': $res = parent::find($_DT_, $this->_where, $aOption); break; } return $res; }