Author: Tianfeng.Han
Inheritance: implements Iterator
Example #1
0
 protected function _execute()
 {
     if ($this->is_execute == 0) {
         $this->exeucte();
     }
     return $this->result->fetchall();
 }
Example #2
0
 protected function _execute()
 {
     if ($this->is_execute == 0) {
         $this->exeucte();
     }
     if ($this->result) {
         return $this->result->fetchall();
     } else {
         return false;
     }
 }
Example #3
0
 /**
  * 获取所有记录
  * @return array | bool
  */
 function getall()
 {
     if ($this->cache_lifetime) {
         $this->getsql(false);
         $cache_key = $this->cache_prefix . '_all_' . md5($this->sql);
         $data = \Swoole::$php->cache->get($cache_key);
         if (empty($data)) {
             if ($this->is_execute == 0) {
                 $this->exeucte();
             }
             $data = $this->result->fetchall();
             \Swoole::$php->cache->set($cache_key, $data, $this->cache_lifetime);
             return $data;
         } else {
             return $data;
         }
     } else {
         if ($this->is_execute == 0) {
             $this->exeucte();
         }
         return $this->result->fetchall();
     }
 }