/** * 插入记录 * @access public * @param string $table 数据表名 * @param array $data 字段数组 * @param array $field 字段信息 * @return 受影响的行数 ~~~ example 1: 单行插入 $this->insert('sys_menu',['sm_id'=>1,'sm_title=>'test','sm_pid'=>0]); example 2: 多行插入 $this->insert('sys_menu', [ [1,'first menu',0], [2,'second menu',1], ], ['sm_id','sm_title,'sm_pid'] ); ~~~ */ public function insert($table, $data = [], $field = []) { parent::insert($table, $data, $field); $sql = parent::getSql(); //获取单条时的SQL语句 self::setBuildSql($sql); return $this; }
/** * * * @param mixed * @return */ public static function insert($row) { $command = new Command(get_called_class()); return $command->insert($row); }