eZ Publish  [4.2]
eZMySQLiDB Class Reference

The eZMySQLiDB class provides MySQL implementation of the database interface. More...

+ Inheritance diagram for eZMySQLiDB:
+ Collaboration diagram for eZMySQLiDB:

List of all members.

Public Member Functions

 arrayQuery ($sql, $params=array(), $server=false)
 availableDatabases ()
 beginQuery ()
 bindingType ()
 bindVariable ($value, $fieldDef=false)
 bitAnd ($arg1, $arg2)
 bitOr ($arg1, $arg2)
 checkCharset ($charset, &$currentCharset)
 close ()
 commitQuery ()
 concatString ($strings=array())
 createDatabase ($dbName)
 databaseClientVersion ()
 databaseName ()
 databaseServerVersion ()
 dropTempTable ($dropTableQuery= '', $server=self::SERVER_SLAVE)
 escapeString ($str)
 eZMySQLiDB ($parameters)
 eZTableList ($server=eZDBInterface::SERVER_MASTER)
 isCharsetSupported ($charset)
 lastSerialID ($table=false, $column=false)
 lock ($table)
 md5 ($str)
 query ($sql, $server=false)
 relationCount ($relationType=eZDBInterface::RELATION_TABLE)
 relationCounts ($relationMask)
 relationList ($relationType=eZDBInterface::RELATION_TABLE)
 relationMatchRegexp ($relationType)
 removeDatabase ($dbName)
 removeRelation ($relationName, $relationType)
 rollbackQuery ()
 setError ()
 subString ($string, $from, $len=null)
 supportedRelationTypeMask ()
 supportedRelationTypes ()
 supportsDefaultValuesInsertion ()
 unlock ()

Public Attributes

 $CharsetMapping

Protected Attributes

 $TempTableList

Private Member Functions

 checkCharsetPriv ($charset, &$currentCharset)
 connect ($server, $db, $user, $password, $socketPath, $charset=null, $port=false)

Detailed Description

The eZMySQLiDB class provides MySQL implementation of the database interface.

eZMySQLiDB is the MySQL implementation of eZDB.

See also:
eZDB

Definition at line 42 of file ezmysqlidb.php.


Member Function Documentation

eZMySQLiDB::arrayQuery ( sql,
params = array(),
server = false 
) [virtual]

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

Parameters:
$sqlSQL query to execute.
$paramsAssociative array containing extra parameters, can contain:
  • offset - The offset of the query.
  • limit - The limit of the query.
  • column - Limit returned row arrays to only contain this column.
$serverWhich server to execute the query on, either eZDBInterface::SERVER_MASTER or eZDBInterface::SERVER_SLAVE

An example would be:

      $db->arrayQuery( 'SELECT * FROM eztable', array( 'limit' => 10, 'offset' => 5 ) );

Implements eZDBInterface.

Definition at line 461 of file ezmysqlidb.php.

eZMySQLiDB::availableDatabases ( )

Return alvailable databases in database.

Returns:
array of available databases, null of none available false if listing databases not supported by database

Reimplemented from eZDBInterface.

Definition at line 807 of file ezmysqlidb.php.

eZMySQLiDB::beginQuery ( )

The query to start the transaction.

Reimplemented from eZDBInterface.

Definition at line 721 of file ezmysqlidb.php.

eZMySQLiDB::bindingType ( ) [virtual]

Returns type of binding used in database plugin.

Implements eZDBInterface.

Definition at line 198 of file ezmysqlidb.php.

eZMySQLiDB::bindVariable ( value,
fieldDef = false 
) [virtual]

Binds variable.

Implements eZDBInterface.

Definition at line 203 of file ezmysqlidb.php.

eZMySQLiDB::bitAnd ( arg1,
arg2 
) [virtual]
Returns:
a sql-expression(string) to generate a bit and of the argument.

Implements eZDBInterface.

Definition at line 568 of file ezmysqlidb.php.

eZMySQLiDB::bitOr ( arg1,
arg2 
) [virtual]
Returns:
a sql-expression(string) to generate a bit and of the argument.

Implements eZDBInterface.

Definition at line 573 of file ezmysqlidb.php.

eZMySQLiDB::checkCharset ( charset,
&$  currentCharset 
)

Checks if the requested character set matches the one used in the database.

Returns:
true if it matches or false if it differs.
Parameters:
[out]$currentCharsetThe charset that the database uses. will only be set if the match fails. Note: This will be specific to the database.
Note:
There will be no check for databases using MySQL 4.1.0 or lower since they do not have proper character set handling.

Reimplemented from eZDBInterface.

Definition at line 219 of file ezmysqlidb.php.

eZMySQLiDB::checkCharsetPriv ( charset,
&$  currentCharset 
) [private]

Definition at line 248 of file ezmysqlidb.php.

Referenced by checkCharset().

eZMySQLiDB::close ( ) [virtual]

Will close the database connection.

Implements eZDBInterface.

Definition at line 766 of file ezmysqlidb.php.

eZMySQLiDB::commitQuery ( )

The query to commit the transaction.

Reimplemented from eZDBInterface.

Definition at line 729 of file ezmysqlidb.php.

eZMySQLiDB::concatString ( strings = array()) [virtual]
Returns:
a sql-expression(string) to concatenate strings.

Implements eZDBInterface.

Definition at line 557 of file ezmysqlidb.php.

eZMySQLiDB::connect ( server,
db,
user,
password,
socketPath,
charset = null,
port = false 
) [private]

Opens a new connection to a MySQL database and returns the connection

Definition at line 117 of file ezmysqlidb.php.

Referenced by eZMySQLiDB().

eZMySQLiDB::createDatabase ( dbName) [virtual]

Create a new database

Implements eZDBInterface.

Definition at line 775 of file ezmysqlidb.php.

eZMySQLiDB::databaseClientVersion ( ) [virtual]
Returns:
the version of the database client or false if no version could be retrieved/

Implements eZDBInterface.

Definition at line 851 of file ezmysqlidb.php.

eZMySQLiDB::databaseName ( ) [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'.

Implements eZDBInterface.

Definition at line 193 of file ezmysqlidb.php.

eZMySQLiDB::databaseServerVersion ( )
Returns:
the version of the database server or false if no version could be retrieved/

Reimplemented from eZDBInterface.

Definition at line 836 of file ezmysqlidb.php.

Referenced by checkCharset().

eZMySQLiDB::dropTempTable ( dropTableQuery = '',
server = self::SERVER_SLAVE 
)

Drop temporary table

Reimplemented from eZDBInterface.

Definition at line 871 of file ezmysqlidb.php.

eZMySQLiDB::escapeString ( str) [virtual]

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

Implements eZDBInterface.

Definition at line 753 of file ezmysqlidb.php.

eZMySQLiDB::eZMySQLiDB ( parameters)

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

Connect to master server

Definition at line 47 of file ezmysqlidb.php.

eZMySQLiDB::eZTableList ( server = eZDBInterface::SERVER_MASTER) [virtual]
Returns:
existing ez publish tables in database

Implements eZDBInterface.

Definition at line 633 of file ezmysqlidb.php.

eZMySQLiDB::isCharsetSupported ( charset)
Returns:
true if the charset $charset is supported by the connected database.

Reimplemented from eZDBInterface.

Definition at line 861 of file ezmysqlidb.php.

Referenced by connect().

eZMySQLiDB::lastSerialID ( table = false,
column = false 
) [virtual]

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

Implements eZDBInterface.

Definition at line 742 of file ezmysqlidb.php.

eZMySQLiDB::lock ( table) [virtual]

Locks a table

Implements eZDBInterface.

Definition at line 685 of file ezmysqlidb.php.

eZMySQLiDB::md5 ( str) [virtual]
Returns:
a sql-expression(string) to generate a md5 sum of the string.

Implements eZDBInterface.

Definition at line 563 of file ezmysqlidb.php.

eZMySQLiDB::query ( sql,
server = false 
) [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.

Parameters:
$sqlSQL query to execute.

Implements eZDBInterface.

Definition at line 298 of file ezmysqlidb.php.

Referenced by arrayQuery(), beginQuery(), commitQuery(), createDatabase(), lock(), removeDatabase(), removeRelation(), rollbackQuery(), and unlock().

eZMySQLiDB::relationCount ( relationType = eZDBInterface::RELATION_TABLE) [virtual]
Returns:
the number of relation objects in the database for the relation type $relationType.

Implements eZDBInterface.

Definition at line 596 of file ezmysqlidb.php.

Referenced by relationCounts().

eZMySQLiDB::relationCounts ( relationMask) [virtual]
Returns:
the relation count for all relation types in the mask $relationMask.

Implements eZDBInterface.

Definition at line 588 of file ezmysqlidb.php.

eZMySQLiDB::relationList ( relationType = eZDBInterface::RELATION_TABLE) [virtual]
Returns:
the relation names in the database as an array for the relation type $relationType.

Implements eZDBInterface.

Definition at line 613 of file ezmysqlidb.php.

eZMySQLiDB::relationMatchRegexp ( relationType) [virtual]
Returns:
A regexp (PCRE) that can be used to filter out certain relation elements. If no special regexp is provided it will return false.
Parameters:
$relationTypeThe type which needs to be filtered, this allows one regexp per type.

An example, will only match tables that start with 'ez'.

     return "#^ez#";
Note:
This function is currently used by the eZDBTool class to remove relation elements of a specific kind (Most likely eZ Publish related elements).

Implements eZDBInterface.

Definition at line 663 of file ezmysqlidb.php.

eZMySQLiDB::removeDatabase ( dbName) [virtual]

Removes a database

Implements eZDBInterface.

Definition at line 784 of file ezmysqlidb.php.

eZMySQLiDB::removeRelation ( relationName,
relationType 
) [virtual]

Tries to remove the relation type $relationType named $relationName

Returns:
true if successful

Implements eZDBInterface.

Definition at line 668 of file ezmysqlidb.php.

eZMySQLiDB::rollbackQuery ( )

The query to cancel the transaction.

Reimplemented from eZDBInterface.

Definition at line 737 of file ezmysqlidb.php.

eZMySQLiDB::setError ( ) [virtual]

Sets the error message and error message number

Implements eZDBInterface.

Definition at line 793 of file ezmysqlidb.php.

Referenced by checkCharsetPriv(), connect(), createDatabase(), query(), and removeDatabase().

eZMySQLiDB::subString ( string,
from,
len = null 
) [virtual]
Returns:
a sql-expression(string) to get substring.

Implements eZDBInterface.

Definition at line 546 of file ezmysqlidb.php.

eZMySQLiDB::supportedRelationTypeMask ( ) [virtual]
Returns:
a mask of the relation type it supports.

Implements eZDBInterface.

Definition at line 578 of file ezmysqlidb.php.

eZMySQLiDB::supportedRelationTypes ( ) [virtual]
Returns:
an array of the relation types.

Implements eZDBInterface.

Definition at line 583 of file ezmysqlidb.php.

eZMySQLiDB::supportsDefaultValuesInsertion ( )

Reimplemented from eZDBInterface.

Definition at line 866 of file ezmysqlidb.php.

eZMySQLiDB::unlock ( ) [virtual]

Releases table locks.

Implements eZDBInterface.

Definition at line 710 of file ezmysqlidb.php.


Member Data Documentation

eZMySQLiDB::$CharsetMapping

Definition at line 877 of file ezmysqlidb.php.

eZMySQLiDB::$TempTableList [protected]

Definition at line 878 of file ezmysqlidb.php.


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