mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-27 02:50:53 +00:00
Merge
This commit is contained in:
commit
4982e7c6c4
1 changed files with 23 additions and 35 deletions
|
@ -127,8 +127,7 @@ class DBLayer {
|
|||
$field_values = implode(',', array_merge(array(':' . implode(',:', array_keys($data))), array_values($datafunc)));
|
||||
try {
|
||||
$sth = $this -> PDO -> prepare( "INSERT INTO $tb_name ($field_options) VALUE ($field_values)" );
|
||||
foreach ( $data as $key => $value )
|
||||
{
|
||||
foreach ($data as $key => $value) {
|
||||
$sth->bindValue( ":$key", $value );
|
||||
}
|
||||
$this->PDO->beginTransaction();
|
||||
|
@ -138,7 +137,7 @@ class DBLayer {
|
|||
}
|
||||
catch (Exception $e) {
|
||||
// for rolling back the changes during transaction
|
||||
// $this -> PDO -> rollBack();
|
||||
$this->PDO->rollBack();
|
||||
throw $e; // new Exception( "error in inseting" );
|
||||
}
|
||||
return $lastId;
|
||||
|
@ -210,12 +209,9 @@ class DBLayer {
|
|||
foreach ($data as $key => $value) {
|
||||
$sth->bindValue(":$key", $value);
|
||||
}
|
||||
$this -> PDO -> beginTransaction();
|
||||
$sth->execute();
|
||||
$this -> PDO -> commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->PDO->rollBack();
|
||||
throw $e; // new Exception( 'error in updating' );
|
||||
return false;
|
||||
}
|
||||
|
@ -238,14 +234,9 @@ class DBLayer {
|
|||
foreach ($data as $key => $value) {
|
||||
$sth->bindValue(":$key", $value);
|
||||
}
|
||||
$this->PDO->beginTransaction();
|
||||
// execution
|
||||
$sth->execute();
|
||||
$this->PDO->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
// for rolling back the changes during transaction
|
||||
$this->PDO->rollBack();
|
||||
throw $e; // new Exception("error in inserting");
|
||||
}
|
||||
}
|
||||
|
@ -262,12 +253,9 @@ class DBLayer {
|
|||
$this->useDb();
|
||||
try {
|
||||
$sth = $this->PDO->prepare("DELETE FROM $tb_name WHERE $where");
|
||||
$this->PDO->beginTransaction();
|
||||
$sth->execute($data);
|
||||
$this->PDO->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->PDO->rollBack();
|
||||
throw $e; // new Exception( "error in deleting" );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue