mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-21 07:35:34 +08:00
reformat code
This commit is contained in:
@@ -18,6 +18,7 @@ class UpdateBody
|
||||
* @var array
|
||||
*/
|
||||
private $set_value;
|
||||
|
||||
/**
|
||||
* UpdateBody constructor.
|
||||
* @param Table $table
|
||||
@@ -31,19 +32,19 @@ class UpdateBody
|
||||
/**
|
||||
* @throws DbException
|
||||
*/
|
||||
public function save(){
|
||||
public function save() {
|
||||
$arr = [];
|
||||
$msg = [];
|
||||
foreach($this->set_value as $k => $v) {
|
||||
$msg []= $k .' = ?';
|
||||
$arr[]=$v;
|
||||
foreach ($this->set_value as $k => $v) {
|
||||
$msg [] = $k . ' = ?';
|
||||
$arr[] = $v;
|
||||
}
|
||||
if(($msg ?? []) == []) throw new DbException('update value sets can not be empty!');
|
||||
$line = 'UPDATE '.$this->table->getTableName().' SET '.implode(', ', $msg);
|
||||
if($this->where_thing != []) {
|
||||
if (($msg ?? []) == []) throw new DbException('update value sets can not be empty!');
|
||||
$line = 'UPDATE ' . $this->table->getTableName() . ' SET ' . implode(', ', $msg);
|
||||
if ($this->where_thing != []) {
|
||||
list($sql, $param) = $this->getWhereSQL();
|
||||
$arr = array_merge($arr, $param);
|
||||
$line .= ' WHERE '.$sql;
|
||||
$line .= ' WHERE ' . $sql;
|
||||
}
|
||||
return DB::rawQuery($line, $arr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user