Public Member Functions | |
select ($select= '*', $escape=NULL) | |
select_max ($select= '', $alias= '') | |
select_min ($select= '', $alias= '') | |
select_avg ($select= '', $alias= '') | |
select_sum ($select= '', $alias= '') | |
distinct ($val=TRUE) | |
from ($from) | |
join ($table, $cond, $type= '') | |
where ($key, $value=NULL, $escape=TRUE) | |
or_where ($key, $value=NULL, $escape=TRUE) | |
where_in ($key=NULL, $values=NULL) | |
or_where_in ($key=NULL, $values=NULL) | |
where_not_in ($key=NULL, $values=NULL) | |
or_where_not_in ($key=NULL, $values=NULL) | |
like ($field, $match= '', $side= 'both') | |
not_like ($field, $match= '', $side= 'both') | |
or_like ($field, $match= '', $side= 'both') | |
or_not_like ($field, $match= '', $side= 'both') | |
group_by ($by) | |
having ($key, $value= '', $escape=TRUE) | |
or_having ($key, $value= '', $escape=TRUE) | |
order_by ($orderby, $direction= '') | |
limit ($value, $offset= '') | |
offset ($offset) | |
set ($key, $value= '', $escape=TRUE) | |
get ($table= '', $limit=null, $offset=null) | |
count_all_results ($table= '') | |
get_where ($table= '', $where=null, $limit=null, $offset=null) | |
insert_batch ($table= '', $set=NULL) | |
set_insert_batch ($key, $value= '', $escape=TRUE) | |
insert ($table= '', $set=NULL) | |
replace ($table= '', $set=NULL) | |
update ($table= '', $set=NULL, $where=NULL, $limit=NULL) | |
update_batch ($table= '', $set=NULL, $index=NULL) | |
set_update_batch ($key, $index= '', $escape=TRUE) | |
empty_table ($table= '') | |
truncate ($table= '') | |
delete ($table= '', $where= '', $limit=NULL, $reset_data=TRUE) | |
dbprefix ($table= '') | |
set_dbprefix ($prefix= '') | |
_object_to_array ($object) | |
_object_to_array_batch ($object) | |
start_cache () | |
stop_cache () | |
flush_cache () | |
![]() | |
__construct ($params) | |
initialize () | |
db_set_charset ($charset, $collation) | |
platform () | |
version () | |
query ($sql, $binds=FALSE, $return_object=TRUE) | |
load_rdriver () | |
simple_query ($sql) | |
trans_off () | |
trans_strict ($mode=TRUE) | |
trans_start ($test_mode=FALSE) | |
trans_complete () | |
trans_status () | |
compile_binds ($sql, $binds) | |
is_write_type ($sql) | |
elapsed_time ($decimals=6) | |
total_queries () | |
last_query () | |
escape ($str) | |
escape_like_str ($str) | |
primary ($table= '') | |
list_tables ($constrain_by_prefix=FALSE) | |
table_exists ($table_name) | |
list_fields ($table= '') | |
field_exists ($field_name, $table_name) | |
field_data ($table= '') | |
insert_string ($table, $data) | |
update_string ($table, $data, $where) | |
_has_operator ($str) | |
call_function ($function) | |
cache_set_path ($path= '') | |
cache_on () | |
cache_off () | |
cache_delete ($segment_one= '', $segment_two= '') | |
cache_delete_all () | |
_cache_init () | |
close () | |
display_error ($error= '', $swap= '', $native=FALSE) | |
protect_identifiers ($item, $prefix_single=FALSE) | |
_protect_identifiers ($item, $prefix_single=FALSE, $protect_identifiers=NULL, $field_exists=TRUE) | |
Data Fields | |
$ar_select = array() | |
$ar_distinct = FALSE | |
$ar_from = array() | |
$ar_join = array() | |
$ar_where = array() | |
$ar_like = array() | |
$ar_groupby = array() | |
$ar_having = array() | |
$ar_keys = array() | |
$ar_limit = FALSE | |
$ar_offset = FALSE | |
$ar_order = FALSE | |
$ar_orderby = array() | |
$ar_set = array() | |
$ar_wherein = array() | |
$ar_aliased_tables = array() | |
$ar_store_array = array() | |
$ar_caching = FALSE | |
$ar_cache_exists = array() | |
$ar_cache_select = array() | |
$ar_cache_from = array() | |
$ar_cache_join = array() | |
$ar_cache_where = array() | |
$ar_cache_like = array() | |
$ar_cache_groupby = array() | |
$ar_cache_having = array() | |
$ar_cache_orderby = array() | |
$ar_cache_set = array() | |
$ar_no_escape = array() | |
$ar_cache_no_escape = array() | |
![]() | |
$username | |
$password | |
$hostname | |
$database | |
$dbdriver = 'mysql' | |
$dbprefix = '' | |
$char_set = 'utf8' | |
$dbcollat = 'utf8_general_ci' | |
$autoinit = TRUE | |
$swap_pre = '' | |
$port = '' | |
$pconnect = FALSE | |
$conn_id = FALSE | |
$result_id = FALSE | |
$db_debug = FALSE | |
$benchmark = 0 | |
$query_count = 0 | |
$bind_marker = '?' | |
$save_queries = TRUE | |
$queries = array() | |
$query_times = array() | |
$data_cache = array() | |
$trans_enabled = TRUE | |
$trans_strict = TRUE | |
$_trans_depth = 0 | |
$_trans_status = TRUE | |
$cache_on = FALSE | |
$cachedir = '' | |
$cache_autodel = FALSE | |
$CACHE | |
$_protect_identifiers = TRUE | |
$_reserved_identifiers = array('*') | |
$stmt_id | |
$curs_id | |
$limit_used | |
Protected Member Functions | |
_max_min_avg_sum ($select= '', $alias= '', $type= 'MAX') | |
_create_alias_from_table ($item) | |
_where ($key, $value=NULL, $type= 'AND ', $escape=NULL) | |
_where_in ($key=NULL, $values=NULL, $not=FALSE, $type= 'AND ') | |
_like ($field, $match= '', $type= 'AND ', $side= 'both', $not= '') | |
_having ($key, $value= '', $type= 'AND ', $escape=TRUE) | |
_track_aliases ($table) | |
_compile_select ($select_override=FALSE) | |
_merge_cache () | |
_reset_run ($ar_reset_items) | |
_reset_select () | |
_reset_write () | |
![]() | |
_reset_select () | |
|
protected |
Compile the SELECT statement
Generates a query string based on which functions were used. Should not be called directly. The get() function calls it.
|
protected |
Determines the alias name based on the table
string |
|
protected |
|
protected |
|
protected |
Processing Function for the four functions above:
select_max() select_min() select_avg() select_sum()
string | the field |
string | an alias |
|
protected |
Merge Cache
When called, this function merges any cached AR arrays with locally called ones.
_object_to_array | ( | $object) |
Object to Array
Takes an object as input and converts the class variables to array key/vals
object |
_object_to_array_batch | ( | $object) |
Object to Array
Takes an object as input and converts the class variables to array key/vals
object |
|
protected |
Resets the active record values. Called by the get() function
array | An array of fields to reset |
|
protected |
Resets the active record values. Called by the get() function
|
protected |
Resets the active record "write" values.
Called by the insert() update() insert_batch() update_batch() and delete() functions
|
protected |
Track Aliases
Used to track SQL statements written with aliased tables.
string | The table to inspect |
|
protected |
|
protected |
Where_in
Called by where_in, where_in_or, where_not_in, where_not_in_or
string | The field to search |
array | The values searched on |
boolean | If the statement would be IN or NOT IN |
string |
count_all_results | ( | $table = '' ) |
"Count All Results" query
Generates a platform-specific query string that counts all records returned by an Active Record query.
string |
dbprefix | ( | $table = '' ) |
DB Prefix
Prepends a database prefix if one exists in configuration
string | the table |
delete | ( | $table = '' , |
|
$where = '' , |
|||
$limit = NULL , |
|||
$reset_data = TRUE |
|||
) |
Delete
Compiles a delete string and runs the query
mixed | the table(s) to delete from. String or array |
mixed | the where clause |
mixed | the limit clause |
boolean |
distinct | ( | $val = TRUE ) |
DISTINCT
Sets a flag which tells the query string compiler to add DISTINCT
bool |
empty_table | ( | $table = '' ) |
Empty Table
Compiles a delete string and runs "DELETE FROM table"
string | the table to empty |
flush_cache | ( | ) |
Flush Cache
Empties the AR cache
public
from | ( | $from) |
From
Generates the FROM portion of the query
mixed | can be a string or array |
get | ( | $table = '' , |
|
$limit = null , |
|||
$offset = null |
|||
) |
Get
Compiles the select statement based on the other functions called and runs the query
string | the table |
string | the limit clause |
string | the offset clause |
get_where | ( | $table = '' , |
|
$where = null , |
|||
$limit = null , |
|||
$offset = null |
|||
) |
Get_Where
Allows the where clause, limit and offset to be added directly
string | the where clause |
string | the limit clause |
string | the offset clause |
group_by | ( | $by) |
GROUP BY
string |
having | ( | $key, | |
$value = '' , |
|||
$escape = TRUE |
|||
) |
Sets the HAVING value
Separates multiple calls with AND
string | |
string |
insert | ( | $table = '' , |
|
$set = NULL |
|||
) |
Insert
Compiles an insert string and runs the query
string | the table to insert data into |
array | an associative array of insert values |
insert_batch | ( | $table = '' , |
|
$set = NULL |
|||
) |
Insert_Batch
Compiles batch insert strings and runs the queries
string | the table to retrieve the results from |
array | an associative array of insert values |
join | ( | $table, | |
$cond, | |||
$type = '' |
|||
) |
Join
Generates the JOIN portion of the query
string | |
string | the join condition |
string | the type of join |
like | ( | $field, | |
$match = '' , |
|||
$side = 'both' |
|||
) |
Like
Generates a LIKE% portion of the query. Separates multiple calls with AND
mixed | |
mixed |
limit | ( | $value, | |
$offset = '' |
|||
) |
Sets the LIMIT value
integer | the limit value |
integer | the offset value |
not_like | ( | $field, | |
$match = '' , |
|||
$side = 'both' |
|||
) |
Not Like
Generates a NOT LIKE portion of the query. Separates multiple calls with AND
mixed | |
mixed |
offset | ( | $offset) |
Sets the OFFSET value
integer | the offset value |
or_having | ( | $key, | |
$value = '' , |
|||
$escape = TRUE |
|||
) |
Sets the OR HAVING value
Separates multiple calls with OR
string | |
string |
or_like | ( | $field, | |
$match = '' , |
|||
$side = 'both' |
|||
) |
OR Like
Generates a LIKE% portion of the query. Separates multiple calls with OR
mixed | |
mixed |
or_not_like | ( | $field, | |
$match = '' , |
|||
$side = 'both' |
|||
) |
OR Not Like
Generates a NOT LIKE portion of the query. Separates multiple calls with OR
mixed | |
mixed |
or_where | ( | $key, | |
$value = NULL , |
|||
$escape = TRUE |
|||
) |
OR Where
Generates the WHERE portion of the query. Separates multiple calls with OR
mixed | |
mixed |
or_where_in | ( | $key = NULL , |
|
$values = NULL |
|||
) |
Where_in_or
Generates a WHERE field IN ('item', 'item') SQL query joined with OR if appropriate
string | The field to search |
array | The values searched on |
or_where_not_in | ( | $key = NULL , |
|
$values = NULL |
|||
) |
Where_not_in_or
Generates a WHERE field NOT IN ('item', 'item') SQL query joined with OR if appropriate
string | The field to search |
array | The values searched on |
order_by | ( | $orderby, | |
$direction = '' |
|||
) |
Sets the ORDER BY value
string | |
string | direction: asc or desc |
replace | ( | $table = '' , |
|
$set = NULL |
|||
) |
Replace
Compiles an replace into string and runs the query
string | the table to replace data into |
array | an associative array of insert values |
select | ( | $select = '*' , |
|
$escape = NULL |
|||
) |
Select
Generates the SELECT portion of the query
string |
select_avg | ( | $select = '' , |
|
$alias = '' |
|||
) |
Select Average
Generates a SELECT AVG(field) portion of a query
string | the field |
string | an alias |
select_max | ( | $select = '' , |
|
$alias = '' |
|||
) |
Select Max
Generates a SELECT MAX(field) portion of a query
string | the field |
string | an alias |
select_min | ( | $select = '' , |
|
$alias = '' |
|||
) |
Select Min
Generates a SELECT MIN(field) portion of a query
string | the field |
string | an alias |
select_sum | ( | $select = '' , |
|
$alias = '' |
|||
) |
Select Sum
Generates a SELECT SUM(field) portion of a query
string | the field |
string | an alias |
set | ( | $key, | |
$value = '' , |
|||
$escape = TRUE |
|||
) |
The "set" function. Allows key/value pairs to be set for inserting or updating
mixed | |
string | |
boolean |
set_dbprefix | ( | $prefix = '' ) |
Set DB Prefix
Set's the DB Prefix to something new without needing to reconnect
string | the prefix |
set_insert_batch | ( | $key, | |
$value = '' , |
|||
$escape = TRUE |
|||
) |
The "set_insert_batch" function. Allows key/value pairs to be set for batch inserts
mixed | |
string | |
boolean |
set_update_batch | ( | $key, | |
$index = '' , |
|||
$escape = TRUE |
|||
) |
The "set_update_batch" function. Allows key/value pairs to be set for batch updating
array | |
string | |
boolean |
start_cache | ( | ) |
Start Cache
Starts AR caching
stop_cache | ( | ) |
Stop Cache
Stops AR caching
truncate | ( | $table = '' ) |
Truncate
Compiles a truncate string and runs the query If the database does not support the truncate() command This function maps to "DELETE FROM table"
string | the table to truncate |
update | ( | $table = '' , |
|
$set = NULL , |
|||
$where = NULL , |
|||
$limit = NULL |
|||
) |
Update
Compiles an update string and runs the query
string | the table to retrieve the results from |
array | an associative array of update values |
mixed | the where clause |
update_batch | ( | $table = '' , |
|
$set = NULL , |
|||
$index = NULL |
|||
) |
Update_Batch
Compiles an update string and runs the query
string | the table to retrieve the results from |
array | an associative array of update values |
string | the where key |
where | ( | $key, | |
$value = NULL , |
|||
$escape = TRUE |
|||
) |
Where
Generates the WHERE portion of the query. Separates multiple calls with AND
mixed | |
mixed |
where_in | ( | $key = NULL , |
|
$values = NULL |
|||
) |
Where_in
Generates a WHERE field IN ('item', 'item') SQL query joined with AND if appropriate
string | The field to search |
array | The values searched on |
where_not_in | ( | $key = NULL , |
|
$values = NULL |
|||
) |
Where_not_in
Generates a WHERE field NOT IN ('item', 'item') SQL query joined with AND if appropriate
string | The field to search |
array | The values searched on |