本文整理汇总了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();
}