zhamao-framework/src/ZM/DB/InsertBody.php
whale 169a751e0f update to 1.2 version
Generate systemd script
Default info_level set to 2
Modify & add some comment for Example module
Brand new Console
Add daemon command argument
Add #OnTick annotation
Add ZMRobot API class
2020-04-29 15:29:56 +08:00

34 lines
593 B
PHP

<?php
namespace ZM\DB;
use ZM\Exception\DbException;
class InsertBody
{
/**
* @var Table
*/
private $table;
private $row;
/**
* InsertBody constructor.
* @param Table $table
* @param $row
*/
public function __construct(Table $table, $row) {
$this->table = $table;
$this->row = $row;
}
/**
* @throws DbException
*/
public function save() {
DB::rawQuery('INSERT INTO ' . $this->table->getTableName() . ' VALUES ('.implode(',', array_fill(0, count($this->row), '?')).')', $this->row);
}
}