Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Public Attributes | Protected Attributes | List of all members
eZDBInterface Class Reference
Inheritance diagram for eZDBInterface:

## Public Member Functions
| __construct ( $parameters)
| attributes ()
| hasAttribute ( $name)
| attribute ( $name)
| checkCharset ( $charset, &$currentCharset)
| prepareSqlQuery (&$fd, &$buffer)
| insertFile ( $path, $sqlFile, $usePathType=true)
| reportQuery ( $class, $sql, $numRows, $timeTaken, $asDebug=false)
| setIsSQLOutputEnabled ( $enabled)
| startTimer ()
| endTimer ()
| startTime ()
| endTime ()
| timeTaken ()
| databaseName ()
| socketPath ()
| connectRetryCount ()
| connectRetryWaitTime ()
| supportedRelationTypeMask ()
| useShortNames ()
| supportedRelationTypes ()
| subString ( $string, $from, $len=null)
| concatString ( $strings=array())
| md5 ( $str)
| bitAnd ( $arg1, $arg2)
| bitOr ( $arg1, $arg2)
| hasRequiredServerVersion ( $minVersion, $name=false)
| databaseServerVersion ()
| databaseClientVersion ()
| isCharsetSupported ( $charset)
| charset ()
| usesBuiltinEncoding ()
| bindingType ()
| bindVariable ( $value, $fieldDef=false)
| query ( $sql, $server=false)
| arrayQuery ( $sql, $params=array(), $server=false)
| lock ( $table)
| unlock ()
| begin ()
| beginQuery ()
| commit ()
| commitQuery ()
| rollback ()
| generateFailedTransactionStack ()
| generateFailedTransactionStackEntry ( $stack, $indentCount)
| generateTraceEntry ( $entry)
| rollbackQuery ()
| invalidateTransaction ()
| reportError ()
| isTransactionValid ()
| transactionCounter ()
| relationCounts ( $relationMask)
| relationCount ( $relationType=eZDBInterface::RELATION_TABLE)
| eZTableList ( $server=self::SERVER_MASTER)
| relationList ( $relationType=eZDBInterface::RELATION_TABLE)
| removeRelation ( $relationName, $relationType)
| relationName ( $relationType)
| relationMatchRegexp ( $relationType)
| implodeWithTypeCast ( $glue, &$pieces, $type)
| lastSerialID ( $table=false, $column=false)
| escapeString ( $str)
| close ()
| isConnected ()
| createDatabase ( $dbName)
| removeDatabase ( $dbName)
| createTempTable ( $createTableQuery='', $server=self::SERVER_SLAVE)
| dropTempTable ( $dropTableQuery='', $server=self::SERVER_SLAVE)
| dropTempTableList ( $tableList, $server=self::SERVER_SLAVE)
| setError ()
| errorMessage ()
| errorNumber ()
| availableDatabases ()
| generateUniqueTempTableName ( $pattern, $randomizeIndex=false, $server=self::SERVER_SLAVE)
| version ()
| generateSQLINStatement ( $elements, $columnName='', $not=false, $unique=true, $type=false)
| supportsDefaultValuesInsertion ()
| setErrorHandling ( $errorHandling)
| truncateString ( $string, $maxLength, $fieldName, $truncationSuffix='')
| countStringSize ( $string)

## Public Attributes
const | BINDING_NO = 0
const | BINDING_NAME = 1
const | BINDING_ORDERED = 2
const | RELATION_TABLE = 0
const | RELATION_SEQUENCE = 1
const | RELATION_TRIGGER = 2
const | RELATION_VIEW = 3
const | RELATION_INDEX = 4
const | RELATION_TABLE_BIT = 1
const | RELATION_SEQUENCE_BIT = 2
const | RELATION_TRIGGER_BIT = 4
const | RELATION_VIEW_BIT = 8
const | RELATION_INDEX_BIT = 16
const | RELATION_NONE = 0
const | RELATION_MASK = 31
const | ERROR_MISSING_EXTENSION = 1
const | SERVER_MASTER = 1
const | SERVER_SLAVE = 2
const | MAX_INT = 2147483647
const | MIN_INT = -2147483648
| $Server
| $Port
| $SocketPath
| $DB
| $DBConnection
| $DBWriteConnection
| $User
| $Password
| $Charset
| $ConnectRetries
| $OutputTextCodec
| $InputTextCodec
| $UseBuiltinEncoding
| $OutputSQL
| $IsConnected = false
| $NumQueries = 0
| $StartTime
| $EndTime
| $TimeTaken
| $ErrorMessage
| $ErrorNumber = 0
| $RecordError = true
| $UsePersistentConnection = false
| $UseSlaveServer
| $SlaveDB
| $SlaveServer
| $SlavePort
| $SlaveUser
| $SlavePassword
| $TransactionCounter
| $TransactionIsValid
| $TransactionStackTree
| $IsInternalCharset
| $SlowSQLTimeout
| $QueryAnalysisOutput
| $AttributeVariableMap

## Protected Attributes
| $errorHandling = eZDB::ERROR_HANDLING_STANDARD

## Detailed Description

Definition at line 19 of file ezdbinterface.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZDBInterface::__construct | ( |  | $parameters | ) |

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

Parameters

  array | $parameters |

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 64 of file ezdbinterface.php.

References eZTextCodec\instance().

## Member Function Documentation

## ◆ arrayQuery()

eZDBInterface::arrayQuery | ( |  | $sql,
|  |  | $params = `array()`,
|  |  | $server = `false`
| ) |  |

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

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

Parameters

  string | $sql | SQL query to execute.
  array | $params | Associative 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.
  int | bool | $server | Which server to execute the query on, either eZDBInterface::SERVER_MASTER or eZDBInterface::SERVER_SLAVE

Returns
  array

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, eZNullDB, and eZMySQLiDB.

Definition at line 681 of file ezdbinterface.php.

## ◆ attribute()

eZDBInterface::attribute | ( |  | $name | ) |

Returns the value of the attribute $name if it exists, otherwise null.

Parameters

  string | $name |

Returns
  null

Definition at line 206 of file ezdbinterface.php.

References eZDebug\writeError().

## ◆ attributes()

eZDBInterface::attributes | ( |  | ) |

Returns the available attributes for this database handler.

Returns
  array

Definition at line 180 of file ezdbinterface.php.

## ◆ availableDatabases()

eZDBInterface::availableDatabases | ( |  | ) |

Returns an array of available databases in the database, null of none available, false if listing databases not supported by database

Returns
  array|null|bool

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 1399 of file ezdbinterface.php.

## ◆ begin()

eZDBInterface::begin | ( |  | ) |

Begin a new transaction.

If we are already in transaction then we omit this new transaction and its matching commit or rollback.

Returns
  bool

Reimplemented in eZNullDB.

Definition at line 710 of file ezdbinterface.php.

References $RecordError, $TransactionCounter, beginQuery(), and isConnected().

Referenced by eZPostgreSQLDB\lock().

## ◆ beginQuery()

eZDBInterface::beginQuery | ( |  | ) |

The query to start a transaction.

This function must be reimplemented in the subclasses.

Returns
  bool

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 770 of file ezdbinterface.php.

Referenced by begin().

## ◆ bindingType()

eZDBInterface::bindingType | ( |  | ) |

Returns type of binding used in database plugin.

Returns
  int

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 638 of file ezdbinterface.php.

## ◆ bindVariable()

eZDBInterface::bindVariable | ( |  | $value,
|  |  | $fieldDef = `false`
| ) |  |

Binds variable.

Parameters

  mixed | $value |
  mixed | $fieldDef |

Returns
  mixed

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 649 of file ezdbinterface.php.

## ◆ bitAnd()

eZDBInterface::bitAnd | ( |  | $arg1,
|  |  | $arg2
| ) |  |

Returns a sql-expression(string) to generate a bit and of the argument.

Parameters

  string | $arg1 |
  string | $arg2 |

Returns
  string

Reimplemented in eZSQLite3DB, and eZMySQLiDB.

Definition at line 544 of file ezdbinterface.php.

## ◆ bitOr()

eZDBInterface::bitOr | ( |  | $arg1,
|  |  | $arg2
| ) |  |

Returns a sql-expression(string) to generate a bit and of the argument.

Parameters

  string | $arg1 |
  string | $arg2 |

Returns
  string

Reimplemented in eZSQLite3DB, and eZMySQLiDB.

Definition at line 556 of file ezdbinterface.php.

## ◆ charset()

eZDBInterface::charset | ( |  | ) |

Returns the charset which the database is encoded in.

See also
  usesBuiltinEncoding()

Returns
  string

Definition at line 616 of file ezdbinterface.php.

References $Charset.

## ◆ checkCharset()

eZDBInterface::checkCharset | ( |  | $charset,
|  | & | $currentCharset
| ) |  |

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

The default is to always return true, see the specific database handler for more information.

Parameters

  string | array | $charset |
  string | $currentCharset | The charset that the database uses, will only be set if the match fails.

Returns
  bool true if it matches or false if it differs.

Reimplemented in eZSQLite3DB, and eZMySQLiDB.

Definition at line 229 of file ezdbinterface.php.

## ◆ close()

eZDBInterface::close | ( |  | ) |

Will close the database connection.

Returns
  void

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, eZNullDB, and eZMySQLiDB.

Definition at line 1294 of file ezdbinterface.php.

## ◆ commit()

eZDBInterface::commit | ( |  | ) |

Commits the current transaction. If this is not the outermost it will not commit to the database immediately but instead decrease the transaction counter.

If the current transaction had any errors in it the transaction will be rollbacked instead of commited. This ensures that the database is in a valid state. Also the PHP execution will be stopped.

Returns
  bool true if the transaction was successful, false otherwise.

Reimplemented in eZNullDB.

Definition at line 785 of file ezdbinterface.php.

References $RecordError, $TransactionCounter, commitQuery(), isConnected(), rollbackQuery(), and eZDebug\writeError().

Referenced by eZPostgreSQLDB\unlock().

## ◆ commitQuery()

eZDBInterface::commitQuery | ( |  | ) |

The query to commit the transaction.

This function must be reimplemented in the subclasses.

Returns
  bool

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 854 of file ezdbinterface.php.

Referenced by commit().

## ◆ concatString()

eZDBInterface::concatString | ( |  | $strings = `array()` | ) |

Returns a sql-expression(string) to concatenate strings.

Parameters

  array | $strings |

Returns
  string

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 521 of file ezdbinterface.php.

## ◆ connectRetryCount()

eZDBInterface::connectRetryCount | ( |  | ) |

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

Returns
  int

Definition at line 458 of file ezdbinterface.php.

References $ConnectRetries.

Referenced by eZPostgreSQLDB\__construct(), eZSQLite3DB\connect(), and eZMySQLiDB\connect().

## ◆ connectRetryWaitTime()

eZDBInterface::connectRetryWaitTime | ( |  | ) |

Returns the number of seconds the db handler should wait before rereconnecting.

Returns
  int

Definition at line 468 of file ezdbinterface.php.

Referenced by eZPostgreSQLDB\__construct(), eZSQLite3DB\connect(), and eZMySQLiDB\connect().

## ◆ countStringSize()

eZDBInterface::countStringSize | ( |  | $string | ) |

Returns the size of the $string

This method is meant to be overridden if needed by different DB implementation: for example oracle handles bytes and not char

Parameters

  $string |

Returns
  int

Definition at line 1559 of file ezdbinterface.php.

## ◆ createDatabase()

eZDBInterface::createDatabase | ( |  | $dbName | ) |

Create a new database

Parameters

  string | $dbName |

Returns
  void

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 1315 of file ezdbinterface.php.

## ◆ createTempTable()

eZDBInterface::createTempTable | ( |  | $createTableQuery = `''`,
|  |  | $server = `self::SERVER_SLAVE`
| ) |  |

Create a new temporary table

Parameters

  string | $createTableQuery |
  int | $server |

Definition at line 1335 of file ezdbinterface.php.

References query().

## ◆ databaseClientVersion()

eZDBInterface::databaseClientVersion | ( |  | ) |

Returns the version of the database client or false if no version could be retrieved/

Returns
  string|bool

Reimplemented in eZSQLite3DB, and eZMySQLiDB.

Definition at line 595 of file ezdbinterface.php.

## ◆ databaseName()

eZDBInterface::databaseName | ( |  | ) |

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'.

Returns
  string

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, eZNullDB, and eZMySQLiDB.

Definition at line 438 of file ezdbinterface.php.

Referenced by hasRequiredServerVersion(), and insertFile().

## ◆ databaseServerVersion()

eZDBInterface::databaseServerVersion | ( |  | ) |

Returns the version of the database server or false if no version could be retrieved/

Returns
  string|bool

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 586 of file ezdbinterface.php.

Referenced by hasRequiredServerVersion().

## ◆ dropTempTable()

eZDBInterface::dropTempTable | ( |  | $dropTableQuery = `''`,
|  |  | $server = `self::SERVER_SLAVE`
| ) |  |

Drop temporary table

Parameters

  string | $dropTableQuery |
  int | $server |

Returns
  void

Reimplemented in eZMySQLiDB.

Definition at line 1347 of file ezdbinterface.php.

References query().

Referenced by dropTempTableList().

## ◆ dropTempTableList()

eZDBInterface::dropTempTableList | ( |  | $tableList,
|  |  | $server = `self::SERVER_SLAVE`
| ) |  |

Drop temporary table list

Parameters

  array | $tableList |
  int | $server |

Definition at line 1358 of file ezdbinterface.php.

References dropTempTable().

## ◆ endTime()

eZDBInterface::endTime | ( |  | ) |

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

@access private

Returns
  bool|float

Definition at line 415 of file ezdbinterface.php.

References $EndTime.

## ◆ endTimer()

eZDBInterface::endTimer | ( |  | ) |

Stops the current timer and calculates the time taken.

@access private

Definition at line 390 of file ezdbinterface.php.

References $StartTime.

Referenced by eZSQLite3DB\arrayQuery(), eZMySQLiDB\query(), eZPostgreSQLDB\query(), and eZSQLite3DB\query().

## ◆ errorMessage()

eZDBInterface::errorMessage | ( |  | ) |

Returns the error message

Returns
  string

Definition at line 1378 of file ezdbinterface.php.

References $ErrorMessage.

## ◆ errorNumber()

eZDBInterface::errorNumber | ( |  | ) |

Returns the error number

Returns
  int

Definition at line 1388 of file ezdbinterface.php.

References $ErrorNumber.

Referenced by eZMySQLiDB\availableDatabases(), and insertFile().

## ◆ escapeString()

eZDBInterface::escapeString | ( |  | $str | ) |

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

Parameters

  string | $str |

Returns
  string mixed

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, eZNullDB, and eZMySQLiDB.

Definition at line 1284 of file ezdbinterface.php.

## ◆ eZTableList()

eZDBInterface::eZTableList | ( |  | $server = `self::SERVER_MASTER` | ) |

Returns the existing ez publish tables in database

Parameters

  int | $server |

Returns
  array

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 1171 of file ezdbinterface.php.

Referenced by generateUniqueTempTableName().

## ◆ generateFailedTransactionStack()

eZDBInterface::generateFailedTransactionStack | ( |  | ) |

Goes through the transaction stack tree {

See also
  eZDBInterface::$TransactionStackTree}, generates the text output for it and returns it.

Returns
  bool|string The generated string or false if it is disabled.

Definition at line 902 of file ezdbinterface.php.

References generateFailedTransactionStackEntry().

## ◆ generateFailedTransactionStackEntry()

eZDBInterface::generateFailedTransactionStackEntry | ( |  | $stack,
|  |  | $indentCount
| ) |  |

Recursive helper function for generating stack tree output.

@access private

Parameters

  array | $stack |
  int | $indentCount |

Returns
  string The generated string

Definition at line 919 of file ezdbinterface.php.

References generateTraceEntry().

Referenced by generateFailedTransactionStack().

## ◆ generateSQLINStatement()

eZDBInterface::generateSQLINStatement | ( |  | $elements,
|  |  | $columnName = `''`,
|  |  | $not = `false`,
|  |  | $unique = `true`,
|  |  | $type = `false`
| ) |  |

This function can be used to create a SQL IN statement to be used in a WHERE clause:

WHERE columnName IN ( element1, element2, ... ) By default, the elements that can be submitted as an anonymous array (or an integer value in case of a single element) will just be imploded. Drivers for databases with a limitation of the elements within an IN statement have to reimplement this function. It is also possible to negate the "IN" to a "NOT IN" by using the last parameter of this function.

Usage:

$db =& eZDB::instance(); $db->generateSQLINStatement( array( 2, 5, 43, ) );

Parameters

  int | array | $elements | Elements that should (not) be matched by the IN statment as an integer or anonymous array
  string | $columnName | Column name of the database table the IN statement should be created for
  bool | $not | Will generate a "NOT IN" ( if set to true ) statement instead of an "IN" ( if set to false , default )
  | $unique | Wether or not to make the array unique. Not implemented in this class, but can be used by extending classes (oracle does use it)
  | $type | The type to cast the array elements to

Returns
  string A string with the correct IN statement like for example "columnName IN ( element1, element2 )"

Definition at line 1477 of file ezdbinterface.php.

References implodeWithTypeCast().

## ◆ generateTraceEntry()

eZDBInterface::generateTraceEntry | ( |  | $entry | ) |

Helper function for generating output for one stack-trace entry.

@access private

Parameters

  array | $entry |

Returns
  string The generated string

Definition at line 968 of file ezdbinterface.php.

Referenced by generateFailedTransactionStackEntry().

## ◆ generateUniqueTempTableName()

eZDBInterface::generateUniqueTempTableName | ( |  | $pattern,
|  |  | $randomizeIndex = `false`,
|  |  | $server = `self::SERVER_SLAVE`
| ) |  |

Generate unique table name basing on the given pattern.

If the pattern contains a (%) character then the character is replaced with a part providing uniqueness (e.g. random number).

Parameters

  string | $pattern |
  bool | $randomizeIndex |
  int | $server |

Returns
  string

Definition at line 1420 of file ezdbinterface.php.

References eZTableList().

## ◆ hasAttribute()

eZDBInterface::hasAttribute | ( |  | $name | ) |

Returns true if the attribute $name exists for this database handler.

Parameters

  string | $name |

Returns
  bool

Definition at line 191 of file ezdbinterface.php.

## ◆ hasRequiredServerVersion()

eZDBInterface::hasRequiredServerVersion | ( |  | $minVersion,
|  |  | $name = `false`
| ) |  |

Checks if the version number of the server is equal or larger than $minVersion.

Will also check if the database type is correct if $name is set.

Parameters

  string | $minVersion | A string denoting the min. required version.
  string | bool | $name | The name of the database type it requires or false if it does not matter.

Returns
  bool true if the server fulfills the requirements.

Definition at line 570 of file ezdbinterface.php.

References databaseName(), and databaseServerVersion().

## ◆ implodeWithTypeCast()

eZDBInterface::implodeWithTypeCast | ( |  | $glue,
|  | & | $pieces,
|  |  | $type
| ) |  |

Casts elements of $pieces to type $type and returns them as string separated by $glue.

Use {

See also
  generateSQLINStatement()} if you intend to use this for IN statments! Example: `$this->implodeWithTypeCast( ',', $myArray, 'int' );`

Parameters

  string | $glue | The separator.
  array | $pieces | The array containing the elements.
  string | $type | The type to cast to.

Returns
  string

Definition at line 1252 of file ezdbinterface.php.

Referenced by generateSQLINStatement().

## ◆ insertFile()

eZDBInterface::insertFile | ( |  | $path,
|  |  | $sqlFile,
|  |  | $usePathType = `true`
| ) |  |

Inserts the SQL file $sqlFile found in the path $path into the currently connected database.

Parameters

  string | $path |
  string | $sqlFile |
  bool | $usePathType |

Returns
  bool true if succesful.

Definition at line 294 of file ezdbinterface.php.

References $OutputSQL, databaseName(), errorNumber(), eZDir\path(), prepareSqlQuery(), query(), and eZDebug\writeError().

## ◆ invalidateTransaction()

eZDBInterface::invalidateTransaction | ( |  | ) |

Invalidates the current transaction, see {

See also
  commit()} for more details on this.
  isTransactionValid()

Returns
  bool true if it was invalidated or false if there is no transaction to invalidate.

Definition at line 1026 of file ezdbinterface.php.

Referenced by reportError().

## ◆ isCharsetSupported()

eZDBInterface::isCharsetSupported | ( |  | $charset | ) |

Returns true if the charset $charset is supported by the connected database.

Parameters

  string | $charset |

Returns
  bool

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 605 of file ezdbinterface.php.

## ◆ isConnected()

eZDBInterface::isConnected | ( |  | ) |

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

@access protected

Returns
  bool

Definition at line 1304 of file ezdbinterface.php.

References $IsConnected.

Referenced by eZPostgreSQLDB\arrayQuery(), begin(), commit(), eZPostgreSQLDB\correctSequenceValues(), eZPostgreSQLDB\databaseServerVersion(), eZPostgreSQLDB\eZTableList(), eZPostgreSQLDB\lastSerialID(), eZPostgreSQLDB\lock(), eZPostgreSQLDB\query(), eZPostgreSQLDB\relationCount(), eZPostgreSQLDB\relationCounts(), eZPostgreSQLDB\relationList(), eZPostgreSQLDB\removeRelation(), and rollback().

## ◆ isTransactionValid()

eZDBInterface::isTransactionValid | ( |  | ) |

Returns if the current or last running transaction is valid

See also
  invalidateTransaction()

Returns
  bool true if the current or last running transaction was valid, false otherwise

Definition at line 1127 of file ezdbinterface.php.

References $TransactionIsValid.

## ◆ lastSerialID()

eZDBInterface::lastSerialID | ( |  | $table = `false`,
|  |  | $column = `false`
| ) |  |

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

Parameters

  string | bool | $table |
  string | bool | $column |

Returns
  int|bool The most recent value for the sequence

Reimplemented in eZSQLite3DB, eZNullDB, eZMySQLiDB, and eZPostgreSQLDB.

Definition at line 1274 of file ezdbinterface.php.

## ◆ lock()

eZDBInterface::lock | ( |  | $table | ) |

Locks one or several tables

Parameters

  string | array | $table |

Reimplemented in eZPostgreSQLDB, eZNullDB, and eZMySQLiDB.

Definition at line 690 of file ezdbinterface.php.

## ◆ md5()

eZDBInterface::md5 | ( |  | $str | ) |

Returns a sql-expression(string) to generate a md5 sum of the string.

Parameters

  string | $str |

Returns
  string

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 532 of file ezdbinterface.php.

Referenced by reportError().

## ◆ prepareSqlQuery()

eZDBInterface::prepareSqlQuery | ( | & | $fd,
|  | & | $buffer
| ) |  |

Prepare the sql file so we can create the database.

@access private

Parameters

  resource | $fd | The file descriptor
  string | $buffer | Reference to string buffer for SQL queries.

Returns
  array

Definition at line 242 of file ezdbinterface.php.

Referenced by insertFile().

## ◆ query()

eZDBInterface::query | ( |  | $sql,
|  |  | $server = `false`
| ) |  |

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

  string | $sql | SQL query to execute.
  int | bool | $server |

Returns
  mixed

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, eZNullDB, and eZMySQLiDB.

Definition at line 661 of file ezdbinterface.php.

Referenced by createTempTable(), dropTempTable(), and insertFile().

## ◆ relationCount()

eZDBInterface::relationCount | ( |  | $relationType = `eZDBInterface::RELATION_TABLE` | ) |

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

Parameters

  int | $relationType |

Returns
  int

Reimplemented in eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 1161 of file ezdbinterface.php.

## ◆ relationCounts()

eZDBInterface::relationCounts | ( |  | $relationMask | ) |

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

Parameters

  int | $relationMask |

Returns
  int

Reimplemented in eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 1151 of file ezdbinterface.php.

## ◆ relationList()

eZDBInterface::relationList | ( |  | $relationType = `eZDBInterface::RELATION_TABLE` | ) |

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

Parameters

  int | $relationType |

Returns
  array

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 1181 of file ezdbinterface.php.

## ◆ relationMatchRegexp()

eZDBInterface::relationMatchRegexp | ( |  | $relationType | ) |

Return A regexp (PCRE) that can be used to filter out certain relation elements. If no special regexp is provided it will return false.

An example, will only match tables that start with 'ez'. `return "#^ez#";`

This function is currently used by the eZDBTool class to remove relation elements of a specific kind (Most likely eZ Publish related elements).

Parameters

  int | $relationType | The type which needs to be filtered, this allows one regexp per type.

Returns
  bool

Reimplemented in eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 1233 of file ezdbinterface.php.

## ◆ relationName()

eZDBInterface::relationName | ( |  | $relationType | ) |

Returns the name of the relation type which is usable in SQL or false if unknown type.

This function can be used by some database handlers which can operate on relation types using SQL.

@access protected

Parameters

  int | $relationType |

Returns
  bool

Reimplemented in eZMySQLiDB.

Definition at line 1206 of file ezdbinterface.php.

References RELATION_INDEX, RELATION_SEQUENCE, RELATION_TABLE, RELATION_TRIGGER, and RELATION_VIEW.

Referenced by eZPostgreSQLDB\removeRelation(), and eZSQLite3DB\removeRelation().

## ◆ removeDatabase()

eZDBInterface::removeDatabase | ( |  | $dbName | ) |

Removes a database

Parameters

  string | $dbName |

Returns
  void

Reimplemented in eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 1325 of file ezdbinterface.php.

## ◆ removeRelation()

eZDBInterface::removeRelation | ( |  | $relationName,
|  |  | $relationType
| ) |  |

Tries to remove the relation type $relationType named $relationName

Parameters

  string | $relationName |
  int | $relationType |

Returns
  bool true if successful

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 1192 of file ezdbinterface.php.

## ◆ reportError()

eZDBInterface::reportError | ( |  | ) |

This is called whenever an error occurs in one of the database handlers.

If a transaction is active it will be invalidated as well.

@access protected

Exceptions

  eZDBException |

Definition at line 1042 of file ezdbinterface.php.

References eZExecution\cleanup(), eZDB\ERROR_HANDLING_EXCEPTIONS, eZDebug\HANDLE_NONE, invalidateTransaction(), eZSys\isShellExecution(), md5(), eZDebug\printReport(), rollback(), eZSys\serverVariable(), eZExecution\setCleanExit(), eZDebug\setHandleType(), and eZDebug\writeError().

Referenced by eZSQLite3DB\arrayQuery(), eZMySQLiDB\query(), eZPostgreSQLDB\query(), and eZSQLite3DB\query().

## ◆ reportQuery()

eZDBInterface::reportQuery | ( |  | $class,
|  |  | $sql,
|  |  | $numRows,
|  |  | $timeTaken,
|  |  | $asDebug = `false`
| ) |  |

Writes a debug notice with query information.

@access private

Parameters

  string | $class |
  string | $sql |
  int | string | $numRows |
  int | string | $timeTaken |
  bool | $asDebug |

Definition at line 353 of file ezdbinterface.php.

References eZDebug\writeDebug(), and eZDebug\writeNotice().

Referenced by eZMySQLiDB\arrayQuery(), eZSQLite3DB\arrayQuery(), eZMySQLiDB\checkCharsetPriv(), eZMySQLiDB\eZTableList(), eZMySQLiDB\query(), eZPostgreSQLDB\query(), eZSQLite3DB\query(), eZMySQLiDB\relationCount(), and eZMySQLiDB\relationList().

## ◆ rollback()

eZDBInterface::rollback | ( |  | ) |

Cancels the transaction.

Returns
  bool

Reimplemented in eZNullDB.

Definition at line 864 of file ezdbinterface.php.

References $RecordError, isConnected(), rollbackQuery(), and eZDebug\writeError().

Referenced by reportError().

## ◆ rollbackQuery()

eZDBInterface::rollbackQuery | ( |  | ) |

The query to cancel the transaction.

This function must be reimplemented in the subclasses.

Returns
  bool

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 1015 of file ezdbinterface.php.

Referenced by commit(), and rollback().

## ◆ setError()

eZDBInterface::setError | ( |  | ) |

Sets the error message and error message number

Returns
  void

Reimplemented in eZSQLite3DB, and eZPostgreSQLDB.

Definition at line 1369 of file ezdbinterface.php.

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

## ◆ setErrorHandling()

eZDBInterface::setErrorHandling | ( |  | $errorHandling | ) |

Sets the eZDB error handling mode

Parameters

  int | $errorHandling | Possible values are:pm eZDB::ERROR_HANDLING_STANDARD: backward compatible error handling, using reportError eZDB::ERROR_HANDLING_EXCEPTION: using exceptions

Since
  4.5

Definition at line 1515 of file ezdbinterface.php.

References $errorHandling, eZDB\ERROR_HANDLING_EXCEPTIONS, and eZDB\ERROR_HANDLING_STANDARD.

## ◆ setIsSQLOutputEnabled()

eZDBInterface::setIsSQLOutputEnabled | ( |  | $enabled | ) |

Enabled or disables sql output.

Parameters

  bool | $enabled |

Definition at line 370 of file ezdbinterface.php.

## ◆ socketPath()

eZDBInterface::socketPath | ( |  | ) |

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

Returns
  string|bool

Definition at line 448 of file ezdbinterface.php.

References $SocketPath.

## ◆ startTime()

eZDBInterface::startTime | ( |  | ) |

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

@access private

Returns
  bool|float

Definition at line 404 of file ezdbinterface.php.

References $StartTime.

## ◆ startTimer()

eZDBInterface::startTimer | ( |  | ) |

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

@access private

Definition at line 380 of file ezdbinterface.php.

Referenced by eZSQLite3DB\arrayQuery(), eZMySQLiDB\query(), eZPostgreSQLDB\query(), and eZSQLite3DB\query().

## ◆ subString()

eZDBInterface::subString | ( |  | $string,
|  |  | $from,
|  |  | $len = `null`
| ) |  |

Returns a sql-expression(string) to get substring.

Parameters

  string | $string |
  int | $from |
  int | $len |

Returns
  string

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 510 of file ezdbinterface.php.

## ◆ supportedRelationTypeMask()

eZDBInterface::supportedRelationTypeMask | ( |  | ) |

Returns a mask of the relation type it supports.

Returns
  int

Reimplemented in eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 478 of file ezdbinterface.php.

References RELATION_NONE.

## ◆ supportedRelationTypes()

eZDBInterface::supportedRelationTypes | ( |  | ) |

Returns an array of the relation types.

Returns
  array

Reimplemented in eZSQLite3DB, eZPostgreSQLDB, and eZMySQLiDB.

Definition at line 497 of file ezdbinterface.php.

## ◆ supportsDefaultValuesInsertion()

eZDBInterface::supportsDefaultValuesInsertion | ( |  | ) |

Returns true if the database handler support the insertion of default values, false if not

Returns
  bool

Reimplemented in eZMySQLiDB.

Definition at line 1502 of file ezdbinterface.php.

## ◆ timeTaken()

eZDBInterface::timeTaken | ( |  | ) |

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

@access private

Returns
  bool|float

Definition at line 426 of file ezdbinterface.php.

References $TimeTaken.

Referenced by eZSQLite3DB\arrayQuery(), eZMySQLiDB\query(), eZPostgreSQLDB\query(), and eZSQLite3DB\query().

## ◆ transactionCounter()

eZDBInterface::transactionCounter | ( |  | ) |

Returns the current transaction counter.

0 means no transactions, 1 or higher means 1 or more transactions are running and a negative value means something is wrong.

Returns
  int

Definition at line 1140 of file ezdbinterface.php.

References $TransactionCounter.

## ◆ truncateString()

eZDBInterface::truncateString | ( |  | $string,
|  |  | $maxLength,
|  |  | $fieldName,
|  |  | $truncationSuffix = `''`
| ) |  |

Truncates a $string to a $maxLength

This method is meant to be overridden if needed by different DB implementation: for example oracle handles bytes and not char

Parameters

  $string |
  $maxLength |
  $fieldName |
  $truncationSuffix | string to be added at the end, room will be left so it can be added later.

Returns
  string

Definition at line 1537 of file ezdbinterface.php.

References eZDebug\writeDebug().

## ◆ unlock()

eZDBInterface::unlock | ( |  | ) |

Releases table locks.

Returns
  void

Reimplemented in eZPostgreSQLDB, eZNullDB, and eZMySQLiDB.

Definition at line 699 of file ezdbinterface.php.

## ◆ usesBuiltinEncoding()

eZDBInterface::usesBuiltinEncoding | ( |  | ) |

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

This functionality might be removed in the future

Returns
  bool

Definition at line 628 of file ezdbinterface.php.

References $UseBuiltinEncoding.

## ◆ useShortNames()

eZDBInterface::useShortNames | ( |  | ) |

Returns if the short column names should be used insted of default ones

Returns
  bool

Definition at line 488 of file ezdbinterface.php.

Referenced by eZPersistentObject\replaceFieldsWithLongNames(), and eZPersistentObject\replaceFieldsWithShortNames().

## ◆ version()

eZDBInterface::version | ( |  | ) |

Get database version number

Returns
  string|bool Version number, false if not supported

Definition at line 1441 of file ezdbinterface.php.

## Member Data Documentation

## ◆ $AttributeVariableMap

eZDBInterface::$AttributeVariableMap

Definition at line 1833 of file ezdbinterface.php.

## ◆ $Charset

eZDBInterface::$Charset

Definition at line 1637 of file ezdbinterface.php.

Referenced by charset().

## ◆ $ConnectRetries

eZDBInterface::$ConnectRetries

Definition at line 1645 of file ezdbinterface.php.

Referenced by connectRetryCount().

## ◆ $DB

eZDBInterface::$DB

Definition at line 1597 of file ezdbinterface.php.

Referenced by eZPostgreSQLDB\__construct(), and eZMySQLiDB\eZTableList().

## ◆ $DBConnection

eZDBInterface::$DBConnection

Definition at line 1605 of file ezdbinterface.php.

Referenced by eZMySQLiDB\eZTableList(), and eZMySQLiDB\setError().

## ◆ $DBWriteConnection

eZDBInterface::$DBWriteConnection

Definition at line 1613 of file ezdbinterface.php.

Referenced by eZMySQLiDB\__construct(), and eZMySQLiDB\eZTableList().

## ◆ $EndTime

eZDBInterface::$EndTime

Definition at line 1709 of file ezdbinterface.php.

Referenced by endTime().

## ◆ $errorHandling

eZDBInterface::$errorHandling = eZDB::ERROR_HANDLING_STANDARD
| protected

Definition at line 1828 of file ezdbinterface.php.

Referenced by setErrorHandling().

## ◆ $ErrorMessage

eZDBInterface::$ErrorMessage

Definition at line 1725 of file ezdbinterface.php.

Referenced by errorMessage().

## ◆ $ErrorNumber

eZDBInterface::$ErrorNumber = 0

Definition at line 1733 of file ezdbinterface.php.

Referenced by errorNumber().

## ◆ $InputTextCodec

eZDBInterface::$InputTextCodec

Definition at line 1661 of file ezdbinterface.php.

## ◆ $IsConnected

eZDBInterface::$IsConnected = false

Definition at line 1685 of file ezdbinterface.php.

Referenced by isConnected().

## ◆ $IsInternalCharset

eZDBInterface::$IsInternalCharset

Definition at line 1830 of file ezdbinterface.php.

## ◆ $NumQueries

eZDBInterface::$NumQueries = 0

Definition at line 1693 of file ezdbinterface.php.

## ◆ $OutputSQL

eZDBInterface::$OutputSQL

Definition at line 1677 of file ezdbinterface.php.

Referenced by insertFile().

## ◆ $OutputTextCodec

eZDBInterface::$OutputTextCodec

Definition at line 1653 of file ezdbinterface.php.

## ◆ $Password

eZDBInterface::$Password

Definition at line 1629 of file ezdbinterface.php.

Referenced by eZPostgreSQLDB\__construct().

## ◆ $Port

eZDBInterface::$Port

Definition at line 1581 of file ezdbinterface.php.

Referenced by eZPostgreSQLDB\__construct().

## ◆ $QueryAnalysisOutput

eZDBInterface::$QueryAnalysisOutput

Definition at line 1832 of file ezdbinterface.php.

## ◆ $RecordError

eZDBInterface::$RecordError = true

Definition at line 1741 of file ezdbinterface.php.

Referenced by begin(), commit(), eZMySQLiDB\query(), and rollback().

## ◆ $Server

eZDBInterface::$Server

Definition at line 1573 of file ezdbinterface.php.

Referenced by eZPostgreSQLDB\__construct().

## ◆ $SlaveDB

eZDBInterface::$SlaveDB

Definition at line 1765 of file ezdbinterface.php.

Referenced by eZMySQLiDB\eZTableList().

## ◆ $SlavePassword

eZDBInterface::$SlavePassword

Definition at line 1797 of file ezdbinterface.php.

## ◆ $SlavePort

eZDBInterface::$SlavePort

Definition at line 1781 of file ezdbinterface.php.

## ◆ $SlaveServer

eZDBInterface::$SlaveServer

Definition at line 1773 of file ezdbinterface.php.

## ◆ $SlaveUser

eZDBInterface::$SlaveUser

Definition at line 1789 of file ezdbinterface.php.

## ◆ $SlowSQLTimeout

eZDBInterface::$SlowSQLTimeout

Definition at line 1831 of file ezdbinterface.php.

## ◆ $SocketPath

eZDBInterface::$SocketPath

Definition at line 1589 of file ezdbinterface.php.

Referenced by socketPath().

## ◆ $StartTime

eZDBInterface::$StartTime

Definition at line 1701 of file ezdbinterface.php.

Referenced by endTimer(), and startTime().

## ◆ $TimeTaken

eZDBInterface::$TimeTaken

Definition at line 1717 of file ezdbinterface.php.

Referenced by timeTaken().

## ◆ $TransactionCounter

eZDBInterface::$TransactionCounter

Definition at line 1805 of file ezdbinterface.php.

Referenced by begin(), commit(), and transactionCounter().

## ◆ $TransactionIsValid

eZDBInterface::$TransactionIsValid

Definition at line 1813 of file ezdbinterface.php.

Referenced by isTransactionValid().

## ◆ $TransactionStackTree

eZDBInterface::$TransactionStackTree

Definition at line 1821 of file ezdbinterface.php.

## ◆ $UseBuiltinEncoding

eZDBInterface::$UseBuiltinEncoding

Definition at line 1669 of file ezdbinterface.php.

Referenced by usesBuiltinEncoding().

## ◆ $UsePersistentConnection

eZDBInterface::$UsePersistentConnection = false

Definition at line 1749 of file ezdbinterface.php.

## ◆ $User

eZDBInterface::$User

Definition at line 1621 of file ezdbinterface.php.

Referenced by eZPostgreSQLDB\__construct().

## ◆ $UseSlaveServer

eZDBInterface::$UseSlaveServer

Definition at line 1757 of file ezdbinterface.php.

## ◆ BINDING_NAME

const eZDBInterface::BINDING_NAME = 1

Definition at line 22 of file ezdbinterface.php.

## ◆ BINDING_NO

const eZDBInterface::BINDING_NO = 0

Definition at line 21 of file ezdbinterface.php.

Referenced by eZMySQLiDB\bindingType(), eZPostgreSQLDB\bindingType(), eZSQLite3DB\bindingType(), eZPersistentObject\storeObject(), and eZPersistentObject\updateObjectList().

## ◆ BINDING_ORDERED

const eZDBInterface::BINDING_ORDERED = 2

Definition at line 23 of file ezdbinterface.php.

## ◆ ERROR_MISSING_EXTENSION

const eZDBInterface::ERROR_MISSING_EXTENSION = 1

Definition at line 40 of file ezdbinterface.php.

Referenced by eZMySQLiDB\__construct(), eZPostgreSQLDB\__construct(), and eZSQLite3DB\__construct().

## ◆ MAX_INT

const eZDBInterface::MAX_INT = 2147483647

Definition at line 50 of file ezdbinterface.php.

## ◆ MIN_INT

const eZDBInterface::MIN_INT = -2147483648

Definition at line 57 of file ezdbinterface.php.

## ◆ RELATION_INDEX

const eZDBInterface::RELATION_INDEX = 4

Definition at line 29 of file ezdbinterface.php.

Referenced by eZPostgreSQLDB\relationKind(), relationName(), and eZPostgreSQLDB\supportedRelationTypes().

## ◆ RELATION_INDEX_BIT

const eZDBInterface::RELATION_INDEX_BIT = 16

Definition at line 35 of file ezdbinterface.php.

Referenced by eZPostgreSQLDB\supportedRelationTypeMask().

## ◆ RELATION_MASK

const eZDBInterface::RELATION_MASK = 31

Definition at line 38 of file ezdbinterface.php.

## ◆ RELATION_NONE

const eZDBInterface::RELATION_NONE = 0

Definition at line 37 of file ezdbinterface.php.

Referenced by supportedRelationTypeMask().

## ◆ RELATION_SEQUENCE

const eZDBInterface::RELATION_SEQUENCE = 1

Definition at line 26 of file ezdbinterface.php.

Referenced by eZPostgreSQLDB\eZTableList(), eZPostgreSQLDB\relationKind(), relationName(), and eZPostgreSQLDB\supportedRelationTypes().

## ◆ RELATION_SEQUENCE_BIT

const eZDBInterface::RELATION_SEQUENCE_BIT = 2

Definition at line 32 of file ezdbinterface.php.

Referenced by eZPostgreSQLDB\supportedRelationTypeMask().

## ◆ RELATION_TABLE

const eZDBInterface::RELATION_TABLE = 0

Definition at line 25 of file ezdbinterface.php.

Referenced by eZMySQLiDB\eZTableList(), eZPostgreSQLDB\eZTableList(), eZSQLite3DB\eZTableList(), eZMySQLiDB\relationCount(), eZPostgreSQLDB\relationKind(), eZMySQLiDB\relationList(), eZSQLite3DB\relationList(), relationName(), eZMySQLiDB\supportedRelationTypes(), eZPostgreSQLDB\supportedRelationTypes(), and eZSQLite3DB\supportedRelationTypes().

## ◆ RELATION_TABLE_BIT

const eZDBInterface::RELATION_TABLE_BIT = 1

Definition at line 31 of file ezdbinterface.php.

Referenced by eZMySQLiDB\relationCounts(), eZMySQLiDB\supportedRelationTypeMask(), and eZPostgreSQLDB\supportedRelationTypeMask().

## ◆ RELATION_TRIGGER

const eZDBInterface::RELATION_TRIGGER = 2

Definition at line 27 of file ezdbinterface.php.

Referenced by eZPostgreSQLDB\relationKind(), relationName(), and eZPostgreSQLDB\supportedRelationTypes().

## ◆ RELATION_TRIGGER_BIT

const eZDBInterface::RELATION_TRIGGER_BIT = 4

Definition at line 33 of file ezdbinterface.php.

Referenced by eZPostgreSQLDB\supportedRelationTypeMask().

## ◆ RELATION_VIEW

const eZDBInterface::RELATION_VIEW = 3

Definition at line 28 of file ezdbinterface.php.

Referenced by eZPostgreSQLDB\relationKind(), relationName(), and eZPostgreSQLDB\supportedRelationTypes().

## ◆ RELATION_VIEW_BIT

const eZDBInterface::RELATION_VIEW_BIT = 8

Definition at line 34 of file ezdbinterface.php.

Referenced by eZPostgreSQLDB\supportedRelationTypeMask().

## ◆ SERVER_MASTER

const eZDBInterface::SERVER_MASTER = 1

Definition at line 42 of file ezdbinterface.php.

Referenced by eZMySQLiDB\query().

## ◆ SERVER_SLAVE

const eZDBInterface::SERVER_SLAVE = 2

Definition at line 43 of file ezdbinterface.php.

Referenced by eZContentObjectTreeNode\calendar(), eZContentObjectTreeNode\createPermissionCheckingSQL(), eZMySQLiDB\eZTableList(), eZMySQLiDB\query(), eZContentObjectTreeNode\subTreeByNodeID(), eZContentObjectTreeNode\subTreeCountByNodeID(), eZContentObjectTreeNode\subTreeMultiPaths(), and eZContentObjectTreeNode\subtreeSoleNodeCount().

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

- ezdbinterface.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.