Cml\Db\MySql\Pdo::set PHP Method

set() public method

根据key 新增 一条数据
public set ( string $table, array $data, mixed $tablePrefix = null ) : boolean | integer
$table string
$data array eg: ['username'=>'admin', 'email'=>'[email protected]']
$tablePrefix mixed 表前缀 不传则获取配置中配置的前缀
return boolean | integer
    public function set($table, $data, $tablePrefix = null)
    {
        is_null($tablePrefix) && ($tablePrefix = $this->tablePrefix);
        $tableName = $tablePrefix . $table;
        if (is_array($data)) {
            $s = $this->arrToCondition($data, $table);
            $stmt = $this->prepare("INSERT INTO {$tableName} SET {$s}", $this->wlink);
            $this->execute($stmt);
            $this->setCacheVer($tableName);
            return $this->insertId();
        } else {
            return false;
        }
    }