コード例 #1
0
ファイル: viewmeta.php プロジェクト: Debenson/openwan
 /**
  * 开启一个查询,并根据提供的参数设置查询对象
  *
  * @param array $args
  *
  * @return QDB_Select
  */
 function findByArgs(array $args = array())
 {
     $select = new QDB_Select(QDB::getConn($this->_dsn));
     $select->setSQL($this->_find_sql)->asColl()->asObject($this->class_name);
     $c = count($args);
     if ($c > 0) {
         if ($c == 1 && is_int($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;
 }