CMySqlComposer
extends CSqlComposerBase
in package
Extends the CSqlComposerBase class to perform all specific MySQL SQL code.
It is a complete class and could be used directly but if you want to change the DBMS you will have to modify all the classes that use it instead of in one place (CSqlCompser). Use the CSqlCompser derived class instead.
Tags
Table of Contents
- $elements_per_page : int
- $page : int
- $params : array<string|int, mixed>
- $renamed_tables : array<string|int, mixed>
- __construct() : mixed
- __toString() : string
- binding() : void
- Set the parameters for the binding
- clear() : void
- Reset all internal data (like a new)
- from() : CSqlComposerBase
- fromList() : CSqlComposerBase
- getRenamedTable() : string
- Return the Renamed Table
- groupBy() : CSqlComposerBase
- having() : CSqlComposerBase
- innerJoin() : CSqlComposerBase
- Sets the name of the table to INNER JOIN and its condition for crossing with a starting table
- join() : CSqlComposerBase
- Sets the name of the table to JOIN and its condition for crossing with a starting table
- leftJoin() : CSqlComposerBase
- Sets the name of the table to LEFT JOIN and its condition for crossing with a starting table
- match() : CSqlComposerBase
- Set match element for advanced search
- orderBy() : CSqlComposerBase
- outerJoin() : CSqlComposerBase
- Sets the name of the table to OUTER JOIN and its condition for crossing with a starting table
- paging() : CSqlComposerBase
- Impostazione dei parametri per l'impaginazione dei dati
- prepare() : string
- SQL query composer according to the MySQL standard
- rightJoin() : CSqlComposerBase
- Sets the name of the table to RIGHT JOIN and its condition for crossing with a starting table
- select() : CSqlComposerBase
- Set the fields of the query
- selectList() : CSqlComposerBase
- Set the fields of the query
- setRenamedTables() : void
- Set the ramed tables name
- where() : CSqlComposerBase
- _getTable() : CSqlComposerBase
- _getTables() : CSqlComposerBase
- _setJoin() : CSqlComposerBase
- Sets the name of the table to join and its condition for crossing with a starting table
Properties
$elements_per_page
protected
int
$elements_per_page
= 0
Tags
$page
protected
int
$page
= 0
Tags
$params
protected
array<string|int, mixed>
$params
= []
Tags
$renamed_tables
protected
static array<string|int, mixed>
$renamed_tables
= []
Tags
Methods
__construct()
public
__construct([string|null $table = null ]) : mixed
Parameters
- $table : string|null = null
-
name of the default db table
Tags
Return values
mixed —__toString()
public
__toString() : string
Tags
Return values
string —the string containing the query made up of all the parameters previously set
binding()
Set the parameters for the binding
public
binding([array<string|int, mixed>|null $params = null ]) : void
Parameters
- $params : array<string|int, mixed>|null = null
-
list of parameters deferred in the query by the placeholder "?"
Tags
Return values
void —clear()
Reset all internal data (like a new)
public
clear() : void
Tags
Return values
void —from()
public
from(string $table[, string|null $as = null ]) : CSqlComposerBase
Parameters
- $table : string
-
name of table
- $as : string|null = null
-
alias table name
Tags
Return values
CSqlComposerBase —this object
fromList()
public
fromList(array<string|int, mixed> $tables) : CSqlComposerBase
Parameters
- $tables : array<string|int, mixed>
-
list of table name in the query
Tags
Return values
CSqlComposerBase —this object
getRenamedTable()
Return the Renamed Table
public
static getRenamedTable(string $table) : string
Parameters
- $table : string
-
name of renamed table
Tags
Return values
string —the original table name
groupBy()
public
groupBy(string $group_by) : CSqlComposerBase
Parameters
- $group_by : string
-
list of field names to group by
Tags
Return values
CSqlComposerBase —this object
having()
public
having(string $having) : CSqlComposerBase
Parameters
- $having : string
-
conditions for group by having
Tags
Return values
CSqlComposerBase —this object
innerJoin()
Sets the name of the table to INNER JOIN and its condition for crossing with a starting table
public
innerJoin(string $table, string $on_condition[, string|null $as = null ]) : CSqlComposerBase
Parameters
- $table : string
-
name of table
- $on_condition : string
-
condition for crossing with a starting table
- $as : string|null = null
-
alias table name
Tags
Return values
CSqlComposerBase —this object
join()
Sets the name of the table to JOIN and its condition for crossing with a starting table
public
join(string $table, string $on_condition[, string|null $as = null ]) : CSqlComposerBase
Parameters
- $table : string
-
name of table
- $on_condition : string
-
condition for crossing with a starting table
- $as : string|null = null
-
alias table name
Tags
Return values
CSqlComposerBase —this object
leftJoin()
Sets the name of the table to LEFT JOIN and its condition for crossing with a starting table
public
leftJoin(string $table, string $on_condition[, string|null $as = null ]) : CSqlComposerBase
Parameters
- $table : string
-
name of table
- $on_condition : string
-
condition for crossing with a starting table
- $as : string|null = null
-
alias table name
Tags
Return values
CSqlComposerBase —this object
match()
Set match element for advanced search
public
match(string $items, string $match) : CSqlComposerBase
Parameters
- $items : string
-
list of items
- $match : string
-
condition for advanced search
Tags
Return values
CSqlComposerBase —this object
orderBy()
public
orderBy(array<string|int, mixed> $order_by) : CSqlComposerBase
Parameters
- $order_by : array<string|int, mixed>
-
list of field names to order by
Tags
Return values
CSqlComposerBase —this object
outerJoin()
Sets the name of the table to OUTER JOIN and its condition for crossing with a starting table
public
outerJoin(string $table, string $on_condition[, string|null $as = null ]) : CSqlComposerBase
Parameters
- $table : string
-
name of table
- $on_condition : string
-
condition for crossing with a starting table
- $as : string|null = null
-
alias table name
Tags
Return values
CSqlComposerBase —this object
paging()
Impostazione dei parametri per l'impaginazione dei dati
public
paging(int $page[, int $elements_per_page = DEFAULT_ITEMS_PER_REQUEST ]) : CSqlComposerBase
Parameters
- $page : int
-
page to read (starting from 1)
- $elements_per_page : int = DEFAULT_ITEMS_PER_REQUEST
-
maximum total of elements that make up a page
return CSqlComposerBase this object
Tags
Return values
CSqlComposerBase —prepare()
SQL query composer according to the MySQL standard
public
prepare() : string
Tags
Return values
string —the composed SQL code
rightJoin()
Sets the name of the table to RIGHT JOIN and its condition for crossing with a starting table
public
rightJoin(string $table, string $on_condition[, string|null $as = null ]) : CSqlComposerBase
Parameters
- $table : string
-
name of table
- $on_condition : string
-
condition for crossing with a starting table
- $as : string|null = null
-
alias table name
Tags
Return values
CSqlComposerBase —this object
select()
Set the fields of the query
public
select(string $items) : CSqlComposerBase
Parameters
- $items : string
-
list of db fields separated by a comma
Tags
Return values
CSqlComposerBase —this object
selectList()
Set the fields of the query
public
selectList(array<string|int, mixed> $items) : CSqlComposerBase
Parameters
- $items : array<string|int, mixed>
-
array contains the list of db fields
Tags
Return values
CSqlComposerBase —this object
setRenamedTables()
Set the ramed tables name
public
static setRenamedTables(array<string|int, string> $renamed_tables) : void
Parameters
- $renamed_tables : array<string|int, string>
-
list of renamed tables (is an associative array original_table=>renamed_table)
Tags
Return values
void —where()
public
where(string $conditions) : CSqlComposerBase
Parameters
- $conditions : string
-
WHERE conditions
Tags
Return values
CSqlComposerBase —this object
_getTable()
private
_getTable(string $type, string $table[, string|null $as = null ]) : CSqlComposerBase
Parameters
- $type : string
-
type table: TABLE|JOIN|LEFT JOIN
- $table : string
-
name of table
- $as : string|null = null
-
alias table name
Tags
Return values
CSqlComposerBase —this object
_getTables()
private
_getTables(string $type, array<string|int, mixed> $tables) : CSqlComposerBase
Parameters
- $type : string
-
type table: TABLE|JOIN|
- $tables : array<string|int, mixed>
-
list of tables in an array containing the name and possibly its alias name (as)
Tags
Return values
CSqlComposerBase —this object
_setJoin()
Sets the name of the table to join and its condition for crossing with a starting table
private
_setJoin(string $join_type, string $table, string $on_condition[, string|null $as = null ]) : CSqlComposerBase
Parameters
- $join_type : string
-
type of join (LEFT JOIN, RIGHT JOIN, INNER JOIN, OUTER JOIN)
- $table : string
-
name of table
- $on_condition : string
-
condition for crossing with a starting table
- $as : string|null = null
-
alias table name
Tags
Return values
CSqlComposerBase —this object