SqlInsertRequest
extends AbstractSqlRequest
in package
Uses
FieldListFacet
The main SQL Insert Request class
This class handles sql INSERT request to the DBMS server.
Table of Contents
Properties
- $class : string|null
- The class
- $idField : string
- The ID field
- $parameters : array<string|int, string>
- The SQL Query Parameters
- $sqlAdapter : AbstractSqlAdapter
- The SQL Adapter
Methods
- __construct() : mixed
- Constructor
- __toString() : string
- Get object as string
- escapeIdentifier() : string
- Escape an SQL identifier using SQL Adapter
- escapeValue() : string
- Escape an SQL value using SQL Adapter
- fields() : mixed|$this
- Set/Get the field list to get
- formatCondition() : string
- from() : static|string
- Set/Get the table parameter
- getClone() : static
- Get a clone of current request
- getEntityName() : string
- Get the name to use in SQL Query
- getIdField() : string
- get the ID field
- getLastId() : string|null
- getQuery() : string
- Get the query as string
- getSqlAdapter() : AbstractSqlAdapter
- Get the SQL Adapter
- output() : mixed
- Set/Get the output parameter
- run() : string|int
- Run the query and return results
- setSqlAdapter() : static
- Set the SQL Adapter
- get() : mixed
- Get a parameter for this query
- set() : static
- Set a parameter for this query
- sget() : mixed
- Set/Get a parameter for this query If there is a value (non-null), we set it, or we get it
Properties
$class
The class
protected
string|null
$class
$idField
The ID field
protected
string
$idField
$parameters
The SQL Query Parameters
protected
array<string|int, string>
$parameters
= []
$sqlAdapter
The SQL Adapter
protected
AbstractSqlAdapter
$sqlAdapter
Methods
__construct()
Constructor
public
__construct(AbstractSqlAdapter $sqlAdapter, string $idField[, string|null $class = null ]) : mixed
Parameters
- $sqlAdapter : AbstractSqlAdapter
- $idField : string
- $class : string|null = null
__toString()
Get object as string
public
__toString() : string
Tags
Return values
stringescapeIdentifier()
Escape an SQL identifier using SQL Adapter
public
escapeIdentifier(string $identifier) : string
Parameters
- $identifier : string
Return values
stringescapeValue()
Escape an SQL value using SQL Adapter
public
escapeValue(mixed $value) : string
Parameters
- $value : mixed
Return values
stringfields()
Set/Get the field list to get
public
fields([array<string|int, mixed>|null $fields = null ]) : mixed|$this
Parameters
- $fields : array<string|int, mixed>|null = null
-
List of fields and values
Return values
mixed|$thisformatCondition()
public
formatCondition(array<string|int, mixed>|string $condition, string|mixed|null $operator, mixed|null $value[, bool $escapeValue = true ]) : string
Parameters
- $condition : array<string|int, mixed>|string
-
The condition or the field
- $operator : string|mixed|null
-
Value or operator
- $value : mixed|null
-
The value to use
- $escapeValue : bool = true
-
Should the value be escaped ?
Return values
stringfrom()
Set/Get the table parameter
public
from([string|null $table = null ]) : static|string
Parameters
- $table : string|null = null
Return values
static|stringgetClone()
Get a clone of current request
public
getClone([bool $withParameters = true ]) : static
Parameters
- $withParameters : bool = true
-
True to also copy parameters, default to true
Return values
staticgetEntityName()
Get the name to use in SQL Query
public
getEntityName() : string
Return values
stringgetIdField()
get the ID field
public
getIdField() : string
Return values
stringgetLastId()
public
getLastId() : string|null
Return values
string|nullgetQuery()
Get the query as string
public
getQuery() : string
Return values
stringgetSqlAdapter()
Get the SQL Adapter
public
getSqlAdapter() : AbstractSqlAdapter
Return values
AbstractSqlAdapteroutput()
Set/Get the output parameter
public
output([string|null $output = null ]) : mixed
Parameters
- $output : string|null = null
run()
Run the query and return results
public
run() : string|int
Return values
string|intsetSqlAdapter()
Set the SQL Adapter
public
setSqlAdapter(AbstractSqlAdapter $sqlAdapter) : static
Parameters
- $sqlAdapter : AbstractSqlAdapter
Return values
staticget()
Get a parameter for this query
protected
get(string $parameter[, mixed $default = null ]) : mixed
Parameters
- $parameter : string
- $default : mixed = null
set()
Set a parameter for this query
protected
set(string $parameter, mixed $value) : static
Parameters
- $parameter : string
- $value : mixed
Return values
staticsget()
Set/Get a parameter for this query If there is a value (non-null), we set it, or we get it
protected
sget(string $parameter[, mixed $value = null ]) : mixed
Parameters
- $parameter : string
- $value : mixed = null