Database independent query interface This is a wrapper for the PHP PDO
This is a wrapper for the PHP PDO.
| package |
Framework |
|---|---|
| subpackage |
Database |
__construct(string $db_dsnw, string $db_dsnr = '', boolean $pconn = false)
stringDSN for read/write operations
stringOptional DSN for read only operations
booleanEnables persistent connections
_fetch_row(mixed $result, integer $mode) : mixed
mixedOptional query handle
integerFetch mode identifier
mixedArray with col values or false on failure
_query(string $query, integer $offset, integer $numrows, array $params) : \PDOStatement|boolean
stringSQL query to execute
integerOffset for LIMIT statement
integerNumber of rows for LIMIT statement
arrayValues to be inserted in query
\PDOStatement|booleanQuery handle or False on error
affected_rows(mixed $result = null) : integer
mixedOptional query handle
integerNumber of (matching) rows
array2list(array $arr, string $type = null) : string
arrayInput array
stringType of data (integer, bool, ident)
stringComma-separated list of quoted values for use in query
closeConnection()
concat() : string
stringSQL statement to be used in query
conn_configure(array $dsn, \PDO $dbh)
arrayDSN for DB connections
\PDOConnection handler
conn_create( $dsn)
conn_prepare(array $dsn)
arrayDSN for DB connections
db_connect(string $mode, boolean $force = false)
stringConnection mode (r|w)
booleanEnforce using the given mode
debug(string $query)
stringSQL query
decode(mixed $input, boolean $serialized = false) : mixed
mixedInput data
booleanEnable serialization
mixedDecoded data
dsn_connect(array $dsn, string $mode)
arrayDSN for DB connections
stringConnection mode (r|w)
dsn_select( $query)
dsn_string(array $dsn) : string
arrayDSN parameters
stringDSN string
encode(mixed $input, boolean $serialized = false) : mixed
mixedData to fix
booleanEnable serialization
mixedProperly UTF-8 encoded data
endTransaction() : boolean
booleanTrue on success, False on failure
escape(string $str) : string
stringA string to escape
stringEscaped string for use in a query
escapeSimple(string $str) : string
| deprecated |
Replaced by rcube_db::escape |
|---|---|
| see | \rcube_db::escape |
stringA string to escape
stringEscaped string for use in a query
exec_script(string $sql) : \boolen
stringSQL queries to execute
\boolenTrue on success, False on error
factory(string $db_dsnw, string $db_dsnr = '', boolean $pconn = false) : \rcube_db
stringDSN for read/write operations
stringOptional DSN for read only operations
booleanEnables persistent connections
\rcube_dbObject instance
fetch_array(mixed $result = null) : mixed
mixedOptional query handle
mixedArray with col values or false on failure
fetch_assoc(mixed $result = null) : mixed
mixedOptional query handle
mixedArray with col values or false on failure
fix_table_names( $sql)
fix_table_names_callback( $matches)
fromunixtime(integer $timestamp) : string
| deprecated |
|---|
integerUnix timestamp
stringDate string in db-specific format
get_variable(string $varname, mixed $default = null) : mixed
stringVariable name
mixedDefault value if variable is not set
mixedVariable value or default
handle_error(string $query) : mixed
This by default logs the error but could be overridden by a driver implementation
stringQuery that triggered the error
mixedResult to be stored and returned
ilike(string $column, string $value) : string
stringField name
stringSearch value
stringSQL statement to use in query
insert_id(string $table = '') : mixed
stringTable name (to find the incremented sequence)
mixedID or false on failure
is_connected() : boolean
booleanTrue if in connected state
is_error(mixed $result = null) : string
mixedOptional query result
stringError message
is_replicated() : boolean
booleanReturns true if dsnw != dsnr
limitquery() : \PDOStatement|boolean
\PDOStatement|booleanQuery handle or False on error
list_cols(string $table) : array
stringTable name
arrayList of table cols
list_tables() : array
arrayList of all tables of the current database
now(integer $interval) : string
integerOptional interval (in seconds) to add/subtract
stringSQL function to use in query
num_rows(mixed $result = null) : mixed
| deprecated |
This method shows very poor performance and should be avoided. |
|---|
mixedOptional query handle
mixedNumber of rows or false on failure
parse_dsn( $dsn) : array
arrayDSN parameters
query() : \number
\numberQuery handle identifier
query_execute( $query)
query_parse(string $query) : string
stringSQL query
stringSQL query
quote(mixed $input, string $type = null) : string
mixedValue to quote
stringType of data (integer, bool, ident)
stringQuoted/converted string for use in query
quote_identifier(string $str) : string
stringValue to quote
stringQuoted string for use in query
quoteIdentifier(string $str) : string
| deprecated |
Replaced by rcube_db::quote_identifier |
|---|---|
| see | \rcube_db::quote_identifier |
stringValue to quote
stringQuoted string for use in query
reset()
When we know we don't need to access the last query result we can destroy it and release memory. Useful especially if the query returned big chunk of data.
rollbackTransaction() : boolean
booleanTrue on success, False on failure
sequence_name(string $table) : string
stringTable name
stringTranslated sequence name
set_debug(boolean $dbg = true)
booleanTrue if SQL queries should be logged
set_limit(string $query, integer $limit, integer $offset) : string
stringSQL query
integerNumber of rows
integerOffset
stringSQL query
set_option(string $name, mixed $value)
stringOption name
mixedOption value
set_table_dsn(string $table, string $mode)
stringTable name
stringDSN connection ('r' or 'w') to be used
startTransaction() : boolean
booleanTrue on success, False on failure
table_name(string $table, boolean $quoted = false) : string
stringTable name
booleanQuote table identifier
stringTranslated table name
DEBUG_LINE_LENGTH
DEFAULT_QUOTE
db_provider :
db_dsnw :
db_dsnr :
db_connected :
db_mode :
dbh :
dbhs :
table_connections :
db_error :
db_error_msg :
conn_failure :
db_index :
last_result :
tables :
variables :