Query for INSERT
package | salt\sql\queries |
---|---|
inherited_from | \salt\BaseQuery |
__construct(array<mixed,\salt\Base>|\salt\Base $objects, \salt\Query $select = NULL
)
inherited_from | \salt\BaseQuery::__construct() |
---|
array<mixed,\salt\Base>
\salt\Base
object or array of object (of same type) to insert
\salt\Query
SELECT query to use for insert.
__construct(\salt\Base $obj)
\salt\Base
the object used for retrieve metadata.
disableIfEmpty(mixed $list)
This can be used if the query contains an IN where condition with an empty array : Executing the query result in an exception, but we can use this function for return an empty result without exception :
$q->whereAnd('ids', 'IN', $values); // will produce a bad where clause : "ids IN ()" if $values is empty $q->disabledIfEmpty($values); $db->execQuery($q); // valid, will not execute query, so not throw exception
mixed
escapeName(string $name) : string
string
a SQL name : database, table, field, alias, etc...
string
SQL escaped text with backquote.getBinds(string $source = \salt\ClauseType::ALL
) : array<mixed,mixed[]>
string
(Optional) ClauseType or specific text for restrict returned binds to specified source
array<mixed,mixed[]>
list of binds : array of array('value' => ..., 'type' => ...)getInsertObjectCount() : integer
integer
the number of expected objects to insertgetPaginationBinds(\salt\Pagination $pagination) : array<mixed,mixed[]>
\salt\Pagination
the Pagination object
array<mixed,mixed[]>
binds for the Pagination : array of bindName => array of ('value' => ..., 'type' => ...)isEnabled() : boolean
boolean
TRUE if the query can be executed, FALSE otherwiseisPrivateBinds() : boolean
boolean
TRUE if privateBinds has been calledprivateBinds(boolean $privateBinds = TRUE
) : \salt\SqlBindField
boolean
(Optional, TRUE) hide binds values in debug queries
\salt\SqlBindField
the current objecttoCountQuery() : \salt\CountQuery
Have to be overrided by child classes if needed
\salt\SaltException |
if called on BaseQuery instance |
---|
\salt\CountQuery
the SQL query for count querytoSQL() : string
string
the memoized SQL textaddBind(mixed $value, integer $type, string $source = \salt\ClauseType::ALL
) : string
mixed
value of bind
integer
(FieldType) type of the field
string
(Optional) ClauseType or other text : clause where the bind will be used, if we know it
string
the bind namebuildSQL() : string
string
the SQL textlinkBindsOf(\salt\SqlBindField $other, string $source= \salt\ClauseType::ALL
, string $otherSource= \salt\ClauseType::ALL
)
\salt\SqlBindField
the other SqlBindField to link
string
clause usage of the SqlBindField if we known it
string
restrict link to this source in $other
\salt\SaltException |
if this SqlBindField is already resolved |
---|
removeBinds(string $source)
string
ClauseType of specific text
resolveFieldName(string $source, mixed|\salt\SqlExpr $fieldNameOrValue, mixed|\salt\SqlExpr $fieldOfValue = NULL
) : string | array<mixed,string>
string
caller of resolve : ClauseType or specific text
mixed
\salt\SqlExpr
a FieldName (string) or SqlExpr or potential value (int, string, array) if 3rd argument is provided
mixed
\salt\SqlExpr
a Field related to the value. Can be a SqlExpr or a string. Can be NULL if 2nd argument is a string fieldName
string
array<mixed,string>
absolute field name (alias.fieldname) or string with bind values or array of bind values if 2nd argument is an array of valuescheckNotResolved()
\salt\SaltException |
if called after toSQL() |
---|
getFieldType(string $field) : integer
string
the fieldName
integer
FiedType type of the field$_salt_obj : \salt\Base
$_salt_bindNumber : integer
0
$_salt_bindPaginationNumber : integer
0
$_salt_binds : array<mixed,mixed>
array()
content | array of bindName => array( 'value' => mixed // value of bind 'type' => int FieldType // type of field 'private' => boolean // if value is private data (like passwords) ) |
---|
$_salt_enabled : boolean
TRUE
$_salt_fields : array<mixed,string>
array()
$_salt_objects : array<mixed,\salt\Base>
array()
$_salt_others : array<mixed,\salt\SqlBindField[][]>
array()
content | array of (ClauseType (source) => array of ClauseType(dest) => array of SqlBindField) |
---|
$_salt_privateBinds : boolean
FALSE
$_salt_query : \salt\Query
NULL
$_salt_sets : array<mixed,string[]>
array()
content | array of array of field=>bind |
---|
$_salt_sources : array<mixed,string[]>
array()
content | array of (ClauseType => array of bindName) |
---|
$_salt_text : string
NULL