Example #1
0
 public function execute($sql, $bindParams = array(), $additionalParameters = array())
 {
     $connection = $this->connection;
     if (empty($bindParams)) {
         $result = ibase_query($connection, $sql);
     } else {
         $holderRegex = "/@[a-zA-Z0-9_]+@/";
         preg_match_all($holderRegex, $sql, $matches);
         $args = array($connection, preg_replace($holderRegex, "?", $sql));
         foreach ($matches[0] as $holder) {
             $args[] = $bindParams[$holder];
         }
         $result = call_user_func_array("ibase_query", $args);
     }
     if (!$result) {
         $this->executeError($sql);
     }
     $rows = array();
     if (is_resource($result)) {
         while ($row = ibase_fetch_assoc($result, IBASE_TEXT)) {
             $rows[] = array_change_key_case($row);
         }
         ibase_free_result($result);
     } else {
         $this->affectedRows = $result === true ? 0 : $result;
     }
     if ($this->autoCommit) {
         ibase_commit($connection);
     }
     return empty($rows) ? null : $rows;
 }
Example #2
0
function gcms_commit()
{
    global $gcms_trans_id;
    if ($gcms_trans_id) {
        ibase_commit($gcms_trans_id);
    }
    $gcms_trans_id = false;
}
Example #3
0
 /**
  * SQL Transaction
  * @access private
  */
 function _sql_transaction($status = 'begin')
 {
     switch ($status) {
         case 'begin':
             return true;
             break;
         case 'commit':
             return @ibase_commit();
             break;
         case 'rollback':
             return @ibase_rollback();
             break;
     }
     return true;
 }
 function CommitTransaction($intTrans)
 {
     if ($this->intDebug) {
         echo "Committing transaction...\t\t<br>";
     }
     $this->intTrans = ibase_commit($this->intTrans);
     $this->intTransStatus++;
     return $this->intQuery;
 }
Example #5
0
 /**
  * Commits the current transaction
  *
  * @return int  DB_OK on success.  A DB_Error object on failure.
  */
 function commit()
 {
     return @ibase_commit($this->connection);
 }
 /**
  * Commit Transaction
  *
  * @return	bool
  */
 public function trans_commit()
 {
     // When transactions are nested we only begin/commit/rollback the outermost ones
     if (!$this->trans_enabled or $this->_trans->depth > 0) {
         return TRUE;
     }
     return ibase_commit($this->_ibase_trans);
 }
Example #7
0
 /**
 +----------------------------------------------------------
 * 用于非自动提交状态下面的查询提交
 +----------------------------------------------------------
 * @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 true;
 }
        if ($_REQUEST['spt'] == '') {
            $exception = array('spt_id', 'nama_kegiatan');
            $other_request = array('pendataan_id' => $ID_HEADER, 'pendataan_no' => $no_spt, 'jenis_pendataan' => 'LISTRIK');
        } else {
            $exception = array('nama_kegiatan');
            $other_request = array('pendataan_id' => $ID_HEADER, 'pendataan_no' => $no_spt, 'jenis_pendataan' => 'LISTRIK', 'spt_id' => $_REQUEST['spt']);
        }
        ibase_trans();
        $a = $fbird->FBInsert('pendataan_spt', $other_request, $exception);
        unset($exception);
        unset($other_request);
        if ($a) {
            $ID_CONTENT = $fbird->setGenerator('GEN_PENDATAAN_LISTRIK');
            $exception = array();
            $other_request = array('listrik_id' => $ID_CONTENT, 'pendataan_id' => $ID_HEADER, 'id_rekening' => $_REQUEST['rekening']);
            $b = $fbird->FBInsert('pendataan_listrik', $other_request, $exception);
            unset($exception);
            unset($other_request);
            if ($b) {
                ibase_commit();
                echo 'Data Telah Tersimpan';
            } else {
                ibase_rollback();
                echo 'Gagal Di Content';
            }
        } else {
            ibase_rollback();
            echo 'Gagal d Header ';
        }
    }
}
 /**
  * 用于非自动提交状态下面的查询提交
  * @access public
  * @return boolen
  */
 public function commit()
 {
     if ($this->transTimes > 0) {
         $result = ibase_commit($this->_linkID);
         $this->transTimes = 0;
         if (!$result) {
             $this->error();
             return false;
         }
     }
     return true;
 }
Example #10
0
 public function transCommit()
 {
     return ibase_commit($this->ibase_trans);
 }
 function do_dellfolderno($folderno)
 {
     //	if (!isOwner(m_quotes($filderno), $_SESSION["clientcode"])) return false;
     $conn = db_connect();
     $tsql = "select * from n_dellfolderno('" . $folderno . "')";
     $stmt = ibase_query($conn, $tsql);
     if ($stmt === false) {
         echo "Error in executing query.<br/>";
         die(0);
     }
     ibase_fetch_row($stmt);
     ibase_free_result($stmt);
     ibase_commit();
     ibase_close($conn);
 }
Example #12
0
 function trans($action, $transID = null)
 {
     //action = begin, commit oder rollback
     if ($action == 'begin') {
         $this->transID = ibase_trans($this->linkId);
         return $this->transID;
     }
     if ($action == 'commit' and !empty($this->transID)) {
         ibase_commit($this->linkId, $this->transID);
     }
     if ($action == 'rollback') {
         ibase_rollback($this->linkId, $this->transID);
     }
 }
    protected function gravaTrasacao($transacao) {
	return ibase_commit($transacao);
    }
Example #14
0
 /**
  * Envoie une commande COMMIT à la base de données pour validation de la
  * transaction courante
  * 
  * @access public
  * @return boolean
  */
 function commit()
 {
     if (!($result = ibase_commit($this->link))) {
         ibase_rollback($this->link);
     }
     $this->autocommit = true;
     return $result;
 }
Example #15
0
 function _performCommit()
 {
     return ibase_commit($this->trans);
 }
 /**
  * Commit the database changes done during a transaction that is in
  * progress. This function may only be called when auto-committing is
  * disabled, otherwise it will fail. Therefore, a new transaction is
  * implicitly started after committing the pending changes.
  *
  * @return mixed MDB_OK on success, a MDB error on failure
  * @access public
  */
 function commit()
 {
     $this->debug('Commit Transaction');
     if ($this->auto_commit) {
         return $this->raiseError(MDB_ERROR, NULL, NULL, 'Commit: transaction changes are being auto commited');
     }
     return @ibase_commit($this->connection);
 }
Example #17
0
 /**
  * This function commits a transaction.
  *
  * @access public
  * @override
  * @throws Throwable_SQL_Exception              indicates that the executed
  *                                              statement failed
  */
 public function commit()
 {
     if (!$this->is_connected()) {
         throw new Throwable_SQL_Exception('Message: Failed to commit SQL transaction. Reason: Unable to find connection.');
     }
     $command = @ibase_commit($this->resource);
     if ($command === FALSE) {
         throw new Throwable_SQL_Exception('Message: Failed to commit SQL transaction. Reason: :reason', array(':reason' => @ibase_errmsg()));
     }
     $this->sql = 'COMMIT;';
 }
 /**
  * Commit Transaction
  *
  * @access	public
  * @return	bool		
  */
 function trans_commit()
 {
     if (!$this->trans_enabled) {
         return TRUE;
     }
     // When transactions are nested we only begin/commit/rollback the outermost ones
     if ($this->_trans_depth > 0) {
         return TRUE;
     }
     return @ibase_commit();
 }
 /**
  * Commits statements in a transaction.
  * @param  string  optional savepoint name
  * @return void
  * @throws DibiDriverException
  */
 public function commit($savepoint = NULL)
 {
     if ($savepoint !== NULL) {
         throw new DibiNotSupportedException('Savepoints are not supported in Firebird/Interbase.');
     }
     if (!ibase_commit($this->transaction)) {
         throw new DibiDriverException('Unable to handle operation - failure when commiting transaction.');
     }
     $this->inTransaction = FALSE;
 }
Example #20
0
 /**
  * Commit the database changes done during a transaction that is in
  * progress or release a savepoint. This function may only be called when
  * auto-committing is disabled, otherwise it will fail. Therefore, a new
  * transaction is implicitly started after committing the pending changes.
  *
  * @param   string  name of a savepoint to release
  * @return  mixed   MDB2_OK on success, a MDB2 error on failure
  *
  * @access  public
  */
 function commit($savepoint = null)
 {
     $this->debug('Committing transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
     if (!$this->in_transaction) {
         return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'commit/release savepoint cannot be done changes are auto committed', __FUNCTION__);
     }
     if (null !== $savepoint) {
         $query = 'RELEASE SAVEPOINT ' . $savepoint;
         return $this->_doQuery($query, true);
     }
     if (!@ibase_commit($this->transaction_id)) {
         return $this->raiseError(null, null, null, 'could not commit a transaction', __FUNCTION__);
     }
     $this->in_transaction = false;
     $this->transaction_id = 0;
     return MDB2_OK;
 }
Example #21
0
 function sql_freeresult($query_id = false)
 {
     if (!$query_id) {
         $query_id = $this->query_result;
     }
     if (!$this->transaction && $query_id) {
         @ibase_commit();
     }
     return $query_id ? @ibase_free_result($query_id) : false;
 }
Example #22
0
 /**
  * @brief query xml에 navigation 정보가 있을 경우 페이징 관련 작업을 처리한다
  *
  * 그닥 좋지는 않은 구조이지만 편리하다.. -_-;
  **/
 function _getNavigationData($table_list, $columns, $left_join, $condition, $output)
 {
     require_once _XE_PATH_ . 'classes/page/PageHandler.class.php';
     $query_groupby = '';
     if ($output->groups) {
         foreach ($output->groups as $key => $val) {
             $group_list[] = $this->autoQuotes($val);
         }
         if (count($group_list)) {
             $query_groupby = sprintf(" GROUP BY %s", implode(", ", $group_list));
         }
     }
     /*
     // group by 절이 포함된 SELECT 쿼리의 전체 갯수를 구하기 위한 수정
     // 정상적인 동작이 확인되면 주석으로 막아둔 부분으로 대체합니다.
     //
     $count_condition = strlen($query_groupby) ? sprintf('%s group by %s', $condition, $query_groupby) : $condition;
     $total_count = $this->getCountCache($output->tables, $count_condition);
     if($total_count === false) {
         $count_query = sprintf('select count(*) as "count" from %s %s %s', implode(', ', $table_list), implode(' ', $left_join), $count_condition);
         if (count($output->groups))
             $count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query);
         $result = $this->_query($count_query);
         $count_output = $this->_fetch($result);
         $total_count = (int)$count_output->count;
         $this->putCountCache($output->tables, $count_condition, $total_count);
     }
     */
     // 전체 개수를 구함
     $count_query = sprintf("select count(*) as \"count\" from %s %s %s", implode(',', $table_list), implode(' ', $left_join), $condition);
     $total_count = $this->getCountCache($output->tables, $condition);
     if ($total_count === false) {
         $result = $this->_query($count_query);
         $count_output = $this->_fetch($result);
         if (!$this->transaction_started) {
             @ibase_commit($this->fd);
         }
         $total_count = (int) $count_output->count;
         $this->putCountCache($output->tables, $condition, $total_count);
     }
     $list_count = $output->list_count['value'];
     if (!$list_count) {
         $list_count = 20;
     }
     $page_count = $output->page_count['value'];
     if (!$page_count) {
         $page_count = 10;
     }
     $page = $output->page['value'];
     if (!$page) {
         $page = 1;
     }
     // 전체 페이지를 구함
     if ($total_count) {
         $total_page = (int) (($total_count - 1) / $list_count) + 1;
     } else {
         $total_page = 1;
     }
     // 페이지 변수를 체크
     if ($page > $total_page) {
         $page = $total_page;
     }
     $start_count = ($page - 1) * $list_count;
     // list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
     if ($output->order) {
         $conditions = $this->getConditionList($output);
         if (!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
             foreach ($output->order as $key => $val) {
                 $col = $val[0];
                 if (!in_array($col, array('list_order', 'update_order'))) {
                     continue;
                 }
                 if ($condition) {
                     $condition .= sprintf(' and "%s" < 2100000000 ', $col);
                 } else {
                     $condition = sprintf(' where "%s" < 2100000000 ', $col);
                 }
             }
         }
     }
     $limit = sprintf('FIRST %d SKIP %d ', $list_count, $start_count);
     $query = sprintf('SELECT %s %s FROM %s %s %s', $limit, $columns, implode(',', $table_list), implode(' ', $left_join), $condition);
     if (strlen($query_groupby)) {
         $query .= $query_groupby;
     }
     if ($output->order) {
         foreach ($output->order as $key => $val) {
             $index_list[] = sprintf("%s %s", $this->autoQuotes($val[0]), $val[1]);
         }
         if (count($index_list)) {
             $query .= sprintf(" ORDER BY %s", implode(",", $index_list));
         }
     }
     $query .= ";";
     $result = $this->_query($query);
     if ($this->isError()) {
         if (!$this->transaction_started) {
             @ibase_rollback($this->fd);
         }
         $buff = new Object();
         $buff->total_count = 0;
         $buff->total_page = 0;
         $buff->page = 1;
         $buff->data = array();
         $buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count);
         return $buff;
     }
     $virtual_no = $total_count - ($page - 1) * $list_count;
     while ($tmp = ibase_fetch_object($result)) {
         foreach ($tmp as $key => $val) {
             $type = $output->column_type[$key];
             if ($type == null) {
                 foreach ($output->columns as $cols) {
                     if ($cols['alias'] == $key) {
                         $type = $output->column_type[$cols['name']];
                     }
                 }
             }
             if ($type == "text" || $type == "bigtext") {
                 $blob_data = ibase_blob_info($tmp->{$key});
                 $blob_hndl = ibase_blob_open($tmp->{$key});
                 $tmp->{$key} = ibase_blob_get($blob_hndl, $blob_data[0]);
                 ibase_blob_close($blob_hndl);
             }
         }
         $data[$virtual_no--] = $tmp;
     }
     if (!$this->transaction_started) {
         @ibase_commit($this->fd);
     }
     $buff = new Object();
     $buff->total_count = $total_count;
     $buff->total_page = $total_page;
     $buff->page = $page;
     $buff->data = $data;
     $buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count);
     return $buff;
 }
Example #23
0
 function _performCommit()
 {
     if (!is_resource($this->trans)) {
         return false;
     }
     $result = @ibase_commit($this->trans);
     if (true === $result) {
         $this->trans = null;
     }
     return $result;
 }
Example #24
0
 /**
  * Commit a transaction.
  *
  * @return void
  */
 protected function _commit()
 {
     if (!ibase_commit(is_resource($this->_transResource) ? $this->_transResource : $this->_connection)) {
         /**
          * @see Zend_Db_Adapter_Firebird_Exception
          */
         require_once 'Zend/Db/Adapter/Firebird/Exception.php';
         throw new Zend_Db_Adapter_Firebird_Exception(ibase_errmsg());
     }
     $this->_transResource = null;
 }
Example #25
0
 /**
  * Commit Transaction
  *
  * @return	bool
  */
 protected function _trans_commit()
 {
     if (ibase_commit($this->_ibase_trans)) {
         $this->_ibase_trans = NULL;
         return TRUE;
     }
     return FALSE;
 }
Example #26
0
 /**
  * @see ILumine_Connection::commit()
  */
 public function commit($transactionID = null)
 {
     if (is_null($transactionID)) {
         $id = $this->transactions_count - 1;
     } else {
         $id = $transactionID;
     }
     if (isset($this->transactions[$id])) {
         ibase_commit($this->conn_id);
         unset($this->transactions[$id]);
     }
 }
Example #27
0
 function CommitTransaction()
 {
     $this->Debug("Commit Transaction");
     if ($this->auto_commit) {
         return $this->SetError("Commit transaction", "transaction changes are being auto commited");
     }
     if ($this->transaction_id && !ibase_commit($this->transaction_id)) {
         return $this->SetError("Commit transaction", "Could not commit a pending transaction: " . ibase_errmsg());
     }
     if (!($this->transaction_id = ibase_trans(IBASE_COMMITTED, $this->connection))) {
         return $this->SetError("Commit transaction", "Could start a new transaction: " . ibase_errmsg());
     }
     return 1;
 }
 function _query($sql, $iarr = false)
 {
     if (is_array($sql)) {
         $fn = 'ibase_execute';
         $sql = $sql[1];
     } else {
         $fn = 'ibase_query';
     }
     if (!$this->autoCommit && $this->_transactionID) {
         $conn = $this->_transactionID;
         $docommit = false;
     } else {
         $conn = $this->_connectionID;
         $docommit = true;
     }
     if (is_array($iarr)) {
         switch (sizeof($iarr)) {
             case 1:
                 $ret = $fn($conn, $sql, $iarr[0]);
                 break;
             case 2:
                 $ret = $fn($conn, $sql, $iarr[0], $iarr[1]);
                 break;
             case 3:
                 $ret = $fn($conn, $sql, $iarr[0], $iarr[1], $iarr[2]);
                 break;
             case 4:
                 $ret = $fn($conn, $sql, $iarr[0], $iarr[1], $iarr[2], $iarr[3]);
                 break;
             case 5:
                 $ret = $fn($conn, $sql, $iarr[0], $iarr[1], $iarr[2], $iarr[3], $iarr[4]);
                 break;
             case 6:
                 $ret = $fn($conn, $sql, $iarr[0], $iarr[1], $iarr[2], $iarr[3], $iarr[4], $iarr[5]);
                 break;
             case 7:
                 $ret = $fn($conn, $sql, $iarr[0], $iarr[1], $iarr[2], $iarr[3], $iarr[4], $iarr[5], $iarr[6]);
                 break;
             default:
                 ADOConnection::outp("Too many parameters to ibase query {$sql}");
             case 8:
                 $ret = $fn($conn, $sql, $iarr[0], $iarr[1], $iarr[2], $iarr[3], $iarr[4], $iarr[5], $iarr[6], $iarr[7]);
                 break;
         }
     } else {
         $ret = $fn($conn, $sql);
     }
     if ($docommit && $ret === true) {
         ibase_commit($this->_connectionID);
     }
     $this->_handleerror();
     return $ret;
 }
Example #29
0
 function _query($sql, $iarr = false)
 {
     if (!$this->autoCommit && $this->_transactionID) {
         $conn = $this->_transactionID;
         $docommit = false;
     } else {
         $conn = $this->_connectionID;
         $docommit = true;
     }
     if (is_array($sql)) {
         $fn = 'ibase_execute';
         $sql = $sql[1];
         if (is_array($iarr)) {
             if (ADODB_PHPVER >= 0x4050) {
                 // actually 4.0.4
                 if (!isset($iarr[0])) {
                     $iarr[0] = '';
                 }
                 // PHP5 compat hack
                 $fnarr =& array_merge(array($sql), $iarr);
                 $ret = call_user_func_array($fn, $fnarr);
             } else {
                 switch (sizeof($iarr)) {
                     case 1:
                         $ret = $fn($sql, $iarr[0]);
                         break;
                     case 2:
                         $ret = $fn($sql, $iarr[0], $iarr[1]);
                         break;
                     case 3:
                         $ret = $fn($sql, $iarr[0], $iarr[1], $iarr[2]);
                         break;
                     case 4:
                         $ret = $fn($sql, $iarr[0], $iarr[1], $iarr[2], $iarr[3]);
                         break;
                     case 5:
                         $ret = $fn($sql, $iarr[0], $iarr[1], $iarr[2], $iarr[3], $iarr[4]);
                         break;
                     case 6:
                         $ret = $fn($sql, $iarr[0], $iarr[1], $iarr[2], $iarr[3], $iarr[4], $iarr[5]);
                         break;
                     case 7:
                         $ret = $fn($sql, $iarr[0], $iarr[1], $iarr[2], $iarr[3], $iarr[4], $iarr[5], $iarr[6]);
                         break;
                     default:
                         ADOConnection::outp("Too many parameters to ibase query {$sql}");
                     case 8:
                         $ret = $fn($sql, $iarr[0], $iarr[1], $iarr[2], $iarr[3], $iarr[4], $iarr[5], $iarr[6], $iarr[7]);
                         break;
                 }
             }
         } else {
             $ret = $fn($sql);
         }
     } else {
         $fn = 'ibase_query';
         if (is_array($iarr)) {
             if (ADODB_PHPVER >= 0x4050) {
                 // actually 4.0.4
                 if (sizeof($iarr) == 0) {
                     $iarr[0] = '';
                 }
                 // PHP5 compat hack
                 $fnarr =& array_merge(array($conn, $sql), $iarr);
                 $ret = call_user_func_array($fn, $fnarr);
             } else {
                 switch (sizeof($iarr)) {
                     case 1:
                         $ret = $fn($conn, $sql, $iarr[0]);
                         break;
                     case 2:
                         $ret = $fn($conn, $sql, $iarr[0], $iarr[1]);
                         break;
                     case 3:
                         $ret = $fn($conn, $sql, $iarr[0], $iarr[1], $iarr[2]);
                         break;
                     case 4:
                         $ret = $fn($conn, $sql, $iarr[0], $iarr[1], $iarr[2], $iarr[3]);
                         break;
                     case 5:
                         $ret = $fn($conn, $sql, $iarr[0], $iarr[1], $iarr[2], $iarr[3], $iarr[4]);
                         break;
                     case 6:
                         $ret = $fn($conn, $sql, $iarr[0], $iarr[1], $iarr[2], $iarr[3], $iarr[4], $iarr[5]);
                         break;
                     case 7:
                         $ret = $fn($conn, $sql, $iarr[0], $iarr[1], $iarr[2], $iarr[3], $iarr[4], $iarr[5], $iarr[6]);
                         break;
                     default:
                         ADOConnection::outp("Too many parameters to ibase query {$sql}");
                     case 8:
                         $ret = $fn($conn, $sql, $iarr[0], $iarr[1], $iarr[2], $iarr[3], $iarr[4], $iarr[5], $iarr[6], $iarr[7]);
                         break;
                 }
             }
         } else {
             $ret = $fn($conn, $sql);
         }
     }
     if ($docommit && $ret === true) {
         ibase_commit($this->_connectionID);
     }
     $this->_handleerror();
     return $ret;
 }
Example #30
0
 public function commit()
 {
     if (!$this->trans) {
         $this->result = ibase_commit($this->connection);
     } else {
         $this->result = ibase_rollback($this->trans);
         $this->trans = null;
     }
     if (!$this->result) {
         throw new Exception(ibase_errmsg());
     }
 }