示例#1
0
 /**
  * 开启一个查询,并根据提供的参数设置查询对象
  *
  * @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;
 }
示例#2
0
文件: meta.php 项目: Debenson/openwan
 /**
  * 开启一个查询,并根据提供的参数设置查询对象
  *
  * @param array $args
  *
  * @return QDB_Select
  */
 function findByArgs(array $args = array())
 {
     $select = new QDB_Select($this->table->getConn());
     $select->asColl()->from($this->table)->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);
         }
     }
     if ($this->inherit_base_class && $this->inherit_type_field) {
         // 如果是来自某个继承类的查询,则限定只能查询该类型的对象
         $select->where(array($this->inherit_type_field => $this->class_name));
     }
     return $select;
 }
示例#3
0
文件: table.php 项目: fchaose/qeephp
 /**
  * 发起一个查询,获得一个 QDB_Select 查询对象
  *
  * @return QDB_Select
  */
 function select()
 {
     if (!$this->_inited) {
         $this->init();
     }
     $select = new QDB_Select($this->_conn);
     $select->from($this);
     $args = func_get_args();
     if (!empty($args)) {
         call_user_func_array(array($select, 'where'), $args);
     }
     return $select;
 }
示例#4
0
 /**
  * 开启一个查询,并根据提供的参数设置查询对象
  *
  * @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;
 }
示例#5
0
文件: meta.php 项目: fchaose/qeephp
 /**
  * 开启一个查询,并根据提供的参数设置查询对象
  *
  * @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;
 }