FOSSology  4.4.0
Open Source License Compliance by Open Source Software
Fossology\Lib\Db\DbManager Class Reference
Inheritance diagram for Fossology\Lib\Db\DbManager:
Inheritance graph
Collaboration diagram for Fossology\Lib\Db\DbManager:
Collaboration graph

Public Member Functions

 __construct (Logger $logger)
 
 setDriver (Driver &$dbDriver)
 
 getDriver ()
 
 begin ()
 
 commit ()
 
 rollback ()
 
 prepare ($statementName, $sqlStatement)
 
 insertPreparedAndReturn ($statementName, $sqlStatement, $params, $returning)
 
 execute ($statementName, $params=array())
 
 getSingleRow ($sqlStatement, $params=array(), $statementName="")
 
 getRows ($sqlStatement, $params=array(), $statementName="")
 
 queryOnce ($sqlStatement, $sqlLog='')
 
 freeResult ($res)
 
 fetchArray ($res)
 
 fetchAll ($res)
 
 createMap ($tableName, $keyColumn, $valueColumn, $sqlLog='')
 
 flushStats ()
 
 booleanFromDb ($booleanValue)
 
 booleanToDb ($booleanValue)
 
 insertInto ($tableName, $keys, $params, $sqlLog='', $returning='')
 
 insertTableRow ($tableName, $assocParams, $sqlLog='', $returning='')
 
 updateTableRow ($tableName, $assocParams, $idColName, $id, $sqlLog='')
 
 existsTable ($tableName)
 
 existsColumn ($tableName, $columnName)
 

Protected Member Functions

 checkResult ($result, $sqlStatement="")
 Check the result for unexpected errors. If found, treat them as fatal. More...
 
 formatMilliseconds ($seconds)
 
 collectStatistics ($statementName, $execTime)
 

Protected Attributes

 $dbDriver
 
 $preparedStatements
 
 $logger
 
 $cumulatedTime = array()
 
 $queryCount = array()
 

Private Member Functions

 cleanupParamsArray ($params)
 

Private Attributes

 $transactionDepth = 0
 

Detailed Description

Definition at line 14 of file DbManager.php.

Member Function Documentation

◆ checkResult()

Fossology\Lib\Db\DbManager::checkResult (   $result,
  $sqlStatement = "" 
)
protected

Check the result for unexpected errors. If found, treat them as fatal.

Parameters
resource$resultcommand result object
string$sqlStatementSQL command (optional)

Definition at line 116 of file DbManager.php.

◆ collectStatistics()

Fossology\Lib\Db\DbManager::collectStatistics (   $statementName,
  $execTime 
)
protected
Parameters
$statementName
$execTime

Definition at line 274 of file DbManager.php.

◆ createMap()

Fossology\Lib\Db\DbManager::createMap (   $tableName,
  $keyColumn,
  $valueColumn,
  $sqlLog = '' 
)
Parameters
string$tableName
string$keyColumn
string$valueColumn
string$sqlLog
Returns
array

Definition at line 232 of file DbManager.php.

◆ execute()

Fossology\Lib\Db\DbManager::execute (   $statementName,
  $params = array() 
)
abstract
Parameters
string$statementNamestatement name
array$paramsparameters
Exceptions

Reimplemented in Fossology\Lib\Db\SolidDbManager, and Fossology\Lib\Db\ModernDbManager.

◆ existsColumn()

Fossology\Lib\Db\DbManager::existsColumn (   $tableName,
  $columnName 
)
Parameters
$tableName
$columnName
Exceptions

Definition at line 390 of file DbManager.php.

◆ existsTable()

Fossology\Lib\Db\DbManager::existsTable (   $tableName)
Parameters
string$tableName
Exceptions

Definition at line 376 of file DbManager.php.

◆ fetchAll()

Fossology\Lib\Db\DbManager::fetchAll (   $res)
Parameters
ressource
Returns
array

Definition at line 220 of file DbManager.php.

◆ fetchArray()

Fossology\Lib\Db\DbManager::fetchArray (   $res)
Parameters
ressource
Returns
array

Definition at line 211 of file DbManager.php.

◆ formatMilliseconds()

Fossology\Lib\Db\DbManager::formatMilliseconds (   $seconds)
protected
Parameters
$seconds
Returns
string

Definition at line 265 of file DbManager.php.

◆ freeResult()

Fossology\Lib\Db\DbManager::freeResult (   $res)
Parameters
ressource
Returns
bool

Definition at line 202 of file DbManager.php.

◆ getDriver()

Fossology\Lib\Db\DbManager::getDriver ( )

return Driver

Definition at line 42 of file DbManager.php.

◆ getRows()

Fossology\Lib\Db\DbManager::getRows (   $sqlStatement,
  $params = array(),
  $statementName = "" 
)
Parameters
$sqlStatement
array$params
string$statementName
Returns
array

Definition at line 164 of file DbManager.php.

◆ getSingleRow()

Fossology\Lib\Db\DbManager::getSingleRow (   $sqlStatement,
  $params = array(),
  $statementName = "" 
)
Parameters
string$sqlStatement
array$params
string$statementName(optional)
Returns
array

Definition at line 142 of file DbManager.php.

◆ insertInto()

Fossology\Lib\Db\DbManager::insertInto (   $tableName,
  $keys,
  $params,
  $sqlLog = '',
  $returning = '' 
)
Parameters
$tableName
$keys
$params
string$sqlLog
string$returning
Returns
mixed|void

Definition at line 309 of file DbManager.php.

◆ insertPreparedAndReturn()

Fossology\Lib\Db\DbManager::insertPreparedAndReturn (   $statementName,
  $sqlStatement,
  $params,
  $returning 
)

Note: this builds a query which is not useable with SQLite one should use SqLiteE::insertPreparedAndReturn() instead

Parameters
$statementName
$sqlStatement
$params
$returning
Returns
mixed

Definition at line 92 of file DbManager.php.

◆ insertTableRow()

Fossology\Lib\Db\DbManager::insertTableRow (   $tableName,
  $assocParams,
  $sqlLog = '',
  $returning = '' 
)
Parameters
$tableName
array$assocParamsarray with keys as column names
string$sqlLog
string$returningcolumn that should be returned (empty string if not required)
Returns
mixed|null

Definition at line 336 of file DbManager.php.

◆ prepare()

Fossology\Lib\Db\DbManager::prepare (   $statementName,
  $sqlStatement 
)
abstract
Parameters
$statementName
$sqlStatement
Exceptions

Reimplemented in Fossology\Lib\Db\SolidDbManager, and Fossology\Lib\Db\ModernDbManager.

◆ queryOnce()

Fossology\Lib\Db\DbManager::queryOnce (   $sqlStatement,
  $sqlLog = '' 
)

use only for create, begin, commit and injection free queries

Parameters
string$sqlStatement
string$sqlLogsqlStatement

Definition at line 185 of file DbManager.php.

◆ setDriver()

Fossology\Lib\Db\DbManager::setDriver ( Driver $dbDriver)

param Driver

Definition at line 36 of file DbManager.php.


The documentation for this class was generated from the following file: