Zeta Components Manual :: Docs For Class ezcDbHandler
Database::ezcDbHandler
Class ezcDbHandler
Defines interface for all the database drivers implementations.
ezcDbHandler provides some functionality that is not present in PDO.
- handling of offset/limit in a datbase independent way
- correct recursive handling of transactions
Source for this file: /Database/src/handler.php
PDO | --ezcDbHandler
Version: | //autogentag// |
Descendants
Child Class | Description |
---|---|
ezcDbHandlerPgsql | PostgreSQL driver implementation |
ezcDbHandlerOracle | Oracle driver implementation |
ezcDbHandlerMssql | MS SQL Server driver implementation. |
ezcDbHandlerSqlite | SQLite driver implementation |
ezcDbHandlerMysql | MySQL driver implementation |
Inherited Constants
From PDO (Internal Class): | |
---|---|
ATTR_AUTOCOMMIT = 0
|
|
ATTR_CASE = 8
|
|
ATTR_CLIENT_VERSION = 5
|
|
ATTR_CONNECTION_STATUS = 7
|
|
ATTR_CURSOR = 10
|
|
ATTR_CURSOR_NAME = 9
|
|
ATTR_DEFAULT_FETCH_MODE = 19
|
|
ATTR_DRIVER_NAME = 16
|
|
ATTR_EMULATE_PREPARES = 20
|
|
ATTR_ERRMODE = 3
|
|
ATTR_FETCH_CATALOG_NAMES = 15
|
|
ATTR_FETCH_TABLE_NAMES = 14
|
|
ATTR_MAX_COLUMN_LEN = 18
|
|
ATTR_ORACLE_NULLS = 11
|
|
ATTR_PERSISTENT = 12
|
|
ATTR_PREFETCH = 1
|
|
ATTR_SERVER_INFO = 6
|
|
ATTR_SERVER_VERSION = 4
|
|
ATTR_STATEMENT_CLASS = 13
|
|
ATTR_STRINGIFY_FETCHES = 17
|
|
ATTR_TIMEOUT = 2
|
|
CASE_LOWER = 2
|
|
CASE_NATURAL = 0
|
|
CASE_UPPER = 1
|
|
CURSOR_FWDONLY = 0
|
|
CURSOR_SCROLL = 1
|
|
ERRMODE_EXCEPTION = 2
|
|
ERRMODE_SILENT = 0
|
|
ERRMODE_WARNING = 1
|
|
ERR_NONE = '00000'
|
|
FETCH_ASSOC = 2
|
|
FETCH_BOTH = 4
|
|
FETCH_BOUND = 6
|
|
FETCH_CLASS = 8
|
|
FETCH_CLASSTYPE = 262144
|
|
FETCH_COLUMN = 7
|
|
FETCH_FUNC = 10
|
|
FETCH_GROUP = 65536
|
|
FETCH_INTO = 9
|
|
FETCH_KEY_PAIR = 12
|
|
FETCH_LAZY = 1
|
|
FETCH_NAMED = 11
|
|
FETCH_NUM = 3
|
|
FETCH_OBJ = 5
|
|
FETCH_ORI_ABS = 4
|
|
FETCH_ORI_FIRST = 2
|
|
FETCH_ORI_LAST = 3
|
|
FETCH_ORI_NEXT = 0
|
|
FETCH_ORI_PRIOR = 1
|
|
FETCH_ORI_REL = 5
|
|
FETCH_PROPS_LATE = 1048576
|
|
FETCH_SERIALIZE = 524288
|
|
FETCH_UNIQUE = 196608
|
|
MYSQL_ATTR_COMPRESS = 1006
|
|
MYSQL_ATTR_DIRECT_QUERY = 1007
|
|
MYSQL_ATTR_FOUND_ROWS = 1008
|
|
MYSQL_ATTR_IGNORE_SPACE = 1009
|
|
MYSQL_ATTR_INIT_COMMAND = 1002
|
|
MYSQL_ATTR_LOCAL_INFILE = 1001
|
|
MYSQL_ATTR_MAX_BUFFER_SIZE = 1005
|
|
MYSQL_ATTR_READ_DEFAULT_FILE = 1003
|
|
MYSQL_ATTR_READ_DEFAULT_GROUP = 1004
|
|
MYSQL_ATTR_USE_BUFFERED_QUERY = 1000
|
|
NULL_EMPTY_STRING = 1
|
|
NULL_NATURAL = 0
|
|
NULL_TO_STRING = 2
|
|
PARAM_BOOL = 5
|
|
PARAM_EVT_ALLOC = 0
|
|
PARAM_EVT_EXEC_POST = 3
|
|
PARAM_EVT_EXEC_PRE = 2
|
|
PARAM_EVT_FETCH_POST = 5
|
|
PARAM_EVT_FETCH_PRE = 4
|
|
PARAM_EVT_FREE = 1
|
|
PARAM_EVT_NORMALIZE = 6
|
|
PARAM_INPUT_OUTPUT = 2147483648
|
|
PARAM_INT = 1
|
|
PARAM_LOB = 3
|
|
PARAM_NULL = 0
|
|
PARAM_STMT = 4
|
|
PARAM_STR = 2
|
Member Variables
protected string |
$identifierQuoteChars
= array(
Characters to quote identifiers with. Should be overwritten in handler implementation, if different for a specific handler. In some cases the quoting start and end characters differ (e.g. ODBC), but mostly they are the same. |
protected bool |
$transactionErrorFlag
= false
This flag is set to true when an SQL query has failed. In this case the transaction should be rolled back. |
protected int |
$transactionNestingLevel
= 0
Stores the transaction nesting level. |
Method Summary
public ezcDbHandler |
__construct(
$dbParams
, $dsn
)
Constructs a handler object. |
public bool |
beginTransaction(
)
Begins a transaction. |
public bool |
commit(
)
Commits a transaction. |
public ezcQueryDelete |
createDeleteQuery(
)
Returns a new ezcQueryDelete derived object for the correct database type. |
public ezcQueryExpression |
createExpression(
)
Returns a new ezcQueryExpression derived object for the correct database type. |
public ezcQueryInsert |
createInsertQuery(
)
Returns a new ezcQueryInsert derived object for the correct database type. |
public ezcQuerySelect |
createSelectQuery(
)
Returns a new ezcQuerySelect derived object for the correct database type. |
public ezcQueryUpdate |
createUpdateQuery(
)
Returns a new ezcQueryUpdate derived object for the correct database type. |
public ezcDbUtilities |
createUtilities(
)
Returns a new ezcUtilities derived object for the correct database type. |
public string |
quoteIdentifier(
$identifier
)
Returns the quoted version of an identifier to be used in an SQL query. |
public bool |
rollback(
)
Rollback a transaction. |
Inherited Methods
From PDO (Internal Class) | |
---|---|
public PDO |
constructor __construct ( $dsn, $username, $passwd, [$options = ] )
|
public void |
beginTransaction ( )
|
public void |
commit ( )
|
public void |
errorCode ( )
|
public void |
errorInfo ( )
|
public void |
exec ( $query )
|
public void |
getAttribute ( $attribute )
|
public void |
getAvailableDrivers ( )
|
public void |
inTransaction ( )
|
public void |
lastInsertId ( [$seqname = ] )
|
public void |
prepare ( $statment, [$options = ] )
|
public void |
query ( )
|
public void |
quote ( $string, [$paramtype = ] )
|
public void |
rollBack ( )
|
public void |
setAttribute ( $attribute, $value )
|
public void |
__sleep ( )
|
public void |
__wakeup ( )
|
Methods
__construct
Constructs a handler object.
note: Remember to always call this constructor from constructor of a derived class!
Parameters:
Name | Type | Description |
---|---|---|
$dbParams |
array | Misc database connection parameters. |
$dsn |
string | Data Source Name, generated by constructor of a derived class. |
Redefinition of:
Method | Description |
---|---|
PDO::constructor __construct ( $dsn, $username, $passwd, [$options = ] ) |
Redefined in descendants as:
Method | Description |
---|---|
ezcDbHandlerPgsql::__construct() |
Constructs a handler object from the parameters $dbParams. |
ezcDbHandlerOracle::__construct() |
Constructs a handler object from the parameters $dbParams. |
ezcDbHandlerMssql::__construct() |
Constructs a handler object from the parameters $dbParams. |
ezcDbHandlerSqlite::__construct() |
Constructs a handler object from the parameters $dbParams. |
ezcDbHandlerMysql::__construct() |
Constructs a handler object from the parameters $dbParams. |
beginTransaction
Begins a transaction.
This method executes a begin transaction query unless a transaction has already been started (transaction nesting level > 0 )
Each call to beginTransaction() must have a corresponding commit() or rollback() call.
Redefinition of:
Method | Description |
---|---|
PDO::beginTransaction ( ) |
Redefined in descendants as:
Method | Description |
---|---|
ezcDbHandlerMssql::beginTransaction() |
Begins a transaction. |
commit
Commits a transaction.
If this this call to commit corresponds to the outermost call to beginTransaction() and all queries within this transaction were successful, a commit query is executed. If one of the queries returned with an error, a rollback query is executed instead.
This method returns true if the transaction was successful. If the transaction failed and rollback was called, false is returned.
Redefinition of:
Method | Description |
---|---|
PDO::commit ( ) |
Redefined in descendants as:
Method | Description |
---|---|
ezcDbHandlerMssql::commit() |
Commits a transaction. |
createDeleteQuery
Returns a new ezcQueryDelete derived object for the correct database type.
createExpression
Returns a new ezcQueryExpression derived object for the correct database type.
Redefined in descendants as:
Method | Description |
---|---|
ezcDbHandlerPgsql::createExpression() |
Returns a new ezcQueryExpression derived object with PostgreSQL implementation specifics. |
ezcDbHandlerOracle::createExpression() |
Returns a new ezcQueryExpression derived object with Oracle implementation specifics. |
ezcDbHandlerMssql::createExpression() |
Returns a new ezcQueryExpression derived object with SQL Server implementation specifics. |
ezcDbHandlerSqlite::createExpression() |
Returns a new ezcQueryExpression derived object with SQLite implementation specifics. |
createInsertQuery
Returns a new ezcQueryInsert derived object for the correct database type.
createSelectQuery
Returns a new ezcQuerySelect derived object for the correct database type.
Redefined in descendants as:
Method | Description |
---|---|
ezcDbHandlerOracle::createSelectQuery() |
Returns a new ezcQuerySelect derived object with Oracle implementation specifics. |
ezcDbHandlerMssql::createSelectQuery() |
Returns a new ezcQuerySelectMssql derived object with SQL Server implementation specifics. |
ezcDbHandlerSqlite::createSelectQuery() |
Returns a new ezcQuerySelect derived object with SQLite implementation specifics. |
createUpdateQuery
Returns a new ezcQueryUpdate derived object for the correct database type.
createUtilities
Returns a new ezcUtilities derived object for the correct database type.
Redefined in descendants as:
Method | Description |
---|---|
ezcDbHandlerPgsql::createUtilities() |
Returns a new ezcUtilities derived object with PostgreSQL implementation specifics. |
ezcDbHandlerOracle::createUtilities() |
Returns a new ezcUtilities derived object with Oracle implementation specifics. |
ezcDbHandlerSqlite::createUtilities() |
Returns a new ezcUtilities derived object with SQLite implementation specifics. |
ezcDbHandlerMysql::createUtilities() |
Returns a new ezcUtilities derived object for this database instance. |
quoteIdentifier
Returns the quoted version of an identifier to be used in an SQL query.
This method takes a given identifier and quotes it, so it can safely be used in SQL queries.
Parameters:
Name | Type | Description |
---|---|---|
$identifier |
string | The identifier to quote. |
rollback
Rollback a transaction.
If this this call to rollback corresponds to the outermost call to beginTransaction(), a rollback query is executed. If this is an inner transaction (nesting level > 1) the error flag is set, leaving the rollback to the outermost transaction.
This method always returns true.
Redefinition of:
Method | Description |
---|---|
PDO::rollBack ( ) |
Redefined in descendants as:
Method | Description |
---|---|
ezcDbHandlerMssql::rollback() |
Rollback a transaction. |