Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Static Public Member Functions | Public Attributes | Static Protected Attributes | Private Member Functions | List of all members
eZDB Class Reference
Database abstraction layer

The eZDB class provides database wrapper functions The eZ db library procides a database independent framework for SQL databases. The current supported databases are: PostgreSQL and MySQL. More...

## Static Public Member Functions
static | hasInstance ()
static | setInstance ( $instance)
static | instance ( $databaseImplementation=false, $databaseParameters=false, $forceNewInstance=false)
static | checkTransactionCounter ()
static | setErrorHandling ( $errorHandling)

## Public Attributes
const | ERROR_HANDLING_STANDARD = 1
const | ERROR_HANDLING_EXCEPTIONS = 2

## Static Protected Attributes
static | $errorHandling = self::ERROR_HANDLING_STANDARD

## Private Member Functions
| __construct ()

## Detailed Description

The eZDB class provides database wrapper functions The eZ db library procides a database independent framework for SQL databases. The current supported databases are: PostgreSQL and MySQL.

eZ db is designed to be used with the following type subset of SQL: int, float, varchar and text.

To store date and time values int's are used. eZ locale is used to present the date and times on a localized format. That way we don't have to worry about the different date and time formats used in the different databases.

Auto incrementing numbers, sequences, are used to generate unique id's for a table row. This functionality is abstracted as it works different in the different databases.

Limit and offset functionality is also abstracted by the eZ db library.

eZ db is designed to use lowercase in all table/column names. This is done to prevent errors as the different databases handles this differently. Especially when returning the data as an associative array.

// Get the current database instance
// will create a new database object and connect to the database backend
// if there is already created an instance for this session the existing
// object will be returned.
// the settings for the database connections are set in site.ini
$db = eZDB::instance();
// Run a simple query
$db->query( 'DELETE FROM sql_test' );
// insert some data
$str = $db->escapeString( "Testing escaping'\"" );
$db->query( "INSERT INTO sql_test ( name, description ) VALUES ( 'New test', '$str' )" );
// Get the last serial value for the sql_test table
$rowID = $db->lastSerialID( 'sql_test', 'id' );
// fetch some data into an array of associative arrays
$rows = $db->arrayQuery( 'SELECT * FROM sql_test' );
foreach ( $rows as $row )
{
print( $row['name'] );
}
// fetch some data with a limit
// will return the 10 first rows in the result
$ret = $db->arrayQuery( 'SELECT id, name, description, rownum FROM sql_test',
array( 'offset' => 0, 'limit' => 10 ) );
// check which implementation we're running
print( $db->databaseName() );
eZDB\instance
static instance( $databaseImplementation=false, $databaseParameters=false, $forceNewInstance=false)
Definition: ezdb.php:117

See also
  eZLocale eZINI

Definition at line 79 of file ezdb.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZDB::__construct | ( |  | ) |
| private

Constructor. NOTE: Should not be used.

Definition at line 85 of file ezdb.php.

References eZDebug\writeError().

## Member Function Documentation

## ◆ checkTransactionCounter()

static eZDB::checkTransactionCounter | ( |  | ) |
| static

Checks transaction counter If the current transaction counter is 1 or higher means 1 or more transactions are running and a negative value means something is wrong. Prints the error.

Definition at line 293 of file ezdb.php.

References instance(), and eZDebug\writeError().

Referenced by eZModule\redirectTo(), and eZScript\shutdown().

## ◆ hasInstance()

static eZDB::hasInstance | ( |  | ) |
| static

Returns an instance of the database object.

Definition at line 94 of file ezdb.php.

Referenced by eZDBCleanup(), and eZScript\shutdown().

## ◆ instance()

static eZDB::instance | ( |  | $databaseImplementation = `false`,
|  |  | $databaseParameters = `false`,
|  |  | $forceNewInstance = `false`
| ) |  |
| static

Returns a shared instance of the eZDBInterface class aka database object. If you want to change the current database values you should use $forceNewInstance.

Parameters

  string | false | $databaseImplementation |
  array | false | $databaseParameters | If array, then key 'use_defaults' (bool) is used.
  bool | $forceNewInstance |

Returns
  eZDBInterface

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 117 of file ezdb.php.

References eZExtension\getHandlerClass(), eZTextCodec\internalCharset(), and eZDebug\writeError().

Referenced by eZUser\_loginUser(), eZOrder\active(), eZOrder\activeCount(), eZISBN10To13Converter\addAllClasses(), eZContentObjectTreeNode\addChildTo(), eZContentObject\addContentObjectRelation(), eZCollaborationItemGroupLink\addItem(), eZContentLanguage\addLanguage(), eZCollaborationItemMessageLink\addMessage(), eZSearchLog\addPhrase(), eZContentObject\allowedAssignStateIDList(), eZContentCacheManager\appendKeywordNodeIDs(), eZPolicy\appendLimitation(), eZRole\appendPolicy(), eZSection\applyTo(), eZOrder\archiveOrder(), eZContentObject\assignDefaultStates(), eZContentObject\assignedNodes(), eZContentObjectTreeNode\assignSectionToSubTree(), eZContentObject\assignState(), eZRole\assignToUser(), eZIdentifierType\assignValue(), eZContentObject\authorArray(), eZMatrixType\batchInitializeObjectAttributeData(), eZMultiOption2Type\batchInitializeObjectAttributeData(), eZOptionType\batchInitializeObjectAttributeData(), eZStringType\batchInitializeObjectAttributeData(), eZXMLTextType\batchInitializeObjectAttributeData(), eZContentClassAttribute\cachedInfo(), eZProductCollectionItem\calculatePriceWithOptions(), eZContentObjectTreeNode\calendar(), eZContentObject\canCreateClassList(), eZContentObjectTreeNode\canCreateClassList(), eZContentClass\canInstantiateClassList(), eZApproveType\checkApproveCollaboration(), eZTipafriendRequest\checkReceiver(), checkTransactionCounter(), eZContentObjectTreeNode\childrenByName(), eZContentClassAttribute\classAttributeIdentifiersHash(), eZUserType\classAttributeRemovableInformation(), eZContentLanguage\classCount(), eZContentClass\classIdentifiersHash(), eZContentObject\className(), eZISBNGroup\cleanAll(), eZISBNGroupRange\cleanAll(), eZISBNRegistrantRange\cleanAll(), eZURLWildcard\cleanup(), eZDBTool\cleanup(), eZForgotPassword\cleanup(), eZBasket\cleanup(), eZCollaborationItem\cleanup(), eZContentBrowseBookmark\cleanup(), eZContentBrowseRecent\cleanup(), eZInformationCollection\cleanup(), eZInformationCollectionAttribute\cleanup(), eZOrder\cleanup(), eZOrderItem\cleanup(), eZPreferences\cleanup(), eZTipafriendCounter\cleanup(), eZTipafriendRequest\cleanup(), eZWishList\cleanup(), eZWorkflowProcess\cleanup(), eZNotificationCollection\cleanup(), eZNotificationCollectionItem\cleanup(), eZNotificationEvent\cleanup(), eZNotificationEventFilter\cleanup(), eZCollaborationNotificationRule\cleanup(), eZGeneralDigestUserSettings\cleanup(), eZSubtreeNotificationRule\cleanup(), eZOperationMemento\cleanup(), eZApproveType\cleanupAfterRemoving(), eZRole\cleanupByNode(), eZBasket\cleanupCurrentBasket(), eZBasket\cleanupExpired(), eZProductCollectionItemOption\cleanupList(), eZProductCollection\cleanupList(), eZProductCollectionItem\cleanupList(), eZOrder\cleanupOrder(), eZWorkflow\cleanupWorkFlowProcess(), eZEnumType\cloneClassAttribute(), eZContentObjectAttribute\cloneContentObjectAttribute(), eZDBGarbageCollector\collectBaskets(), eZDBGarbageCollector\collectProductCollectionItemOptions(), eZDBGarbageCollector\collectProductCollectionItems(), eZDBGarbageCollector\collectProductCollections(), eZPersistentObject\conditionTextByRow(), eZInformationCollectionAttribute\contentClassAttributeName(), eZContentObject\contentObjectAttributes(), eZNodeviewfunctions\contentViewGenerate(), eZContentObject\copy(), eZPolicy\copy(), eZProductCollection\copy(), eZRole\copy(), eZContentObject\copyContentObjectRelations(), eZRole\copyPolicies(), eZContentObjectTreeNodeOperations\copyPublishContentObject(), eZContentObjectTreeNodeOperations\copySubtree(), eZContentObject\copyVersion(), eZURLAliasQuery\count(), eZContentFunctions\createAndPublishObject(), eZApproveType\createApproveCollaboration(), eZContentObjectTreeNode\createAttributeFilterSQLStrings(), eZUser\createHash(), eZSimplifiedXMLEditOutput\createLinksArray(), eZContentBrowseBookmark\createNew(), eZContentBrowseRecent\createNew(), eZContentObject\createNewVersion(), eZContentObjectTreeNode\createNodesConditionSQLStringFromPath(), eZContentObjectTreeNode\createObjectNameFilterConditionSQLString(), eZBasket\createOrder(), eZContentObjectTreeNode\createPathConditionAndNotEqParentSQLStrings(), eZContentObjectTreeNode\createPermissionCheckingSQL(), eZPolicy\createTemporaryCopy(), eZRole\createTemporaryVersion(), eZContentObject\createWithNodeAssignment(), eZContentObjectTreeNode\creator(), eZBasket\currentBasket(), eZOrder\customerCount(), eZOrder\customerList(), eZSiteInstaller\dbBegin(), eZSiteInstaller\dbCommit(), eZKeywordType\deleteStoredObjectAttribute(), eZURLType\deleteStoredObjectAttribute(), eZUserType\deleteStoredObjectAttribute(), eZXMLTextType\deleteStoredObjectAttribute(), eZObjectRelationListType\deleteStoredObjectAttribute(), eZOrder\detachProductCollection(), eZDiscount\discountPercent(), eZPersistentObject\escapeArray(), eZApproveType\execute(), eZStaticCache\executeActions(), eZContentObject\exists(), eZDBCleanup(), eZUser\failedLoginAttemptsByUserID(), eZContentObject\fetch(), eZContentObjectTreeNode\fetch(), eZKeyword\fetch(), eZContentObjectTreeNode\fetchAliasesFromNodeList(), eZURLAliasQuery\fetchAll(), eZContentClass\fetchAllClasses(), eZUser\fetchAnonymousCount(), eZContentObjectVersion\fetchAttributes(), eZContentObject\fetchAttributesByIdentifier(), eZURLAliasML\fetchByAction(), eZContentObject\fetchByNodeID(), eZURLAliasML\fetchByParentID(), eZURLAliasML\fetchByPath(), eZContentObject\fetchByRemoteID(), eZRole\fetchByUser(), eZUserDiscountRule\fetchByUserIDArray(), eZNodeAssignment\fetchChildCountByVersionStatus(), eZNodeAssignment\fetchChildListByVersionStatus(), eZContentClassClassGroup\fetchClassList(), eZInformationCollection\fetchCollectionCountForObject(), eZUser\fetchContentList(), eZOrderStatusHistory\fetchCount(), eZVatRule\fetchCountByCategory(), eZInformationCollection\fetchCountForAttribute(), eZInformationCollection\fetchCountList(), eZVatType\fetchDependentClassesCount(), eZVatType\fetchDependentProductsCount(), eZWorkflowProcess\fetchForStatus(), eZContentObject\fetchForUpdate(), eZGeneralDigestHandler\fetchHandlersForUser(), eZContentObject\fetchIDArray(), eZRole\fetchIDListByUser(), eZContentClass\fetchIDListContainingDatatype(), eZImageFile\fetchImageAttributesByFilepath(), eZGeneralDigestHandler\fetchItemsForUser(), eZContentObjectTreeNode\fetchList(), eZOrderStatusHistory\fetchListByOrder(), eZContentObjectTreeNode\fetchListCount(), eZCollaborationItem\fetchListTool(), eZUser\fetchLoggedInCount(), eZUser\fetchLoggedInList(), eZContentObjectTreeNode\fetchNode(), eZContentObjectTreeNode\fetchNodesByPathString(), eZEnumType\fetchObjectAttributeHTTPInput(), eZContentObject\fetchObjectCountByUserID(), eZPersistentObject\fetchObjectList(), eZURLAliasML\fetchPathByActionList(), eZOrderStatus\fetchPolicyList(), eZProductCategory\fetchProductCountByCategory(), eZRole\fetchRolesByLimitation(), eZViewCounter\fetchTopList(), eZRole\fetchUserByRole(), eZUser\fetchUserClassList(), eZRole\fetchUserID(), eZSubtreeNotificationRule\fetchUserList(), eZContentObjectVersion\fetchVersionForUpdate(), eZContentObject\fillNodeListAttributes(), eZPolicyLimitation\findByType(), eZContentObjectTreeNode\findMainNode(), eZContentObjectTreeNode\findMainNodeArray(), eZContentObjectTreeNode\findNode(), eZURLAliasML\findUniqueText(), eZContentObject\fixReverseRelations(), eZStaticCache\generateCache(), eZURLAliasML\generateCond(), eZURLAliasML\generateGlobCond(), eZUser\generateGroupIdList(), eZUserDiscountRule\generateIDListByUserID(), eZStaticCache\generateNodeListCache(), eZURLAliasQuery\generateSQL(), eZPackage\getInstallState(), eZContentObjectTreeNode\getName(), eZOrder\getNewID(), eZURLAliasML\getNewID(), eZLDAPUser\getNodeAssignmentsForGroupName(), eZContentObjectTreeNode\getObjectIdsInNodeSubTree(), eZContentObjectTreeNode\getParentNodeId(), eZContentObjectTreeNode\getParentNodeIdListByContentObjectID(), eZURLAliasML\getPath(), eZPathElement\getPath(), eZPathElement\getPathArray(), eZTemplateCacheBlock\getSubtreeModification(), eZContentObject\getVersionCount(), eZCollaborationItemHandler\handleCollaborationEvent(), eZBinaryFileType\handleDownload(), eZURL\handleList(), eZPersistentObject\handleRows(), eZContentUpload\handleUpload(), eZRole\hasPolicy(), eZISBN13\hasRangeData(), eZUser\hasStoredLogin(), eZContentObject\hasVisibleNode(), eZContentObjectTreeNode\hideSubTree(), eZDataType\importDBDataFromDBAFile(), eZViewCounter\increase(), eZInformationCollection\informationCollectionAttributes(), eZScript\initialize(), eZEnumType\initializeClassAttribute(), eZContentClass\initializeCopy(), eZEnumType\initializeObjectAttribute(), eZContentClassAttribute\initializeObjectAttributes(), eZBinaryFileType\insertHTTPFile(), eZDBPackageHandler\install(), eZINIAddonPackageHandler\install(), eZCollaborationGroup\instantiate(), eZContentClass\instantiate(), eZDBTool\isEmpty(), eZImageFile\isReferencedByOtherAttributes(), eZImageFile\isReferencedByOtherImageFiles(), eZUser\isUserLoggedIn(), eZCollaborationGroup\itemCount(), eZContentLanguage\languagesSQLFilter(), eZUser\lastVisit(), eZUser\limitList(), eZUser\loginCount(), eZUser\loginFailed(), eZLDAPUser\loginUser(), eZTextFileUser\loginUser(), eZUser\logoutCurrent(), eZOrder\modifyStatus(), eZSearchLog\mostFrequentPhraseArray(), eZContentObjectTreeNode\move(), eZContentObjectTreeNodeOperations\move(), eZImageFile\moveFilepath(), eZContentObject\names(), eZPersistentObject\newObjectOrder(), eZContentObject\nextVersion(), eZContentObjectVersion\nonTranslatableAttributesToUpdate(), eZContentClass\objectCount(), eZContentLanguage\objectCount(), eZContentLanguage\objectInitialCount(), eZXMLTextType\onPublish(), eZOrder\orderList(), eZOrder\orderStatistics(), eZOrderStatus\orderStatusCount(), eZURLType\postStore(), eZXMLOutputHandler\prefetch(), eZContentObject\previousVersion(), eZNotificationEventFilter\process(), eZVatRule\productCategories(), eZOrder\productList(), eZLDAPUser\publishUpdateUser(), eZNodeAssignment\purge(), eZOrder\purge(), eZContentObject\purge(), eZNodeAssignment\purgeByID(), eZNodeAssignment\purgeByParentAndContentObjectID(), eZContentObjectTrashNode\purgeForObject(), eZURL\registerURLArray(), eZContentObject\relatedObjectCount(), eZContentObject\relatedObjects(), eZKeyword\relatedObjects(), eZContentClass\removableInformation(), eZNodeAssignment\remove(), eZContentObjectVersion\removeAssignment(), eZContentClass\removeAttributes(), eZURLAliasML\removeByAction(), eZNodeAssignment\removeByID(), eZPolicyLimitation\removeByID(), eZProductCategory\removeByID(), eZContentBrowseBookmark\removeByNodeID(), eZGeneralDigestUserSettings\removeByUserId(), eZContentClassName\removeClassName(), eZInformationCollection\removeCollection(), eZInformationCollection\removeContentObject(), eZContentObject\removeContentObjectRelation(), eZNotificationCollection\removeEmpty(), eZWorkflow\removeEvents(), eZOrder\removeHistory(), eZContentObjectTreeNode\removeNodeFromTree(), eZPersistentObject\removeObject(), eZOrder\removeOrderItems(), eZRole\removePolicies(), eZRole\removePolicy(), eZVatRule\removeProductCategories(), eZContentBrowseRecent\removeRecentByNodeID(), eZVatRule\removeReferencesToProductCategory(), eZContentObjectAttribute\removeRelationsByContentClassAttributeId(), eZURLAliasML\removeSingleEntry(), eZSearchLog\removeStatistics(), eZContentObjectTreeNode\removeSubtrees(), eZContentClass\removeTemporary(), eZRole\removeTemporary(), eZWorkflow\removeTemporary(), eZPolicy\removeThis(), eZContentObject\removeThis(), eZContentClassAttribute\removeThis(), eZWorkflow\removeThis(), eZContentObjectTreeNode\removeThis(), eZOrderStatus\removeThis(), eZProductCollectionItem\removeThis(), eZRole\removeThis(), eZRSSExport\removeThis(), eZVatType\removeThis(), eZWorkflowProcess\removeThis(), eZContentObjectVersion\removeTranslation(), eZContentClass\removeTranslation(), eZContentObject\removeTranslation(), eZTrigger\removeTriggerForWorkflow(), eZRole\removeUserAssignment(), eZRole\removeUserAssignmentByID(), eZVatRule\removeVatRule(), eZContentObjectVersion\removeVersions(), eZPersistentObject\reorderObject(), eZVatType\resetToDefaultInProducts(), eZNamePatternResolver\resolveNamePattern(), eZContentObject\restoreObjectAttributes(), eZContentObjectTreeNode\reverseRelatedCount(), eZURLAliasML\reverseTranslate(), eZRole\revertFromTemporaryVersion(), eZTrigger\runWorkflow(), eZSection\sectionCount(), eZContentObjectVersion\serialize(), eZContentObjectVersion\setAlwaysAvailableLanguageID(), eZContentClass\setAlwaysAvailableLanguageID(), eZContentObject\setAlwaysAvailableLanguageID(), setErrorHandling(), eZUser\setFailedLoginAttempts(), eZPackage\setInstalled(), eZURLAliasML\setLangMaskAlwaysAvailable(), eZCollaborationItemParticipantLink\setLastRead(), eZContentObject\setName(), eZNodeAssignment\setNewMainAssignment(), eZContentObjectAssignmentHandler\setupAssignments(), eZEnum\setValue(), eZPreferences\setValue(), eZSiteInstaller\setVersion(), eZEnum\setVersion(), eZContentObjectTreeNode\setVersionByObjectID(), eZScript\shutdown(), eZContentLanguage\sqlFilter(), eZContentObject\stateIDArray(), eZContentObject\stateIdentifierArray(), eZKeyword\store(), eZContentObject\store(), eZContentObjectAttribute\store(), eZContentObjectTreeNode\store(), eZVatRule\store(), eZWorkflowEvent\store(), eZPDFExport\store(), eZWorkflow\store(), eZContentClass\store(), eZRSSExport\store(), eZOrderStatus\storeCustom(), eZWorkflowEvent\storeDefined(), eZWorkflow\storeDefined(), eZContentObject\storeInput(), eZContentObject\storeNodeModified(), eZPersistentObject\storeObject(), eZURLAliasML\storePath(), eZContentClass\storeVersioned(), eZContentClassAttribute\storeVersioned(), eZCollaborationGroup\subTree(), eZContentStructureTreeOperator\subTree(), eZContentObjectTreeNode\subTreeByNodeID(), eZContentObjectTreeNode\subTreeCountByNodeID(), eZContentObjectTreeNode\subTreeMultiPaths(), eZContentObjectTreeNode\subtreeSoleNodeCount(), eZSiteInstaller\swapNodes(), eZPersistentObject\swapRow(), eZURLAliasML\translate(), eZContentObjectAttribute\translateTo(), eZContentObjectVersion\translationList(), eZContentObjectTrashNode\trashList(), eZOrder\unArchiveOrder(), eZContentObjectTreeNode\unhideSubTree(), eZContentObjectVersion\unpublish(), eZContentObjectVersion\unserialize(), eZContentFunctions\updateAndPublishObject(), eZContentObjectTreeNode\updateAndStoreModified(), eZISBN10To13Converter\updateClassAttributeToISBN13(), eZISBN10To13Converter\updateContentISBNNumber(), eZUser\updateLastVisit(), eZUser\updateLastVisitByLogout(), eZContentObjectTreeNode\updateMainNodeID(), eZContentBrowseRecent\updateNodeID(), eZContentObjectTreeNode\updateNodeVisibility(), eZPersistentObject\updateObjectList(), eZContentObjectTreeNode\updatePathIdentificationString(), eZBasket\updatePrices(), eZURL\url(), eZURL\urlByMD5(), eZURL\urlByURL(), eZPreferences\value(), eZPreferences\values(), and eZContentObject\versionLanguageName().

## ◆ setErrorHandling()

static eZDB::setErrorHandling | ( |  | $errorHandling | ) |
| static

Sets the default eZDB error handling mode. Use eZDB::instance()->setErrorHandling() with the same parameters to set error handling for one instance only

Parameters

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

Exceptions

  RuntimeException | thrown when an invalid error handling is given @access private

Since
  4.5

Definition at line 345 of file ezdb.php.

References $errorHandling, and instance().

## ◆ setInstance()

static eZDB::setInstance | ( |  | $instance | ) |
| static

Sets the global database instance to $instance.

Definition at line 103 of file ezdb.php.

## Member Data Documentation

## ◆ $errorHandling

eZDB::$errorHandling = self::ERROR_HANDLING_STANDARD
| static protected

Definition at line 363 of file ezdb.php.

Referenced by setErrorHandling().

## ◆ ERROR_HANDLING_EXCEPTIONS

const eZDB::ERROR_HANDLING_EXCEPTIONS = 2

Definition at line 361 of file ezdb.php.

Referenced by eZPostgreSQLDB\query(), eZDBInterface\reportError(), and eZDBInterface\setErrorHandling().

## ◆ ERROR_HANDLING_STANDARD

const eZDB::ERROR_HANDLING_STANDARD = 1

Error handling mode

Definition at line 360 of file ezdb.php.

Referenced by eZMySQLiDB\query(), and eZDBInterface\setErrorHandling().

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

- ezdb.php

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