鐨勬煡璇㈢粨鏋?
if ( $this->queryID ) { $this->free(); }
}
$this->queryTimes++;
$this->Q(1);
$this->queryID = ibase_query($this->_linkID, $this->queryStr);
$this->debug();
if ( !$this->queryID ) {
return false;
} else {
//$this->numCols = ibase_num_fields($this->queryID);
$this->resultSet = $this->getAll();
$this->numRows = count($this->resultSet);
return $this->resultSet;
}
}
/**
+----------------------------------------------------------
* 鎵ц璇彞 閽堝 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 ( $this->queryID ) { $this->free(); }
}
$this->writeTimes++;
$this->W(1);
$result = ibase_query($this->_linkID, $this->queryStr) ;
$this->debug();
if ( false === $result) {
return false;
} else {
$this->numRows = ibase_affected_rows($this->_linkID);
//鍓戦浄 2007.12.28
//$this->lastInsID =
mysql_insert_id($this->_linkID);
$this->lastInsID =0;
return $this->numRows;
}
}
public function startTrans() {
//鏁版嵁rollback 鏀寔
if ($this->transTimes == 0) {
ibase_trans( IBASE_DEFAULT, $this->_linkID);
}
$this->transTimes++;
return ;
}
/**
+----------------------------------------------------------
* 鐢ㄤ簬闈炶嚜鍔ㄦ彁浜ょ姸鎬佷笅闈㈢殑鏌ヨ鎻愪氦
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @return boolen
+----------------------------------------------------------
* @throws ThinkExecption
+----------------------------------------------------------
*/
public function commit()
{
if ($this->transTimes > 0) {
$result = ibase_commit($this->_linkID);
$this->transTimes = 0;
if(!$result){
throw_exception($this->error());
return false;
}
}
return true;
}
/**
+----------------------------------------------------------
* 浜嬪姟鍥炴粴
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @return boolen
+----------------------------------------------------------
* @throws ThinkExecption
+----------------------------------------------------------
*/
public function rollback()
{
if ($this->transTimes > 0) {
$result =ibase_rollback($this->_linkID);
$this->transTimes = 0;
if(!$result){
throw_exception($this->error());
return false;
}
}
return true;
}
/**
+----------------------------------------------------------
* 鑾峰緱涓嬩竴鏉℃煡璇㈢粨鏋?绠鏄撴暟鎹泦鑾峰彇鏂规硶
* 鏌ヨ缁撴灉鏀惧埌 result 鏁扮粍涓?[b