Esempio n. 1
0
 private function _insertIntoPosts($nums)
 {
     $time = time();
     $sql = "INSERT INTO q_posts (title, body, created, updated) VALUES ('title', 'body', {$time}, {$time})";
     $idList = array();
     for ($i = 0; $i < $nums; $i++) {
         $this->dbo->execute($sql);
         $idList[] = $this->dbo->insertID();
     }
     return $idList;
 }
Esempio n. 2
0
 /**
  * 执行查询,返回结果句柄
  *
  * @return QDB_Result_Abstract
  */
 function getQueryHandle()
 {
     // 构造查询 SQL,并取得查询中用到的关联
     $sql = $this->__toString();
     $offset = $this->_parts[self::LIMIT_OFFSET];
     $count = $this->_parts[self::LIMIT_COUNT];
     if (is_null($offset) && is_null($count)) {
         return $this->_conn->execute($sql);
     } else {
         return $this->_conn->selectLimit($sql, $offset, $count);
     }
 }