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

Public Member Functions

 checkTransactionCounter ()
 
 eZDB ()
 

Static Public Member Functions

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

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
// 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() ););
}
// 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

Member Function Documentation

eZDB::checkTransactionCounter ( )

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.

Referenced by eZScript\shutdown().

eZDB::eZDB ( )

Constructor. NOTE: Should not be used.

eZDB::hasInstance ( )
static

Returns an instance of the database object.

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

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

Referenced by eZOrder\activate(), eZShopOperationCollection\activateOrder(), eZOrder\active(), eZOrder\activeCount(), eZContentObjectTreeNode\addChild(), eZContentObject\addContentObjectRelation(), eZCollaborationItemGroupLink\addItem(), eZContentLanguage\addLanguage(), eZCollaborationItemMessageLink\addMessage(), openFts\addObject(), eZSearchEngine\addObject(), eZSearchLog\addPhrase(), eZShopOperationCollection\addToBasket(), eZContentCacheManager\appendKeywordNodeIDs(), eZPolicy\appendLimitation(), applyChanges(), eZOrder\archiveOrder(), eZContentObject\assignedNodes(), eZContentObjectTreeNode\assignSectionToSubTree(), eZIdentifierType\assignValue(), eZContentObject\authorArray(), eZContentOperationCollection\beginPublish(), eZSearchEngine\buildTempTablesForFullTextSearch(), eZSearchEngine\buildWordIDArray(), eZContentClassAttribute\cachedInfo(), eZProductCollectionItem\calculatePriceWithOptions(), eZContentObjectTreeNode\calendar(), eZMultiPriceData\changeCurrency(), eZShopFunctions\changeCurrency(), eZStepInstaller\checkDatabaseRequirements(), checkNodeActions(), checkNodeAssignments(), checkNodeMovements(), eZContentObjectTreeNode\checkPath(), eZTipafriendRequest\checkReceiver(), checkRelationActions(), checkRelationAssignments(), checkTransactionCounter(), eZContentObjectTreeNode\childrenByName(), eZContentObjectTreeNode\classAttributeIDByIdentifier(), eZUserType\classAttributeRemovableInformation(), eZContentObjectTreeNode\classIDByIdentifier(), eZContentObject\className(), eZDBTool\cleanup(), eZForgotPassword\cleanup(), eZTipafriendRequest\cleanup(), eZGeneralDigestUserSettings\cleanup(), eZNotificationCollectionItem\cleanup(), eZTipafriendCounter\cleanup(), eZCollaborationNotificationRule\cleanup(), eZOrderItem\cleanup(), eZNotificationEventFilter\cleanup(), eZContentBrowseBookmark\cleanup(), eZNotificationCollection\cleanup(), eZOperationMemento\cleanup(), eZURLAlias\cleanup(), eZNotificationEvent\cleanup(), eZWishList\cleanup(), eZInformationCollectionAttribute\cleanup(), eZContentBrowseRecent\cleanup(), eZPreferences\cleanup(), eZSubtreeNotificationRule\cleanup(), eZBasket\cleanup(), eZCollaborationItem\cleanup(), eZWorkflowProcess\cleanup(), eZInformationCollection\cleanup(), eZOrder\cleanup(), eZSearchEngine\cleanup(), eZBasket\cleanupCurrentBasket(), eZBasket\cleanupExpired(), eZURLAlias\cleanupForwardingURLs(), eZProductCollectionItemOption\cleanupList(), eZProductCollection\cleanupList(), eZProductCollectionItem\cleanupList(), eZOrder\cleanupOrder(), eZURLAlias\cleanupWildcards(), eZWorkflow\cleanupWorkFlowProcess(), eZContentObjectAttribute\clone(), eZEnumType\cloneClassAttribute(), eZDBGarbageCollector\collectBaskets(), eZDBGarbageCollector\collectProductCollectionItemOptions(), eZDBGarbageCollector\collectProductCollectionItems(), eZDBGarbageCollector\collectProductCollections(), eZPersistentObject\conditionTextByRow(), connectToDatabase(), eZInformationCollectionAttribute\contentClassAttributeName(), eZContentObject\contentClassIdentifier(), eZContentObject\contentObjectAttributes(), eZProductCollection\copy(), eZPolicy\copy(), eZContentObject\copy(), copyBinaryfilesToDB(), eZContentObject\copyContentObjectRelations(), copyImagesToDB(), copyMediafilesToDB(), copyObject(), copySubtree(), eZContentObject\copyVersion(), eZProductCollection\count(), eZContentObjectTreeNode\createAttributeFilterSQLStrings(), eZShopFunctions\createCurrency(), eZWebDAVContentServer\createFolder(), eZSimplifiedXMLEditOutput\createLinksArray(), eZContentBrowseBookmark\createNew(), eZContentBrowseRecent\createNew(), eZContentObject\createNewVersion(), eZBasket\createOrder(), eZContentObjectTreeNode\createPermissionCheckingSQLString(), eZMultiPriceData\createPriceListForCurrency(), eZSearchEngine\createTemporaryTable(), eZContentObject\createWithNodeAssignment(), eZBasket\currentBasket(), eZOrder\customerCount(), eZOrder\customerList(), eZPublishSDK\databaseRelease(), eZPublishSDK\databaseVersion(), eZUserType\deleteStoredObjectAttribute(), eZURLType\deleteStoredObjectAttribute(), eZKeywordType\deleteStoredObjectAttribute(), eZObjectRelationListType\deleteStoredObjectAttribute(), eZXMLTextType\deleteStoredObjectAttribute(), eZOrder\detachProductCollection(), eZDiscount\discountPercent(), eZContentOperationCollection\endPublish(), eZPersistentObject\escapeArray(), eZContentObject\exists(), eZDBCleanup(), eZFetchActiveSessionCount(), eZFetchActiveSessions(), eZSessionCountActive(), eZSessionDestroy(), eZSessionEmpty(), eZSessionGarbageCollector(), eZSessionRead(), eZSessionRemove(), eZSessionStart(), eZSessionStop(), eZSessionWrite(), eZKeyword\fetch(), eZContentObject\fetch(), eZContentObjectTreeNode\fetch(), eZContentObjectTreeNode\fetchAliasesFromNodeList(), eZUser\fetchAnonymousCount(), eZContentObjectVersion\fetchAttributes(), eZShopFunctionCollection\fetchBestSellList(), eZContentObject\fetchByNodeID(), eZContentObject\fetchByRemoteID(), eZUserDiscountRule\fetchByUserIDArray(), eZContentClassClassGroup\fetchClassList(), eZInformationCollection\fetchCollectionCountForObject(), eZUser\fetchContentList(), eZOrderStatusHistory\fetchCount(), eZVatRule\fetchCountByCategory(), eZInformationCollection\fetchCountForAttribute(), eZInformationCollection\fetchCountList(), eZMultiPriceData\fetchDataListWithoutPriceInCurrency(), eZVatType\fetchDependentClassesCount(), eZVatType\fetchDependentProductsCount(), eZWorkflowProcess\fetchForStatus(), eZGeneralDigestHandler\fetchHandlersForUser(), eZContentObject\fetchIDArray(), eZUserDiscountRule\fetchIDListByUserID(), eZImageFile\fetchImageAttributesByFilepath(), eZGeneralDigestHandler\fetchItemsForUser(), eZContentFunctionCollection\fetchKeyword(), eZContentFunctionCollection\fetchKeywordCount(), eZContentObjectTreeNode\fetchList(), eZOrderStatusHistory\fetchListByOrder(), eZContentObjectTreeNode\fetchListCount(), eZCollaborationItem\fetchListTool(), eZUser\fetchLoggedInCount(), eZUser\fetchLoggedInList(), eZContentObjectTreeNode\fetchNode(), eZContentObjectTreeNode\fetchNodesByPathString(), eZEnumType\fetchObjectAttributeHTTPInput(), eZContentObject\fetchObjectCountByUserID(), eZPersistentObject\fetchObjectList(), eZOrderStatus\fetchPolicyList(), eZProductCategory\fetchProductCountByCategory(), eZShopFunctionCollection\fetchRelatedPurchaseList(), eZContentFunctionCollection\fetchSameClassAttributeNodeList(), eZViewCounter\fetchTopList(), eZSearchEngine\fetchTotalObjectCount(), eZSubtreeNotificationRule\fetchUserList(), eZContentObject\fillNodeListAttributes(), eZPolicyLimitation\findByType(), eZContentObjectTreeNode\findMainNode(), eZContentObjectTreeNode\findMainNodeArray(), eZContentObjectTreeNode\findNode(), eZContentObject\fixReverseRelations(), eZStaticCache\generateCache(), eZStaticCache\generateNodeListCache(), eZImageAliasHandler\generateXMLData(), eZContentObjectTreeNode\getName(), eZContentObjectTreeNode\getParentNodeId(), eZContentObject\getVersionCount(), eZUser\groups(), eZCollaborationItemHandler\handleCollaborationEvent(), eZBinaryFileType\handleDownload(), eZURL\handleList(), handleNodeTemplate(), eZContentUpload\handleUpload(), eZShopOperationCollection\handleUserCountry(), eZUser\hasStoredLogin(), importRSSItem(), eZSearchEngine\indexWords(), eZInformationCollection\informationCollectionAttributes(), eZStepSiteDetails\init(), eZScript\initialize(), eZEnumType\initializeClassAttribute(), eZContentClass\initializeCopy(), eZEnumType\initializeObjectAttribute(), eZStepCreateSites\initializePackage(), eZBinaryFileType\insertHTTPFile(), eZDBPackageHandler\install(), eZINIAddonPackageHandler\install(), eZDbSchema\instance(), eZCollaborationGroup\instantiate(), eZContentClass\instantiate(), eZDBTool\isEmpty(), eZUser\isUserLoggedIn(), eZCollaborationGroup\itemCount(), eZContentLanguage\languagesSQLFilter(), eZUser\lastVisit(), eZUser\limitList(), loadDatabaseSchema(), eZLDAPUser\loginUser(), eZTextFileUser\loginUser(), eZUser\loginUser(), eZUser\logoutCurrent(), eZOrder\modifyStatus(), eZSearchLog\mostFrequentPhraseArray(), eZContentObjectTreeNodeOperations\move(), eZContentObjectTreeNode\move(), eZImageFile\moveFilepath(), eZPersistentObject\newObjectOrder(), eZContentObject\nextVersion(), eZContentObjectVersion\nonTranslatableAttributesToUpdate(), eZContentLanguage\objectCount(), eZContentClass\objectCount(), eZContentLanguage\objectInitialCount(), eZOrder\orderList(), eZOrder\orderStatistics(), eZOrderStatus\orderStatusCount(), eZPDFXMLOutput\pdf(), eZSearchEngine\prepareWordIDArrays(), eZSearchEngine\prepareWordIDArraysForPattern(), eZVatRule\productCategories(), eZOrder\productList(), eZContentObject\publishContentObjectRelations(), eZContentOperationCollection\publishNode(), eZNodeAssignment\purge(), eZOrder\purge(), eZContentObject\purge(), eZNodeAssignment\purgeByID(), eZContentOperationCollection\registerSearchObject(), eZURL\registerURL(), eZURL\registerURLArray(), eZContentObject\relatedObjectCount(), eZKeyword\relatedObjects(), eZContentObject\relatedObjects(), eZContentObject\remoteID(), eZContentClass\removableInformation(), eZProductCategory\remove(), eZMultiPriceData\remove(), eZWorkflow\remove(), eZVatRule\remove(), eZPolicyLimitation\remove(), eZProductCollectionItem\remove(), eZRSSExport\remove(), eZPolicy\remove(), eZNodeAssignment\remove(), eZVatType\remove(), eZOrderStatus\remove(), eZContentClassAttribute\remove(), eZWorkflowProcess\remove(), eZContentObjectVersion\remove(), eZContentObject\remove(), eZContentObjectTreeNode\remove(), eZContentClass\removeAttributes(), eZMultiPriceData\removeByID(), eZNodeAssignment\removeByID(), eZContentBrowseBookmark\removeByNodeID(), eZInformationCollection\removeCollection(), eZInformationCollection\removeContentObject(), eZContentObject\removeContentObjectRelation(), eZShopFunctions\removeCurrency(), eZCurrencyData\removeCurrencyList(), eZNotificationCollection\removeEmpty(), eZWorkflow\removeEvents(), eZWorkflowFunctions\removeGroup(), eZOrder\removeHistory(), eZContentObjectTreeNode\removeNodeFromTree(), openFts\removeObject(), eZPersistentObject\removeObject(), eZSearchEngine\removeObject(), eZContentOperationCollection\removeOldNodes(), eZOrder\removeOrderItems(), eZMultiPriceData\removePriceListForCurrency(), eZVatRule\removeProductCategories(), eZContentBrowseRecent\removeRecentByNodeID(), eZVatRule\removeReferencesToProductCategory(), eZContentObject\removeReverseRelations(), eZUser\removeSessionData(), eZSearchLog\removeStatistics(), eZContentObjectTreeNode\removeSubtrees(), eZWorkflow\removeTemporary(), eZContentObjectVersion\removeTranslation(), eZContentObject\removeTranslation(), eZTrigger\removeTriggerForWorkflow(), eZContentObjectVersion\removeVersions(), eZPersistentObject\reorderObject(), eZVatType\resetToDefaultInProducts(), eZContentObjectTreeNode\reverseRelatedCount(), eZContentObject\revertTo(), eZTrigger\runWorkflow(), openFts\search(), eZSearchEngine\search(), eZSection\sectionCount(), eZContentObjectVersion\serialize(), eZContentObjectVersion\setAlwaysAvailableLanguageID(), eZContentObject\setAlwaysAvailableLanguageID(), eZCollaborationItemParticipantLink\setLastRead(), eZContentObject\setName(), eZNodeAssignment\setNewMainAssignment(), eZContentOperationCollection\setObjectStatusPublished(), eZContentObjectAssignmentHandler\setupAssignments(), eZPreferences\setValue(), eZEnum\setValue(), eZEnum\setVersion(), eZScript\shutdown(), eZContentLanguage\sqlFilter(), eZKeyword\store(), eZPDFExport\store(), eZRSSExport\store(), eZVatRule\store(), eZContentObject\store(), eZWorkflowEvent\store(), eZWorkflow\store(), eZContentObjectAttribute\store(), eZContentClass\store(), eZOrderStatus\storeCustom(), eZContentClassAttribute\storeDefined(), eZContentClass\storeDefined(), eZContentObject\storeInput(), storeNodeAssignments(), eZContentObject\storeNodeModified(), eZPersistentObject\storeObject(), eZRSSEditFunction\storeRSSExport(), storeRSSImport(), eZContentStructureTreeOperator\subTree(), eZCollaborationGroup\subTree(), eZContentObjectTreeNode\subTree(), eZTemplateCacheFunction\subtreeCacheSubDir(), eZContentObjectTreeNode\subTreeCount(), eZContentObjectTreeNode\subTreeMultiPaths(), eZContentObjectTreeNode\subtreeSoleNodeCount(), eZPersistentObject\swapRow(), eZURLAlias\totalCount(), eZURLAlias\translate(), eZContentObjectAttribute\translateTo(), eZContentObjectVersion\translationList(), eZOrder\unArchiveOrder(), eZContentObjectVersion\unserialize(), eZContentObject\unserialize(), eZMultiPriceData\updateAutoprices(), eZURLAlias\updateChildAliases(), eZURLAlias\updateForwardID(), eZUser\updateLastVisit(), eZContentObjectTreeNode\updateMainNodeID(), eZContentBrowseRecent\updateNodeID(), eZPersistentObject\updateObjectList(), eZBasket\updatePrices(), eZContentOperationCollection\updateSectionID(), eZContentObjectTreeNode\updateSubTreePath(), eZContentObjectTreeNode\updateURLAlias(), eZURL\url(), eZURL\urlByMD5(), eZURL\urlByURL(), eZPreferences\value(), eZPreferences\values(), and eZXHTMLXMLOutput\xhtml().

eZDB::setInstance ( $instance)
static

Sets the global database instance to $instance.

Referenced by eZStepCreateSites\initializePackage(), and eZWebDAVContentServer\setCurrentSite().


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