PHP 클래스 hyperdb, quilt

상속: extends wpdb
파일 보기 프로젝트 열기: NetSys/quilt

공개 프로퍼티들

프로퍼티 타입 설명
$check_tcp_responsiveness boolean Whether to check with fsockopen prior to mysql_connect.
$db_connections array The log of db connections made and the time each one took
$dbh resource The current mysql link resource
$dbh2host array Lookup array (dbhname => host:port)
$dbhs array Associative array (dbhname => dbh) for established mysql connections
$default_lag_threshold integer Maximum lag in seconds. Set null to disable. Requires callbacks.
$hyper_callbacks array Optional directory of callbacks to determine datasets from queries
$hyper_servers array The multi-dimensional array of datasets and servers
$hyper_tables array Optional directory of tables and their datasets
$last_found_rows_result resource After any SQL_CALC_FOUND_ROWS query, the query "SELECT FOUND_ROWS()" is sent and the mysql result resource stored here. The next query for FOUND_ROWS() will retrieve this. We do this to prevent any intervening queries from making FOUND_ROWS() inaccessible. You may prevent this by adding "NO_SELECT_FOUND_ROWS" in a comment.
$last_table string The last table that was queried
$last_used_server array The last server used and the database name selected
$max_connections integer The maximum number of db links to keep open. The least-recently used link will be closed when the number of links exceeds this.
$min_tries integer Minimum number of connections to try before bailing
$open_connections The list of unclosed connections sorted by LRU
$persistent boolean Whether to use mysql_pconnect instead of mysql_connect
$save_backtrace Whether to save debug_backtrace in save_query_callback. You may wish to disable this, e.g. when tracing out-of-memory problems.
$save_queries boolean Whether to store queries in an array. Useful for debugging and profiling.
$save_query_callback callable Custom callback to save debug info in $this->queries
$srtm array Otherwise it is an array of written tables.
$used_servers array Lookup array (dbhname => (server, db name) ) for re-selecting the db when a link is re-used.

공개 메소드들

메소드 설명
__construct ( $args = null ) Gets ready to make database connections
_real_escape ( $string ) * Force addslashes() for the escapes.
add_callback ( $callback, $group = 'dataset' ) Add a callback to a group of callbacks.
add_database ( $db ) Add the connection parameters for a database
add_table ( $dataset, $table ) Specify the dateset where a table is found
check_database_version ( $dbh_or_table = false ) : WP_Error Whether or not MySQL database is at least the required minimum version.
check_lag ( )
check_tcp_responsiveness ( $host, $port, $float_timeout ) : (bool) Check the responsiveness of a tcp/ip daemon
db_connect ( $query = '' ) : resource Figure out which database server should handle the query, and connect to it.
db_version ( false | string | resource $dbh_or_table = false ) : false | string The database version number
disconnect ( $dbhname ) Disconnect and remove connection from open connections list
flush ( ) Kill cached query results
get_caller ( ) : string Get the name of the function that called wpdb.
get_lag ( )
get_lag_cache ( )
get_table_from_query ( $q ) : string Find the first table name referenced in a query
has_cap ( string $db_cap, false | string | resource $dbh_or_table = false ) : boolean Generic function to determine if a database supports a particular feature The additional argument allows the caller to check a specific database.
hyperdb ( $args = null ) Triggers __construct() for backwards compatibility with PHP4
init_charset ( ) Sets $this->charset and $this->collate
is_write_query ( $q ) : boolean Determine the likelihood that this query could alter anything
query ( string $query ) : integer Basic query. See docs for more details.
run_callbacks ( $group, $args = null ) Callbacks are executed in the order in which they are registered until one of them returns something other than null.
send_reads_to_masters ( ) Set a flag to prevent reading from slaves which might be lagging after a write
set_charset ( resource $dbh, string $charset = null, string $collate = null ) Sets the connection's character set.
supports_collation ( $dbh_or_table = false ) : boolean This function is called when WordPress is generating the table schema to determine wether or not the current database supports or needs the collation statements.

메소드 상세

__construct() 공개 메소드

Gets ready to make database connections
public __construct ( $args = null )

_real_escape() 공개 메소드

HyperDB makes connections when a query is made which is why we can't use mysql_real_escape_string() for escapes. This is also the reason why we don't allow certain charsets. See set_charset().
public _real_escape ( $string )

add_callback() 공개 메소드

The default group is 'dataset', used to examine queries and determine dataset.
public add_callback ( $callback, $group = 'dataset' )

add_database() 공개 메소드

Add the connection parameters for a database
public add_database ( $db )

add_table() 공개 메소드

Specify the dateset where a table is found
public add_table ( $dataset, $table )

check_database_version() 공개 메소드

The additional argument allows the caller to check a specific database.
부터: 2.5.0
public check_database_version ( $dbh_or_table = false ) : WP_Error
리턴 WP_Error

check_lag() 공개 메소드

public check_lag ( )

check_tcp_responsiveness() 공개 메소드

Check the responsiveness of a tcp/ip daemon
public check_tcp_responsiveness ( $host, $port, $float_timeout ) : (bool)
리턴 (bool)

db_connect() 공개 메소드

Figure out which database server should handle the query, and connect to it.
public db_connect ( $query = '' ) : resource
리턴 resource mysql database connection

db_version() 공개 메소드

The database version number
public db_version ( false | string | resource $dbh_or_table = false ) : false | string
$dbh_or_table false | string | resource the databaese (the current database, the database housing the specified table, or the database of the mysql resource)
리턴 false | string false on failure, version number on success

disconnect() 공개 메소드

Disconnect and remove connection from open connections list
public disconnect ( $dbhname )

flush() 공개 메소드

Kill cached query results
public flush ( )

get_caller() 공개 메소드

Get the name of the function that called wpdb.
public get_caller ( ) : string
리턴 string the name of the calling function

get_lag() 공개 메소드

public get_lag ( )

get_lag_cache() 공개 메소드

public get_lag_cache ( )

get_table_from_query() 공개 메소드

Find the first table name referenced in a query
public get_table_from_query ( $q ) : string
리턴 string table

has_cap() 공개 메소드

Generic function to determine if a database supports a particular feature The additional argument allows the caller to check a specific database.
public has_cap ( string $db_cap, false | string | resource $dbh_or_table = false ) : boolean
$db_cap string the feature
$dbh_or_table false | string | resource the databaese (the current database, the database housing the specified table, or the database of the mysql resource)
리턴 boolean

hyperdb() 공개 메소드

Triggers __construct() for backwards compatibility with PHP4
public hyperdb ( $args = null )

init_charset() 공개 메소드

Sets $this->charset and $this->collate
public init_charset ( )

is_write_query() 공개 메소드

Determine the likelihood that this query could alter anything
public is_write_query ( $q ) : boolean
리턴 boolean

query() 공개 메소드

Basic query. See docs for more details.
public query ( string $query ) : integer
$query string
리턴 integer number of rows

run_callbacks() 공개 메소드

Callbacks are executed in the order in which they are registered until one of them returns something other than null.
public run_callbacks ( $group, $args = null )

send_reads_to_masters() 공개 메소드

Set a flag to prevent reading from slaves which might be lagging after a write

set_charset() 공개 메소드

Sets the connection's character set.
public set_charset ( resource $dbh, string $charset = null, string $collate = null )
$dbh resource The resource given by mysql_connect
$charset string The character set (optional)
$collate string The collation (optional)

supports_collation() 공개 메소드

The additional argument allows the caller to check a specific database.
public supports_collation ( $dbh_or_table = false ) : boolean
리턴 boolean

프로퍼티 상세

$check_tcp_responsiveness 공개적으로 프로퍼티

Whether to check with fsockopen prior to mysql_connect.
public bool $check_tcp_responsiveness
리턴 boolean

$db_connections 공개적으로 프로퍼티

The log of db connections made and the time each one took
public array $db_connections
리턴 array

$dbh 공개적으로 프로퍼티

The current mysql link resource
public resource $dbh
리턴 resource

$dbh2host 공개적으로 프로퍼티

Lookup array (dbhname => host:port)
public array $dbh2host
리턴 array

$dbhs 공개적으로 프로퍼티

Associative array (dbhname => dbh) for established mysql connections
public array $dbhs
리턴 array

$default_lag_threshold 공개적으로 프로퍼티

Maximum lag in seconds. Set null to disable. Requires callbacks.
public int $default_lag_threshold
리턴 integer

$hyper_callbacks 공개적으로 프로퍼티

Optional directory of callbacks to determine datasets from queries
public array $hyper_callbacks
리턴 array

$hyper_servers 공개적으로 프로퍼티

The multi-dimensional array of datasets and servers
public array $hyper_servers
리턴 array

$hyper_tables 공개적으로 프로퍼티

Optional directory of tables and their datasets
public array $hyper_tables
리턴 array

$last_found_rows_result 공개적으로 프로퍼티

After any SQL_CALC_FOUND_ROWS query, the query "SELECT FOUND_ROWS()" is sent and the mysql result resource stored here. The next query for FOUND_ROWS() will retrieve this. We do this to prevent any intervening queries from making FOUND_ROWS() inaccessible. You may prevent this by adding "NO_SELECT_FOUND_ROWS" in a comment.
public resource $last_found_rows_result
리턴 resource

$last_table 공개적으로 프로퍼티

The last table that was queried
public string $last_table
리턴 string

$last_used_server 공개적으로 프로퍼티

The last server used and the database name selected
public array $last_used_server
리턴 array

$max_connections 공개적으로 프로퍼티

The maximum number of db links to keep open. The least-recently used link will be closed when the number of links exceeds this.
public int $max_connections
리턴 integer

$min_tries 공개적으로 프로퍼티

Minimum number of connections to try before bailing
public int $min_tries
리턴 integer

$open_connections 공개적으로 프로퍼티

The list of unclosed connections sorted by LRU
public $open_connections

$persistent 공개적으로 프로퍼티

Whether to use mysql_pconnect instead of mysql_connect
public bool $persistent
리턴 boolean

$save_backtrace 공개적으로 프로퍼티

Whether to save debug_backtrace in save_query_callback. You may wish to disable this, e.g. when tracing out-of-memory problems.
public $save_backtrace

$save_queries 공개적으로 프로퍼티

Whether to store queries in an array. Useful for debugging and profiling.
public bool $save_queries
리턴 boolean

$save_query_callback 공개적으로 프로퍼티

Custom callback to save debug info in $this->queries
public callable $save_query_callback
리턴 callable

$srtm 공개적으로 프로퍼티

Otherwise it is an array of written tables.
public array $srtm
리턴 array

$used_servers 공개적으로 프로퍼티

Lookup array (dbhname => (server, db name) ) for re-selecting the db when a link is re-used.
public array $used_servers
리턴 array