示例#1
0
文件: Model.php 项目: v3u3i87/run_cli
 /**
  * 查询类型
  * @param null $_field
  * @return mixed
  */
 public function select($_field = null)
 {
     $sql = ' SELECT ' . $this->lodeField($_field) . $this->mergeSql();
     $_data = $this->_db->select($sql);
     if (!empty($this->_pageData)) {
         $this->_pageData['data'] = $_data;
         $_data = $this->_pageData;
     }
     return $_data;
 }
示例#2
0
文件: Query.php 项目: v3u3i87/upadd
 /**
  * 去重返回列表
  * @param $key
  * @return $this
  */
 protected function get_distinct($key, $field = null)
 {
     if ($key) {
         $tmp = null;
         if ($field) {
             $tmp = ", `{$field}` ";
         }
         $sql = " distinct `{$key}` ";
         if ($tmp) {
             $sql .= $tmp;
         }
         $this->_db->_sql = 'SELECT ' . $sql . $this->mergeSqlLogic() . ';';
         $_data = $this->_db->select();
         $this->clear_where();
         if ($_data) {
             return $_data;
         }
     }
     return [];
 }
示例#3
0
 /**
  * 切换到指定的数据库,数据库索引号 index 用数字值指定,以 0 作为起始索引值
  * @param type $index
  * @return type
  */
 public function selectMain($index)
 {
     return $this->cacheWrite->select($index);
 }