PHP Class DB_dsql, atk4

Inheritance: extends AbstractModel, implements Iterator
Show file Open project: atk4/atk4 Class Usage Examples

Public Properties

Property Type Description
$_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

Public Methods

Method Description
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.

Method Details

SQLTemplate() public method

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

__clone() public method

public __clone ( )

__toString() public method

Convert object to string - generate SQL expression
public __toString ( ) : string
return string

_render() public method

Helper for render(), which does the actual work.
public _render ( ) : string
return string Resulting query

_render_where() public method

Subroutine which renders either [where] or [having].
public _render_where ( string $kind ) : array
$kind string 'where' or 'having'
return array Parsed chunks of query

_setArray() public method

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

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

andExpr() public method

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

args() public method

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

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
return string Quoted string

calcFoundRows() public method

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

calc_found_rows() public method

Deprecation: 4.3.2. Naming bug. Use foundRows() instead.
public calc_found_rows ( )

call() public method

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

Return expression for concatinating multiple values Accepts variable number of arguments, all of them would be escaped.
public concat ( ) : DB_dsql
return DB_dsql clone of $this

consume() public method

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
return string Quoted expression

count() public method

Creates expression for COUNT().
public count ( string | object $arg = null ) : DB_dsql
$arg string | object Typically fieldname or expression of a sub-query
return DB_dsql clone of $this

current() public method

public current ( )

debug() public method

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

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

Executes delete query.
public delete ( )

describe() public method

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
return DB_dsql clone of $this

do_getAll() public method

public do_getAll ( )

do_getAllHash() public method

public do_getAllHash ( )

do_getHash() public method

public do_getHash ( )

do_getOne() public method

public do_getOne ( )

do_getRow() public method

public do_getRow ( )

do_insert() public method

Deprecation: 4.3.0 use insert()
public do_insert ( )

do_replace() public method

Deprecation: 4.3.0 use replace()
public do_replace ( )

do_select() public method

Deprecation: 4.3.0 use select()
public do_select ( )

do_update() public method

Deprecation: 4.3.0 use update()
public do_update ( )

dsql() public method

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
return DB_dsql Empty query for same database

escape() public method

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
return string Safe and escapeed string

execute() public method

Executes current query.
public execute ( )

expr() public method

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()
return DB_dsql New dynamic query, won't affect $this

fetch() public method

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
return mixed return result of PDO::fetch

fetchAll() public method

public fetchAll ( )

field() public method

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

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
return DB_dsql Clone of $this with only one field

foundRows() public method

After fetching data, call this to find out how many rows there were in total. Call calcFoundRows() for better performance.
public foundRows ( ) : integer
return integer number of results

fx() public method

$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() public method

Will execute DSQL query and return all results inside array of hashes.
public get ( ) : array
return array Array of associative arrays

getAll() public method

public getAll ( )

getDebugQuery() public method

Return formatted debug output.
public getDebugQuery ( string $r = null ) : string
$r string Rendered material
return string SQL syntax of query

getField() public method

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
return DB_dsql Expression pointing to specified field

getHash() public method

Will execute DSQL query and return first row as hash (column=>value).
public getHash ( ) : array
return array Hash of next row in data stream

getOne() public method

You can also simply cast your DSQL into string to get this value echo $dsql;
public getOne ( ) : string
return string Value of first column in first row

getRow() public method

Will execute DSQL query and return first row as array (not hash). If you call several times will return subsequent rows.
public getRow ( ) : array
return array Next row of your data (not hash)

group() public method

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

hasInsertOption() public method

Check if specified insert option was previously added.
public hasInsertOption ( string $option ) : boolean
$option string Which option to check?
return boolean

hasOption() public method

Check if specified option was previously added.
public hasOption ( string $option ) : boolean
$option string Which option to check?
return boolean

having() public method

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

Sets IGNORE option.
public ignore ( )

insert() public method

Executes insert query. Returns ID of new record.
public insert ( ) : integer
return integer new record ID (from last_id)

insertAll() public method

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
return array List of IDs

join() public method

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 method

public key ( )

limit() public method

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 method

public next ( )

option() public method

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

option_insert() public method

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

option_replace() public method

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

orExpr() public method

Shortcut to produce expression which concatinates "where" clauses with "OR" operator.
public orExpr ( ) : DB_dsql
return DB_dsql New dynamic query, won't affect $this

order() public method

$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() public method

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

preexec() public method

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

Returns method for generating random numbers. This is used for ordering table in random order.
public random ( ) : DB_dsql
return DB_dsql clone of $this

render() public method

Converts query into string format. This will contain parametric references.
public render ( ) : string
return string Resulting query

render_andwhere() public method

Renders [andwhere].
public render_andwhere ( ) : string
return string rendered SQL chunk

render_args() public method

Renders [args].
public render_args ( ) : string
return string rendered SQL chunk

render_field() public method

Returns template component [field].
public render_field ( ) : string
return string Parsed template chunk

render_from() public method

Conditionally returns "from", only if table is Specified Do not call directly.
public render_from ( ) : string
return string Parsed template chunk

render_fx() public method

Renders [fx].
public render_fx ( ) : string
return string rendered SQL chunk

render_group() public method

Renders [group].
public render_group ( ) : string
return string rendered SQL chunk

render_having() public method

Renders [having].
public render_having ( ) : string
return string rendered SQL chunk

render_join() public method

Renders [join].
public render_join ( ) : string
return string rendered SQL chunk

render_limit() public method

Renders [limit].
public render_limit ( ) : string
return string rendered SQL chunk

render_options() public method

Renders [options].
public render_options ( ) : string
return string rendered SQL chunk

render_options_insert() public method

Renders [options_insert].
public render_options_insert ( ) : string
return string rendered SQL chunk

render_options_replace() public method

Renders [options_replace].
public render_options_replace ( ) : string
return string rendered SQL chunk

render_order() public method

Renders [order].
public render_order ( ) : string
return string rendered SQL chunk

render_orwhere() public method

Renders [orwhere].
public render_orwhere ( ) : string
return string rendered SQL chunk

render_set() public method

Renders [set] for UPDATE query.
public render_set ( ) : string
return string rendered SQL chunk

render_set_fields() public method

Renders [set_fields] for INSERT.
public render_set_fields ( ) : string
return string rendered SQL chunk

render_set_values() public method

Renders [set_values] for INSERT.
public render_set_values ( ) : string
return string rendered SQL chunk

render_table() public method

Renders part of the template: [table] Do not call directly.
public render_table ( ) : string
return string Parsed template chunk

render_table_noalias() public method

Returns template component [table_noalias].
public render_table_noalias ( ) : string
return string Parsed template chunk

render_where() public method

Renders [where].
public render_where ( ) : string
return string rendered SQL chunk

replace() public method

Executes replace query.
public replace ( )

reset() public method

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

rewind() public method

public rewind ( )

select() public method

Executes select query.
public select ( )

set() public method

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

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

Creates expression for SUM().
public sum ( string | object $arg ) : DB_dsql
$arg string | object Typically fieldname or expression of a sub-query
return DB_dsql clone of $this

table() public method

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

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

Executes truncate query.
public truncate ( )

update() public method

Executes update query.
public update ( )

useExpr() public method

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 method

public valid ( )

where() public method

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

Property Details

$_iterating public property

public $_iterating

$args public property

Data accumulated by calling Definition methods, which is then used when rendering.
public array $args
return array

$bt public property

Backtics are added around all fields. Set this to blank string to avoid.
public string $bt
return string

$data public property

{{{ Iterator support
public $data

$debug public property

Call $q->debug() to turn on debugging or $q->debug(false) to turn ir off.
public bool $debug
return boolean

$default_exception public property

Class name of default exception
public string $default_exception
return string

$default_field public property

If no fields are defined, this field is used.
public string|DB_dsql $default_field
return string | DB_dsql

$extra_params public property

Manually-specified params
public array $extra_params
return array

$id_field public property

Required for non-id based tables.
public string $id_field
return string

$main_table public property

Used to determine main table.
public bool|string $main_table
return boolean | string

$mode public property

Mode is initialized to "select" by default.
public string $mode
return string

$output_mode public property

When you convert this object to string, the following happens:
public string $output_mode
return string

$owner public property

Owner of this object
public $owner

$param_base public property

Prefix for all parameteric variables: a, a_2, a_3, etc.
public string $param_base
return string

$params public property

List of PDO parametical arguments for a query. Used only during rendering.
public array $params
return array

$preexec public property

public $preexec

$sql_templates public property

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 public property

PDO statement if query is prepared. Used by iterator.
public PDOStatement $stmt
return PDOStatement

$template public property

Expression to use when converting to string
public string $template
return string