Cheetah
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
ChWsbDb Class Reference
Inheritance diagram for ChWsbDb:
ChAdsDb ChBlogsDb ChCRSSDb ChWsbCaptchaQuery ChWsbCmtsQuery ChWsbDatabaseBackup ChWsbEditorQuery ChWsbExportQuery ChWsbInstallerUi ChWsbMemberInfoQuery ChWsbModuleDb ChWsbPaymentsQuery ChWsbPrivacyQuery ChWsbProfileQuery ChWsbSessionQuery ChWsbSiteMapsQuery ChWsbSocialSharingQuery ChWsbSubscriptionQuery ChWsbVotingQuery

Public Member Functions

 setTimezone ($sTimezone)
 
 getLink ()
 
 res ($sQuery, $aBindings=[], $bReplaying=false)
 
 getAll ($sQuery, $aBindings=[], $iFetchType=PDO::FETCH_ASSOC)
 
 getRow ($sQuery, $aBindings=[], $iFetchStyle=PDO::FETCH_ASSOC)
 
 getColumn ($sQuery, $aBindings=[])
 
 getOne ($sQuery, $aBindings=[], $iIndex=0)
 
 getFirstRow ($sQuery, $aBindings=[], $iFetchStyle=PDO::FETCH_ASSOC)
 
 getNextRow ()
 
 getAllWithKey ($sQuery, $sFieldKey, $aBindings=[], $iFetchType=PDO::FETCH_ASSOC)
 
 getPairs ($sQuery, $sFieldKey, $sFieldValue, $aBindings=[])
 
 query ($sQuery, $aBindings=[])
 
 getNumRows ($oStmt=null)
 
 getAffectedRows ($oStmt=null)
 
 fillArray ($oStmt, $iFetchType=PDO::FETCH_ASSOC)
 
 lastId ()
 
 getParam ($sName, $bCache=true)
 
 setParam ($sName, $sValue)
 
 listTables ()
 
 getFields ($sTable)
 
 isFieldExists ($sTable, $sFieldName)
 
 fetchField ($mixedQuery, $iField, $aBindings=[])
 
 getDbCacheObject ()
 
 genDbCacheKey ($sName)
 
 fromCache ($sName, $sFunc)
 
 cleanCache ($sName)
 
fromMemory ($sName, $sFunc)
 
 cleanMemory ($sName)
 
 arrayToSQL ($a, $sDiv=',')
 
 escape ($sText, $bReal=true)
 
 implode_escape ($mixed)
 
 unescape ($mixed)
 

Static Public Member Functions

static getInstance ()
 

Public Attributes

 $port
 
 $socket
 
 $dbname
 
 $user
 
 $password
 
 $oParams = null
 
 $oDbCacheObject = null
 

Protected Member Functions

 __construct ()
 
 connect ()
 
 disconnect ()
 

Protected Attributes

 $host
 
 $link
 
 $oCurrentStmt
 
 $iCurrentFetchStyle
 

Static Protected Attributes

static $instance
 

Detailed Description

Definition at line 12 of file ChWsbDb.php.

Constructor & Destructor Documentation

◆ __construct()

ChWsbDb::__construct ( )
protected

Member Function Documentation

◆ arrayToSQL()

ChWsbDb::arrayToSQL (   $a,
  $sDiv = ',' 
)

Convert array of key => values to SQL query. Array keys are field names and array values are field values.

Parameters
$aarray
$sDivfields separator, by default it is ',', another useful value is ' AND '
Returns
part of SQL query string

Definition at line 609 of file ChWsbDb.php.

◆ cleanCache()

ChWsbDb::cleanCache (   $sName)

Reimplemented in ChPageACDb.

Definition at line 565 of file ChWsbDb.php.

◆ cleanMemory()

ChWsbDb::cleanMemory (   $sName)

Definition at line 591 of file ChWsbDb.php.

◆ connect()

ChWsbDb::connect ( )
protected

connect to database with appointed parameters

Definition at line 94 of file ChWsbDb.php.

◆ disconnect()

ChWsbDb::disconnect ( )
protected

close pdo connection

Definition at line 120 of file ChWsbDb.php.

◆ escape()

ChWsbDb::escape (   $sText,
  $bReal = true 
)
Parameters
string$sText
bool$bRealreturn the actual quotes value or strip the quotes, PS: Use the pdo bindings for user's sake
Returns
string

Definition at line 624 of file ChWsbDb.php.

◆ fetchField()

ChWsbDb::fetchField (   $mixedQuery,
  $iField,
  $aBindings = [] 
)

Definition at line 504 of file ChWsbDb.php.

◆ fillArray()

ChWsbDb::fillArray (   $oStmt,
  $iFetchType = PDO::FETCH_ASSOC 
)
Parameters
PDOStatement$oStmt
int$iFetchType
Returns
array

Definition at line 430 of file ChWsbDb.php.

◆ fromCache()

ChWsbDb::fromCache (   $sName,
  $sFunc 
)

Reimplemented in ChPageACDb.

Definition at line 534 of file ChWsbDb.php.

◆ fromMemory()

& ChWsbDb::fromMemory (   $sName,
  $sFunc 
)

Definition at line 574 of file ChWsbDb.php.

◆ genDbCacheKey()

ChWsbDb::genDbCacheKey (   $sName)

Definition at line 527 of file ChWsbDb.php.

◆ getAffectedRows()

ChWsbDb::getAffectedRows (   $oStmt = null)

execute any query return number of rows affected/false

Parameters
null | PDOStatement$oStmt
Returns
int

Definition at line 409 of file ChWsbDb.php.

◆ getAll()

ChWsbDb::getAll (   $sQuery,
  $aBindings = [],
  $iFetchType = PDO::FETCH_ASSOC 
)

execute sql query and return table of records as result

Parameters
string$sQuery
array$aBindings
int$iFetchType
Returns
array

Definition at line 206 of file ChWsbDb.php.

◆ getAllWithKey()

ChWsbDb::getAllWithKey (   $sQuery,
  $sFieldKey,
  $aBindings = [],
  $iFetchType = PDO::FETCH_ASSOC 
)

execute sql query and return table of records as result

Parameters
string$sQuery
string$sFieldKey
array$aBindings
int$iFetchType
Returns
array

Definition at line 338 of file ChWsbDb.php.

◆ getColumn()

ChWsbDb::getColumn (   $sQuery,
  $aBindings = [] 
)

execute sql query and return a column as result

Parameters
string$sQuery
array$aBindings
Returns
array

Definition at line 243 of file ChWsbDb.php.

◆ getDbCacheObject()

ChWsbDb::getDbCacheObject ( )

Definition at line 512 of file ChWsbDb.php.

◆ getFields()

ChWsbDb::getFields (   $sTable)

Definition at line 483 of file ChWsbDb.php.

◆ getFirstRow()

ChWsbDb::getFirstRow (   $sQuery,
  $aBindings = [],
  $iFetchStyle = PDO::FETCH_ASSOC 
)

execute sql query and return the first row of result and keep $array type and poiter to all data

Parameters
string$sQuery
array$aBindings
int$iFetchStyle
Returns
array

Definition at line 284 of file ChWsbDb.php.

◆ getInstance()

static ChWsbDb::getInstance ( )
static

Instance of db class

Returns
static

Definition at line 82 of file ChWsbDb.php.

◆ getLink()

ChWsbDb::getLink ( )

Definition at line 137 of file ChWsbDb.php.

◆ getNextRow()

ChWsbDb::getNextRow ( )

return next row of pointed last getFirstRow calling data

Returns
array

Definition at line 309 of file ChWsbDb.php.

◆ getNumRows()

ChWsbDb::getNumRows (   $oStmt = null)
Parameters
null | PDOStatement$oStmt
Returns
int

Definition at line 398 of file ChWsbDb.php.

◆ getOne()

ChWsbDb::getOne (   $sQuery,
  $aBindings = [],
  $iIndex = 0 
)

execute sql query and return one value result

Parameters
string$sQuery
array$aBindings
int$iIndex
Returns
mixed

Definition at line 263 of file ChWsbDb.php.

◆ getPairs()

ChWsbDb::getPairs (   $sQuery,
  $sFieldKey,
  $sFieldValue,
  $aBindings = [] 
)

execute sql query and return table of records as result

Parameters
string$sQuery
string$sFieldKey
string$sFieldValue
array$aBindings
Returns
array

Definition at line 363 of file ChWsbDb.php.

◆ getParam()

ChWsbDb::getParam (   $sName,
  $bCache = true 
)

Definition at line 454 of file ChWsbDb.php.

◆ getRow()

ChWsbDb::getRow (   $sQuery,
  $aBindings = [],
  $iFetchStyle = PDO::FETCH_ASSOC 
)

execute sql query and return one row result

Parameters
string$sQuery
array$aBindings
int$iFetchStyle
Returns
array

Definition at line 225 of file ChWsbDb.php.

◆ implode_escape()

ChWsbDb::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; // outputs: SELECT * FROM `t` WHERE `a` IN (2, 4.5, 'apple', 'car')
Parameters
$mixedarray or parameters or just one paramter
Returns
string which is ready to pass to IN(...) SQL construction

Definition at line 650 of file ChWsbDb.php.

◆ isFieldExists()

ChWsbDb::isFieldExists (   $sTable,
  $sFieldName 
)

Definition at line 497 of file ChWsbDb.php.

◆ lastId()

ChWsbDb::lastId ( )

Retuns last insert id

Returns
string

Definition at line 449 of file ChWsbDb.php.

◆ listTables()

ChWsbDb::listTables ( )

Returns an array of all the table names in the database

Returns
array

Definition at line 471 of file ChWsbDb.php.

◆ query()

ChWsbDb::query (   $sQuery,
  $aBindings = [] 
)

execute any query return number of rows affected

Parameters
string$sQuery
array$aBindings
Returns
int

Definition at line 386 of file ChWsbDb.php.

◆ res()

ChWsbDb::res (   $sQuery,
  $aBindings = [],
  $bReplaying = false 
)

execute any query

Parameters
string$sQuery
array$aBindings
bool$bReplaying
Returns
PDOStatement

Definition at line 150 of file ChWsbDb.php.

◆ setParam()

ChWsbDb::setParam (   $sName,
  $sValue 
)

Definition at line 459 of file ChWsbDb.php.

◆ setTimezone()

ChWsbDb::setTimezone (   $sTimezone)

Sets mysql time zone for current session

Parameters
string$sTimezone

Definition at line 130 of file ChWsbDb.php.

◆ unescape()

ChWsbDb::unescape (   $mixed)
Parameters
$mixed
Returns
array|mixed

Definition at line 670 of file ChWsbDb.php.

Member Data Documentation

◆ $dbname

ChWsbDb::$dbname

Definition at line 14 of file ChWsbDb.php.

◆ $host

ChWsbDb::$host
protected

Definition at line 14 of file ChWsbDb.php.

◆ $iCurrentFetchStyle

ChWsbDb::$iCurrentFetchStyle
protected

Definition at line 34 of file ChWsbDb.php.

◆ $instance

ChWsbDb::$instance
staticprotected

Definition at line 24 of file ChWsbDb.php.

◆ $link

ChWsbDb::$link
protected

Definition at line 19 of file ChWsbDb.php.

◆ $oCurrentStmt

ChWsbDb::$oCurrentStmt
protected

Definition at line 29 of file ChWsbDb.php.

◆ $oDbCacheObject

ChWsbDb::$oDbCacheObject = null

Definition at line 46 of file ChWsbDb.php.

◆ $oParams

ChWsbDb::$oParams = null

Definition at line 39 of file ChWsbDb.php.

◆ $password

ChWsbDb::$password

Definition at line 14 of file ChWsbDb.php.

◆ $port

ChWsbDb::$port

Definition at line 14 of file ChWsbDb.php.

◆ $socket

ChWsbDb::$socket

Definition at line 14 of file ChWsbDb.php.

◆ $user

ChWsbDb::$user

Definition at line 14 of file ChWsbDb.php.


The documentation for this class was generated from the following file:
$oDb
global $oDb
Definition: db.inc.php:39
$s
$s
Definition: embed.php:13