Метод |
Описание |
|
SQLTemplate ( string $mode ) |
Switch template for this query. Determines what would be done
on execute. |
|
__clone ( ) |
|
|
__toString ( ) : string |
Convert object to string - generate SQL expression |
|
_render ( ) : string |
Helper for render(), which does the actual work. |
|
_render_where ( string $kind ) : array |
Subroutine which renders either [where] or [having]. |
|
_setArray ( mixed $values, string $name, boolean $parse_commas = true ) |
Internal method which can be used by simple param-giving methods such
as option(), group(), etc. |
|
_unique ( &$array, $desired = null ) |
{{{ Generic routines |
|
andExpr ( ) : DB_dsql |
Shortcut to produce expression for series of conditions concatinated
with "and". Useful to be passed inside where() or join(). |
|
args ( array $args ) |
set arguments for call(). Used by fx() and call() but you can use This
with ->expr("in ([args])")->args($values);. |
|
bt ( mixed $s ) : string |
Adds backtics around argument. This will allow you to use reserved
SQL words as table or field names such as "table". |
|
calcFoundRows ( ) |
Sets flag to hint SQL (if supported) to prepare total number of columns. |
|
calc_found_rows ( ) |
|
|
call ( string $fx, array $args = null ) |
Sets a template for a user-defined method call with specified arguments. |
|
concat ( ) : DB_dsql |
Return expression for concatinating multiple values
Accepts variable number of arguments, all of them would be
escaped. |
|
consume ( string | Field | DB_dsql $dsql, boolean $tick = true ) : string |
Recursively renders sub-query or expression, combining parameters. |
|
count ( string | object $arg = null ) : DB_dsql |
Creates expression for COUNT(). |
|
current ( ) |
|
|
debug ( boolean | string $msg = true ) |
This is identical to AbstractObject::debug(), but as an object
will refer to the $owner. This is to avoid string-casting and
messing up with the DSQL string. |
|
del ( string $args ) |
Removes definition for argument. $q->del('where'), $q->del('fields') etc. |
|
delete ( ) |
Executes delete query. |
|
describe ( string $table = null ) : DB_dsql |
Creates a query for listing tables in databse-specific form
Agile Toolkit DSQL does not pretend to know anything about model
structure, so result parsing is up to you. |
|
do_getAll ( ) |
|
|
do_getAllHash ( ) |
|
|
do_getHash ( ) |
|
|
do_getOne ( ) |
|
|
do_getRow ( ) |
|
|
do_insert ( ) |
|
|
do_replace ( ) |
|
|
do_select ( ) |
|
|
do_update ( ) |
|
|
dsql ( ) : DB_dsql |
Create new dsql object linked with the same database connection and
bearing same data-type. You can use this method to create sub-queries. |
|
escape ( string $val ) : string |
Converts value into parameter and returns reference. Use only during
query rendering. Consider using consume() instead. |
|
execute ( ) |
Executes current query. |
|
expr ( string $expr, array $tags = [] ) : DB_dsql |
Returns new dynamic query and initializes it to use specific template. |
|
fetch ( integer $mode = PDO::FETCH_ASSOC ) : mixed |
Will execute the query (if it's not executed already) and return
first row. |
|
fetchAll ( ) |
|
|
field ( string | array $field, string $table = null, string $alias = null ) |
Adds new column to resulting select by querying $field. |
|
fieldQuery ( string | array $field, string $table = null, string $alias = null ) : DB_dsql |
Removes all field definitions and returns only field you specify
as parameter to this method. Original query is not affected ($this)
Same as for field() syntax. |
|
foundRows ( ) : integer |
After fetching data, call this to find out how many rows there were in
total. Call calcFoundRows() for better performance. |
|
fx ( string $fx, array $args = null ) |
Executes a standard function with arguments, such as IF. |
|
get ( ) : array |
Will execute DSQL query and return all results inside array of hashes. |
|
getAll ( ) |
|
|
getDebugQuery ( string $r = null ) : string |
Return formatted debug output. |
|
getField ( string $fld ) : DB_dsql |
Return expression containing a properly escaped field. Use make
subquery condition reference parent query. |
|
getHash ( ) : array |
Will execute DSQL query and return first row as hash (column=>value). |
|
getOne ( ) : string |
Will execute DSQL query and return first column of a first row. |
|
getRow ( ) : array |
Will execute DSQL query and return first row as array (not hash). If
you call several times will return subsequent rows. |
|
group ( string | object $group ) |
Implemens GROUP BY functionality. Simply pass either string field
or expression. |
|
hasInsertOption ( string $option ) : boolean |
Check if specified insert option was previously added. |
|
hasOption ( string $option ) : boolean |
Check if specified option was previously added. |
|
having ( mixed $field, string $cond = UNDEFINED, string $value = UNDEFINED ) |
Same syntax as where(). |
|
ignore ( ) |
Sets IGNORE option. |
|
insert ( ) : integer |
Executes insert query. Returns ID of new record. |
|
insertAll ( array $array ) : array |
Inserts multiple rows of data. Uses ignore option
AVOID using this, might not be implemented correctly. |
|
join ( string $foreign_table, mixed $master_field = null, string $join_kind = null, string $_foreign_alias = null ) |
Joins your query with another table. |
|
key ( ) |
|
|
limit ( integer $cnt, integer $shift ) |
Limit how many rows will be returned. |
|
next ( ) |
|
|
option ( string | expresion $option ) |
Defines query option, such as DISTINCT. |
|
option_insert ( string | expresion $option ) |
Defines insert query option, such as IGNORE. |
|
option_replace ( string | expresion $option ) |
Defines replace query option, such as IGNORE. |
|
orExpr ( ) : DB_dsql |
Shortcut to produce expression which concatinates "where" clauses with
"OR" operator. |
|
order ( mixed $order, string | boolean $desc = null ) |
Orders results by field or Expression. See documentation for full
list of possible arguments. |
|
paramBase ( string $param_base ) |
Change prefix for parametric values. Not really useful. |
|
preexec ( ) |
Execute query faster, but don't fetch data until iterating started. This
can be done if you need to know foundRows() before fetching data. |
|
random ( ) : DB_dsql |
Returns method for generating random numbers. This is used for ordering
table in random order. |
|
render ( ) : string |
Converts query into string format. This will contain parametric
references. |
|
render_andwhere ( ) : string |
Renders [andwhere]. |
|
render_args ( ) : string |
Renders [args]. |
|
render_field ( ) : string |
Returns template component [field]. |
|
render_from ( ) : string |
Conditionally returns "from", only if table is Specified
Do not call directly. |
|
render_fx ( ) : string |
Renders [fx]. |
|
render_group ( ) : string |
Renders [group]. |
|
render_having ( ) : string |
Renders [having]. |
|
render_join ( ) : string |
Renders [join]. |
|
render_limit ( ) : string |
Renders [limit]. |
|
render_options ( ) : string |
Renders [options]. |
|
render_options_insert ( ) : string |
Renders [options_insert]. |
|
render_options_replace ( ) : string |
Renders [options_replace]. |
|
render_order ( ) : string |
Renders [order]. |
|
render_orwhere ( ) : string |
Renders [orwhere]. |
|
render_set ( ) : string |
Renders [set] for UPDATE query. |
|
render_set_fields ( ) : string |
Renders [set_fields] for INSERT. |
|
render_set_values ( ) : string |
Renders [set_values] for INSERT. |
|
render_table ( ) : string |
Renders part of the template: [table]
Do not call directly. |
|
render_table_noalias ( ) : string |
Returns template component [table_noalias]. |
|
render_where ( ) : string |
Renders [where]. |
|
replace ( ) |
Executes replace query. |
|
reset ( ) |
Removes all definitions. Start from scratch. |
|
rewind ( ) |
|
|
select ( ) |
Executes select query. |
|
set ( string $field, mixed $value = UNDEFINED ) |
Sets field value for INSERT or UPDATE statements. |
|
setCustom ( string | array $tag, string | object $value = null ) |
Defines a custom tag variable. WARNING: always backtick / escaped
argument if it's unsafe. |
|
sum ( string | object $arg ) : DB_dsql |
Creates expression for SUM(). |
|
table ( string $table = UNDEFINED, string $alias = UNDEFINED ) |
Specifies which table to use in this dynamic query. You may specify
array to perform operation on multiple tables. |
|
template ( string $template ) |
Explicitly sets template to your query. Remember to change
$this->mode if you switch this. |
|
truncate ( ) |
Executes truncate query. |
|
update ( ) |
Executes update query. |
|
useExpr ( string $expr, array $tags = [] ) |
Change template of existing query instead of creating new one. If unsure
use expr(). |
|
valid ( ) |
|
|
where ( mixed $field, string $cond = UNDEFINED, string $value = UNDEFINED, string $kind = 'where' ) |
Adds condition to your query. |
|