eZDBInterface Class Reference
[Database abstraction layer]

The eZDBInterface defines the interface for all database implementations. More...

Inheritance diagram for eZDBInterface:

eZMySQLDB eZNullDB eZOracleDB eZPostgreSQLDB List of all members.

Public Methods

 eZDBInterface ($parameters)
 setIsSQLOutputEnabled ($enabled)
 databaseName ()
 socketPath ()
 connectRetryCount ()
 connectRetryWaitTime ()
 supportedRelationTypeMask ()
 supportedRelationTypes ()
 charset ()
 usesBuiltinEncoding ()
query ($sql)
arrayQuery ($sql,$params=array())
 lock ($table)
 unlock ()
 begin ()
 commit ()
 rollback ()
 relationCounts ($relationMask)
 relationCount ($relationType=EZ_DB_RELATION_TABLE)
 relationList ($relationType=EZ_DB_RELATION_TABLE)
 removeRelation ($relationName,$relationType)
 lastSerialID ($table,$column)
escapeString ($str)
 close ()
 isConnected ()
 createDatabase ()
 setError ()
 errorMessage ()
 errorNumber ()

Protected Methods

 relationName ($relationType)

Protected Attributes

 Server
 SocketPath
 The socket path, used by MySQL.

 DB
 The current database name.

 DBConnection
 The current connection, false if not connection has been made.

 DBWriteConnection
 Contains the write database connection if used.

 User
 Stores the database connection user.

 Password
 Stores the database connection password.

 Charset
 The charset used for the current database.

 ConnectRetries
 The number of times to retry a connection if it fails.

 OutputTextCodec
 Instance of a textcodec which handles text conversion, may not be set if no builtin encoding is used.

 UseBuiltinEncoding
 True if a builtin encoder is to be used, this means that all input/output text is converted.

 OutputSQL
 Setting if SQL queries should be sent to debug output.

 IsConnected = false
 Contains true if we're connected to the database backend.

 NumQueries = 0
 Contains number of queries sended to DB.

 StartTime
 The start time of the timer.

 EndTime
 The end time of the tiemr.

 TimeTaken
 The total number of milliseconds the timer took.

 ErrorMessage
 The database error message of the last executed function.

 ErrorNumber
 The database error message number of the last executed function.

 RecordError = true
 If true then ErrorMessage and ErrorNumber get filled.

 UsePersistentConnection = false
 If true then the database connection should be persistent.

 UserSlaveServer
 Contains true if slave servers are enabled.

 SlaveDB
 The slave database name.

 SlaveServer
 The slave server name.

 SlaveUser
 The slave database user.

 SlavePassword
 The slave database user password.


Private Methods

 reportQuery ($class,$sql,$numRows,$timeTaken)
 startTimer ()
 endTimer ()
 startTime ()
 endTime ()
 timeTaken ()

Detailed Description

The eZDBInterface defines the interface for all database implementations.

See also:
eZDB

Definition at line ezdbinterface.php.


Constructor & Destructor Documentation

eZDBInterface::eZDBInterface   parameters
 

Create a new eZDBInterface object and connects to the database backend.

Definition at line ezdbinterface.php.

References User.

Referenced by eZPostgreSQLDB::eZPostgreSQLDB().


Member Function Documentation

& eZDBInterface::arrayQuery   sql,
  params = array()
[pure virtual]
 

Executes an SQL query and returns the result as an array of accociative arrays.

Implemented in eZPostgreSQLDB.

Definition at line ezdbinterface.php.

eZDBInterface::begin   [pure virtual]
 

Starts a new transaction.

Implemented in eZPostgreSQLDB.

Definition at line ezdbinterface.php.

eZDBInterface::charset  
 

Returns the charset which the database is encoded in.

See also:
usesBuiltinEncoding

Definition at line ezdbinterface.php.

References Charset.

Referenced by eZDBInterface().

eZDBInterface::close   [pure virtual]
 

Will close the database connection.

Implemented in eZPostgreSQLDB.

Definition at line ezdbinterface.php.

eZDBInterface::commit   [pure virtual]
 

Commits the transaction.

Implemented in eZPostgreSQLDB.

Definition at line ezdbinterface.php.

eZDBInterface::connectRetryCount  
 

Returns:
the number of times the db handler should try to reconnect if it fails.

Definition at line ezdbinterface.php.

References ConnectRetries.

Referenced by eZPostgreSQLDB::eZPostgreSQLDB().

eZDBInterface::connectRetryWaitTime  
 

Returns:
the number of seconds the db handler should wait before rereconnecting.
Note:
Currently returns 3 seconds.

Definition at line ezdbinterface.php.

Referenced by eZPostgreSQLDB::eZPostgreSQLDB().

eZDBInterface::createDatabase   [pure virtual]
 

Create a new database

Definition at line ezdbinterface.php.

eZDBInterface::databaseName   [pure virtual]
 

Returns the name of driver, this is used to determine the name of the database type. For instance multiple implementations of the MySQL database will all return 'mysql'.

Implemented in eZPostgreSQLDB.

Definition at line ezdbinterface.php.

eZDBInterface::endTime   [private]
 

Returns:
the micro time when the timer was ended or false if no timer.

Definition at line ezdbinterface.php.

References EndTime.

eZDBInterface::endTimer   [private]
 

Stops the current timer and calculates the time taken.

See also:
startTimer, timeTaken

Definition at line ezdbinterface.php.

References TimeTaken.

Referenced by eZMySQLDB::query().

eZDBInterface::errorMessage  
 

Returns the error message

Definition at line ezdbinterface.php.

References ErrorMessage.

eZDBInterface::errorNumber  
 

Returns the error number

Definition at line ezdbinterface.php.

References ErrorNumber.

& eZDBInterface::escapeString   str [pure virtual]
 

Will escape a string so it's ready to be inserted in the database.

Implemented in eZPostgreSQLDB.

Definition at line ezdbinterface.php.

eZDBInterface::isConnected  
 

Returns true if we're connected to the database backend.

Definition at line ezdbinterface.php.

References IsConnected.

Referenced by eZMySQLDB::unlock().

eZDBInterface::lastSerialID   table,
  column
[pure virtual]
 

Returns the last serial ID generated with an auto increment field.

Implemented in eZPostgreSQLDB.

Definition at line ezdbinterface.php.

eZDBInterface::lock   table [pure virtual]
 

Locks a table

Implemented in eZPostgreSQLDB.

Definition at line ezdbinterface.php.

& eZDBInterface::query   sql [pure virtual]
 

Execute a query on the global MySQL database link. If it returns an error, the script is halted and the attempted SQL query and MySQL error message are printed.

Implemented in eZPostgreSQLDB.

Definition at line ezdbinterface.php.

eZDBInterface::relationCount   relationType = EZ_DB_RELATION_TABLE [pure virtual]
 

Returns:
the number of relation objects in the database for the relation type $relationType.

Implemented in eZPostgreSQLDB.

Definition at line ezdbinterface.php.

eZDBInterface::relationCounts   relationMask [pure virtual]
 

Returns:
the relation count for all relation types in the mask $relationMask.

Implemented in eZPostgreSQLDB.

Definition at line ezdbinterface.php.

eZDBInterface::relationList   relationType = EZ_DB_RELATION_TABLE [pure virtual]
 

Returns:
the relation names in the database as an array for the relation type $relationType.

Implemented in eZPostgreSQLDB.

Definition at line ezdbinterface.php.

eZDBInterface::relationName   relationType [protected]
 

Returns:
the name of the relation type which is usable in SQL or false if unknown type.
Note:
This function can be used by som database handlers which can operate on relation types using SQL.

Definition at line ezdbinterface.php.

Referenced by removeRelation().

eZDBInterface::removeRelation   relationName,
  relationType
[pure virtual]
 

Tries to remove the relation type $relationType named $relationName

Returns:
true if successful

Implemented in eZPostgreSQLDB.

Definition at line ezdbinterface.php.

References relationName().

eZDBInterface::reportQuery   class,
  sql,
  numRows,
  timeTaken
[private]
 

Writes a debug notice with query information.

Definition at line ezdbinterface.php.

References eZDebug::writeNotice().

Referenced by eZMySQLDB::query().

eZDBInterface::rollback   [pure virtual]
 

Cancels the transaction.

Implemented in eZPostgreSQLDB.

Definition at line ezdbinterface.php.

eZDBInterface::setError   [pure virtual]
 

Sets the error message and error message number

Implemented in eZMySQLDB.

Definition at line ezdbinterface.php.

eZDBInterface::setIsSQLOutputEnabled   enabled
 

Enabled or disables sql output.

Definition at line ezdbinterface.php.

References OutputSQL.

eZDBInterface::socketPath  
 

Returns:
the socket path for the database or false if no socket path was defined.

Definition at line ezdbinterface.php.

References SocketPath.

Referenced by eZMySQLDB::eZMySQLDB().

eZDBInterface::startTime   [private]
 

Returns:
the micro time when the timer was start or false if no timer.

Definition at line ezdbinterface.php.

References StartTime.

eZDBInterface::startTimer   [private]
 

Records the current micro time. End the timer with endTimer() and fetch the result with timeTaken();

Definition at line ezdbinterface.php.

References StartTime.

Referenced by eZMySQLDB::query().

eZDBInterface::supportedRelationTypeMask   [pure virtual]
 

Returns:
a mask of the relation type it supports.

Implemented in eZPostgreSQLDB.

Definition at line ezdbinterface.php.

eZDBInterface::supportedRelationTypes   [pure virtual]
 

Returns:
an array of the relation types.

Implemented in eZPostgreSQLDB.

Definition at line ezdbinterface.php.

eZDBInterface::timeTaken   [private]
 

Returns:
the number of milliseconds the last operation took or false if no value.

Definition at line ezdbinterface.php.

References TimeTaken.

Referenced by reportQuery().

eZDBInterface::unlock   [pure virtual]
 

Releases table locks.

Implemented in eZPostgreSQLDB.

Definition at line ezdbinterface.php.

eZDBInterface::usesBuiltinEncoding  
 

Returns true if the database handles encoding itself, if not all queries and returned data must be decoded yourselves.

Note:
This functionality might be removed in the future

Definition at line ezdbinterface.php.

References UseBuiltinEncoding.


Member Data Documentation

eZDBInterface::Server [protected]
 

Contains the current server

Definition at line ezdbinterface.php.

Referenced by eZPostgreSQLDB::eZPostgreSQLDB().


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

Exponential