当前位置: 首页>>代码示例>>PHP>>正文


PHP Horde_Db_Adapter::rollbackDbTransaction方法代码示例

本文整理汇总了PHP中Horde_Db_Adapter::rollbackDbTransaction方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Db_Adapter::rollbackDbTransaction方法的具体用法?PHP Horde_Db_Adapter::rollbackDbTransaction怎么用?PHP Horde_Db_Adapter::rollbackDbTransaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Horde_Db_Adapter的用法示例。


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

示例1: write

 /**
  */
 public function write($id, $session_data)
 {
     if (!$this->_db->isActive()) {
         $this->_db->reconnect();
         $this->_db->beginDbTransaction();
     }
     /* Check if session exists. */
     try {
         $exists = $this->_db->selectValue(sprintf('SELECT 1 FROM %s WHERE session_id = ?', $this->_params['table']), array($id));
     } catch (Horde_Db_Exception $e) {
         return false;
     }
     /* Update or insert session data. */
     $session_data = new Horde_Db_Value_Binary($session_data);
     try {
         if ($exists) {
             $query = sprintf('UPDATE %s ' . 'SET session_data = ?, session_lastmodified = ? ' . 'WHERE session_id = ?', $this->_params['table']);
             $values = array($session_data, time(), $id);
             $this->_db->update($query, $values);
         } else {
             $query = sprintf('INSERT INTO %s ' . '(session_id, session_data, session_lastmodified) ' . 'VALUES (?, ?, ?)', $this->_params['table']);
             $values = array($id, $session_data, time());
             $this->_db->insert($query, $values);
         }
         $this->_db->commitDbTransaction();
     } catch (Horde_Db_Exception $e) {
         try {
             $this->_db->rollbackDbTransaction();
         } catch (Horde_Db_Exception $e) {
         }
         return false;
     }
     return true;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:36,代码来源:Sql.php

示例2: write

 /**
  */
 public function write($id, $session_data)
 {
     if (!$this->_db->isActive()) {
         $this->_db->reconnect();
         $this->_db->beginDbTransaction();
     }
     /* Check if session exists. */
     try {
         $exists = $this->_db->selectValue(sprintf('SELECT 1 FROM %s WHERE session_id = ?', $this->_params['table']), array($id));
     } catch (Horde_Db_Exception $e) {
         return false;
     }
     /* Update or insert session data. */
     $values = array('session_data' => new Horde_Db_Value_Binary($session_data), 'session_lastmodified' => time());
     try {
         if ($exists) {
             $this->_db->updateBlob($this->_params['table'], $values, array('session_id = ?', array($id)));
         } else {
             $this->_db->insertBlob($this->_params['table'], array_merge(array('session_id' => $id), $values));
         }
         $this->_db->commitDbTransaction();
     } catch (Horde_Db_Exception $e) {
         try {
             $this->_db->rollbackDbTransaction();
         } catch (Horde_Db_Exception $e) {
         }
         return false;
     }
     return true;
 }
开发者ID:horde,项目名称:horde,代码行数:32,代码来源:Sql.php

示例3: removeAllVersions

 /**
  */
 public function removeAllVersions($pagename)
 {
     /* Remove attachments and do other cleanup. */
     parent::removeAllVersions($pagename);
     $this->_pageNames = null;
     try {
         $this->_db->beginDbTransaction();
         $this->_db->delete('DELETE FROM ' . $this->_params['table'] . ' WHERE page_name = ?', array($this->_convertToDriver($pagename)));
         $this->_db->delete('DELETE FROM ' . $this->_params['historytable'] . ' WHERE page_name = ?', array($this->_convertToDriver($pagename)));
         $this->_db->commitDbTransaction();
     } catch (Horde_Db_Exception $e) {
         $this->_db->rollbackDbTransaction();
         throw new Wicked_Exception($e);
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:17,代码来源:Sql.php

示例4: sort

 /**
  */
 public function sort($rules)
 {
     $old = $this->_filters;
     parent::sort($rules);
     $query = sprintf('UPDATE %s SET rule_order = ? WHERE rule_id = ?', $this->_params['table_rules']);
     $this->_db->beginDbTransaction();
     try {
         foreach ($this->_filters as $key => $val) {
             $this->_db->update($query, array($key, $val['id']));
         }
     } catch (Horde_Db_Exception $e) {
         $this->_db->rollbackDbTransaction();
         $this->_filters = $old;
         throw new Ingo_Exception($e);
     }
     $this->_db->commitDbTransaction();
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:19,代码来源:Sql.php

示例5: rollbackDbTransaction

 /**
  * Rolls back the transaction (and turns on auto-committing). Must be
  * done if the transaction block raises an exception or returns false.
  */
 public function rollbackDbTransaction()
 {
     $result = $this->_write->rollbackDbTransaction();
     $this->_lastQuery = $this->_write->getLastQuery();
     return $result;
 }
开发者ID:horde,项目名称:horde,代码行数:10,代码来源:SplitRead.php


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