com\setasign\SetaFramework\Database\Query

Insert Class Query Insert

File: /SetaFramework/src/Database/Query/Insert.php

Class hierarchy

Implements

Summary

Constants

PART_SUBSELECT

private const Insert::PART_SUBSELECT = 'subselect'

Properties

$parts

protected array Insert::$parts = array()

Contains the single parts of the statement


Methods

__construct()

public Insert::__construct (
?string $tableName = null
)

Constructor

Parameters
$tableName : ?string
 

columns()

public Insert::columns (
array $columns
): static

Sets the columns-block

This will replace all existing columns

Parameters
$columns : array
 

getSql()

Returns the query as string

Parameters
$quoteInterface : \com\setasign\SetaFramework\Database\QuoteInterface
 

getSqlColumns()

Parses the columns-block to string

Parameters
$quoteInterface : \com\setasign\SetaFramework\Database\QuoteInterface
 

getSqlValues()

Parses the values-block to string

Parameters
$quoteInterface : \com\setasign\SetaFramework\Database\QuoteInterface
 

into()

public Insert::into (
string $tableName
): static

Set a table in into-block

Parameters
$tableName : string
 

reset()

public Insert::reset (
?string $part = null
): static

Resets a single part or all parts of the statement

Parameters
$part : ?string
 
Exceptions

Throws \InvalidArgumentException

select()

public Insert::select (
\Closure $select
): static
Parameters
$select : \Closure
 

set()

public Insert::set (
array $data
): static

Sets the columns and values

This method is for mysql-like syntax but dont create a set-syntax query. With this method is it only possible to insert one row.

Parameters
$data : array
 

values()

public Insert::values (
array $values
): static

Add a value

Parameters
$values : array