Example #1
0
 /**
  * 清空结果集内存
  *
  * @return boolean 是否清空成功
  */
 public function free()
 {
     if (is_bool($this->_rs)) {
         $rtn = true;
     } else {
         if (is_array($this->_rs)) {
             $rtn = true;
         } else {
             switch (DBManager::workingMode()) {
                 case DBManager::MODE_PDO:
                     $rtn = $this->_rs->closeCursor();
                     break;
                 case DBManager::MODE_SQLI:
                     $rtn = $this->_rs->free();
                     break;
                 case DBManager::MODE_SQL:
                     $rtn = mysql_free_result($this->_rs);
                     break;
                 default:
                     $rtn = true;
                     break;
             }
         }
     }
     unset($this->_rs);
     return $rtn;
 }
Example #2
0
 /**
  * 获取insertID
  *
  * @return int
  */
 public function insertID()
 {
     switch (DBManager::workingMode()) {
         case DBManager::MODE_PDO:
             return $this->_link->lastInsertId();
         case DBManager::MODE_SQLI:
             return $this->_link->insert_id;
         case DBManager::MODE_SQL:
             return mysql_insert_id($this->_link);
         default:
             return 0;
     }
 }