本文整理匯總了PHP中Zend_Db_Adapter_Abstract::rollback方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Db_Adapter_Abstract::rollback方法的具體用法?PHP Zend_Db_Adapter_Abstract::rollback怎麽用?PHP Zend_Db_Adapter_Abstract::rollback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Db_Adapter_Abstract
的用法示例。
在下文中一共展示了Zend_Db_Adapter_Abstract::rollback方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: parseCsv
/**
* Parses csv file
*
* @param string $file
* @return Mage_Core_Model_Resource_Abstract
*/
public function parseCsv($file)
{
$info = pathinfo($file);
$io = new Varien_Io_File();
$io->open(array('path' => $info['dirname']));
$io->streamOpen($info['basename'], 'r');
$headers = $io->streamReadCsv();
if ($headers === false) {
$io->streamClose();
Mage::throwException(Mage::helper('pyro_licenses')->__('You must specify valid headers in the first row'));
}
if (false === ($columns = $this->_prepareColumns($headers))) {
$io->streamClose();
Mage::throwException(Mage::helper('pyro_licenses')->__("Invalid header: 'License' is missed"));
}
$this->_write->beginTransaction();
try {
$rowNumber = 1;
$importData = array();
while (false !== ($csvLine = $io->streamReadCsv())) {
$rowNumber++;
// check for empty lines
$emptyLine = array_unique($csvLine);
if (count($emptyLine) == 1 && $emptyLine[0] == "") {
continue;
}
$row = $this->_getImportRow($csvLine, $columns, $rowNumber);
if ($row !== false) {
$importData[] = $row;
}
if (count($importData) == 5000) {
$this->_saveImportData($importData);
$importData = array();
}
}
$this->_saveImportData($importData);
$io->streamClose();
} catch (Mage_Core_Exception $e) {
$this->_write->rollback();
$io->streamClose();
Mage::throwException($e->getMessage());
} catch (Exception $e) {
$this->_write->rollback();
$io->streamClose();
Mage::logException($e);
Mage::throwException(Mage::helper('adminhtml')->__($e->getMessage()));
}
$this->_write->commit();
if ($this->_importErrors) {
$error = sprintf('ImportSubscribers: "%1$s"', implode('", "', $this->_importErrors));
Mage::log($error, 3, '', true);
}
return $this;
}
示例2: rollback
public function rollback()
{
$this->_connection->rollback();
}