mirror of
https://github.com/optim-enterprises-bv/control-pane.git
synced 2025-11-02 19:07:59 +00:00
* Missed from refactoring pull
This commit is contained in:
@@ -2492,10 +2492,12 @@ class ClonOS {
|
|||||||
[$this->form['pkg_vm_cpus']],
|
[$this->form['pkg_vm_cpus']],
|
||||||
[$owner]
|
[$owner]
|
||||||
));
|
));
|
||||||
if($res===false) return $this->messageError('sql error!');
|
|
||||||
if(!$res['error']) return $this->messageSuccess($res);
|
|
||||||
|
|
||||||
return $this->messageError('sql error!',$res);
|
if($res['error'] == false){
|
||||||
|
return $this->messageSuccess($res);
|
||||||
|
} else {
|
||||||
|
return $this->messageError('sql error!',$res);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ccmd_vmTemplateEditInfo(){
|
function ccmd_vmTemplateEditInfo(){
|
||||||
|
|||||||
11
php/db.php
11
php/db.php
@@ -161,6 +161,7 @@ class Db {
|
|||||||
|
|
||||||
function insert($sql, $values){
|
function insert($sql, $values){
|
||||||
try {
|
try {
|
||||||
|
$this->_pdo->beginTransaction();
|
||||||
$query = $this->_pdo->prepare($sql);
|
$query = $this->_pdo->prepare($sql);
|
||||||
$i = 1;
|
$i = 1;
|
||||||
foreach($values as $v){
|
foreach($values as $v){
|
||||||
@@ -172,15 +173,19 @@ class Db {
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$query->execute();
|
$query->execute();
|
||||||
|
$lastId = $this->_pdo->lastInsertId();
|
||||||
$this->_pdo->commit();
|
$this->_pdo->commit();
|
||||||
} catch(PDOException $e) {
|
} catch(PDOException $e) {
|
||||||
|
$this->_pdo->rollBack();
|
||||||
|
#throw new Exception($e->getMessage());
|
||||||
return array('error'=>true,'info'=>$e->getMessage());
|
return array('error'=>true,'info'=>$e->getMessage());
|
||||||
}
|
}
|
||||||
return array('error'=>false,'lastID'=>$query->lastInsertId());
|
return array('error'=>false,'lastID'=>$lastId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function update($sql, $values){
|
function update($sql, $values){
|
||||||
try {
|
try {
|
||||||
|
$this->_pdo->beginTransaction();
|
||||||
$query = $this->_pdo->prepare($sql);
|
$query = $this->_pdo->prepare($sql);
|
||||||
$i = 1;
|
$i = 1;
|
||||||
foreach($values as $v){
|
foreach($values as $v){
|
||||||
@@ -195,7 +200,9 @@ class Db {
|
|||||||
$rowCount=$query->rowCount();
|
$rowCount=$query->rowCount();
|
||||||
$this->_pdo->commit();
|
$this->_pdo->commit();
|
||||||
} catch(PDOException $e) {
|
} catch(PDOException $e) {
|
||||||
return false;//$e->getMessage();
|
$this->_pdo->rollBack();
|
||||||
|
#return false;
|
||||||
|
throw new Exception($e->getMessage());
|
||||||
}
|
}
|
||||||
return array('rowCount'=>$rowCount);
|
return array('rowCount'=>$rowCount);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user