• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP odbc_rollback函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中odbc_rollback函数的典型用法代码示例。如果您正苦于以下问题:PHP odbc_rollback函数的具体用法?PHP odbc_rollback怎么用?PHP odbc_rollback使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了odbc_rollback函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: rollbackTransaction

 /**
  * rollback the sql transaction
  *
  */
 protected function rollbackTransaction()
 {
     if (self::$transactionStarted[$this->datastore] == true) {
         if (!odbc_rollback($this->con)) {
             throw new Exception('unable to rollback transaction: ' . odbc_errormsg($this->con));
         }
         self::$transactionStarted[$this->datastore] = false;
     }
 }
开发者ID:nephie,项目名称:AZL-website,代码行数:13,代码来源:mssqlmodel_.php


示例2: _sql_transaction

 /**
  * SQL Transaction
  * @access: private
  */
 function _sql_transaction($status = 'begin')
 {
     switch ($status) {
         case 'begin':
             return @odbc_autocommit($this->db_connect_id, false);
             break;
         case 'commit':
             $result = @odbc_commit($this->db_connect_id);
             @odbc_autocommit($this->db_connect_id, true);
             return $result;
             break;
         case 'rollback':
             $result = @odbc_rollback($this->db_connect_id);
             @odbc_autocommit($this->db_connect_id, true);
             return $result;
             break;
     }
     return true;
 }
开发者ID:yunsite,项目名称:gloryroad,代码行数:23,代码来源:mssql_odbc.php


示例3: rollback

 /**
  * Rollback a transaction
  *
  * @param unknown_type $model
  * @return boolean True on success, false on fail
  * (i.e. if the database/model does not support transactions,
  * or a transaction has not started).
  */
 function rollback(&$model)
 {
     if (parent::rollback($model)) {
         $this->_transactionStarted = false;
         return odbc_rollback($this->connection);
     }
     return false;
 }
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:16,代码来源:dbo_odbc.php


示例4: _execute

 /**
  * Executes given SQL statement.
  *
  * @param string $sql SQL statement
  * @return resource Result resource identifier
  * @access protected
  */
 function _execute($sql)
 {
     switch ($sql) {
         case 'BEGIN':
             return odbc_autocommit($this->connection, false);
         case 'COMMIT':
             return odbc_commit($this->connection);
         case 'ROLLBACK':
             return odbc_rollback($this->connection);
     }
     // TODO: should flags be set? possible requirement:  SQL_CURSOR_STATIC
     return odbc_exec($this->connection, $sql);
 }
开发者ID:jerzzz777,项目名称:cake-cart,代码行数:20,代码来源:dbo_odbc.php


示例5: rollback

 function rollback()
 {
     //5.3.0
     return odbc_rollback($this->_LINK);
 }
开发者ID:emelianov,项目名称:helpdesk,代码行数:5,代码来源:class.sql.php


示例6: trans_rollback

 /**
  * Rollback Transaction
  *
  * @return	bool
  */
 public function trans_rollback()
 {
     // When transactions are nested we only begin/commit/rollback the outermost ones
     if (!$this->trans_enabled or $this->_trans_depth > 0) {
         return TRUE;
     }
     $ret = odbc_rollback($this->conn_id);
     odbc_autocommit($this->conn_id, TRUE);
     return $ret;
 }
开发者ID:NaszvadiG,项目名称:boilerplate,代码行数:15,代码来源:odbc_driver.php


示例7: RollbackTrans

 function RollbackTrans()
 {
     if ($this->transOff) {
         return true;
     }
     if ($this->transCnt) {
         $this->transCnt -= 1;
     }
     $this->_autocommit = true;
     $ret = odbc_rollback($this->_connectionID);
     odbc_autocommit($this->_connectionID, true);
     return $ret;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:13,代码来源:adodb-odbc.inc.php


示例8: _trans_rollback

 /**
  * Rollback Transaction
  *
  * @return	bool
  */
 protected function _trans_rollback()
 {
     if (odbc_rollback($this->conn_id)) {
         odbc_autocommit($this->conn_id, TRUE);
         return TRUE;
     }
     return FALSE;
 }
开发者ID:borisper1,项目名称:vesi-cms-ng,代码行数:13,代码来源:odbc_driver.php


示例9: handleTransactionQueries

 /**
  * Makes sure each database and extension handles BEGIN, COMMIT and ROLLBACK 
  * 
  * @param  string &$sql          The SQL to check for a transaction query
  * @param  string $result_class  The type of result object to create
  * @return mixed  `FALSE` if normal processing should continue, otherwise an object of the type $result_class
  */
 private function handleTransactionQueries(&$sql, $result_class)
 {
     // SQL Server supports transactions, but starts then with BEGIN TRANSACTION
     if ($this->type == 'mssql' && preg_match('#^\\s*(begin|start(\\s+transaction)?)\\s*#i', $sql)) {
         $sql = 'BEGIN TRANSACTION';
     }
     $begin = FALSE;
     $commit = FALSE;
     $rollback = FALSE;
     // Track transactions since most databases don't support nesting
     if (preg_match('#^\\s*(begin|start)(\\s+(transaction|work))?\\s*$#iD', $sql)) {
         if ($this->inside_transaction) {
             throw new fProgrammerException('A transaction is already in progress');
         }
         $this->inside_transaction = TRUE;
         $begin = TRUE;
     } elseif (preg_match('#^\\s*(commit)(\\s+(transaction|work))?\\s*$#iD', $sql)) {
         if (!$this->inside_transaction) {
             throw new fProgrammerException('There is no transaction in progress');
         }
         $this->inside_transaction = FALSE;
         $commit = TRUE;
     } elseif (preg_match('#^\\s*(rollback)(\\s+(transaction|work))?\\s*$#iD', $sql)) {
         if (!$this->inside_transaction) {
             throw new fProgrammerException('There is no transaction in progress');
         }
         $this->inside_transaction = FALSE;
         $rollback = TRUE;
     }
     if (!$begin && !$commit && !$rollback) {
         return FALSE;
     }
     // The PDO, OCI8, ODBC and SQLSRV extensions require special handling through methods and functions
     $is_pdo = $this->extension == 'pdo';
     $is_oci = $this->extension == 'oci8';
     $is_odbc = $this->extension == 'odbc';
     $is_sqlsrv = $this->extension == 'sqlsrv';
     if (!$is_pdo && !$is_oci && !$is_odbc && !$is_sqlsrv) {
         return FALSE;
     }
     // PDO seems to act weird if you try to start transactions through a normal query call
     if ($is_pdo) {
         try {
             $is_mssql = $this->type == 'mssql' && substr($this->database, 0, 4) != 'dsn:';
             $is_oracle = $this->type == 'oracle' && substr($this->database, 0, 4) != 'dsn:';
             if ($begin) {
                 // The SQL Server PDO object hasn't implemented transactions
                 if ($is_mssql) {
                     $this->connection->exec('BEGIN TRANSACTION');
                 } elseif ($is_oracle) {
                     $this->connection->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE);
                 } else {
                     $this->connection->beginTransaction();
                 }
             } elseif ($commit) {
                 if ($is_mssql) {
                     $this->connection->exec('COMMIT');
                 } elseif ($is_oracle) {
                     $this->connection->exec('COMMIT');
                     $this->connection->setAttribute(PDO::ATTR_AUTOCOMMIT, TRUE);
                 } else {
                     $this->connection->commit();
                 }
             } elseif ($rollback) {
                 if ($is_mssql) {
                     $this->connection->exec('ROLLBACK');
                 } elseif ($is_oracle) {
                     $this->connection->exec('ROLLBACK');
                     $this->connection->setAttribute(PDO::ATTR_AUTOCOMMIT, TRUE);
                 } else {
                     $this->connection->rollBack();
                 }
             }
         } catch (Exception $e) {
             $db_type_map = array('mssql' => 'MSSQL', 'mysql' => 'MySQL', 'oracle' => 'Oracle', 'postgresql' => 'PostgreSQL', 'sqlite' => 'SQLite');
             throw new fSQLException('%1$s error (%2$s) in %3$s', $db_type_map[$this->type], $e->getMessage(), $sql);
         }
     } elseif ($is_oci) {
         if ($commit) {
             oci_commit($this->connection);
         } elseif ($rollback) {
             oci_rollback($this->connection);
         }
     } elseif ($is_odbc) {
         if ($begin) {
             odbc_autocommit($this->connection, FALSE);
         } elseif ($commit) {
             odbc_commit($this->connection);
             odbc_autocommit($this->connection, TRUE);
         } elseif ($rollback) {
             odbc_rollback($this->connection);
             odbc_autocommit($this->connection, TRUE);
         }
//.........这里部分代码省略.........
开发者ID:jsuarez,项目名称:MyDesign,代码行数:101,代码来源:fDatabase.php


示例10: rollback

 /**
  * Roll back transaction
  *
  * @throws VerticaException
  * @author Sergii Katrych <[email protected]>
  */
 public function rollback()
 {
     $result = odbc_rollback($this->getConnection());
     if (false === $result) {
         throw new VerticaException("Failed to RollBack transaction due to " . odbc_errormsg($this->getConnection()), odbc_error($this->getConnection()));
     }
 }
开发者ID:maschek,项目名称:vertica-php-adapter,代码行数:13,代码来源:VerticaOdbcAbstract.php


示例11: rollback

 public function rollback()
 {
     odbc_rollback($this->_con);
 }
开发者ID:startsevsa,项目名称:cash,代码行数:4,代码来源:odbc.php


示例12: rollback

 /**
  * Rollback queries without ending the transaction
  */
 public function rollback()
 {
     switch ($this->mode) {
         case "mysql":
             $result = $this->server->rollback();
             break;
         case "postgres":
         case "redshift":
             $result = $this->query("ROLLBACK");
             break;
         case "odbc":
             $result = odbc_rollback($this->server);
             break;
         default:
             throw new \Exception("rollback() not supported in this mode (" . $this->mode . ")");
     }
     if (!$result) {
         $this->error();
     }
     return true;
 }
开发者ID:duncan3dc,项目名称:sql-class,代码行数:24,代码来源:Sql.php


示例13: rollback

 function rollback()
 {
     odbc_rollback($this->connection);
     odbc_autocommit($this->connection, true);
 }
开发者ID:rshariffdeen,项目名称:olio,代码行数:5,代码来源:ODBCConnection.php


示例14: RollbackTrans

 function RollbackTrans()
 {
     $ret = odbc_rollback($this->_connectionID);
     odbc_autocommit($this->_connectionID, true);
     return $ret;
 }
开发者ID:qoire,项目名称:portal,代码行数:6,代码来源:adodb-odbc.inc.php


示例15: odbc_errormsg

if ($rh == NULL) {
    echo odbc_errormsg($r);
    exit(1);
}
$rh = odbc_exec($r, "INSERT INTO innotable SET idx=300");
if ($rh == NULL) {
    echo odbc_errormsg($r);
    exit(1);
}
odbc_autocommit($r, false);
$rh = odbc_exec($r, "INSERT INTO innotable SET idx=500");
if ($rh == NULL) {
    echo odbc_errormsg($r);
    exit(1);
}
odbc_rollback($r);
$rh = odbc_exec($r, "SELECT * FROM innotable");
if ($rh == NULL) {
    echo odbc_errormsg($r);
    exit(1);
}
// fetch
while ($rr = odbc_fetch_array($rh)) {
    var_dump($rr);
}
$rh = odbc_exec($r, "INSERT INTO innotable SET idx=700");
if ($rh == NULL) {
    echo odbc_errormsg($r);
    exit(1);
}
odbc_commit($r);
开发者ID:jenalgit,项目名称:roadsend-php,代码行数:31,代码来源:commit-rollback.php


示例16: RollbackTransaction

 function RollbackTransaction()
 {
     if ($this->auto_commit) {
         return $this->SetError("Rollback transaction", "transactions can not be rolled back when changes are auto commited");
     }
     if (!@odbc_rollback($this->connection)) {
         return $this->SetODBCError("Rollback transaction", "Could not rollback the current transaction", $php_errormsg);
     }
     return 1;
 }
开发者ID:BackupTheBerlios,项目名称:zvs,代码行数:10,代码来源:metabase_odbc.php


示例17: transRollback

 public function transRollback()
 {
     $rollback = odbc_rollback($this->connect);
     odbc_autocommit($this->connect, true);
     return $rollback;
 }
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:6,代码来源:OdbcDriver.php


示例18: _trans_rollback

 /**
  * Rollback Transaction.
  *
  * @return bool
  */
 protected function _trans_rollback()
 {
     if (odbc_rollback($this->conn_id)) {
         odbc_autocommit($this->conn_id, true);
         return true;
     }
     return false;
 }
开发者ID:recca0120,项目名称:laraigniter,代码行数:13,代码来源:odbc_driver.php


示例19: sql_query

 function sql_query($query = "", $transaction = FALSE)
 {
     if ($query != "") {
         $this->num_queries++;
         if ($transaction == BEGIN_TRANSACTION && !$this->in_transaction) {
             if (!odbc_autocommit($this->db_connect_id, false)) {
                 return false;
             }
             $this->in_transaction = TRUE;
         }
         if (preg_match("/^SELECT(.*?)(LIMIT ([0-9]+)[, ]*([0-9]+)*)?\$/s", $query, $limits)) {
             $query = $limits[1];
             if (!empty($limits[2])) {
                 $row_offset = $limits[4] ? $limits[3] : "";
                 $num_rows = $limits[4] ? $limits[4] : $limits[3];
                 $query = "TOP " . ($row_offset + $num_rows) . $query;
             }
             $this->result = odbc_exec($this->db_connect_id, "SELECT {$query}");
             if ($this->result) {
                 if (empty($this->field_names[$this->result])) {
                     for ($i = 1; $i < odbc_num_fields($this->result) + 1; $i++) {
                         $this->field_names[$this->result][] = odbc_field_name($this->result, $i);
                         $this->field_types[$this->result][] = odbc_field_type($this->result, $i);
                     }
                 }
                 $this->current_row[$this->result] = 0;
                 $this->result_rowset[$this->result] = array();
                 $row_outer = isset($row_offset) ? $row_offset + 1 : 1;
                 $row_outer_max = isset($num_rows) ? $row_offset + $num_rows + 1 : 1000000000.0;
                 $row_inner = 0;
                 while (odbc_fetch_row($this->result, $row_outer) && $row_outer < $row_outer_max) {
                     for ($j = 0; $j < count($this->field_names[$this->result]); $j++) {
                         $this->result_rowset[$this->result][$row_inner][$this->field_names[$this->result][$j]] = stripslashes(odbc_result($this->result, $j + 1));
                     }
                     $row_outer++;
                     $row_inner++;
                 }
                 $this->num_rows[$this->result] = count($this->result_rowset[$this->result]);
             }
         } else {
             if (eregi("^INSERT ", $query)) {
                 $this->result = odbc_exec($this->db_connect_id, $query);
                 if ($this->result) {
                     $result_id = odbc_exec($this->db_connect_id, "SELECT @@IDENTITY");
                     if ($result_id) {
                         if (odbc_fetch_row($result_id)) {
                             $this->next_id[$this->db_connect_id] = odbc_result($result_id, 1);
                             $this->affected_rows[$this->db_connect_id] = odbc_num_rows($this->result);
                         }
                     }
                 }
             } else {
                 $this->result = odbc_exec($this->db_connect_id, $query);
                 if ($this->result) {
                     $this->affected_rows[$this->db_connect_id] = odbc_num_rows($this->result);
                 }
             }
         }
         if (!$this->result) {
             if ($this->in_transaction) {
                 odbc_rollback($this->db_connect_id);
                 odbc_autocommit($this->db_connect_id, true);
                 $this->in_transaction = FALSE;
             }
             return false;
         }
         if ($transaction == END_TRANSACTION && $this->in_transaction) {
             $this->in_transaction = FALSE;
             if (!odbc_commit($this->db_connect_id)) {
                 odbc_rollback($this->db_connect_id);
                 odbc_autocommit($this->db_connect_id, true);
                 return false;
             }
             odbc_autocommit($this->db_connect_id, true);
         }
         odbc_free_result($this->result);
         return $this->result;
     } else {
         if ($transaction == END_TRANSACTION && $this->in_transaction) {
             $this->in_transaction = FALSE;
             if (!@odbc_commit($this->db_connect_id)) {
                 odbc_rollback($this->db_connect_id);
                 odbc_autocommit($this->db_connect_id, true);
                 return false;
             }
             odbc_autocommit($this->db_connect_id, true);
         }
         return true;
     }
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:90,代码来源:mssql-odbc.php


示例20: rollbackTrans

 /**
  * Roll back (undo) the current transaction.
  * @throws SQLException
  * @return void
  */
 protected function rollbackTrans()
 {
     if ($this->adapter->supportsTransactions()) {
         $result = @odbc_rollback($this->dblink);
         if (!$result) {
             throw new SQLException('Could not rollback transaction', $this->nativeError());
         }
         @odbc_autocommit($this->dblink, true);
         if (odbc_error($this->dblink) == 'S1C00') {
             throw new SQLException('Could not rollback transaction (autocommit failed)', $this->nativeError());
         }
     }
 }
开发者ID:saiber,项目名称:www,代码行数:18,代码来源:ODBCConnection.php



注:本文中的odbc_rollback函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP onNext函数代码示例发布时间:2022-05-24
下一篇:
PHP odbc_result函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap