eZ Publish  [4.2]
eZMySQLDB Class Reference

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

+ Inheritance diagram for eZMySQLDB:
+ Collaboration diagram for eZMySQLDB:

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)
 eZMySQLDB ($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
 $TempTableList

Private Member Functions

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

Detailed Description

The eZMySQLDB class provides MySQL implementation of the database interface.

eZMySQLDB is the MySQL implementation of eZDB.

See also:
eZDB

Definition at line 41 of file ezmysqldb.php.


Member Function Documentation

eZMySQLDB::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 476 of file ezmysqldb.php.

eZMySQLDB::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 831 of file ezmysqldb.php.

eZMySQLDB::beginQuery ( )

The query to start the transaction.

Reimplemented from eZDBInterface.

Definition at line 746 of file ezmysqldb.php.

eZMySQLDB::bindingType ( ) [virtual]

Returns type of binding used in database plugin.

Implements eZDBInterface.

Definition at line 214 of file ezmysqldb.php.

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

Binds variable.

Implements eZDBInterface.

Definition at line 219 of file ezmysqldb.php.

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

Implements eZDBInterface.

Definition at line 583 of file ezmysqldb.php.

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

Implements eZDBInterface.

Definition at line 588 of file ezmysqldb.php.

eZMySQLDB::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 235 of file ezmysqldb.php.

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

Definition at line 264 of file ezmysqldb.php.

Referenced by checkCharset().

eZMySQLDB::close ( ) [virtual]

Will close the database connection.

Implements eZDBInterface.

Definition at line 790 of file ezmysqldb.php.

eZMySQLDB::commitQuery ( )

The query to commit the transaction.

Reimplemented from eZDBInterface.

Definition at line 754 of file ezmysqldb.php.

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

Implements eZDBInterface.

Definition at line 572 of file ezmysqldb.php.

eZMySQLDB::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 116 of file ezmysqldb.php.

Referenced by eZMySQLDB().

eZMySQLDB::createDatabase ( dbName) [virtual]

Create a new database

Implements eZDBInterface.

Definition at line 799 of file ezmysqldb.php.

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

Implements eZDBInterface.

Definition at line 874 of file ezmysqldb.php.

eZMySQLDB::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 209 of file ezmysqldb.php.

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

Reimplemented from eZDBInterface.

Definition at line 864 of file ezmysqldb.php.

Referenced by availableDatabases(), checkCharset(), connect(), and isCharsetSupported().

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

Drop temporary table

Reimplemented from eZDBInterface.

Definition at line 906 of file ezmysqldb.php.

eZMySQLDB::escapeString ( str) [virtual]

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

Implements eZDBInterface.

Definition at line 778 of file ezmysqldb.php.

eZMySQLDB::eZMySQLDB ( parameters)

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

Connect to master server

Definition at line 46 of file ezmysqldb.php.

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

Implements eZDBInterface.

Definition at line 654 of file ezmysqldb.php.

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

Reimplemented from eZDBInterface.

Definition at line 884 of file ezmysqldb.php.

Referenced by connect().

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

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

Implements eZDBInterface.

Definition at line 767 of file ezmysqldb.php.

eZMySQLDB::lock ( table) [virtual]

Locks a table

Implements eZDBInterface.

Definition at line 710 of file ezmysqldb.php.

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

Implements eZDBInterface.

Definition at line 578 of file ezmysqldb.php.

eZMySQLDB::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 314 of file ezmysqldb.php.

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

eZMySQLDB::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 611 of file ezmysqldb.php.

Referenced by relationCounts().

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

Implements eZDBInterface.

Definition at line 603 of file ezmysqldb.php.

eZMySQLDB::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 630 of file ezmysqldb.php.

eZMySQLDB::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 688 of file ezmysqldb.php.

eZMySQLDB::removeDatabase ( dbName) [virtual]

Removes a database

Implements eZDBInterface.

Definition at line 808 of file ezmysqldb.php.

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

Tries to remove the relation type $relationType named $relationName

Returns:
true if successful

Implements eZDBInterface.

Definition at line 693 of file ezmysqldb.php.

eZMySQLDB::rollbackQuery ( )

The query to cancel the transaction.

Reimplemented from eZDBInterface.

Definition at line 762 of file ezmysqldb.php.

eZMySQLDB::setError ( ) [virtual]

Sets the error message and error message number

Implements eZDBInterface.

Definition at line 817 of file ezmysqldb.php.

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

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

Implements eZDBInterface.

Definition at line 561 of file ezmysqldb.php.

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

Implements eZDBInterface.

Definition at line 593 of file ezmysqldb.php.

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

Implements eZDBInterface.

Definition at line 598 of file ezmysqldb.php.

eZMySQLDB::supportsDefaultValuesInsertion ( )

Reimplemented from eZDBInterface.

Definition at line 901 of file ezmysqldb.php.

eZMySQLDB::unlock ( ) [virtual]

Releases table locks.

Implements eZDBInterface.

Definition at line 735 of file ezmysqldb.php.


Member Data Documentation

eZMySQLDB::$CharsetMapping

Definition at line 912 of file ezmysqldb.php.

eZMySQLDB::$TempTableList

Definition at line 913 of file ezmysqldb.php.


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