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


PHP db2_commit函数代码示例

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


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

示例1: commit

 function commit()
 {
     if (!db2_commit($this->_conn)) {
         throw new DB2Exception(db2_conn_errormsg($this->_conn));
     }
     db2_autocommit($this->_conn, DB2_AUTOCOMMIT_ON);
 }
开发者ID:manish436,项目名称:zform,代码行数:7,代码来源:DB2Connection.php

示例2: CommitTrans

 function CommitTrans($ok = true)
 {
     if ($this->transOff) {
         return true;
     }
     if (!$ok) {
         return $this->RollbackTrans();
     }
     if ($this->transCnt) {
         $this->transCnt -= 1;
     }
     $this->_autocommit = true;
     $ret = db2_commit($this->_connectionID);
     db2_autocommit($this->_connectionID, true);
     return $ret;
 }
开发者ID:rowlandm,项目名称:uiexperiment,代码行数:16,代码来源:adodb-db2.inc.php

示例3: commit

 /**
  * This function commits a transaction.
  *
  * @access public
  * @override
  * @throws Throwable_SQL_Exception              indicates that the executed
  *                                              statement failed
  *
  * @see http://www.php.net/manual/en/function.db2-commit.php
  */
 public function commit()
 {
     if (!$this->is_connected()) {
         throw new Throwable_SQL_Exception('Message: Failed to commit SQL transaction. Reason: Unable to find connection.');
     }
     $command = @db2_commit($this->resource);
     if ($command === FALSE) {
         throw new Throwable_SQL_Exception('Message: Failed to commit SQL transaction. Reason: :reason', array(':reason' => @db2_conn_error($this->resource)));
     }
     @db2_autocommit($this->resource, DB2_AUTOCOMMIT_ON);
     $this->sql = 'COMMIT;';
 }
开发者ID:ruslankus,项目名称:invoice-crm,代码行数:22,代码来源:Standard.php

示例4: DBcommit

function DBcommit()
{
    global $DB;
    $result = false;
    switch ($DB['TYPE']) {
        case ZBX_DB_MYSQL:
            $result = DBexecute('COMMIT');
            break;
        case ZBX_DB_POSTGRESQL:
            $result = DBexecute('COMMIT');
            break;
        case ZBX_DB_ORACLE:
            $result = oci_commit($DB['DB']);
            break;
        case ZBX_DB_DB2:
            $result = db2_commit($DB['DB']);
            if ($result) {
                db2_autocommit($DB['DB'], DB2_AUTOCOMMIT_ON);
            }
            break;
        case ZBX_DB_SQLITE3:
            $result = DBexecute('COMMIT');
            unlock_sqlite3_access();
            break;
    }
    return $result;
}
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:27,代码来源:db.inc.php

示例5: commit

 /**
  * Commit 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 commit(&$model)
 {
     if (parent::commit($model)) {
         if (db2_commit($this->connection)) {
             $this->_transactionStarted = false;
             db2_autocommit($this->connection, DB2_AUTOCOMMIT_ON);
             return true;
         }
     }
     return false;
 }
开发者ID:christianallred,项目名称:fluent_univ,代码行数:19,代码来源:dbo_db2.php

示例6: handleTransactionQueries


//.........这里部分代码省略.........
         }
         unset($this->schema_info['mysql_lock_tables']);
         // These databases issue implicit commit commands when the following statements are run
     } elseif ($this->type == 'mysql' && preg_match('#^\\s*(ALTER|CREATE(?!\\s+TEMPORARY)|DROP|RENAME|TRUNCATE|LOAD|UNLOCK|GRANT|REVOKE|SET\\s+PASSWORD|CACHE|ANALYSE|CHECK|OPTIMIZE|REPAIR|FLUSH|RESET)\\b#i', $sql)) {
         $this->inside_transaction = FALSE;
     } elseif ($this->type == 'oracle' && preg_match('#^\\s*(CREATE|ALTER|DROP|TRUNCATE|GRANT|REVOKE|REPLACE|ANALYZE|AUDIT|COMMENT)\\b#i', $sql)) {
         $this->inside_transaction = FALSE;
     } elseif ($this->type == 'db2' && preg_match('#^\\s*CALL\\s+SYSPROC\\.ADMIN_CMD\\(\'REORG\\s+TABLE\\b#i', $sql)) {
         $this->inside_transaction = FALSE;
         // It appears PDO tracks the transactions, but doesn't know about implicit commits
         if ($this->extension == 'pdo') {
             $this->connection->commit();
         }
     }
     // If MySQL autocommit it set to 0 a new transaction is automatically started
     if (!empty($this->schema_info['mysql_autocommit'])) {
         $this->inside_transaction = TRUE;
     }
     if (!$begin && !$commit && !$rollback) {
         return FALSE;
     }
     // The PDO, OCI8 and SQLSRV extensions require special handling through methods and functions
     $is_pdo = $this->extension == 'pdo';
     $is_oci = $this->extension == 'oci8';
     $is_sqlsrv = $this->extension == 'sqlsrv';
     $is_ibm_db2 = $this->extension == 'ibm_db2';
     if (!$is_pdo && !$is_oci && !$is_sqlsrv && !$is_ibm_db2) {
         return FALSE;
     }
     $this->statement = $statement;
     // 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';
             $is_oracle = $this->type == 'oracle';
             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('db2' => 'DB2', '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_sqlsrv) {
         if ($begin) {
             sqlsrv_begin_transaction($this->connection);
         } elseif ($commit) {
             sqlsrv_commit($this->connection);
         } elseif ($rollback) {
             sqlsrv_rollback($this->connection);
         }
     } elseif ($is_ibm_db2) {
         if ($begin) {
             db2_autocommit($this->connection, FALSE);
         } elseif ($commit) {
             db2_commit($this->connection);
             db2_autocommit($this->connection, TRUE);
         } elseif ($rollback) {
             db2_rollback($this->connection);
             db2_autocommit($this->connection, TRUE);
         }
     }
     if ($result_class) {
         $result = new $result_class($this);
         $result->setSQL($sql);
         $result->setResult(TRUE);
         return $result;
     }
     return TRUE;
 }
开发者ID:daerduoCarey,项目名称:oj,代码行数:101,代码来源:fDatabase.php

示例7: doCommit

 /**
  * End a transaction
  * Must have a preceding begin()
  */
 protected function doCommit($fname = 'DatabaseIbm_db2::commit')
 {
     db2_commit($this->mConn);
     // Some MediaWiki code is still transaction-less (?).
     // The strategy is to keep AutoCommit on for that code
     //  but switch it off whenever a transaction is begun.
     db2_autocommit($this->mConn, DB2_AUTOCOMMIT_ON);
     $this->mTrxLevel = 0;
 }
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:13,代码来源:DatabaseIbm_db2.php

示例8: DBcommit

function DBcommit()
{
    global $DB;
    $result = false;
    if (isset($DB['DB']) && !empty($DB['DB'])) {
        switch ($DB['TYPE']) {
            case 'MYSQL':
                $result = DBexecute('commit');
                break;
            case 'POSTGRESQL':
                $result = DBexecute('commit');
                break;
            case 'ORACLE':
                $result = ocicommit($DB['DB']);
                break;
            case 'IBM_DB2':
                $result = db2_commit($DB['DB']);
                if ($result) {
                    db2_autocommit($DB['DB'], DB2_AUTOCOMMIT_ON);
                }
                break;
            case 'SQLITE3':
                $result = DBexecute('commit');
                unlock_db_access();
                break;
        }
    }
    return $result;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:29,代码来源:db.inc.php

示例9: commit

 /**
  * End a transaction
  * Must have a preceding begin()
  */
 public function commit($fname = 'DatabaseIbm_db2::commit')
 {
     db2_commit($this->mConn);
     // turn auto-commit back on
     db2_autocommit($this->mConn, DB2_AUTOCOMMIT_ON);
     $this->mTrxLevel = 0;
 }
开发者ID:rocLv,项目名称:conference,代码行数:11,代码来源:DatabaseIbm_db2.php

示例10: commit

 /**
  * Commits pending changes to the database when the driver is setup to support transactions.
  *
  * @return bool true if commit succeeded, false if it failed
  */
 public function commit()
 {
     if ($this->database) {
         $success = db2_commit($this->database);
         $this->log->info("IBMDB2Manager.commit(): {$success}");
         $this->executeReorgs();
         return $success;
     }
     return true;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:15,代码来源:IBMDB2Manager.php

示例11: commit

 public static function commit($conn)
 {
     return db2_commit($conn);
 }
开发者ID:Russell-IO,项目名称:php-syslog-ng,代码行数:4,代码来源:jqGridDb2.php

示例12: commit

 /**
  * {@inheritDoc}
  */
 public function commit()
 {
     if (!$this->isConnected()) {
         $this->connect();
     }
     if (!db2_commit($this->resource)) {
         throw new Exception\RuntimeException("The commit has not been successful");
     }
     if ($this->prevAutocommit) {
         db2_autocommit($this->resource, $this->prevAutocommit);
     }
     $this->inTransaction = false;
     return $this;
 }
开发者ID:CHRISTOPHERVANDOMME,项目名称:zf2complet,代码行数:17,代码来源:Connection.php

示例13: commit

 /**
  * End a transaction
  * Must have a preceding begin()
  */
 public function commit()
 {
     db2_commit($this->mConn);
     // turn auto-commit back on
     db2_autocommit($this->mConn, DB2_AUTOCOMMIT_ON);
     $this->mTrxLevel = 0;
 }
开发者ID:josephdye,项目名称:wikireader,代码行数:11,代码来源:DatabaseIbm_db2.php

示例14: _commit

 protected function _commit()
 {
     return db2_commit($this->handle);
 }
开发者ID:codifyllc,项目名称:phpopenfw,代码行数:4,代码来源:dt_db2.class.php

示例15: handleTransactionQueries


//.........这里部分代码省略.........
         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 and SQLSRV extensions require special handling through methods and functions
     $is_pdo = $this->extension == 'pdo';
     $is_oci = $this->extension == 'oci8';
     $is_sqlsrv = $this->extension == 'sqlsrv';
     $is_ibm_db2 = $this->extension == 'ibm_db2';
     if (!$is_pdo && !$is_oci && !$is_sqlsrv && !$is_ibm_db2) {
         return FALSE;
     }
     $this->statement = $sql;
     // 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('db2' => 'DB2', '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_sqlsrv) {
         if ($begin) {
             sqlsrv_begin_transaction($this->connection);
         } elseif ($commit) {
             sqlsrv_commit($this->connection);
         } elseif ($rollback) {
             sqlsrv_rollback($this->connection);
         }
     } elseif ($is_ibm_db2) {
         if ($begin) {
             db2_autocommit($this->connection, FALSE);
         } elseif ($commit) {
             db2_commit($this->connection);
             db2_autocommit($this->connection, TRUE);
         } elseif ($rollback) {
             db2_rollback($this->connection);
             db2_autocommit($this->connection, TRUE);
         }
     }
     if ($result_class) {
         $result = new $result_class($this);
         $result->setSQL($sql);
         $result->setResult(TRUE);
         return $result;
     }
     return TRUE;
 }
开发者ID:JhunCabas,项目名称:material-management,代码行数:101,代码来源:fDatabase.php


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