Documentation

CSqlComposer extends CMySqlComposer
in package

Final class for compose a dialect SQL query (MySQL, PostgresSQL, etc.).

For greater maintainability of the code it is recommended to always use this class instead of its base classes.

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
Only standard code, ignore other dialectic words
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

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

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

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

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()

Only standard code, ignore other dialectic words

public prepare() : string

NOTE: some feature (paging, match,ecc) could be ignored here because you must reimplements prepare() on childs class

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

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

_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


        

Search results