|
| __clone () |
|
| connect () |
|
| disconnect () |
|
| ping () |
|
| pdoExec ($sQuery) |
|
| pdoQuery ($sQuery) |
|
| pdoExceptionHandler ($oException) |
|
| getOption ($sName) |
|
| getOne ($oStatement, $aBindings=array(), $iIndex=0) |
|
| getRow ($oStatement, $aBindings=array(), $iFetchType=PDO::FETCH_ASSOC) |
|
| getColumn ($oStatement, $aBindings=array(), $iFetchColumnNumber=0) |
|
| getFirstRow ($oStatement, $aBindings=array(), $iFetchType=PDO::FETCH_ASSOC) |
|
| getNextRow ($iFetchType=PDO::FETCH_ASSOC) |
|
| getAll ($oStatement, $aBindings=array(), $iFetchType=PDO::FETCH_ASSOC) |
|
| fillArray ($oStatement, $aBindings=array(), $iFetchType=PDO::FETCH_ASSOC) |
|
| getAllWithKey ($oStatement, $sFieldKey, $aBindings=array(), $iFetchType=PDO::FETCH_ASSOC) |
|
| getPairs ($oStatement, $sFieldKey, $sFieldValue, $aBindings=array(), $iFetchType=PDO::FETCH_ASSOC) |
|
| getNumRows ($oStatement=null) |
|
| getAffectedRows ($oStatement=null) |
|
| query ($oStatement, $aBindings=array(), $bVerbose=null) |
|
| res ($oStatement, $aBindings=array(), $bVerbose=null) |
|
| getServerInfo () |
|
| getVersion () |
|
| listTables () |
|
| getDbCacheObject () |
|
| escape ($s) |
|
| implode_escape ($mixed) |
|
| unescape ($mixed) |
|
| prepare ($sQuery) |
|
| prepareAsString ($sQuery) |
|
| arrayToSQL ($a, $sDiv=',', $sOperator='=', $bWildcardSpaceChars=false) |
|
◆ __construct()
BxDolDb::__construct |
( |
|
$aDbConf = false | ) |
|
|
protected |
set database parameters and connect to it
◆ __clone()
Prevent cloning the instance
◆ arrayToSQL()
BxDolDb::arrayToSQL |
( |
|
$a, |
|
|
|
$sDiv = ',' , |
|
|
|
$sOperator = '=' , |
|
|
|
$bWildcardSpaceChars = false |
|
) |
| |
Convert array of key => values to SQL query. Array keys are field names and array values are field values.
- Parameters
-
$a | array |
$sDiv | fields separator, by default it is ',', another useful value is ' AND ' |
$sOperator | operator for comparision: '=' or 'LIKE' |
$bWildcardSpaceChars | substiture any space and dash characters with single wildcard symbol |
- Returns
- part of SQL query string
◆ connect()
connect to database with appointed parameters
◆ disconnect()
◆ escape()
It escapes string to pass to mysql query. Try to use "prepare" function always (
- See also
- BxDolDb::prepare), use "escape" only if "prepare" function is not possible at all. Also consider using "implode_escape" function (
-
BxDolDb::implode_escape).
- Parameters
-
- Returns
- escaped string whcich is ready to pass to SQL query.
◆ fillArray()
BxDolDb::fillArray |
( |
|
$oStatement, |
|
|
|
$aBindings = array() , |
|
|
|
$iFetchType = PDO::FETCH_ASSOC |
|
) |
| |
Executes sql query and returns table of records as result.
- Deprecated:
- use getAll instead.
◆ getAffectedRows()
BxDolDb::getAffectedRows |
( |
|
$oStatement = null | ) |
|
returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement.
◆ getAll()
BxDolDb::getAll |
( |
|
$oStatement, |
|
|
|
$aBindings = array() , |
|
|
|
$iFetchType = PDO::FETCH_ASSOC |
|
) |
| |
execute sql query and return table of records as result
◆ getAllWithKey()
BxDolDb::getAllWithKey |
( |
|
$oStatement, |
|
|
|
$sFieldKey, |
|
|
|
$aBindings = array() , |
|
|
|
$iFetchType = PDO::FETCH_ASSOC |
|
) |
| |
execute sql query and return table of records as result
◆ getColumn()
BxDolDb::getColumn |
( |
|
$oStatement, |
|
|
|
$aBindings = array() , |
|
|
|
$iFetchColumnNumber = 0 |
|
) |
| |
execute sql query and return a column as result
◆ getDbCacheObject()
BxDolDb::getDbCacheObject |
( |
| ) |
|
◆ getFirstRow()
BxDolDb::getFirstRow |
( |
|
$oStatement, |
|
|
|
$aBindings = array() , |
|
|
|
$iFetchType = PDO::FETCH_ASSOC |
|
) |
| |
execute sql query and return the first row of result and keep $array type and poiter to all data
◆ getInstance()
static BxDolDb::getInstance |
( |
| ) |
|
|
static |
◆ getNextRow()
BxDolDb::getNextRow |
( |
|
$iFetchType = PDO::FETCH_ASSOC | ) |
|
return next row of pointed last getFirstRow calling data
◆ getNumRows()
BxDolDb::getNumRows |
( |
|
$oStatement = null | ) |
|
return number of affected rows in current mysql result
NOTE: PDOStatement::rowCount works for SELECT queries in MySQL. So, this method should be rewritten if the other DB engine will be used.
◆ getOne()
BxDolDb::getOne |
( |
|
$oStatement, |
|
|
|
$aBindings = array() , |
|
|
|
$iIndex = 0 |
|
) |
| |
execute sql query and return one value result
◆ getOption()
BxDolDb::getOption |
( |
|
$sName | ) |
|
◆ getPairs()
BxDolDb::getPairs |
( |
|
$oStatement, |
|
|
|
$sFieldKey, |
|
|
|
$sFieldValue, |
|
|
|
$aBindings = array() , |
|
|
|
$iFetchType = PDO::FETCH_ASSOC |
|
) |
| |
execute sql query and return table of records as result
◆ getRow()
BxDolDb::getRow |
( |
|
$oStatement, |
|
|
|
$aBindings = array() , |
|
|
|
$iFetchType = PDO::FETCH_ASSOC |
|
) |
| |
execute sql query and return one row result
◆ getServerInfo()
BxDolDb::getServerInfo |
( |
| ) |
|
◆ getVersion()
◆ implode_escape()
BxDolDb::implode_escape |
( |
|
$mixed | ) |
|
This function is usefull when you need to form array of parameters to pass to IN(...) SQL construction. Example:
$a = array(2, 4.5, 'apple', 'car');
$s = "SELECT * FROM `t` WHERE `a` IN (" . $oDb->implode_escape($a) . ")";
echo $s;
- Parameters
-
$mixed | array or parameters or just one paramter |
- Returns
- string which is ready to pass to IN(...) SQL construction
◆ listTables()
get list of tables in database
◆ pdoExceptionHandler()
BxDolDb::pdoExceptionHandler |
( |
|
$oException | ) |
|
database query exception handler for exceptions appeared out of the try/catch block
◆ pdoExec()
BxDolDb::pdoExec |
( |
|
$sQuery | ) |
|
Can be used to execute queries which shouldn't return data
◆ pdoQuery()
BxDolDb::pdoQuery |
( |
|
$sQuery | ) |
|
Executes query and returns PDOStatement object or false
◆ ping()
◆ prepare()
BxDolDb::prepare |
( |
|
$sQuery | ) |
|
Prepare SQL query before execution if some arguments are need to be passed to it. All parameters marked with question (?) symbol in SQL query are replaced with parameters passed after SQL query parameter. Parameters are properly excaped and surrounded by qutes if needed. Example:
$sSql = $oDb->prepare("SELECT `a`, `b` from `t` WHERE `c` = ? and `d` = ?", 12, 'aa');
echo $sSql;
$a = $oDb->getAll($sSql);
- Parameters
-
string | $sQuery | SQL query, parameters for replacing are marked with ? symbol |
mixed | $mixed | any number if parameters to replace, number of parameters whould match number of ? symbols in SQL query |
- Returns
- PDOStatement object with SQL query ready for execution
◆ prepareAsString()
BxDolDb::prepareAsString |
( |
|
$sQuery | ) |
|
Prepare SQL query before execution if some arguments are need to be passed to it. All parameters marked with question (?) symbol in SQL query are replaced with parameters passed after SQL query parameter. Parameters are properly excaped and surrounded by qutes if needed. Example:
$sSql = $oDb->prepare("SELECT `a`, `b` from `t` WHERE `c` = ? and `d` = ?", 12, 'aa');
echo $sSql;
$a = $oDb->getAll($sSql);
- Parameters
-
string | $sQuery | SQL query, parameters for replacing are marked with ? symbol |
mixed | $mixed | any number if parameters to replace, number of parameters whould match number of ? symbols in SQL query |
- Returns
- string with SQL query.
◆ query()
BxDolDb::query |
( |
|
$oStatement, |
|
|
|
$aBindings = array() , |
|
|
|
$bVerbose = null |
|
) |
| |
execute any query return number of rows affected/false
◆ res()
BxDolDb::res |
( |
|
$oStatement, |
|
|
|
$aBindings = array() , |
|
|
|
$bVerbose = null |
|
) |
| |
◆ unescape()
BxDolDb::unescape |
( |
|
$mixed | ) |
|
The documentation for this class was generated from the following file: