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


PHP DataSource::begin方法代码示例

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


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

示例1: run

 /**
  * Run
  *
  * @return void
  */
 public function run()
 {
     $null = null;
     $this->db = ConnectionManager::getDataSource($this->connection);
     $this->db->cacheSources = false;
     $this->db->begin($null);
     if (!isset($this->args[0]) || !in_array($this->args[0], array('insert', 'remove'))) {
         $this->out(__d('SoftDelete', 'Invalid option'));
         return $this->_displayHelp(null);
     }
     if (!isset($this->args[1])) {
         $this->out(__d('SoftDelete', 'You missed field name.'));
         return $this->_displayHelp(null);
     }
     try {
         $this->_run($this->args[0], $this->args[1]);
         $this->_clearCache();
     } catch (Exception $e) {
         $this->db->rollback($null);
         throw $e;
     }
     $this->out(__d('SoftDelete', 'All tables are updated.'));
     $this->out('');
     return $this->db->commit($null);
 }
开发者ID:radig,项目名称:SoftDelete,代码行数:30,代码来源:SoftDeleteShell.php

示例2: setUp

 /**
  * (non-PHPdoc)
  * @see ActiveSync/ActiveSync_TestCase::setUp()
  */
 public function setUp()
 {
     $this->_db = ConnectionManager::getDataSource('test');
     $this->_db->begin();
     $this->_deviceBackend = new Syncroton_Backend_Device($this->_db);
     $this->_folderBackend = new Syncroton_Backend_Folder($this->_db);
     require_once dirname(__FILE__) . DS . 'DeviceTest.php';
     $newDevice = DeviceTest::getTestDevice();
     $this->_device = $this->_deviceBackend->create($newDevice);
 }
开发者ID:malamalca,项目名称:lil-activesync,代码行数:14,代码来源:FolderTest.php

示例3: run

 /**
  * Run migration
  *
  * @param string $direction, up or down direction of migration process
  * @return boolean Status of the process
  */
 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:Demired,项目名称:CakeWX,代码行数:31,代码来源:CakeMigration.php

示例4: begin

 /**
  * Begin a transaction
  *
  * @param model $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).
  * @access public
  */
 function begin(&$model)
 {
     if (parent::begin($model) && $this->execute($this->_commands['begin'])) {
         $this->_transactionStarted = true;
         return true;
     }
     return false;
 }
开发者ID:sathishkumarb,项目名称:HVMS,代码行数:17,代码来源:dbo_source.php

示例5: setUp

 /**
  * (non-PHPdoc)
  * @see ActiveSync/ActiveSync_TestCase::setUp()
  */
 public function setUp()
 {
     $this->_db = ConnectionManager::getDataSource('test');
     $this->_db->begin();
     $this->_deviceBackend = new Syncroton_Backend_Device($this->_db);
 }
开发者ID:malamalca,项目名称:lil-activesync,代码行数:10,代码来源:DeviceTest.php


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