src/Components/DatabaseClient.php
public function insert(string $from, array $data, array $options = [])
    {
        if (!$data) {
            throw new \RuntimeException('The data inserted into the database cannot be empty');
        }

        list($statement, $bindings) = $this->compileInsert($from, $data);

        if (isset($options['dumpSql'])) {
            return [$statement, $bindings];
        }

        $this->fetchAffected($statement, $bindings);

        // 'sequence' For special driver, like PgSQL
        return isset($options['sequence']) ? $this->lastInsertId($options['sequence']) : $this->lastInsertId();
    }
public function insert(string $from, array $data, array $options = [])
    {
        if (!$data) {
            throw new \RuntimeException('The data inserted into the database cannot be empty');
        }

        list($statement, $bindings) = $this->compileInsert($from, $data);

        if (isset($options['dumpSql'])) {
            return [$statement, $bindings];
        }

        $this->fetchAffected($statement, $bindings);

        // 'sequence' For special driver, like PgSQL
        return isset($options['sequence']) ? $this->lastInsertId($options['sequence']) : $this->lastInsertId();
    }
public function insert ( string $ from , array $ data , array $ options = [ ] ) { if ( ! $ data ) { throw new \ RuntimeException ( 'The data inserted into the database cannot be empty' ) ; } list ( $ statement , $ bindings ) = $ this -> compileInsert ( $ from , $ data ) ; if ( isset ( $ options [ 'dumpSql' ] ) ) { return [ $ statement , $ bindings ] ; } $ this -> fetchAffected ( $ statement , $ bindings ) ; // 'sequence' For special driver, like PgSQL return isset ( $ options [ 'sequence' ] ) ? $ this -> lastInsertId ( $ options [ 'sequence' ] ) : $ this -> lastInsertId ( ) ; }
Run a statement for insert a row
@param  string $from
@param  array $data <column => value>
@param  array $options
@return int|array
@throws \RuntimeException
Run a statement for insert a row