PHP 클래스 CI_DB_active_record, 68kb

This is the platform-independent base Active Record implementation class.
저자: ExpressionEngine Dev Team
상속: extends CI_DB_driver
파일 보기 프로젝트 열기: 68kb/68kb 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$ar_aliased_tables
$ar_cache_exists
$ar_cache_from
$ar_cache_groupby
$ar_cache_having
$ar_cache_join
$ar_cache_like
$ar_cache_orderby
$ar_cache_select
$ar_cache_set
$ar_cache_where
$ar_caching Active Record Caching variables
$ar_distinct
$ar_from
$ar_groupby
$ar_having
$ar_join
$ar_like
$ar_limit
$ar_offset
$ar_order
$ar_orderby
$ar_select
$ar_set
$ar_store_array
$ar_where
$ar_wherein

공개 메소드들

메소드 설명
_compile_select ( $select_override = FALSE ) : string Compile the SELECT statement
_create_alias_from_table ( $item ) : string Determines the alias name based on the table
_having ( $key, $value = '', $type = 'AND ', $escape = TRUE ) : object Sets the HAVING values
_like ( $field, $match = '', $type = 'AND ', $side = 'both', $not = '' ) : object Like
_max_min_avg_sum ( $select = '', $alias = '', $type = 'MAX' ) : object Processing Function for the four functions above:
_merge_cache ( ) : void Merge Cache
_object_to_array ( $object ) : array Object to Array
_object_to_array_batch ( $object ) : array Object to Array
_reset_run ( $ar_reset_items ) : void Resets the active record values. Called by the get() function
_reset_select ( ) : void Resets the active record values. Called by the get() function
_reset_write ( ) : void Resets the active record "write" values.
_track_aliases ( $table ) : string Track Aliases
_where ( $key, $value = NULL, $type = 'AND ', $escape = NULL ) : object Where
_where_in ( $key = NULL, $values = NULL, $not = FALSE, $type = 'AND ' ) : object Where_in
count_all_results ( $table = '' ) : string "Count All Results" query
dbprefix ( $table = '' ) : string DB Prefix
delete ( $table = '', $where = '', $limit = NULL, $reset_data = TRUE ) : object Delete
distinct ( $val = TRUE ) : object DISTINCT
empty_table ( $table = '' ) : object Empty Table
flush_cache ( ) : void Flush Cache
from ( $from ) : object From
get ( $table = '', $limit = null, $offset = null ) : object Get
get_where ( $table = '', $where = null, $limit = null, $offset = null ) : object Get_Where
getwhere ( $table = '', $where = null, $limit = null, $offset = null ) getwhere() is an alias of get_where() this function is here for backwards compatibility, as getwhere() has been deprecated
group_by ( $by ) : object GROUP BY
groupby ( $by ) groupby() is an alias of group_by() this function is here for backwards compatibility, as groupby() has been deprecated
having ( $key, $value = '', $escape = TRUE ) : object Sets the HAVING value
insert ( $table = '', $set = NULL ) : object Insert
insert_batch ( $table = '', $set = NULL ) : object Insert_Batch
join ( $table, $cond, $type = '' ) : object Join
like ( $field, $match = '', $side = 'both' ) : object Like
limit ( $value, $offset = '' ) : object Sets the LIMIT value
not_like ( $field, $match = '', $side = 'both' ) : object Not Like
offset ( $offset ) : object Sets the OFFSET value
or_having ( $key, $value = '', $escape = TRUE ) : object Sets the OR HAVING value
or_like ( $field, $match = '', $side = 'both' ) : object OR Like
or_not_like ( $field, $match = '', $side = 'both' ) : object OR Not Like
or_where ( $key, $value = NULL, $escape = TRUE ) : object OR Where
or_where_in ( $key = NULL, $values = NULL ) : object Where_in_or
or_where_not_in ( $key = NULL, $values = NULL ) : object Where_not_in_or
order_by ( $orderby, $direction = '' ) : object Sets the ORDER BY value
orderby ( $orderby, $direction = '' ) orderby() is an alias of order_by() this function is here for backwards compatibility, as orderby() has been deprecated
orhaving ( $key, $value = '', $escape = TRUE ) orhaving() is an alias of or_having() this function is here for backwards compatibility, as orhaving() has been deprecated
orlike ( $field, $match = '', $side = 'both' ) orlike() is an alias of or_like() this function is here for backwards compatibility, as orlike() has been deprecated
orwhere ( $key, $value = NULL, $escape = TRUE ) orwhere() is an alias of or_where() this function is here for backwards compatibility, as orwhere() has been deprecated
replace ( $table = '', $set = NULL )
select ( $select = '*', $escape = NULL ) : object Select
select_avg ( $select = '', $alias = '' ) : object Select Average
select_max ( $select = '', $alias = '' ) : object Select Max
select_min ( $select = '', $alias = '' ) : object Select Min
select_sum ( $select = '', $alias = '' ) : object Select Sum
set ( $key, $value = '', $escape = TRUE ) : object The "set" function. Allows key/value pairs to be set for inserting or updating
set_insert_batch ( $key, $value = '', $escape = TRUE ) : object The "set_insert_batch" function. Allows key/value pairs to be set for batch inserts
set_update_batch ( $key, $index = '', $escape = TRUE ) : object The "set_update_batch" function. Allows key/value pairs to be set for batch updating
start_cache ( ) : void Start Cache
stop_cache ( ) : void Stop Cache
truncate ( $table = '' ) : object Truncate
update ( $table = '', $set = NULL, $where = NULL, $limit = NULL ) : object Update
update_batch ( $table = '', $set = NULL, $index = NULL ) : object Update_Batch
where ( $key, $value = NULL, $escape = TRUE ) : object Where
where_in ( $key = NULL, $values = NULL ) : object Where_in
where_not_in ( $key = NULL, $values = NULL ) : object Where_not_in

메소드 상세

_compile_select() 공개 메소드

Generates a query string based on which functions were used. Should not be called directly. The get() function calls it.
public _compile_select ( $select_override = FALSE ) : string
리턴 string

_create_alias_from_table() 공개 메소드

Determines the alias name based on the table
public _create_alias_from_table ( $item ) : string
리턴 string

_having() 공개 메소드

Called by having() or or_having()
public _having ( $key, $value = '', $type = 'AND ', $escape = TRUE ) : object
리턴 object

_like() 공개 메소드

Called by like() or orlike()
public _like ( $field, $match = '', $type = 'AND ', $side = 'both', $not = '' ) : object
리턴 object

_max_min_avg_sum() 공개 메소드

select_max() select_min() select_avg() select_sum()
public _max_min_avg_sum ( $select = '', $alias = '', $type = 'MAX' ) : object
리턴 object

_merge_cache() 공개 메소드

When called, this function merges any cached AR arrays with locally called ones.
public _merge_cache ( ) : void
리턴 void

_object_to_array() 공개 메소드

Takes an object as input and converts the class variables to array key/vals
public _object_to_array ( $object ) : array
리턴 array

_object_to_array_batch() 공개 메소드

Takes an object as input and converts the class variables to array key/vals
public _object_to_array_batch ( $object ) : array
리턴 array

_reset_run() 공개 메소드

Resets the active record values. Called by the get() function
public _reset_run ( $ar_reset_items ) : void
리턴 void

_reset_select() 공개 메소드

Resets the active record values. Called by the get() function
public _reset_select ( ) : void
리턴 void

_reset_write() 공개 메소드

Called by the insert() update() and delete() functions
public _reset_write ( ) : void
리턴 void

_track_aliases() 공개 메소드

Used to track SQL statements written with aliased tables.
public _track_aliases ( $table ) : string
리턴 string

_where() 공개 메소드

Called by where() or orwhere()
public _where ( $key, $value = NULL, $type = 'AND ', $escape = NULL ) : object
리턴 object

_where_in() 공개 메소드

Called by where_in, where_in_or, where_not_in, where_not_in_or
public _where_in ( $key = NULL, $values = NULL, $not = FALSE, $type = 'AND ' ) : object
리턴 object

count_all_results() 공개 메소드

Generates a platform-specific query string that counts all records returned by an Active Record query.
public count_all_results ( $table = '' ) : string
리턴 string

dbprefix() 공개 메소드

Prepends a database prefix if one exists in configuration
public dbprefix ( $table = '' ) : string
리턴 string

delete() 공개 메소드

Compiles a delete string and runs the query
public delete ( $table = '', $where = '', $limit = NULL, $reset_data = TRUE ) : object
리턴 object

distinct() 공개 메소드

Sets a flag which tells the query string compiler to add DISTINCT
public distinct ( $val = TRUE ) : object
리턴 object

empty_table() 공개 메소드

Compiles a delete string and runs "DELETE FROM table"
public empty_table ( $table = '' ) : object
리턴 object

flush_cache() 공개 메소드

Empties the AR cache
public flush_cache ( ) : void
리턴 void

from() 공개 메소드

Generates the FROM portion of the query
public from ( $from ) : object
리턴 object

get() 공개 메소드

Compiles the select statement based on the other functions called and runs the query
public get ( $table = '', $limit = null, $offset = null ) : object
리턴 object

get_where() 공개 메소드

Allows the where clause, limit and offset to be added directly
public get_where ( $table = '', $where = null, $limit = null, $offset = null ) : object
리턴 object

getwhere() 공개 메소드

getwhere() is an alias of get_where() this function is here for backwards compatibility, as getwhere() has been deprecated
public getwhere ( $table = '', $where = null, $limit = null, $offset = null )

group_by() 공개 메소드

GROUP BY
public group_by ( $by ) : object
리턴 object

groupby() 공개 메소드

groupby() is an alias of group_by() this function is here for backwards compatibility, as groupby() has been deprecated
public groupby ( $by )

having() 공개 메소드

Separates multiple calls with AND
public having ( $key, $value = '', $escape = TRUE ) : object
리턴 object

insert() 공개 메소드

Compiles an insert string and runs the query
public insert ( $table = '', $set = NULL ) : object
리턴 object

insert_batch() 공개 메소드

Compiles batch insert strings and runs the queries
public insert_batch ( $table = '', $set = NULL ) : object
리턴 object

join() 공개 메소드

Generates the JOIN portion of the query
public join ( $table, $cond, $type = '' ) : object
리턴 object

like() 공개 메소드

Generates a %LIKE% portion of the query. Separates multiple calls with AND
public like ( $field, $match = '', $side = 'both' ) : object
리턴 object

limit() 공개 메소드

Sets the LIMIT value
public limit ( $value, $offset = '' ) : object
리턴 object

not_like() 공개 메소드

Generates a NOT LIKE portion of the query. Separates multiple calls with AND
public not_like ( $field, $match = '', $side = 'both' ) : object
리턴 object

offset() 공개 메소드

Sets the OFFSET value
public offset ( $offset ) : object
리턴 object

or_having() 공개 메소드

Separates multiple calls with OR
public or_having ( $key, $value = '', $escape = TRUE ) : object
리턴 object

or_like() 공개 메소드

Generates a %LIKE% portion of the query. Separates multiple calls with OR
public or_like ( $field, $match = '', $side = 'both' ) : object
리턴 object

or_not_like() 공개 메소드

Generates a NOT LIKE portion of the query. Separates multiple calls with OR
public or_not_like ( $field, $match = '', $side = 'both' ) : object
리턴 object

or_where() 공개 메소드

Generates the WHERE portion of the query. Separates multiple calls with OR
public or_where ( $key, $value = NULL, $escape = TRUE ) : object
리턴 object

or_where_in() 공개 메소드

Generates a WHERE field IN ('item', 'item') SQL query joined with OR if appropriate
public or_where_in ( $key = NULL, $values = NULL ) : object
리턴 object

or_where_not_in() 공개 메소드

Generates a WHERE field NOT IN ('item', 'item') SQL query joined with OR if appropriate
public or_where_not_in ( $key = NULL, $values = NULL ) : object
리턴 object

order_by() 공개 메소드

Sets the ORDER BY value
public order_by ( $orderby, $direction = '' ) : object
리턴 object

orderby() 공개 메소드

orderby() is an alias of order_by() this function is here for backwards compatibility, as orderby() has been deprecated
public orderby ( $orderby, $direction = '' )

orhaving() 공개 메소드

orhaving() is an alias of or_having() this function is here for backwards compatibility, as orhaving() has been deprecated
public orhaving ( $key, $value = '', $escape = TRUE )

orlike() 공개 메소드

orlike() is an alias of or_like() this function is here for backwards compatibility, as orlike() has been deprecated
public orlike ( $field, $match = '', $side = 'both' )

orwhere() 공개 메소드

orwhere() is an alias of or_where() this function is here for backwards compatibility, as orwhere() has been deprecated
public orwhere ( $key, $value = NULL, $escape = TRUE )

replace() 공개 메소드

public replace ( $table = '', $set = NULL )

select() 공개 메소드

Generates the SELECT portion of the query
public select ( $select = '*', $escape = NULL ) : object
리턴 object

select_avg() 공개 메소드

Generates a SELECT AVG(field) portion of a query
public select_avg ( $select = '', $alias = '' ) : object
리턴 object

select_max() 공개 메소드

Generates a SELECT MAX(field) portion of a query
public select_max ( $select = '', $alias = '' ) : object
리턴 object

select_min() 공개 메소드

Generates a SELECT MIN(field) portion of a query
public select_min ( $select = '', $alias = '' ) : object
리턴 object

select_sum() 공개 메소드

Generates a SELECT SUM(field) portion of a query
public select_sum ( $select = '', $alias = '' ) : object
리턴 object

set() 공개 메소드

The "set" function. Allows key/value pairs to be set for inserting or updating
public set ( $key, $value = '', $escape = TRUE ) : object
리턴 object

set_insert_batch() 공개 메소드

The "set_insert_batch" function. Allows key/value pairs to be set for batch inserts
public set_insert_batch ( $key, $value = '', $escape = TRUE ) : object
리턴 object

set_update_batch() 공개 메소드

The "set_update_batch" function. Allows key/value pairs to be set for batch updating
public set_update_batch ( $key, $index = '', $escape = TRUE ) : object
리턴 object

start_cache() 공개 메소드

Starts AR caching
public start_cache ( ) : void
리턴 void

stop_cache() 공개 메소드

Stops AR caching
public stop_cache ( ) : void
리턴 void

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"
public truncate ( $table = '' ) : object
리턴 object

update() 공개 메소드

Compiles an update string and runs the query
public update ( $table = '', $set = NULL, $where = NULL, $limit = NULL ) : object
리턴 object

update_batch() 공개 메소드

Compiles an update string and runs the query
public update_batch ( $table = '', $set = NULL, $index = NULL ) : object
리턴 object

where() 공개 메소드

Generates the WHERE portion of the query. Separates multiple calls with AND
public where ( $key, $value = NULL, $escape = TRUE ) : object
리턴 object

where_in() 공개 메소드

Generates a WHERE field IN ('item', 'item') SQL query joined with AND if appropriate
public where_in ( $key = NULL, $values = NULL ) : object
리턴 object

where_not_in() 공개 메소드

Generates a WHERE field NOT IN ('item', 'item') SQL query joined with AND if appropriate
public where_not_in ( $key = NULL, $values = NULL ) : object
리턴 object

프로퍼티 상세

$ar_aliased_tables 공개적으로 프로퍼티

public $ar_aliased_tables

$ar_cache_exists 공개적으로 프로퍼티

public $ar_cache_exists

$ar_cache_from 공개적으로 프로퍼티

public $ar_cache_from

$ar_cache_groupby 공개적으로 프로퍼티

public $ar_cache_groupby

$ar_cache_having 공개적으로 프로퍼티

public $ar_cache_having

$ar_cache_join 공개적으로 프로퍼티

public $ar_cache_join

$ar_cache_like 공개적으로 프로퍼티

public $ar_cache_like

$ar_cache_orderby 공개적으로 프로퍼티

public $ar_cache_orderby

$ar_cache_select 공개적으로 프로퍼티

public $ar_cache_select

$ar_cache_set 공개적으로 프로퍼티

public $ar_cache_set

$ar_cache_where 공개적으로 프로퍼티

public $ar_cache_where

$ar_caching 공개적으로 프로퍼티

Active Record Caching variables
public $ar_caching

$ar_distinct 공개적으로 프로퍼티

public $ar_distinct

$ar_from 공개적으로 프로퍼티

public $ar_from

$ar_groupby 공개적으로 프로퍼티

public $ar_groupby

$ar_having 공개적으로 프로퍼티

public $ar_having

$ar_join 공개적으로 프로퍼티

public $ar_join

$ar_like 공개적으로 프로퍼티

public $ar_like

$ar_limit 공개적으로 프로퍼티

public $ar_limit

$ar_offset 공개적으로 프로퍼티

public $ar_offset

$ar_order 공개적으로 프로퍼티

public $ar_order

$ar_orderby 공개적으로 프로퍼티

public $ar_orderby

$ar_select 공개적으로 프로퍼티

public $ar_select

$ar_set 공개적으로 프로퍼티

public $ar_set

$ar_store_array 공개적으로 프로퍼티

public $ar_store_array

$ar_where 공개적으로 프로퍼티

public $ar_where

$ar_wherein 공개적으로 프로퍼티

public $ar_wherein