Dotclear 2.24
|
Public Member Functions | |
__construct () | |
__get (string $property) | |
__set (string $property, $value) | |
__isset (string $property) | |
__unset (string $property) | |
__invoke () | |
statement () | |
columns ($c, bool $reset=false) | |
fields ($c, bool $reset=false) | |
column ($c, bool $reset=false) | |
field ($c, bool $reset=false) | |
from ($c, bool $reset=false, bool $first=false) | |
where ($c, bool $reset=false) | |
on ($c, bool $reset=false) | |
cond ($c, bool $reset=false) | |
and ($c, bool $reset=false) | |
andGroup ($c) | |
or ($c, bool $reset=false) | |
orGroup ($c) | |
sql ($c, bool $reset=false) | |
escape (string $value) | |
quote ($value, bool $escape=true) | |
alias (string $name, string $alias) | |
as (string $name, string $alias) | |
in ($list, string $cast='') | |
inSelect (string $field, dcSelectStatement $sql) | |
dateFormat (string $field, string $pattern) | |
like (string $field, string $pattern) | |
regexp (string $value) | |
unique (string $field) | |
count (string $field, ?string $as=null, bool $unique=false) | |
avg (string $field, ?string $as=null) | |
max (string $field, ?string $as=null) | |
min (string $field, ?string $as=null) | |
sum (string $field, ?string $as=null) | |
isNull (string $field) | |
isNotNull (string $field) | |
isSame (string $local, string $external) | |
compare (string $external, bool $trigger_error=false, bool $dump=false, bool $print=false) | |
Protected Attributes | |
const | VERBOSE_SQL_ALIAS = false |
$con | |
$syntax | |
$_AS = ' ' | |
$columns = [] | |
$from = [] | |
$where = [] | |
$cond = [] | |
$sql = [] | |
__construct | ( | ) |
Class constructor
Reimplemented in dcSelectStatement, dcJoinStatement, dcUpdateStatement, and dcInsertStatement.
References dcCore\app().
__get | ( | string | $property | ) |
Magic getter method
string | $property | The property |
__set | ( | string | $property, |
$value | |||
) |
Magic setter method
string | $property | The property |
mixed | $value | The value |
__isset | ( | string | $property | ) |
Magic isset method
string | $property | The property |
__unset | ( | string | $property | ) |
Magic unset method
string | $property | The property |
__invoke | ( | ) |
statement | ( | ) |
Returns a SQL dummy statement
Reimplemented in dcSelectStatement, dcJoinStatement, dcDeleteStatement, dcUpdateStatement, dcInsertStatement, and dcTruncateStatement.
Referenced by __invoke(), and compare().
columns | ( | $c, | |
bool | $reset = false |
||
) |
Adds column(s)
mixed | $c | the column(s) |
boolean | $reset | reset previous column(s) first |
References columns().
Referenced by column(), columns(), fields(), dcSelectStatement\statement(), and dcInsertStatement\statement().
fields | ( | $c, | |
bool | $reset = false |
||
) |
column | ( | $c, | |
bool | $reset = false |
||
) |
field | ( | $c, | |
bool | $reset = false |
||
) |
from | ( | $c, | |
bool | $reset = false , |
||
bool | $first = false |
||
) |
Adds FROM clause(s)
mixed | $c | the from clause(s) |
boolean | $reset | reset previous from(s) first |
boolean | $first | put the from clause(s) at top of list |
References from().
Referenced by from(), dcInsertStatement\into(), dcUpdateStatement\ref(), dcUpdateStatement\reference(), dcSelectStatement\statement(), dcJoinStatement\statement(), dcDeleteStatement\statement(), dcUpdateStatement\statement(), dcInsertStatement\statement(), and dcTruncateStatement\statement().
where | ( | $c, | |
bool | $reset = false |
||
) |
Adds WHERE clause(s) condition (each will be AND combined in statement)
mixed | $c | the clause(s) |
boolean | $reset | reset previous where(s) first |
References where().
Referenced by dcAuth\checkUser(), on(), dcSelectStatement\statement(), dcJoinStatement\statement(), dcDeleteStatement\statement(), where(), and dcUpdateStatement\whereStatement().
on | ( | $c, | |
bool | $reset = false |
||
) |
cond | ( | $c, | |
bool | $reset = false |
||
) |
Adds additional WHERE clause condition(s) (including an operator at beginning)
mixed | $c | the clause(s) |
boolean | $reset | reset previous condition(s) first |
References cond().
Referenced by and(), cond(), or(), dcSelectStatement\statement(), dcJoinStatement\statement(), dcDeleteStatement\statement(), and dcUpdateStatement\whereStatement().
and | ( | $c, | |
bool | $reset = false |
||
) |
Adds additional WHERE AND clause condition(s)
mixed | $c | the clause(s) |
boolean | $reset | reset previous condition(s) first |
References cond().
andGroup | ( | $c | ) |
Helper to group some AND parts
mixed | $c | the parts} |
or | ( | $c, | |
bool | $reset = false |
||
) |
Adds additional WHERE OR clause condition(s)
mixed | $c | the clause(s) |
boolean | $reset | reset previous condition(s) first |
References cond().
orGroup | ( | $c | ) |
Helper to group some OR parts
mixed | $c | the parts} |
sql | ( | $c, | |
bool | $reset = false |
||
) |
Adds generic clause(s)
mixed | $c | the clause(s) |
boolean | $reset | reset previous generic clause(s) first |
References sql().
Referenced by sql(), dcSelectStatement\statement(), dcJoinStatement\statement(), dcDeleteStatement\statement(), and dcUpdateStatement\whereStatement().
escape | ( | string | $value | ) |
quote | ( | $value, | |
bool | $escape = true |
||
) |
Quote and escape a value if necessary (type string)
mixed | $value | The value |
boolean | $escape | The escape |
Referenced by like().
alias | ( | string | $name, |
string | $alias | ||
) |
Return a SQL table/column fragment using an alias for a name
string | $name | The name (table, field) |
string | $alias | The alias |
Referenced by as().
as | ( | string | $name, |
string | $alias | ||
) |
in | ( | $list, | |
string | $cast = '' |
||
) |
Return an SQL IN (…) fragment
mixed | $list | The list of values |
string | $cast | Cast given not null values to specified type |
inSelect | ( | string | $field, |
dcSelectStatement | $sql | ||
) |
Return an SQL IN (SELECT …) fragment
string | $field | The field |
dcSelectStatement | $sql | The sql |
References $sql.
dateFormat | ( | string | $field, |
string | $pattern | ||
) |
Return an SQL formatted date
string | $field | Field name |
string | $pattern | Date format |
like | ( | string | $field, |
string | $pattern | ||
) |
Return an SQL formatted like
string | $field | The field |
string | $pattern | The pattern |
References quote().
regexp | ( | string | $value | ) |
Return an SQL formatted REGEXP clause
string | $value | The value |
References escape().
unique | ( | string | $field | ) |
count | ( | string | $field, |
?string | $as = null , |
||
bool | $unique = false |
||
) |
Return an COUNT(…) clause
string | $field | The field |
null | string | $as | Optional alias |
bool | $unique | Unique values only |
References unique().
Referenced by dcSelectStatement\statement(), dcJoinStatement\statement(), dcDeleteStatement\statement(), dcUpdateStatement\statement(), dcInsertStatement\statement(), dcTruncateStatement\statement(), and dcUpdateStatement\whereStatement().
avg | ( | string | $field, |
?string | $as = null |
||
) |
Return an AVG(…) clause
string | $field | The field |
null | string | $as | Optional alias |
max | ( | string | $field, |
?string | $as = null |
||
) |
Return an MAX(…) clause
string | $field | The field |
null | string | $as | Optional alias |
min | ( | string | $field, |
?string | $as = null |
||
) |
Return an MIN(…) clause
string | $field | The field |
null | string | $as | Optional alias |
sum | ( | string | $field, |
?string | $as = null |
||
) |
Return an SUM(…) clause
string | $field | The field |
null | string | $as | Optional alias |
isNull | ( | string | $field | ) |
Return an IS NULL clause
string | $field | The field |
isNotNull | ( | string | $field | ) |
Return an IS NOT NULL clause
string | $field | The field |
isSame | ( | string | $local, |
string | $external | ||
) |
Compare two SQL queries
May be used for debugging purpose as:
if (!$sql->isSame($sql->statement(), $strReq)) { trigger_error('SQL statement error: ' . $sql->statement() . ' / ' . $strReq, E_USER_ERROR); }
string | $local | The local |
string | $external | The external |
References as().
Referenced by compare().
compare | ( | string | $external, |
bool | $trigger_error = false , |
||
bool | $dump = false , |
||
bool | $print = false |
||
) |
Compare local statement and external one
string | $external | The external |
bool | $trigger_error | True to trigger an error if compare failsl |
bool | $dump | True to var_dump() all if compare fails |
bool | True to print_r() all if compare fails |
References isSame(), and statement().
|
protected |
|
protected |
DB handle
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |