http://www.wrox.com/WileyCDA/WroxTit...load_code.html
here in chapter 8 is a PEAR:DB class file new_class.Database.php
It is written in per:db but now per:db is deprecated and mdb2 is in used.
So how can i rebuild it in pear:mdb2?
Is anyone do this?
edit:
is this correct
Code:
function startTransaction() {
//autoCommit returns true/false if the command succeeds
return $this->connect->autoCommit(false);
}
function commit() {
$result= $this->connect->commit();
if(DB::isError($result)) {
throw new Exception($result->getMessage(), $result->getCode());
}
$this->connect->autoCommit(true);
return true;
}
function abort() {
$result= $this->connect->rollback();
if(DB::isError($result)) {
throw new Exception($result->getMessage(), $result->getCode());
}
return true;
}
to
Code:
function startTransaction() {
//autoCommit returns true/false if the command succeeds
return $this->connect->beginTransaction(false);
}
function commit() {
if ($this->connect->in_transaction) {
$this->connect->commit();
}
if(PEAR::isError($result)) {
throw new Exception($result->getMessage(), $result->getCode());
}
if ($this->connect->supports('transactions')) {
$this->connect->beginTransaction(true);
}
return true;
}
function abort() {
if ($this->connect->in_transaction) {
$result= $this->connect->rollback();
}
if(PEAR::isError($result)) {
throw new Exception($result->getMessage(), $result->getCode());
}
return true;
}