Esempio n. 1
0
 /**
  * Rollback transaction.
  */
 public function rollback()
 {
     cubrid_rollback($this->link);
     if ($this->autoCommit && !cubrid_get_autocommit($this->link)) {
         cubrid_set_autocommit($this->link, CUBRID_AUTOCOMMIT_TRUE);
     }
 }
Esempio n. 2
0
 /**
  * Rollback Transaction
  *
  * @access	public
  * @return	bool
  */
 function trans_rollback()
 {
     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;
     }
     cubrid_rollback($this->conn_id);
     if ($this->auto_commit && !cubrid_get_autocommit($this->conn_id)) {
         cubrid_set_autocommit($this->conn_id, CUBRID_AUTOCOMMIT_TRUE);
     }
     return TRUE;
 }
Esempio n. 3
0
 public function transRollback()
 {
     cubrid_rollback($this->connect);
     if (!cubrid_get_autocommit($this->connect)) {
         cubrid_set_autocommit($this->connect, CUBRID_AUTOCOMMIT_TRUE);
     }
     return TRUE;
 }
function cubrid_mysql_rollback($link_identifier)
{
    return cubrid_rollback($link_identifier);
}
Esempio n. 5
0
 /**
  * Rollback Transaction
  *
  * @return	bool
  */
 protected function _trans_rollback()
 {
     if (!cubrid_rollback($this->conn_id)) {
         return FALSE;
     }
     if ($this->auto_commit && !cubrid_get_autocommit($this->conn_id)) {
         cubrid_set_autocommit($this->conn_id, CUBRID_AUTOCOMMIT_TRUE);
     }
     return TRUE;
 }
Esempio n. 6
0
 /**
  * DB transaction rollback
  * this method is private
  * @return boolean
  */
 function _rollback($transactionLevel = 0)
 {
     $connection = $this->_getConnection('master');
     $point = $transactionLevel - 1;
     if ($point) {
         $this->_query("ROLLBACK TO SP" . $point, $connection);
     } else {
         @cubrid_rollback($connection);
     }
     return TRUE;
 }
Esempio n. 7
0
<?php

include_once "connect.inc";
header('Content-type: text/html; charset=euc-kr');
//var_dump($connect_url);
$conn = cubrid_connect_with_url($connect_url);
$sql = "SELECT a from foo";
$result = cubrid_execute($conn, $sql);
$pResult = cubrid_fetch($result);
echo $pResult[0];
echo "<br/>";
cubrid_close_request($result);
cubrid_rollback($conn);
cubrid_disconnect($conn);
Esempio n. 8
0
    $is_exist = false;
}
if ($is_exist === false) {
    $result = cubrid_execute($dh, "CREATE TABLE \"" . $db["table"] . "\" (\n         \"index\"   INTEGER NOT NULL,\n         \"addr1\"   CHARACTER VARYING(12) NOT NULL,\n         \"addr2\"   CHARACTER VARYING(30) NOT NULL,\n         \"addr3\"   CHARACTER VARYING(64) NOT NULL,\n         \"addr4\"   CHARACTER VARYING(24) NOT NULL,\n         \"zipcode\" CHARACTER(7) NOT NULL\n       );");
    if ($result === false) {
        printf("DB Error %d (%d): %s\n", cubrid_error_code(), cubrid_error_code_facility(), cubrid_error_msg());
        cubrid_rollback($dh);
        cubrid_disconnect($dh);
        exit(0);
    }
    cubrid_close_request($result);
    cubrid_commit($dh);
    $result = cubrid_execute($dh, "CREATE UNIQUE INDEX \"" . $db["table"] . "_idx\"\n         ON \"" . $db["table"] . "\" (\"index\" ASC);");
    if ($result === false) {
        printf("Cannot create index.\n");
        cubrid_rollback($dh);
    } else {
        cubrid_close_request($result);
        cubrid_commit($dh);
    }
}
$error_count = 0;
$inserted = 0;
foreach ($addr_list as $val) {
    $result = cubrid_execute($dh, sprintf("INSERT INTO \"%s\" (\"index\", \"addr1\", \"addr2\",\n                  \"addr3\", \"addr4\", \"zipcode\") VALUES\n                  (%d, '%s', '%s', '%s', '%s', '%s');", $db["table"], $val[5], $val[1], $val[2], $val[3], $val[4], $val[0]));
    if ($result === false) {
        $error_count++;
        printf("Insert Error! Index: %d, Error Count: %d\n", $val[5], $error_count);
        continue;
    }
    $inserted++;
Esempio n. 9
0
 public function rollbackTrans()
 {
     cubrid_rollback($this->_conn);
     $this->_transMode = false;
     $this->_transFailedCnt = 0;
     cubrid_set_autocommit($this->_conn, CUBRID_AUTOCOMMIT_TRUE);
     $this->Logging("++ RollbackTrans");
 }
Esempio n. 10
0
 public function testCubridCci4()
 {
     if (OUTPUT_FUNCTION_NAME == true) {
         echo "\r\nRunning: " . __FUNCTION__ . " = ";
     }
     try {
         $table = "t1";
         $this->sql = "create table t1(code int unique, s string) ";
         cubrid_execute($this->con, $this->sql);
         cubrid_commit($this->con);
         for ($i = 0; $i < 100; $i++) {
             $this->sql = "insert into t1 values({$i}, 'aaa')";
             $this->req = cubrid_execute($this->con, $this->sql);
         }
         cubrid_rollback($this->con);
         $this->sql = "select count(*) from t1";
         $this->req = cubrid_execute($this->con, $this->sql);
         $str = cubrid_fetch_row($this->req);
         echo $str[0];
         $this->assertEquals($str[0], 0);
         echo "\r\n#### case Cci4 OK #### ";
     } catch (Exception $e) {
         echo "\r\n#### Catch Cci4 Exception #### ";
     }
     $this->sql = "drop table t1";
     cubrid_execute($this->con, $this->sql);
     cubrid_commit($this->con);
     $this->req = null;
 }
Esempio n. 11
0
 /**
  * DB transaction rollback
  * this method is private
  * @return boolean
  */
 function _rollback()
 {
     $connection = $this->_getConnection('master');
     @cubrid_rollback($connection);
     return TRUE;
 }
Esempio n. 12
0
 /**
  * @brief 롤백
  **/
 function rollback()
 {
     if (!$this->isConnected() || !$this->transaction_started) {
         return;
     }
     @cubrid_rollback($this->fd);
     $this->transaction_started = false;
 }
 function trans_rollback()
 {
     if (!$this->trans_enabled) {
         return TRUE;
     }
     if ($this->_trans_depth > 0) {
         return TRUE;
     }
     cubrid_rollback($this->conn_id);
     if ($this->auto_commit && !cubrid_get_autocommit($this->conn_id)) {
         cubrid_set_autocommit($this->conn_id, CUBRID_AUTOCOMMIT_TRUE);
     }
     return TRUE;
 }