PHP Класс DB_dsql, atk4

Наследование: extends AbstractModel, implements Iterator
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$_iterating
$args array Data accumulated by calling Definition methods, which is then used when rendering.
$bt string Backtics are added around all fields. Set this to blank string to avoid.
$data {{{ Iterator support
$debug boolean Call $q->debug() to turn on debugging or $q->debug(false) to turn ir off.
$default_exception string Class name of default exception
$default_field string | DB_dsql If no fields are defined, this field is used.
$extra_params array Manually-specified params
$id_field string Required for non-id based tables.
$main_table boolean | string Used to determine main table.
$mode string Mode is initialized to "select" by default.
$output_mode string When you convert this object to string, the following happens:
$owner Owner of this object
$param_base string Prefix for all parameteric variables: a, a_2, a_3, etc.
$params array List of PDO parametical arguments for a query. Used only during rendering.
$preexec
$sql_templates Templates are used to construct most common queries. Templates may be changed in vendor-specific implementation of dsql (extending this class).
$stmt PDOStatement PDO statement if query is prepared. Used by iterator.
$template string Expression to use when converting to string

Открытые методы

Метод Описание
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.

Описание методов

SQLTemplate() публичный Метод

By default it is in SELECT mode
public SQLTemplate ( string $mode )
$mode string A key for $this->sql_templates

__clone() публичный Метод

public __clone ( )

__toString() публичный Метод

Convert object to string - generate SQL expression
public __toString ( ) : string
Результат string

_render() публичный Метод

Helper for render(), which does the actual work.
public _render ( ) : string
Результат string Resulting query

_render_where() публичный Метод

Subroutine which renders either [where] or [having].
public _render_where ( string $kind ) : array
$kind string 'where' or 'having'
Результат array Parsed chunks of query

_setArray() публичный Метод

Internal method which can be used by simple param-giving methods such as option(), group(), etc.
public _setArray ( mixed $values, string $name, boolean $parse_commas = true )
$values mixed
$name string
$parse_commas boolean

_unique() публичный Метод

{{{ Generic routines
public _unique ( &$array, $desired = null )

andExpr() публичный Метод

Shortcut to produce expression for series of conditions concatinated with "and". Useful to be passed inside where() or join().
public andExpr ( ) : DB_dsql
Результат DB_dsql New dynamic query, won't affect $this

args() публичный Метод

set arguments for call(). Used by fx() and call() but you can use This with ->expr("in ([args])")->args($values);.
public args ( array $args )
$args array Array with mixed arguments

bt() публичный Метод

Adds backtics around argument. This will allow you to use reserved SQL words as table or field names such as "table".
public bt ( mixed $s ) : string
$s mixed Any string or array of strings
Результат string Quoted string

calcFoundRows() публичный Метод

Use foundRows() to read this afterwards.
public calcFoundRows ( )

calc_found_rows() публичный Метод

Устаревший: 4.3.2. Naming bug. Use foundRows() instead.
public calc_found_rows ( )

call() публичный Метод

Sets a template for a user-defined method call with specified arguments.
public call ( string $fx, array $args = null )
$fx string Name of the user defined method
$args array Arguments in mixed form

concat() публичный Метод

Return expression for concatinating multiple values Accepts variable number of arguments, all of them would be escaped.
public concat ( ) : DB_dsql
Результат DB_dsql clone of $this

consume() публичный Метод

If the argument is more likely to be a field, use tick=true.
public consume ( string | Field | DB_dsql $dsql, boolean $tick = true ) : string
$dsql string | Field | DB_dsql Expression
$tick boolean Preferred quoted style
Результат string Quoted expression

count() публичный Метод

Creates expression for COUNT().
public count ( string | object $arg = null ) : DB_dsql
$arg string | object Typically fieldname or expression of a sub-query
Результат DB_dsql clone of $this

current() публичный Метод

public current ( )

debug() публичный Метод

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.
public debug ( boolean | string $msg = true )
$msg boolean | string "true" to start debugging

del() публичный Метод

Removes definition for argument. $q->del('where'), $q->del('fields') etc.
public del ( string $args )
$args string Could be 'field', 'where', 'order', 'limit', etc

delete() публичный Метод

Executes delete query.
public delete ( )

describe() публичный Метод

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.
public describe ( string $table = null ) : DB_dsql
$table string Table
Результат DB_dsql clone of $this

do_getAll() публичный Метод

public do_getAll ( )

do_getAllHash() публичный Метод

public do_getAllHash ( )

do_getHash() публичный Метод

public do_getHash ( )

do_getOne() публичный Метод

public do_getOne ( )

do_getRow() публичный Метод

public do_getRow ( )

do_insert() публичный Метод

Устаревший: 4.3.0 use insert()
public do_insert ( )

do_replace() публичный Метод

Устаревший: 4.3.0 use replace()
public do_replace ( )

do_select() публичный Метод

Устаревший: 4.3.0 use select()
public do_select ( )

do_update() публичный Метод

Устаревший: 4.3.0 use update()
public do_update ( )

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.
public dsql ( ) : DB_dsql
Результат DB_dsql Empty query for same database

escape() публичный Метод

Converts value into parameter and returns reference. Use only during query rendering. Consider using consume() instead.
public escape ( string $val ) : string
$val string String literal containing input data
Результат string Safe and escapeed string

execute() публичный Метод

Executes current query.
public execute ( )

expr() публичный Метод

Returns new dynamic query and initializes it to use specific template.
public expr ( string $expr, array $tags = [] ) : DB_dsql
$expr string SQL Expression. Don't pass unverified input
$tags array Array of tags and values. @see setCustom()
Результат DB_dsql New dynamic query, won't affect $this

fetch() публичный Метод

Will execute the query (if it's not executed already) and return first row.
public fetch ( integer $mode = PDO::FETCH_ASSOC ) : mixed
$mode integer PDO fetch mode
Результат mixed return result of PDO::fetch

fetchAll() публичный Метод

public fetchAll ( )

field() публичный Метод

Examples: $q->field('name'); Second argument specifies table for regular fields $q->field('name','user'); $q->field('name','user')->field('line1','address'); Array as a first argument will specify mulitple fields, same as calling field() multiple times $q->field(array('name','surname')); Associative array will assume that "key" holds the alias. Value may be object. $q->field(array('alias'=>'name','alias2'=>surname')); $q->field(array('alias'=>$q->expr(..), 'alias2'=>$q->dsql()->.. )); You may use array with aliases together with table specifier. $q->field(array('alias'=>'name','alias2'=>surname'),'user'); You can specify $q->expr() for calculated fields. Alias is mandatory. $q->field( $q->expr('2+2'),'alias'); // must always use alias You can use $q->dsql() for subqueries. Alias is mandatory. $q->field( $q->dsql()->table('x')... , 'alias'); // must always use alias
public field ( string | array $field, string $table = null, string $alias = null )
$field string | array Specifies field to select
$table string Specify if not using primary table
$alias string Specify alias for this field

fieldQuery() публичный Метод

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.
public fieldQuery ( string | array $field, string $table = null, string $alias = null ) : DB_dsql
$field string | array Specifies field to select
$table string Specify if not using primary table
$alias string Specify alias for this field
Результат DB_dsql Clone of $this with only one field

foundRows() публичный Метод

After fetching data, call this to find out how many rows there were in total. Call calcFoundRows() for better performance.
public foundRows ( ) : integer
Результат integer number of results

fx() публичный Метод

$q->fx('if', array($condition, $if_true, $if_false));
public fx ( string $fx, array $args = null )
$fx string Name of the built-in method
$args array Arguments

get() публичный Метод

Will execute DSQL query and return all results inside array of hashes.
public get ( ) : array
Результат array Array of associative arrays

getAll() публичный Метод

public getAll ( )

getDebugQuery() публичный Метод

Return formatted debug output.
public getDebugQuery ( string $r = null ) : string
$r string Rendered material
Результат string SQL syntax of query

getField() публичный Метод

Return expression containing a properly escaped field. Use make subquery condition reference parent query.
public getField ( string $fld ) : DB_dsql
$fld string Field in SQL table
Результат DB_dsql Expression pointing to specified field

getHash() публичный Метод

Will execute DSQL query and return first row as hash (column=>value).
public getHash ( ) : array
Результат array Hash of next row in data stream

getOne() публичный Метод

You can also simply cast your DSQL into string to get this value echo $dsql;
public getOne ( ) : string
Результат string Value of first column in first row

getRow() публичный Метод

Will execute DSQL query and return first row as array (not hash). If you call several times will return subsequent rows.
public getRow ( ) : array
Результат array Next row of your data (not hash)

group() публичный Метод

Implemens GROUP BY functionality. Simply pass either string field or expression.
public group ( string | object $group )
$group string | object Group by this

hasInsertOption() публичный Метод

Check if specified insert option was previously added.
public hasInsertOption ( string $option ) : boolean
$option string Which option to check?
Результат boolean

hasOption() публичный Метод

Check if specified option was previously added.
public hasOption ( string $option ) : boolean
$option string Which option to check?
Результат boolean

having() публичный Метод

Same syntax as where().
public having ( mixed $field, string $cond = UNDEFINED, string $value = UNDEFINED )
$field mixed Field, array for OR or Expression
$cond string Condition such as '=', '>' or 'is not'
$value string Value. Will be quoted unless you pass expression

ignore() публичный Метод

Sets IGNORE option.
public ignore ( )

insert() публичный Метод

Executes insert query. Returns ID of new record.
public insert ( ) : integer
Результат integer new record ID (from last_id)

insertAll() публичный Метод

Inserts multiple rows of data. Uses ignore option AVOID using this, might not be implemented correctly.
public insertAll ( array $array ) : array
$array array Insert multiple rows into table with one query
Результат array List of IDs

join() публичный Метод

Examples: $q->join('address'); // on user.address_id=address.id $q->join('address.user_id'); // on address.user_id=user.id $q->join('address a'); // With alias $q->join(array('a'=>'address')); // Also alias Second argument may specify the field of the master table $q->join('address', 'billing_id'); $q->join('address.code', 'code'); $q->join('address.code', 'user.code'); Third argument may specify which kind of join to use. $q->join('address', null, 'left'); $q->join('address.code', 'user.code', 'inner'); Using array syntax you can join multiple tables too $q->join(array('a'=>'address', 'p'=>'portfolio')); You can use expression for more complex joins $q->join('address', $q->orExpr() ->where('user.billing_id=address.id') ->where('user.technical_id=address.id') )
public join ( string $foreign_table, mixed $master_field = null, string $join_kind = null, string $_foreign_alias = null )
$foreign_table string Table to join with
$master_field mixed Field in master table
$join_kind string 'left' or 'inner', etc
$_foreign_alias string Internal, don't use

key() публичный Метод

public key ( )

limit() публичный Метод

Limit how many rows will be returned.
public limit ( integer $cnt, integer $shift )
$cnt integer Number of rows to return
$shift integer Offset, how many rows to skip

next() публичный Метод

public next ( )

option() публичный Метод

Defines query option, such as DISTINCT.
public option ( string | expresion $option )
$option string | expresion Option to put after SELECT

option_insert() публичный Метод

Defines insert query option, such as IGNORE.
public option_insert ( string | expresion $option )
$option string | expresion Option to put after INSERT

option_replace() публичный Метод

Defines replace query option, such as IGNORE.
public option_replace ( string | expresion $option )
$option string | expresion Option to put after REPLACE

orExpr() публичный Метод

Shortcut to produce expression which concatinates "where" clauses with "OR" operator.
public orExpr ( ) : DB_dsql
Результат DB_dsql New dynamic query, won't affect $this

order() публичный Метод

$q->order('name'); $q->order('name desc'); $q->order('name desc, id asc') $q->order('name',true);
public order ( mixed $order, string | boolean $desc = null )
$order mixed Order by
$desc string | boolean true to sort descending

paramBase() публичный Метод

Change prefix for parametric values. Not really useful.
public paramBase ( string $param_base )
$param_base string prefix to use for param names

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.
public preexec ( )

random() публичный Метод

Returns method for generating random numbers. This is used for ordering table in random order.
public random ( ) : DB_dsql
Результат DB_dsql clone of $this

render() публичный Метод

Converts query into string format. This will contain parametric references.
public render ( ) : string
Результат string Resulting query

render_andwhere() публичный Метод

Renders [andwhere].
public render_andwhere ( ) : string
Результат string rendered SQL chunk

render_args() публичный Метод

Renders [args].
public render_args ( ) : string
Результат string rendered SQL chunk

render_field() публичный Метод

Returns template component [field].
public render_field ( ) : string
Результат string Parsed template chunk

render_from() публичный Метод

Conditionally returns "from", only if table is Specified Do not call directly.
public render_from ( ) : string
Результат string Parsed template chunk

render_fx() публичный Метод

Renders [fx].
public render_fx ( ) : string
Результат string rendered SQL chunk

render_group() публичный Метод

Renders [group].
public render_group ( ) : string
Результат string rendered SQL chunk

render_having() публичный Метод

Renders [having].
public render_having ( ) : string
Результат string rendered SQL chunk

render_join() публичный Метод

Renders [join].
public render_join ( ) : string
Результат string rendered SQL chunk

render_limit() публичный Метод

Renders [limit].
public render_limit ( ) : string
Результат string rendered SQL chunk

render_options() публичный Метод

Renders [options].
public render_options ( ) : string
Результат string rendered SQL chunk

render_options_insert() публичный Метод

Renders [options_insert].
public render_options_insert ( ) : string
Результат string rendered SQL chunk

render_options_replace() публичный Метод

Renders [options_replace].
public render_options_replace ( ) : string
Результат string rendered SQL chunk

render_order() публичный Метод

Renders [order].
public render_order ( ) : string
Результат string rendered SQL chunk

render_orwhere() публичный Метод

Renders [orwhere].
public render_orwhere ( ) : string
Результат string rendered SQL chunk

render_set() публичный Метод

Renders [set] for UPDATE query.
public render_set ( ) : string
Результат string rendered SQL chunk

render_set_fields() публичный Метод

Renders [set_fields] for INSERT.
public render_set_fields ( ) : string
Результат string rendered SQL chunk

render_set_values() публичный Метод

Renders [set_values] for INSERT.
public render_set_values ( ) : string
Результат string rendered SQL chunk

render_table() публичный Метод

Renders part of the template: [table] Do not call directly.
public render_table ( ) : string
Результат string Parsed template chunk

render_table_noalias() публичный Метод

Returns template component [table_noalias].
public render_table_noalias ( ) : string
Результат string Parsed template chunk

render_where() публичный Метод

Renders [where].
public render_where ( ) : string
Результат string rendered SQL chunk

replace() публичный Метод

Executes replace query.
public replace ( )

reset() публичный Метод

Removes all definitions. Start from scratch.
public reset ( )

rewind() публичный Метод

public rewind ( )

select() публичный Метод

Executes select query.
public select ( )

set() публичный Метод

Sets field value for INSERT or UPDATE statements.
public set ( string $field, mixed $value = UNDEFINED )
$field string Name of the field
$value mixed Value of the field

setCustom() публичный Метод

Defines a custom tag variable. WARNING: always backtick / escaped argument if it's unsafe.
public setCustom ( string | array $tag, string | object $value = null )
$tag string | array Corresponds to [tag] inside template
$value string | object Value for the template tag

sum() публичный Метод

Creates expression for SUM().
public sum ( string | object $arg ) : DB_dsql
$arg string | object Typically fieldname or expression of a sub-query
Результат DB_dsql clone of $this

table() публичный Метод

Examples: $q->table('user'); $q->table('user','u'); $q->table('user')->table('salary') $q->table(array('user','salary')); $q->table(array('user','salary'),'user'); $q->table(array('u'=>'user','s'=>'salary')); If you specify multiple tables, you still need to make sure to add proper "where" conditions. All the above examples return $q (for chaining) You can also call table without arguments, which will return current table: echo $q->table(); If multiple tables are used, "false" is returned. Return is not quoted. Please avoid using table() without arguments as more tables may be dynamically added later.
public table ( string $table = UNDEFINED, string $alias = UNDEFINED )
$table string Specify table to use
$alias string Specify alias for the table

template() публичный Метод

Explicitly sets template to your query. Remember to change $this->mode if you switch this.
public template ( string $template )
$template string New template to use by render

truncate() публичный Метод

Executes truncate query.
public truncate ( )

update() публичный Метод

Executes update query.
public update ( )

useExpr() публичный Метод

Change template of existing query instead of creating new one. If unsure use expr().
public useExpr ( string $expr, array $tags = [] )
$expr string SQL Expression. Don't pass unverified input
$tags array Obsolete, use templates / setCustom()

valid() публичный Метод

public valid ( )

where() публичный Метод

Examples: $q->where('id',1); Second argument specifies table for regular fields $q->where('id>','1'); $q->where('id','>',1); You may use expressions $q->where($q->expr('a=b')); $q->where('date>',$q->expr('now()')); $q->where($q->expr('length(password)'),'>',5); Finally, subqueries can also be used $q->where('foo',$q->dsql()->table('foo')->field('name')); To specify OR conditions $q->where($q->orExpr()->where('a',1)->where('b',1)); you can also use the shortcut: $q->where(array('a is null','b is null'));
public where ( mixed $field, string $cond = UNDEFINED, string $value = UNDEFINED, string $kind = 'where' )
$field mixed Field, array for OR or Expression
$cond string Condition such as '=', '>' or 'is not'
$value string Value. Will be quoted unless you pass expression
$kind string Do not use directly. Use having()

Описание свойств

$_iterating публичное свойство

public $_iterating

$args публичное свойство

Data accumulated by calling Definition methods, which is then used when rendering.
public array $args
Результат array

$bt публичное свойство

Backtics are added around all fields. Set this to blank string to avoid.
public string $bt
Результат string

$data публичное свойство

{{{ Iterator support
public $data

$debug публичное свойство

Call $q->debug() to turn on debugging or $q->debug(false) to turn ir off.
public bool $debug
Результат boolean

$default_exception публичное свойство

Class name of default exception
public string $default_exception
Результат string

$default_field публичное свойство

If no fields are defined, this field is used.
public string|DB_dsql $default_field
Результат string | DB_dsql

$extra_params публичное свойство

Manually-specified params
public array $extra_params
Результат array

$id_field публичное свойство

Required for non-id based tables.
public string $id_field
Результат string

$main_table публичное свойство

Used to determine main table.
public bool|string $main_table
Результат boolean | string

$mode публичное свойство

Mode is initialized to "select" by default.
public string $mode
Результат string

$output_mode публичное свойство

When you convert this object to string, the following happens:
public string $output_mode
Результат string

$owner публичное свойство

Owner of this object
public $owner

$param_base публичное свойство

Prefix for all parameteric variables: a, a_2, a_3, etc.
public string $param_base
Результат string

$params публичное свойство

List of PDO parametical arguments for a query. Used only during rendering.
public array $params
Результат array

$preexec публичное свойство

public $preexec

$sql_templates публичное свойство

Templates are used to construct most common queries. Templates may be changed in vendor-specific implementation of dsql (extending this class).
public $sql_templates

$stmt публичное свойство

PDO statement if query is prepared. Used by iterator.
public PDOStatement $stmt
Результат PDOStatement

$template публичное свойство

Expression to use when converting to string
public string $template
Результат string