src/Driver/Compiler.php
public function compileInsert(string $table, array $columns, array $rowsets): string
    {
        if (empty($columns)) {
            throw new CompilerException(
                'Unable to build insert statement, columns must be set'
            );
        }

        if (empty($rowsets)) {
            throw new CompilerException(
                'Unable to build insert statement, at least one value set must be provided'
            );
        }

        //To add needed prefixes (if any)
        $table = $this->quote($table, true);

        //Compiling list of columns
        $columns = $this->prepareColumns($columns);

        //Simply joining every rowset
        $rowsets = implode(",\n", $rowsets);

        return "INSERT INTO {$table} ({$columns})\nVALUES {$rowsets}";
    }
public function compileInsert(string $table, array $columns, array $rowsets): string
    {
        if (empty($columns)) {
            throw new CompilerException(
                'Unable to build insert statement, columns must be set'
            );
        }

        if (empty($rowsets)) {
            throw new CompilerException(
                'Unable to build insert statement, at least one value set must be provided'
            );
        }

        //To add needed prefixes (if any)
        $table = $this->quote($table, true);

        //Compiling list of columns
        $columns = $this->prepareColumns($columns);

        //Simply joining every rowset
        $rowsets = implode(",\n", $rowsets);

        return "INSERT INTO {$table} ({$columns})\nVALUES {$rowsets}";
    }
public function compileInsert ( string $ table , array $ columns , array $ rowsets ) : string { if ( empty ( $ columns ) ) { throw new CompilerException ( 'Unable to build insert statement, columns must be set' ) ; } if ( empty ( $ rowsets ) ) { throw new CompilerException ( 'Unable to build insert statement, at least one value set must be provided' ) ; } //To add needed prefixes (if any) $ table = $ this -> quote ( $ table , true ) ; //Compiling list of columns $ columns = $ this -> prepareColumns ( $ columns ) ; //Simply joining every rowset $ rowsets = implode ( ",\n" , $ rowsets ) ; return "INSERT INTO {$table} ({$columns})\nVALUES {$rowsets}" ; }
Create insert query using table names, columns and rowsets. Must support both - single and
batch inserts.

@param string              $table
@param array               $columns
@param FragmentInterface[] $rowsets Every rowset has to be convertable into string. Raw data
not allowed!

@return string

@throws CompilerException
Create insert query using table names columns and rowsets . Must support both - single and batch inserts .