Class QDatabaseBase
Every database adapter must implement the following 5 classes (all of which are abstract): * DatabaseBase * DatabaseFieldBase * DatabaseResultBase * DatabaseRowBase * DatabaseExceptionBase This Database library also has the following classes already defined, and Database adapters are assumed to use them internally: * DatabaseIndex * DatabaseForeignKey * DatabaseFieldType (which is an abstract class that solely contains constants)
- QBaseClass
- QDatabaseBase
Direct known subclasses
QMySqliDatabase, QOracleDatabase, QPdoDatabase, QPostgreSqlDatabase, QSqlServer2005Database, QSqlServerDatabaseIndirect known subclasses
QInformixPdoDatabase, QMySqlDatabase, QMySqli5ClusterDatabase, QMySqli5Database, QPostgreSqlPdoDatabase, QSqLite3PdoDatabase
abstract public
|
|
abstract protected
mixed
|
#
ExecuteQuery( string $strQuery )
Sends a SQL query for execution to the database In this regard, a query is a 'SELECT' statement |
abstract protected
mixed
|
#
ExecuteNonQuery( string $strNonQuery )
Sends a non-SELECT query (such as INSERT, UPDATE, DELETE, TRUNCATE) to DB server. In most cases, the results of this function are not used and you should not send 'SELECT' queries using this method because a result is not guaranteed to be returned |
abstract public
mixed|string[]
|
|
abstract public
mixed
|
|
abstract public
mixed
|
|
abstract public
mixed
|
|
abstract public
mixed
|
|
abstract protected
|
#
ExecuteTransactionBegin( )
This function actually begins the database transaction. Must be implemented in all subclasses. The "TransactionBegin" wrapper are meant to be called by end-user code |
abstract protected
|
#
ExecuteTransactionCommit( )
This function actually commits the database transaction. Must be implemented in all subclasses. The "TransactionCommit" wrapper are meant to be called by end-user code |
abstract protected
|
#
ExecuteTransactionRollBack( )
This function actually rolls back the database transaction. Must be implemented in all subclasses. The "TransactionRollBack" wrapper are meant to be called by end-user code |
public
mixed
|
#
ExecuteProcedure( $strProcName, null $params = null )
Template for executing stored procedures. Optional, for those database drivers that support it. |
final public
|
|
final public
|
|
final public
|
|
final protected
|
|
final protected
|
|
abstract public
|
|
abstract public
|
|
abstract public
|
|
abstract public
mixed
|
|
public
string
|
#
EscapeIdentifier( string $strIdentifier )
Given an identifier for a SQL query, this method returns the escaped identifier |
public
array|string
|
#
EscapeIdentifiers( array|string $mixIdentifiers )
Given an array of identifiers, this method returns array of escaped identifiers For corner case handling, if a single identifier is supplied, a single escaped identifier is returned |
public
array|string
|
#
EscapeValues( array|mixed $mixValues )
Escapes values (or single value) which we can then send to the database |
public
array
|
#
EscapeIdentifiersAndValues( array $mixColumnsAndValuesArray )
Escapes both column and values when supplied as an array |
public
|
#
InsertOrUpdate( string $strTable, array $mixColumnsAndValuesArray, null|string|array $strPKNames = null )
INSERTs or UPDATEs a table |
final public
|
|
final public
mixed
|
|
public
mixed
|
|
public
mixed|
|
|
public
|
#
__construct( integer $intDatabaseIndex, string[] $objConfigArray )
Constructs a Database Adapter based on the database index and the configuration array of properties for this particular adapter. Sets up the base-level configuration properties for this database, namely DB Profiling and Database Index |
public
|
|
public
string
|
#
SqlVariable( mixed $mixData, boolean $blnIncludeEquality = false, boolean $blnReverseEquality = false )
Properly escapes $mixData to be used as a SQL query parameter. If IncludeEquality is set (usually not), then include an equality operator. So for most data, it would just be "=". But, for example, if $mixData is NULL, then most RDBMS's require the use of "IS". |
public
|
|
public
null|string
|
#
OutputProfiling( boolean $blnPrintOutput = true )
Displays the OutputProfiling results, plus a link which will popup the details of the profiling. |
public
null
|
#
ExplainStatement( $strSql )
Executes the explain statement for a given query and returns the output without any transformation. If the database adapter does not support EXPLAIN statements, returns null. |
public static
array
|
#
ExtractCommentOptions( string $strComment )
Utility function to extract the json embedded options structure from the comments. |
OverrideAttributes(),
__call()
|
string |
Adapter
Adapter name |
#
'Generic Database Adapter (Abstract)'
|
protected
integer
|
$intDatabaseIndex
Database Index according to the configuration file |
|
protected
boolean
|
$blnEnableProfiling
Has the profiling been enabled? |
|
protected
|
$strProfileArray
|
|
protected
|
$objConfigArray
|
|
protected
boolean
|
$blnConnectedFlag
|
#
false
|
protected
string
|
$strEscapeIdentifierBegin
The beginning part of characters which can escape identifiers in a SQL query for the database |
#
'"'
|
protected
string
|
$strEscapeIdentifierEnd
The ending part of characters which can escape identifiers in a SQL query for the database |
#
'"'
|
protected
boolean
|
$blnOnlyFullGroupBy
|
#
false
|
protected
integer
|
$intTransactionDepth
The transaction depth value. It is incremented on a transaction begin, decremented on a transaction commit, and reset to zero on a roll back. It is used to implement the recursive transaction functionality. |
#
0
|
protected static
|
$objCacheProviderStack
The stack of cache providers. It is populated with cache providers from different databases, if there are transaction of one DB in the middle of the transaction of another DB. |
public
boolean
|
$Caching
if true objects loaded from this database will be kept in cache (assuming a cache provider is also configured) |
public read-only
string
|
$EscapeIdentifierBegin
|
public read-only
string
|
$EscapeIdentifierEnd
|
public read-only
boolean
|
$EnableProfiling
|
public read-only
integer
|
$AffectedRows
|
public read-only
string
|
$Profile
|
public read-only
integer
|
$DatabaseIndex
|
public read-only
integer
|
$Adapter
|
public read-only
string
|
$Server
|
public read-only
string
|
$Port
|
public read-only
string
|
$Database
|
public read-only
string
|
$Service
|
public read-only
string
|
$Protocol
|
public read-only
string
|
$Host
|
public read-only
string
|
$Username
|
public read-only
string
|
$Password
|
public read-only
string
|
$DateFormat
|
public read-only
boolean
|
$OnlyFullGroupBy
database adapter sub-classes can override and set this property to true to prevent the behavior of automatically adding all the columns to the select clause when the query has an aggregation clause. |