Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
DatabaseOperationsTrait Class Reference
+ Inheritance diagram for DatabaseOperationsTrait:

Public Member Functions

 getDSN ()
 
 getDbObject ()
 
 _connect ()
 
 query ($sql)
 Executes an SQL statement, returning a result set as a statement object.
 
 prepareAndExecute ($tableName, $condition, $fields, $parameters=null, $useCache=false, $one=false)
 
 _optExecuteAndFetch ($statement, $tableName, $condition, $parameters=null, $useCache=false, $one=false)
 
 _optExecuteAndFetchNoCache ($statement, $parameters=null, $one=false)
 
 getDaoPreparedStatement ($tableName, $condition, $fields)
 
 prepareAndExecuteNoCache ($tableName, $condition, $fields, $parameters=null)
 
 storeCache ()
 
 prepareAndFetchAll ($sql, $parameters=null, $mode=null)
 
 prepareAndFetchOne ($sql, $parameters=null, $mode=null)
 
 prepareAndFetchAllColumn ($sql, $parameters=null, $column=null)
 
 prepareAndFetchColumn ($sql, $parameters=null, $columnNumber=0)
 
 getUpdateStatement ($sql)
 
 prepareAndExecuteUpdate ($sql, $parameters=null)
 Prepares a statement and execute a query for update (INSERT, UPDATE, DELETE...)
 
 execute ($sql)
 Execute an SQL statement and return the number of affected rows (INSERT, UPDATE or DELETE)
 
 prepareStatement ($sql)
 Prepares a statement for execution and returns a statement object.
 
 prepareNamedStatement (string $name, string $sql)
 Prepares and returns a statement for execution and gives it a name.
 
 getNamedStatement (string $name, ?string $sql=null)
 Returns the statement corresponding to the name.
 
 bindValueFromStatement ($statement, $parameter, $value)
 Sets $value to $parameter.
 
 lastInserId ($name=null)
 Returns the last insert id.
 
 count ($tableName, $condition='')
 Returns the number of records in $tableName matching with the condition passed as a parameter.
 
 queryColumn ($query, $columnNumber=null)
 
 fetchAll ($query, $mode=null)
 
 isConnected ()
 
 ping ()
 

Private Member Functions

 getCacheValue ($tableName, $condition, $parameters, &$cKey)
 
 getStatement ($sql)
 

Detailed Description

Definition at line 20 of file DatabaseOperationsTrait.php.

Member Function Documentation

◆ _connect()

_connect ( )

Definition at line 28 of file DatabaseOperationsTrait.php.

◆ _optExecuteAndFetch()

_optExecuteAndFetch (   $statement,
  $tableName,
  $condition,
  $parameters = null,
  $useCache = false,
  $one = false 
)

Definition at line 82 of file DatabaseOperationsTrait.php.

◆ _optExecuteAndFetchNoCache()

_optExecuteAndFetchNoCache (   $statement,
  $parameters = null,
  $one = false 
)

Definition at line 96 of file DatabaseOperationsTrait.php.

◆ bindValueFromStatement()

bindValueFromStatement (   $statement,
  $parameter,
  $value 
)

Sets $value to $parameter.

Parameters
mixed$statement
string$parameter
mixed$value
Returns
boolean

Definition at line 214 of file DatabaseOperationsTrait.php.

◆ count()

count (   $tableName,
  $condition = '' 
)

Returns the number of records in $tableName matching with the condition passed as a parameter.

Parameters
string$tableName
string$conditionPart following the WHERE of an SQL statement

Definition at line 233 of file DatabaseOperationsTrait.php.

◆ execute()

execute (   $sql)

Execute an SQL statement and return the number of affected rows (INSERT, UPDATE or DELETE)

Parameters
string$sql
Returns
int the number of rows that were modified or deleted by the SQL statement you issued

Definition at line 170 of file DatabaseOperationsTrait.php.

◆ fetchAll()

fetchAll (   $query,
  $mode = null 
)

Definition at line 244 of file DatabaseOperationsTrait.php.

◆ getCacheValue()

getCacheValue (   $tableName,
  $condition,
  $parameters,
$cKey 
)
private

Definition at line 68 of file DatabaseOperationsTrait.php.

◆ getDaoPreparedStatement()

getDaoPreparedStatement (   $tableName,
  $condition,
  $fields 
)

Definition at line 100 of file DatabaseOperationsTrait.php.

◆ getDbObject()

getDbObject ( )

Definition at line 24 of file DatabaseOperationsTrait.php.

◆ getDSN()

getDSN ( )
abstract

Reimplemented in Database.

◆ getNamedStatement()

getNamedStatement ( string  $name,
?string  $sql = null 
)

Returns the statement corresponding to the name.

Parameters
string$name
?string$sql
Returns
mixed

Definition at line 202 of file DatabaseOperationsTrait.php.

◆ getStatement()

getStatement (   $sql)
private
Parameters
string$sql
Returns
object statement

Definition at line 140 of file DatabaseOperationsTrait.php.

◆ getUpdateStatement()

getUpdateStatement (   $sql)
Parameters
string$sql
Returns
object statement

Definition at line 149 of file DatabaseOperationsTrait.php.

◆ isConnected()

isConnected ( )

Definition at line 248 of file DatabaseOperationsTrait.php.

◆ lastInserId()

lastInserId (   $name = null)

Returns the last insert id.

Returns
string

Definition at line 223 of file DatabaseOperationsTrait.php.

◆ ping()

ping ( )

Definition at line 252 of file DatabaseOperationsTrait.php.

◆ prepareAndExecute()

prepareAndExecute (   $tableName,
  $condition,
  $fields,
  $parameters = null,
  $useCache = false,
  $one = false 
)
Parameters
string$tableName
string$condition
array | string$fields
array$parameters
boolean | null$useCache
Returns
array

Definition at line 51 of file DatabaseOperationsTrait.php.

◆ prepareAndExecuteNoCache()

prepareAndExecuteNoCache (   $tableName,
  $condition,
  $fields,
  $parameters = null 
)

Definition at line 105 of file DatabaseOperationsTrait.php.

◆ prepareAndExecuteUpdate()

prepareAndExecuteUpdate (   $sql,
  $parameters = null 
)

Prepares a statement and execute a query for update (INSERT, UPDATE, DELETE...)

Parameters
string$sql
array | null$parameters
Returns
boolean

Definition at line 160 of file DatabaseOperationsTrait.php.

◆ prepareAndFetchAll()

prepareAndFetchAll (   $sql,
  $parameters = null,
  $mode = null 
)

Definition at line 114 of file DatabaseOperationsTrait.php.

◆ prepareAndFetchAllColumn()

prepareAndFetchAllColumn (   $sql,
  $parameters = null,
  $column = null 
)

Definition at line 122 of file DatabaseOperationsTrait.php.

◆ prepareAndFetchColumn()

prepareAndFetchColumn (   $sql,
  $parameters = null,
  $columnNumber = 0 
)

Definition at line 126 of file DatabaseOperationsTrait.php.

◆ prepareAndFetchOne()

prepareAndFetchOne (   $sql,
  $parameters = null,
  $mode = null 
)

Definition at line 118 of file DatabaseOperationsTrait.php.

◆ prepareNamedStatement()

prepareNamedStatement ( string  $name,
string  $sql 
)

Prepares and returns a statement for execution and gives it a name.

Parameters
string$name
string$sql
Returns
mixed

Definition at line 191 of file DatabaseOperationsTrait.php.

◆ prepareStatement()

prepareStatement (   $sql)

Prepares a statement for execution and returns a statement object.

Parameters
string$sql
Returns
object|boolean

Definition at line 180 of file DatabaseOperationsTrait.php.

◆ query()

query (   $sql)

Executes an SQL statement, returning a result set as a statement object.

Parameters
string$sql
Returns
object|boolean

Definition at line 38 of file DatabaseOperationsTrait.php.

◆ queryColumn()

queryColumn (   $query,
  $columnNumber = null 
)

Definition at line 240 of file DatabaseOperationsTrait.php.

◆ storeCache()

storeCache ( )

Definition at line 110 of file DatabaseOperationsTrait.php.


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