I am creating joomla(2.5) with hikashop (eshop component) component to automatically import customers. Problem is that I am using JDatabase transactions which is not working as expected(rollback does not work). Method processSingle processes each customer and returns weather it suceeded or not. Also for debugging there is one more parameter to know which method(step) failed. I have written another script which uses identical rolling back structure and it seems to work, but this one doesn't. I have tried to catch DatabaseException but there is no exceptions. There is part of code which fails rolling back transaction.
foreach ($this->customerList as $customer) {
// start tracking database entries
$this->db->transactionStart();
$oCustomer = new stdClass();
$oCustomer->raw_data = $customer;
// escaping from sql injection
$oCustomer = $this->escapeObj($oCustomer);
// here we process all items taking one and going through all steps
$methodfailed = "";
$success = $this->processSingle($oCustomer, $methodfailed);
$processed++;
if ($success) {
$succeeded++;
// if succeded save changes
$this->db->transactionCommit();
} else {
$failed++;
echo $this->error . "<br/>";
echo "failed method:" . $methodfailed . "<br/>";
// if failed rollback database entries
$this->db->transactionRollback();
}
}
Anyone had similar problems? By the way I am using PHP/5.3.3-7.