Object constructor
rcube_mdb2
__construct
(string $db_dsnw, [string $db_dsnr = ''], [ $pconn = false])
-
string
$db_dsnw: DSN for read/write operations
-
string
$db_dsnr: Optional DSN for read only operations
-
$pconn
Get number of affected rows for the last query
mixed
affected_rows
([number $res_id = null])
-
number
$res_id: Optional query handle identifier
Return list of elements for use with SQL's IN clause
string
array2list
(array $arr, [string $type = null])
-
array
$arr: Input array
-
string
$type: Type of data
Abstract SQL statement for value concatenation
string
concat
()
Connect to appropiate database depending on the operation
void
db_connect
(string $mode)
-
string
$mode: Connection mode (r|w)
Debug handler for the MDB2
void
debug_handler
( &$db, $scope, $message, [ $context = array()])
-
&$db
-
$scope
-
$message
-
$context
Decodes encoded UTF-8 string/object/array (recursive)
mixed
decode
(mixed $input)
Encodes non-UTF-8 characters in string/array/object (recursive)
mixed
encode
(mixed $input)
-
mixed
$input: Data to fix
Escapes a string
string
escapeSimple
(string $str)
-
string
$str: The string to be escaped
Get an index array for one row If no query handle is specified, the last query will be taken as reference
mixed
fetch_array
([number $res_id = null])
-
number
$res_id: Optional query handle identifier
Get an associative array for one row If no query handle is specified, the last query will be taken as reference
mixed
fetch_assoc
([number $res_id = null])
-
number
$res_id: Optional query handle identifier
Return SQL statement to convert from a unix timestamp
string
fromunixtime
(string $timestamp)
-
string
$timestamp: Field name
Return SQL statement for case insensitive LIKE
string
ilike
(string $column, string $value)
-
string
$column: Field name
-
string
$value: Search value
Get last inserted record ID For Postgres databases, a sequence name is required
mixed
insert_id
([string $table = ''])
-
string
$table: Table name (to find the incremented sequence)
Connection state checker
void
is_connected
(boolean 0)
-
boolean
0: True if in connected state
Getter for error state
void
is_error
(boolean 0)
Is database replication configured?
This returns true if dsnw != dsnr
void
is_replicated
()
Execute a SQL query with limits
number
limitquery
(string 0, number 1, number 2, mixed 3)
-
string
0: SQL query to execute
-
number
1: Offset for LIMIT statement
-
number
2: Number of rows for LIMIT statement
-
mixed
3: Values to be inserted in query
Wrapper for SHOW COLUMNS command
array
list_cols
(string $table)
-
string
$table: Table name
Wrapper for the SHOW TABLES command
array
list_tables
()
Return SQL function for current time and date
string
now
()
Get number of rows for a SQL query If no query handle is specified, the last query will be taken as reference
mixed
num_rows
([number $res_id = null])
-
number
$res_id: Optional query handle identifier
Execute a SQL query
number
query
(string 0, mixed 1)
-
string
0: SQL query to execute
-
mixed
1: Values to be inserted in query
Formats input so it can be safely used in a query
string
quote
(mixed $input, [string $type = null])
-
mixed
$input: Value to quote
-
string
$type: Type of data
Quotes a string so it can be safely used as a table or column name
string
quoteIdentifier
(string $str)
-
string
$str: Value to quote
Quotes a string so it can be safely used as a table or column name
string
quote_identifier
(string $str)
-
string
$str: Value to quote
Activate/deactivate debug mode
void
set_debug
([boolean $dbg = true])
-
boolean
$dbg: True if SQL queries should be logged
Return SQL statement to convert a field value into a unix timestamp
This method is deprecated and should not be used anymore due to limitations of timestamp functions in Mysql (year 2038 problem)
string
unixtimestamp
(string $field)
-
string
$field: Field name