eZ Publish  [4.0]
eZDB Class Reference

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

List of all members.

Static Public Member Functions

static checkTransactionCounter ()
static hasInstance ()
static instance ($databaseImplementation=false, $databaseParameters=false, $forceNewInstance=false)
static setInstance ($instance)

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.

  // include the library
  //include_once( 'lib/ezdb/classes/ezdb.php' );

  // 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() );
See also:
eZLocale eZINI

Definition at line 109 of file ezdb.php.


Constructor & Destructor Documentation

eZDB::__construct ( ) [private]

Constructor. NOTE: Should not be used.

Definition at line 115 of file ezdb.php.


Member Function Documentation

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 345 of file ezdb.php.

Referenced by eZScript\shutdown().

static eZDB::hasInstance ( ) [static]

Returns an instance of the database object.

Definition at line 124 of file ezdb.php.

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

static eZDB::instance ( databaseImplementation = false,
databaseParameters = false,
forceNewInstance = false 
) [static]

Returns an instance of the database object. If you want to change the current database values you should set $forceNewInstance to true to force a new instance.

Definition at line 143 of file ezdb.php.

Referenced by eZOrder\activate(), eZOrder\active(), eZOrder\activeCount(), eZISBN10To13Converter\addAllClasses(), eZContentObjectTreeNode\addChildTo(), eZContentObject\addContentObjectRelation(), eZCollaborationItemGroupLink\addItem(), eZContentLanguage\addLanguage(), eZCollaborationItemMessageLink\addMessage(), eZSearchLog\addPhrase(), eZContentCacheManager\appendKeywordNodeIDs(), eZPolicy\appendLimitation(), eZRole\appendPolicy(), eZOrder\archiveOrder(), eZContentObject\assignedNodes(), eZContentObjectTreeNode\assignSectionToSubTree(), eZRole\assignToUser(), eZIdentifierType\assignValue(), eZContentObject\authorArray(), backupTables(), eZContentClassAttribute\cachedInfo(), eZProductCollectionItem\calculatePriceWithOptions(), eZContentObjectTreeNode\calendar(), eZContentObject\canCreateClassList(), eZContentObjectTreeNode\canCreateClassList(), eZContentClass\canInstantiateClassList(), changeDBCharset(), changeDBCharsetORACLE(), checkDBCharset(), checkDBDriver(), checkDBExtraConditions(), checkDBExtraConditionsORACLE(), eZTipafriendRequest\checkReceiver(), checkTransactionCounter(), eZContentObjectTreeNode\childrenByName(), eZContentObjectTreeNode\classAttributeIDByIdentifier(), eZUserType\classAttributeRemovableInformation(), eZContentLanguage\classCount(), eZContentObjectTreeNode\classIDByIdentifier(), eZContentObject\className(), eZISBNGroup\cleanAll(), eZISBNGroupRange\cleanAll(), eZISBNRegistrantRange\cleanAll(), eZDBTool\cleanup(), eZForgotPassword\cleanup(), eZTipafriendRequest\cleanup(), eZGeneralDigestUserSettings\cleanup(), eZURLWildcard\cleanup(), eZTipafriendCounter\cleanup(), eZNotificationCollectionItem\cleanup(), eZCollaborationNotificationRule\cleanup(), eZNotificationEventFilter\cleanup(), eZOrderItem\cleanup(), eZContentBrowseBookmark\cleanup(), eZNotificationCollection\cleanup(), eZOperationMemento\cleanup(), eZNotificationEvent\cleanup(), eZWishList\cleanup(), eZInformationCollectionAttribute\cleanup(), eZPreferences\cleanup(), eZContentBrowseRecent\cleanup(), eZBasket\cleanup(), eZCollaborationItem\cleanup(), eZSubtreeNotificationRule\cleanup(), eZWorkflowProcess\cleanup(), eZInformationCollection\cleanup(), eZOrder\cleanup(), 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\contentClassIdentifier(), eZContentObject\contentObjectAttributes(), convertSerializedData(), convertXMLData(), eZProductCollection\copy(), eZRole\copy(), eZPolicy\copy(), eZContentObject\copy(), copyBinaryfilesToDB(), eZContentObject\copyContentObjectRelations(), copyImagesToDB(), copyMediafilesToDB(), eZRole\copyPolicies(), eZContentObject\copyVersion(), eZURLAliasQuery\count(), eZContentFunctions\createAndPublishObject(), eZContentObjectTreeNode\createAttributeFilterSQLStrings(), createContentClassAttributeTempTable(), eZWebDAVContentServer\createFolder(), eZSimplifiedXMLEditOutput\createLinksArray(), eZContentBrowseBookmark\createNew(), eZContentBrowseRecent\createNew(), eZContentObject\createNewVersion(), eZContentObjectTreeNode\createNodesConditionSQLStringFromPath(), eZContentObjectTreeNode\createObjectNameFilterConditionSQLString(), eZBasket\createOrder(), eZContentObjectTreeNode\createPathConditionAndNotEqParentSQLStrings(), eZContentObjectTreeNode\createPermissionCheckingSQL(), eZRole\createTemporaryVersion(), createURLListCondition(), eZContentObject\createWithNodeAssignment(), eZBasket\currentBasket(), eZOrder\customerCount(), eZOrder\customerList(), eZUserType\deleteStoredObjectAttribute(), eZURLType\deleteStoredObjectAttribute(), eZKeywordType\deleteStoredObjectAttribute(), eZXMLTextType\deleteStoredObjectAttribute(), eZObjectRelationListType\deleteStoredObjectAttribute(), eZOrder\detachProductCollection(), eZDiscount\discountPercent(), eZPersistentObject\escapeArray(), eZStaticCache\executeActions(), eZContentObject\exists(), eZDBCleanup(), eZSessionCountActive(), eZSessionDestroy(), eZSessionEmpty(), eZSessionGarbageCollector(), eZSessionRead(), eZSessionRemove(), eZSessionStart(), eZSessionStop(), eZSessionWrite(), eZKeyword\fetch(), eZContentObject\fetch(), eZContentObjectTreeNode\fetch(), eZContentObjectTreeNode\fetchAliasesFromNodeList(), eZURLAliasQuery\fetchAll(), eZContentObjectVersion\fetchAttributes(), eZContentObject\fetchAttributesByIdentifier(), eZURLAliasML\fetchByAction(), eZContentObject\fetchByNodeID(), eZURLAliasML\fetchByParentID(), eZURLAliasML\fetchByPath(), eZContentObject\fetchByRemoteID(), eZRole\fetchByUser(), eZUserDiscountRule\fetchByUserIDArray(), eZContentClassClassGroup\fetchClassList(), eZInformationCollection\fetchCollectionCountForObject(), eZOrderStatusHistory\fetchCount(), eZVatRule\fetchCountByCategory(), eZInformationCollection\fetchCountForAttribute(), eZInformationCollection\fetchCountList(), eZVatType\fetchDependentClassesCount(), eZVatType\fetchDependentProductsCount(), eZWorkflowProcess\fetchForStatus(), eZGeneralDigestHandler\fetchHandlersForUser(), fetchHistoricRedirectionChunk(), fetchHistoricRedirectionCount(), fetchHistoricURLChunk(), fetchHistoricURLCount(), fetchHistoricWildcardChunk(), fetchHistoricWildcardCount(), eZContentObject\fetchIDArray(), eZRole\fetchIDListByUser(), eZUserDiscountRule\fetchIDListByUserID(), eZContentClass\fetchIDListContainingDatatype(), eZImageFile\fetchImageAttributesByFilepath(), eZGeneralDigestHandler\fetchItemsForUser(), eZContentObjectTreeNode\fetchList(), eZOrderStatusHistory\fetchListByOrder(), eZContentObjectTreeNode\fetchListCount(), eZCollaborationItem\fetchListTool(), fetchMaskByNodeID(), eZContentObjectTreeNode\fetchNode(), eZContentObjectTreeNode\fetchNodesByPathString(), eZEnumType\fetchObjectAttributeHTTPInput(), eZContentObject\fetchObjectCountByUserID(), eZPersistentObject\fetchObjectList(), eZURLAliasML\fetchPathByActionList(), fetchPathIdentificationString(), fetchPathIdentificationStringChunk(), fetchPathIdentificationStringCount(), eZOrderStatus\fetchPolicyList(), eZProductCategory\fetchProductCountByCategory(), eZRole\fetchRolesByLimitation(), eZViewCounter\fetchTopList(), eZRole\fetchUserByRole(), eZRole\fetchUserID(), eZSubtreeNotificationRule\fetchUserList(), eZContentObject\fillNodeListAttributes(), eZPolicyLimitation\findByType(), eZContentObjectTreeNode\findMainNode(), eZContentObjectTreeNode\findMainNodeArray(), eZContentObjectTreeNode\findNode(), eZURLAliasML\findUniqueText(), eZContentObject\fixReverseRelations(), eZStaticCache\generateCache(), eZURLAliasML\generateCond(), eZURLAliasML\generateGlobCond(), eZStaticCache\generateNodeListCache(), eZURLAliasQuery\generateSQL(), eZImageAliasHandler\generateXMLData(), eZPackage\getInstallState(), eZContentObjectTreeNode\getName(), eZURLAliasML\getNewID(), eZContentObjectTreeNode\getParentNodeId(), eZPathElement\getPath(), eZURLAliasML\getPath(), eZPathElement\getPathArray(), eZTemplateCacheBlock\getSubtreeModification(), eZContentObject\getVersionCount(), eZCollaborationItemHandler\handleCollaborationEvent(), eZBinaryFileType\handleDownload(), eZURL\handleList(), eZContentUpload\handleUpload(), eZISBN13\hasRangeData(), eZDataType\importDBDataFromDBAFile(), importRSSItem(), eZInformationCollection\informationCollectionAttributes(), eZEnumType\initializeClassAttribute(), eZContentClass\initializeCopy(), eZEnumType\initializeObjectAttribute(), eZBinaryFileType\insertHTTPFile(), eZDBPackageHandler\install(), eZINIAddonPackageHandler\install(), eZCollaborationGroup\instantiate(), eZContentClass\instantiate(), eZDBTool\isEmpty(), eZCollaborationGroup\itemCount(), eZContentLanguage\languagesSQLFilter(), loadDatabaseSchema(), markAsImported(), eZOrder\modifyStatus(), eZSearchLog\mostFrequentPhraseArray(), eZContentObjectTreeNodeOperations\move(), eZContentObjectTreeNode\move(), eZImageFile\moveFilepath(), eZContentObject\names(), eZPersistentObject\newObjectOrder(), eZContentObject\nextVersion(), eZContentObjectVersion\nonTranslatableAttributesToUpdate(), eZContentLanguage\objectCount(), eZContentClass\objectCount(), eZContentLanguage\objectInitialCount(), eZOrder\orderList(), eZOrder\orderStatistics(), eZOrderStatus\orderStatusCount(), parseCustomSerializedDataOption(), eZXMLOutputHandler\prefetch(), eZContentObject\previousVersion(), eZVatRule\productCategories(), eZOrder\productList(), eZContentObject\publishContentObjectRelations(), eZNodeAssignment\purge(), eZOrder\purge(), eZContentObject\purge(), eZNodeAssignment\purgeByID(), eZContentObjectTrashNode\purgeForObject(), eZURL\registerURL(), eZURL\registerURLArray(), eZContentObject\relatedObjectCount(), eZKeyword\relatedObjects(), eZContentObject\relatedObjects(), eZContentObject\remoteID(), eZContentClass\removableInformation(), eZNodeAssignment\remove(), eZContentObjectVersion\removeAssignment(), eZContentClass\removeAttributes(), eZURLAliasML\removeByAction(), eZProductCategory\removeByID(), eZPolicyLimitation\removeByID(), eZNodeAssignment\removeByID(), eZContentBrowseBookmark\removeByNodeID(), 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(), eZContentObject\removeReverseRelations(), eZURLAliasML\removeSingleEntry(), eZSearchLog\removeStatistics(), eZContentObjectTreeNode\removeSubtrees(), eZWorkflow\removeTemporary(), eZRole\removeTemporary(), eZContentClass\removeTemporary(), eZWorkflow\removeThis(), eZProductCollectionItem\removeThis(), eZRSSExport\removeThis(), eZPolicy\removeThis(), eZVatType\removeThis(), eZOrderStatus\removeThis(), eZContentClassAttribute\removeThis(), eZRole\removeThis(), eZWorkflowProcess\removeThis(), eZContentObjectVersion\removeThis(), eZContentObject\removeThis(), eZContentObjectTreeNode\removeThis(), eZContentObjectVersion\removeTranslation(), eZContentClass\removeTranslation(), eZContentObject\removeTranslation(), eZTrigger\removeTriggerForWorkflow(), removeURLList(), eZRole\removeUserAssignment(), eZRole\removeUserAssignmentByID(), eZVatRule\removeVatRule(), eZContentObjectVersion\removeVersions(), eZPersistentObject\reorderObject(), eZVatType\resetToDefaultInProducts(), restoreSerializedData(), eZContentObjectTreeNode\reverseRelatedCount(), eZURLAliasML\reverseTranslate(), eZRole\revertFromTemporaryVersion(), eZContentObject\revertTo(), eZRole\roleCount(), eZTrigger\runWorkflow(), eZSection\sectionCount(), eZContentObjectVersion\serialize(), eZContentClass\setAlwaysAvailableLanguageID(), eZContentObjectVersion\setAlwaysAvailableLanguageID(), eZContentObject\setAlwaysAvailableLanguageID(), eZPackage\setInstalled(), eZURLAliasML\setLangMaskAlwaysAvailable(), eZCollaborationItemParticipantLink\setLastRead(), eZContentObject\setName(), eZNodeAssignment\setNewMainAssignment(), eZContentObjectAssignmentHandler\setupAssignments(), eZPreferences\setValue(), eZEnum\setValue(), eZEnum\setVersion(), eZContentLanguage\sqlFilter(), eZKeyword\store(), eZRSSExport\store(), eZPDFExport\store(), eZVatRule\store(), eZWorkflowEvent\store(), eZContentObject\store(), eZWorkflow\store(), eZContentObjectAttribute\store(), eZContentClass\store(), eZOrderStatus\storeCustom(), eZWorkflowEvent\storeDefined(), eZContentClassAttribute\storeDefined(), eZWorkflow\storeDefined(), eZContentClass\storeDefined(), eZContentObject\storeInput(), eZContentObject\storeNodeModified(), eZPersistentObject\storeObject(), eZURLAliasML\storePath(), eZContentObjectTrashNode\storeToTrash(), eZContentStructureTreeOperator\subTree(), eZCollaborationGroup\subTree(), eZContentObjectTreeNode\subTreeByNodeID(), eZContentObjectTreeNode\subTreeCountByNodeID(), eZContentObjectTreeNode\subTreeMultiPaths(), eZContentObjectTreeNode\subtreeSoleNodeCount(), eZPersistentObject\swapRow(), eZURLAliasML\translate(), eZContentObjectAttribute\translateTo(), eZContentObjectVersion\translationList(), eZContentObjectTrashNode\trashList(), eZOrder\unArchiveOrder(), eZContentObjectVersion\unpublish(), eZContentObjectVersion\unserialize(), eZContentObject\unserialize(), eZISBN10To13Converter\updateClassAttributeToISBN13(), eZISBN10To13Converter\updateContentISBNNumber(), eZContentObjectTreeNode\updateMainNodeID(), eZContentBrowseRecent\updateNodeID(), eZPersistentObject\updateObjectList(), eZBasket\updatePrices(), eZURL\url(), eZURL\urlByMD5(), eZURL\urlByURL(), eZPreferences\value(), eZPreferences\values(), and verifyDataInternal().

static eZDB::setInstance ( instance) [static]

Sets the global database instance to $instance.

Definition at line 133 of file ezdb.php.

Referenced by eZWebDAVContentServer\setCurrentSite().


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