/** * 开启一个查询,并根据提供的参数设置查询对象 * * @param array $args * * @return QDB_Select */ function findByArgs(array $args) { $select = new QDB_Select($this->table->getConn()); $select->asObject($this->class_name)->from($this->table); $c = count($args); if ($c > 0) { if ($c == 1 && intval($args[0]) == $args[0] && is_numeric($args[0]) && $this->idname_count == 1) { $select->where(array(reset($this->idname) => $args[0])); } else { call_user_func_array(array($select, 'where'), $args); } } return $select; }
/** * 开启一个查询,并根据提供的参数设置查询对象 * * @param array $args * * @return QDB_Select */ function findByArgs(array $args) { $select = new QDB_Select($this->table->getConn()); $select->asObject($this->class_name)->from($this->table); if (count($args)) { call_user_func_array(array($select, 'where'), $args); } return $select; }