本文整理汇总了PHP中object::commit方法的典型用法代码示例。如果您正苦于以下问题:PHP object::commit方法的具体用法?PHP object::commit怎么用?PHP object::commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object
的用法示例。
在下文中一共展示了object::commit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _multiManage
/**
* Action a report drop down
*
* @return @e void
*/
protected function _multiManage()
{
$merge_id = $this->request['sessionID'] = intval($this->request['merge_id']);
$mergeOption = trim($this->request['mergeOption']);
$items = is_array($_POST['changeIds']) ? IPSLib::cleanIntArray(array_keys($_POST['changeIds'])) : array();
/* Fetch session and check */
$session = $this->skinFunctions->fetchSession($merge_id);
if ($session === FALSE) {
$this->registry->output->showError($this->lang->words['sd_nosession']);
}
/* Got items? */
if (count($items)) {
/* Process. I love pointless comments */
switch ($mergeOption) {
case 'resolve_custom':
$this->skinFunctions->resolveConflict($items, 'custom');
break;
case 'resolve_new':
$this->skinFunctions->resolveConflict($items, 'new');
break;
case 'commit':
$this->skinFunctions->commit($items);
break;
case 'revert':
$this->skinFunctions->revert($items);
break;
}
}
/* Flush CDN */
$this->skinFunctions->flushipscdn();
/* Throw it out */
$this->registry->output->global_message = $this->lang->words['skindiff_okmsg'];
return $this->_viewReport();
}
示例2: commit
/**
* Finalizes all add/deletes made to the index
*
* @return object
*/
public function commit()
{
$this->_beforeCommit();
$result = $this->_client->commit();
$this->_afterCommit();
return $result;
}
示例3: reset
/**
* Down all migrations
*
* @return mixed String if reseted or false if fail
* @access public
*/
function reset()
{
if ($this->down(true)) {
if (isset($this->params['force'])) {
App::import('Vendor', $this->_pluginName . '.Migration');
$migration = new Migration($this);
$tables = $this->db->listSources();
if (!empty($tables)) {
$this->db->begin($migration);
foreach ($tables as $table) {
if ($table == $this->_schemaTable) {
continue;
}
if (!$migration->dropTable($table)) {
$this->db->rollback($migration);
$this->err(__d('migrations', 'Can not execute drop of all tables.', true));
return false;
}
}
$this->db->commit($migration);
}
}
return __d('migrations', 'Resetted.', true) . "\n";
}
return false;
}
示例4: array
/**
* Execute Install and Uninstall methods
*
* @param string $command Can be 'up' or 'down'
* @param string $callback Name of callback function
* @return boolean
* @access protected
*/
function _exec($command, $callback)
{
$this->__error = false;
if (!method_exists($this, $command)) {
$this->out(String::insert(__d('migrations', '> Method ":method" not implemented. Skipping...', true), array('method' => $command)));
return true;
}
$method = 'before' . $callback;
if (method_exists($this, $method)) {
if (!$this->{$method}()) {
return false;
}
}
$ok = $this->_db->begin($this->__fakeSchema);
$this->{$command}();
if ($this->stopOnError) {
if ($this->__error) {
$ok = false;
}
}
if ($ok) {
$this->_db->commit($this->__fakeSchema);
} else {
$this->_db->rollback($this->__fakeSchema);
}
$method = 'after' . $callback;
if (method_exists($this, $method)) {
$this->{$method}($ok);
}
return $ok;
}
示例5: commit
/**
This method commits the transaction
@access public
@throws PDOException object
@return void
*/
public function commit()
{
try {
$this->DBHandler->commit();
} catch (PDOException $e) {
throw $e;
}
}
示例6: commit
/**
* 提交事务处理
*
* @access public
* @return boolean
*/
public function commit()
{
if ($this->Transactions == true) {
if ($this->db_link->commit()) {
$this->Transactions = false;
}
}
return true;
}
示例7: commit
/**
* Finalizes all add/deletes made to the index
*
* @return object|bool
*/
public function commit()
{
if ($this->_holdCommit) {
return false;
}
$this->_beforeCommit();
$result = $this->_client->commit();
$this->_afterCommit();
return $result;
}
示例8: commit
/**
* (non-PHPdoc)
* @see PDO::commit()
*/
public function commit()
{
if ($this->pdo->inTransaction) {
if ($this->canEndTransaction) {
$this->pdo->commit();
}
return true;
} else {
return false;
}
}
示例9: commit
/**
* 提交事务处理
*
* @access public
*
* @return boolean
*/
public function commit()
{
//当事务处理开启时
if ($this->_transactions == true) {
if ($this->_dbLink->commit()) {
$this->_transactions = false;
//SQL日志记录
$this->_logQuery('COMMIT');
}
}
return true;
}
示例10: __destruct
/**
* Destructor
*
* @access public
* @return void
*/
public function __destruct()
{
// Create new session ID
if ($this->regenerate_id) {
session_regenerate_id(true);
}
// Close session
session_write_close();
if ($this->transaction) {
$this->db->commit();
}
}
示例11: commit
public static function commit()
{
try {
if (!self::$instance instanceof \PDO) {
throw new \PDOException(self::$exception['no-instance']);
}
if (!self::$instance->commit()) {
throw new \PDOException(current(self::$instance->errorInfo()) . ' ' . end(self::$instance->errorInfo()));
}
} catch (\PDOException $e) {
self::stackTrace($e);
}
}
示例12: transComplete
/**
* Zatwierdzenie SQL-i głównego bloku transakcji, gdy $this->transOff == 1
* oraz gdy nie wystąpiły żadne błędy SQL-owe.
*
* @param boolean $commit
* true - monitoruje błędy SQL,
* false - wymuszenie odrzucenia wszystkich SQL-i w transakcji
*
* @throws MK_Db_Exception
* @return bool
*/
public function transComplete($commit = true)
{
// Zwrócenie szczegółowego komunikatu w konsoli FireBug-a
if (MK_DEBUG_FIREPHP) {
$this->fireBugSqlDump("transComplete(" . ($commit ? 'true' : 'false') . ")");
}
$_transCount = MK_Db_PDO_Singleton::transCount();
if ($_transCount > 1) {
// Transakcja jest w innej transakcji, zamykanie bloku transakcji
MK_Db_PDO_Singleton::transCount(-1);
return true;
} else {
if ($_transCount == 1) {
// Jeśli transakcja nie została przerwana, to należy zamknąć logi
if ($commit == true) {
if (class_exists('TableLogsDb')) {
/** @noinspection PhpUndefinedClassInspection */
$tableLogsDb = new TableLogsDb();
/** @noinspection PhpUndefinedMethodInspection */
$tableLogsDb->closeConnectionForTableLog();
}
}
// Transakcja jest do zamknięcia
MK_Db_PDO_Singleton::transCount(0, true);
} else {
if ($_transCount == 0) {
// Transakcja nie była uruchomiona
return false;
} else {
// Do takiego błędu nie powinno w ogóle dojść, ale należałoby się przed tym zabezpieczyć...
throw new MK_Db_Exception('Transakcja wywołała niespodziewany błąd. Poinformuj administratora systemu.');
}
}
}
/**
* true - COMMIT
* false - ROLLBACK
*/
if ($commit && MK_Db_PDO_Singleton::transOk()) {
if (!$this->db->commit()) {
MK_Db_PDO_Singleton::transOk(false);
throw new MK_Db_Exception('Transakcja nie powiodła się');
}
} else {
MK_Db_PDO_Singleton::transOk(false);
$this->db->rollBack();
}
return MK_Db_PDO_Singleton::transOk();
}
示例13: write
/**
* Write data associated with a given unique ID to container
*
* @access public
* @param string $uniqueId IP address or other unique ID.
* @param array $data The data associated with a given unique ID.
* @return void
* @throws HTTP_FloodControl_Exception if an error occured during writing process.
*/
public function write($uniqueId, $data)
{
$quotedTblName = $this->_db->quoteIdentifier($this->_options['table']);
$this->_db->beginTransaction();
$query = sprintf("DELETE FROM %s WHERE unique_id = %s", $quotedTblName, $this->_db->quote($uniqueId, 'text'));
$result = $this->_db->exec($query);
if (PEAR::isError($result)) {
throw new HTTP_FloodControl_Exception($result->getMessage(), $result->getCode());
}
$query = sprintf("INSERT INTO %s (unique_id, data, access) VALUES (%s, %s, %d)", $quotedTblName, $this->_db->quote($uniqueId, 'text'), $this->_db->quote(serialize($data), 'text'), time());
$result = $this->_db->exec($query);
if (PEAR::isError($result)) {
$this->_db->rollback();
throw new HTTP_FloodControl_Exception($result->getMessage(), $result->getCode());
}
$this->_db->commit();
}
示例14: flushWriteCache
/**
* Flush the write cache to db
*
* @access public
*/
public function flushWriteCache()
{
if ($this->writeCacheData !== null) {
$trans = $this->db->beginTransaction();
/** can't create a prepared sql because some parameters can be null ??? */
foreach ($this->writeCacheData as $key1 => $value1) {
foreach ($value1 as $key2 => $value) {
$fields = array('do_id' => $this->absOrNull($this->do_id), 'app_id' => $this->absOrNull($this->app_id), 'us_id' => $this->absOrNull($this->us_id), 'se_section' => $key1, 'se_param' => $key2);
$sql = "UPDATE " . $this->options['settings_table'] . " SET \n" . " se_value = " . $this->db->quote($this->writeCacheData[$key1][$key2]) . " \n" . "WHERE \n" . $this->array2Where($fields);
$affectedRows = $this->db->exec($sql);
$this->checkDBError($affectedRows, __LINE__);
if ($affectedRows == 0) {
$sql = "INSERT INTO " . $this->options['settings_table'] . " " . " (do_id, app_id, us_id,se_section, se_param, se_value) " . "VALUES " . " (" . $this->db->quote($this->absOrNull($this->do_id)) . ", " . $this->db->quote($this->absOrNull($this->app_id)) . ", " . $this->db->quote($this->absOrNull($this->us_id)) . ", " . $this->db->quote($key1) . ", " . $this->db->quote($key2) . ", " . $this->db->quote($this->writeCacheData[$key1][$key2]) . ")";
$res = $this->db->exec($sql);
$this->checkDBError($res, __LINE__);
}
}
}
$trans = $this->db->commit();
$this->writeCacheData = null;
}
}
示例15: deleteNode
/**
* Delete a node and it's children
*
* @param int $keyValue Primary key of node
* @return bool If it happend or not
*/
public function deleteNode($keyValue)
{
try {
$this->_pdoInstance->beginTransaction();
$this->_lockTables();
$node = $this->getSimpleNode($keyValue);
// Delete the node
$deleteSql = "DELETE FROM `" . $this->getTable() . "`\n WHERE\n `" . $this->getLeftColumn() . "`\n BETWEEN '" . $node[$this->getLeftColumn()] . "'\n AND '" . $node[$this->getRightColumn()] . "'";
$this->_pdoInstance->exec($deleteSql);
// Update left values of other nodes
$updateSql = "UPDATE `" . $this->getTable() . "`\n SET `" . $this->getLeftColumn() . "` = `" . $this->getLeftColumn() . "` - ROUND(\n ('" . $node[$this->getRightColumn()] . "' - '" . $node[$this->getLeftColumn()] . "' + 1)\n )\n WHERE `" . $this->getLeftColumn() . "` > '" . $node[$this->getRightColumn()] . "'";
$this->_pdoInstance->exec($updateSql);
// Update right values of other nodes
$updateSql = "UPDATE `" . $this->getTable() . "`\n SET `" . $this->getRightColumn() . "` = `" . $this->getRightColumn() . "` - ROUND(\n ('" . $node[$this->getRightColumn()] . "' - '" . $node[$this->getLeftColumn()] . "' + 1)\n )\n WHERE `" . $this->getRightColumn() . "` > '" . $node[$this->getRightColumn()] . "'";
$this->_pdoInstance->exec($updateSql);
$this->_pdoInstance->exec("UNLOCK TABLES");
$this->_pdoInstance->commit();
return true;
} catch (\PDOException $e) {
$this->_pdoInstance->rollBack();
return false;
}
}