bug ) throw_exception($this->error());
return false;
} else {
//$this->numCols = $this->PDOStatement->columnCount();
$this->resultSet = $this->getAll();
$this->numRows = count( $this->resultSet );
if ( $this->numRows > 0 ){
return $this->resultSet;
}
return false;
}
}
/**
+----------------------------------------------------------
* 鎵ц璇彞 閽堝 INSERT, UPDATE 浠ュ強DELETE
+----------------------------------------------------------
* @access protected
+----------------------------------------------------------
* @param string $str
sql鎸囦护
+----------------------------------------------------------
* @return integer
+----------------------------------------------------------
* @throws ThinkExecption
+----------------------------------------------------------
*/
protected function _execute($str='') {
$this->initConnect(true);
if ( !$this->_linkID ) return false;
if ( $str != '' ) $this->queryStr = $str;
if (!$this->autoCommit && $this->isMainIps($this->queryStr)) {
$this->startTrans();
}else {
//閲婃斁鍓嶆鐨勬煡璇㈢粨鏋?
if ( !empty($this->PDOStatement) ) { $this->free(); }
}
$this->writeTimes++;
$this->W(1);
$result = $this->_linkID->exec($this->queryStr);
$this->debug();
if ( false === $result) {
//if ( $this->debug ) throw_exception($this->error());
return false;
} else {
$this->numRows = $result;
$this->lastInsID = $this->_linkID->lastInsertId();
return $this->numRows;
}
}
/**
+----------------------------------------------------------
* 鍚姩浜嬪姟
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @return void
+----------------------------------------------------------
* @throws ThinkExecption
+----------------------------------------------------------
*/
public function startTrans() {
//鏁版嵁rollback 鏀寔
if ($this->transTimes == 0) {
$this->_linkID->beginTransaction();
}
$this->transTimes++;
return ;
}
/**
+----------------------------------------------------------
* 鐢ㄤ簬闈炶嚜鍔ㄦ彁浜ょ姸鎬佷笅闈㈢殑鏌ヨ鎻愪氦
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @return boolen
+----------------------------------------------------------
* @throws ThinkExecption
+----------------------------------------------------------
*/
public function commit()
{
if ($this->transTimes > 0) {
$result = $this->_linkID->commit();
$this->transTimes = 0;
if(!$result){
throw_exception($this->error());
return false;
}
}
return true;
}
/**
+----------------------------------------------------------
* 浜嬪姟鍥炴粴
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @return boolen
+----------------------------------------------------------
* @throws ThinkExecption
+----------------------------------------------------------
*/
public function rollback()
{
if ($this->tran