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


PHP resource::rollBack方法代码示例

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


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

示例1: __construct

 /**
  * Construct
  *
  * @param Registry $registry
  * @param Request $request
  * @param int $language_id Default language id
  */
 public function __construct(Registry $registry, Request $request, $language_id)
 {
     $_translation = array();
     $this->_db = $registry->get('db');
     try {
         $statement = $this->_db->query('SELECT * FROM `language`');
     } catch (PDOException $e) {
         if ($this->_db->inTransaction()) {
             $this->_db->rollBack();
         }
         trigger_error($e->getMessage());
     }
     if ($statement->rowCount()) {
         foreach ($statement->fetchAll() as $language) {
             // Add languages registry
             $this->_languages[$language->language_id] = array('language_id' => $language->language_id, 'language_code' => $language->code, 'language_locale' => $language->locale, 'language_name' => $language->name);
             // Set default language
             if ($language->language_id == $language_id) {
                 $this->_language_id = $language->language_id;
                 $this->_language_code = $language->code;
                 $this->_language_locale = $language->locale;
                 $this->_language_name = $language->name;
             }
             // Get active language
             if (isset($request->get['language_id'])) {
                 $_language_id = (int) $request->get['language_id'];
             } else {
                 if (isset($request->cookie['language_id'])) {
                     $_language_id = (int) $request->cookie['language_id'];
                 } else {
                     $_language_id = (int) DEFAULT_LANGUAGE_ID;
                 }
             }
             // Set current language
             $language_file = DIR_BASE . 'language' . DIR_SEPARATOR . $language->code . '.php';
             if ($_language_id == $language->language_id && file_exists($language_file) && is_readable($language_file)) {
                 $this->_language_id = $language->language_id;
                 $this->_language_code = $language->code;
                 $this->_language_locale = $language->locale;
                 $this->_language_name = $language->name;
                 // Load language package if exist
                 require_once $language_file;
                 $this->_translation = $_translation;
             }
         }
     }
 }
开发者ID:rmcdermott,项目名称:bitsybay,代码行数:54,代码来源:language.php

示例2: __construct

 /**
  * Construct
  *
  * @param registry $registry
  * @param int $language_id Current language id
  */
 public function __construct(Registry $registry, $language_id)
 {
     $this->_db = $registry->get('db');
     try {
         $statement = $this->_db->prepare('SELECT * FROM `language`');
         $statement->execute();
     } catch (PDOException $e) {
         if ($this->_db->inTransaction()) {
             $this->_db->rollBack();
         }
         trigger_error($e->getMessage());
     }
     if ($statement->rowCount()) {
         foreach ($statement->fetchAll() as $language) {
             $this->_languages[$language->language_id] = array('language_id' => $language->language_id, 'language_code' => $language->code, 'language_locale' => $language->locale, 'language_name' => $language->name);
             if ($language->language_id == $language_id) {
                 $this->_language_id = $language->language_id;
                 $this->_language_code = $language->code;
                 $this->_language_locale = $language->locale;
                 $this->_language_name = $language->name;
             }
         }
     }
 }
开发者ID:babilavena,项目名称:bitsybay,代码行数:30,代码来源:language.php

示例3: completeTrans

 /**
  * 完成事务,根据查询是否出错决定是提交事务还是回滚事务
  *
  * 如果 $commitOnNoErrors 参数为 true,当事务中所有查询都成功完成时,则提交事务,否则回滚事务
  * 如果 $commitOnNoErrors 参数为 false,则强制回滚事务
  *
  * @param  $commitOnNoErrors 指示在没有错误时是否提交事务
  */
 function completeTrans($commitOnNoErrors = true)
 {
     if ($this->_transCount < 1) {
         return;
     }
     if ($this->_transCount > 1) {
         $this->_transCount -= 1;
         return;
     }
     $this->_transCount = 0;
     if ($this->_transCommit && $commitOnNoErrors) {
         $this->conn->commit();
     } else {
         $this->conn->rollBack();
     }
 }
开发者ID:BGCX261,项目名称:zlskytakeorder-svn-to-git,代码行数:24,代码来源:Sqlitepdo.php

示例4: createDatabaseTables

 protected function createDatabaseTables()
 {
     $queries = array();
     switch ($this->database_driver) {
         case self::SI_DRIVER_SQLITE3:
             $queries[] = "CREATE TABLE \"{$this->database_table}\" (\n                                id VARCHAR(40),\n                                namespace VARCHAR(32) NOT NULL,\n                                code VARCHAR(32) NOT NULL,\n                                code_display VARCHAR(32) NOT NULL,\n                                created INTEGER NOT NULL,\n                                PRIMARY KEY(id, namespace)\n                              )";
             $queries[] = "CREATE INDEX ndx_created ON {$this->database_table} (created)";
             break;
         case self::SI_DRIVER_MYSQL:
             $queries[] = "CREATE TABLE `{$this->database_table}` (\n                                `id` VARCHAR(40) NOT NULL,\n                                `namespace` VARCHAR(32) NOT NULL,\n                                `code` VARCHAR(32) NOT NULL,\n                                `code_display` VARCHAR(32) NOT NULL,\n                                `created` INT NOT NULL,\n                                PRIMARY KEY(id, namespace),\n                                INDEX(created)\n                              )";
             break;
         case self::SI_DRIVER_PGSQL:
             $queries[] = "CREATE TABLE {$this->database_table} (\n                                id character varying(40) NOT NULL,\n                                namespace character varying(32) NOT NULL,\n                                code character varying(32) NOT NULL,\n                                code_display character varying(32) NOT NULL,\n                                created integer NOT NULL,\n                                CONSTRAINT pkey_id_namespace PRIMARY KEY (id, namespace)\n                              )";
             $queries[] = "CREATE INDEX ndx_created ON {$this->database_table} (created);";
             break;
     }
     $this->pdo_conn->beginTransaction();
     foreach ($queries as $query) {
         $result = $this->pdo_conn->query($query);
         if (!$result) {
             $err = $this->pdo_conn->errorInfo();
             trigger_error("Failed to create table.  {$err[1]}: {$err[2]}", E_USER_WARNING);
             $this->pdo_conn->rollBack();
             $this->pdo_conn = false;
             return false;
         }
     }
     $this->pdo_conn->commit();
     return true;
 }
开发者ID:arunrajthala,项目名称:leapers,代码行数:30,代码来源:securimage.php

示例5: rollBack

 /**
  * Rolls back a transaction
  *
  * @return bool
  */
 public function rollBack()
 {
     return $this->_conn->rollBack();
 }
开发者ID:happyxlq,项目名称:pd,代码行数:9,代码来源:Engine.class.php

示例6: _rollBack

 /**
  * Roll-back a transaction.
  */
 protected function _rollBack()
 {
     $this->_connect();
     $this->connection->rollBack();
 }
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:8,代码来源:abstract.class.php


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