當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DboSource::commit方法代碼示例

本文整理匯總了PHP中DboSource::commit方法的典型用法代碼示例。如果您正苦於以下問題:PHP DboSource::commit方法的具體用法?PHP DboSource::commit怎麽用?PHP DboSource::commit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DboSource的用法示例。


在下文中一共展示了DboSource::commit方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: run

 /**
  * Run migration
  *
  * @param string $direction, up or down direction of migration process
  * @return boolean Status of the process
  * @throws MigrationException
  */
 public function run($direction)
 {
     if (!in_array($direction, array('up', 'down'))) {
         throw new MigrationException($this, sprintf(__d('migrations', 'Migration direction (%s) is not one of valid directions.'), $direction), E_USER_NOTICE);
     }
     $this->direction = $direction;
     $null = null;
     $this->db = ConnectionManager::getDataSource($this->connection);
     $this->db->cacheSources = false;
     $this->db->begin($null);
     $this->Schema = new CakeSchema(array('connection' => $this->connection));
     try {
         $this->_invokeCallbacks('beforeMigration', $direction);
         $result = $this->_run();
         $this->_clearCache();
         $this->_invokeCallbacks('afterMigration', $direction);
         if (!$result) {
             return false;
         }
     } catch (Exception $e) {
         $this->db->rollback($null);
         throw $e;
     }
     return $this->db->commit($null);
 }
開發者ID:asadaqain,項目名稱:Guide-on-the-Side,代碼行數:32,代碼來源:CakeMigration.php

示例2: testNestedTransaction

 /**
  * Test nested transaction
  *
  * @return void
  */
 public function testNestedTransaction()
 {
     $nested = $this->Dbo->useNestedTransactions;
     $this->Dbo->useNestedTransactions = true;
     if ($this->Dbo->nestedTransactionSupported() === false) {
         $this->Dbo->useNestedTransactions = $nested;
         $this->skipIf(true, 'The MySQL server do not support nested transaction');
     }
     $this->loadFixtures('Inno');
     $model = ClassRegistry::init('Inno');
     $model->hasOne = $model->hasMany = $model->belongsTo = $model->hasAndBelongsToMany = array();
     $model->cacheQueries = false;
     $this->Dbo->cacheMethods = false;
     $this->assertTrue($this->Dbo->begin());
     $this->assertNotEmpty($model->read(null, 1));
     $this->assertTrue($this->Dbo->begin());
     $this->assertTrue($model->delete(1));
     $this->assertEmpty($model->read(null, 1));
     $this->assertTrue($this->Dbo->rollback());
     $this->assertNotEmpty($model->read(null, 1));
     $this->assertTrue($this->Dbo->begin());
     $this->assertTrue($model->delete(1));
     $this->assertEmpty($model->read(null, 1));
     $this->assertTrue($this->Dbo->commit());
     $this->assertEmpty($model->read(null, 1));
     $this->assertTrue($this->Dbo->rollback());
     $this->assertNotEmpty($model->read(null, 1));
     $this->Dbo->useNestedTransactions = $nested;
 }
開發者ID:laiello,項目名稱:double-l-bookmanagement,代碼行數:34,代碼來源:MysqlTest.php

示例3: testNestedTransaction

 /**
  * Test nested transaction
  *
  * @return void
  */
 public function testNestedTransaction()
 {
     $this->skipIf($this->Dbo->nestedTransactionSupported() === false, 'The Sqlite version do not support nested transaction');
     $this->loadFixtures('User');
     $model = new User();
     $model->hasOne = $model->hasMany = $model->belongsTo = $model->hasAndBelongsToMany = array();
     $model->cacheQueries = false;
     $this->Dbo->cacheMethods = false;
     $this->assertTrue($this->Dbo->begin());
     $this->assertNotEmpty($model->read(null, 1));
     $this->assertTrue($this->Dbo->begin());
     $this->assertTrue($model->delete(1));
     $this->assertEmpty($model->read(null, 1));
     $this->assertTrue($this->Dbo->rollback());
     $this->assertNotEmpty($model->read(null, 1));
     $this->assertTrue($this->Dbo->begin());
     $this->assertTrue($model->delete(1));
     $this->assertEmpty($model->read(null, 1));
     $this->assertTrue($this->Dbo->commit());
     $this->assertEmpty($model->read(null, 1));
     $this->assertTrue($this->Dbo->rollback());
     $this->assertNotEmpty($model->read(null, 1));
 }
開發者ID:saihe,項目名稱:reservation,代碼行數:28,代碼來源:SqliteTest.php

示例4: 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)) {
         $this->_transactionStarted = false;
         return $this->execute('COMMIT TRAN');
     }
     return false;
 }
開發者ID:christianallred,項目名稱:fluent_univ,代碼行數:16,代碼來源:dbo_sybase.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)) {
         $this->_transactionStarted = false;
         return $this->_adodb->CommitTrans();
     }
     return false;
 }
開發者ID:jerzzz777,項目名稱:cake-cart,代碼行數:16,代碼來源:dbo_adodb.php

示例6: 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

示例7: 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)) {
         $this->_transactionStarted = false;
         return $this->pdo_statement->commit();
     }
     return false;
 }
開發者ID:JCVI-Cloud,項目名稱:METAREP,代碼行數:16,代碼來源:dbo_sqlite3.php

示例8: 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 (odbc_commit($this->connection)) {
             $this->_transactionStarted = false;
             return true;
         }
     }
     return false;
 }
開發者ID:rhencke,項目名稱:mozilla-cvs-history,代碼行數:18,代碼來源:dbo_odbc.php

示例9: 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)) {
         $this->__transactionStarted;
         return oci_commit($this->connection);
     }
     return false;
 }
開發者ID:hikmanet,項目名稱:HnsAutomobiles,代碼行數:16,代碼來源:dbo_oci.php

示例10: testNestedTransaction

 /**
  * Test nested transaction
  *
  * @return void
  */
 public function testNestedTransaction()
 {
     $this->Dbo->useNestedTransactions = TRUE;
     $this->skipIf($this->Dbo->nestedTransactionSupported() === FALSE, 'The Postgres server do not support nested transaction');
     $this->loadFixtures('Article');
     $model = new Article();
     $model->hasOne = $model->hasMany = $model->belongsTo = $model->hasAndBelongsToMany = array();
     $model->cacheQueries = FALSE;
     $this->Dbo->cacheMethods = FALSE;
     $this->assertTrue($this->Dbo->begin());
     $this->assertNotEmpty($model->read(NULL, 1));
     $this->assertTrue($this->Dbo->begin());
     $this->assertTrue($model->delete(1));
     $this->assertEmpty($model->read(NULL, 1));
     $this->assertTrue($this->Dbo->rollback());
     $this->assertNotEmpty($model->read(NULL, 1));
     $this->assertTrue($this->Dbo->begin());
     $this->assertTrue($model->delete(1));
     $this->assertEmpty($model->read(NULL, 1));
     $this->assertTrue($this->Dbo->commit());
     $this->assertEmpty($model->read(NULL, 1));
     $this->assertTrue($this->Dbo->rollback());
     $this->assertNotEmpty($model->read(NULL, 1));
 }
開發者ID:mrbadao,項目名稱:api-official,代碼行數:29,代碼來源:PostgresTest.php


注:本文中的DboSource::commit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。