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