DatabaseProvider methods
clearCacheQuery( cacheKeyNamingOptions, overrideCacheProviderName )
Clears the cache for the query identified by the given cacheKeyNamingOptions
cacheKeyNamingOptionsAn optional hash array with the cache key naming options. Cache::buildCacheKeyoverrideCacheProviderNameIf specified, the cache provider with this name will be used instead of the one in the Database configuration keycacheProviderName.
Returns: True if the cache could be cleared successfully, false otherwise.
execute( prepareResult, parameters )
Executes a previously prepared query with the given parameters.
prepareResultThe prepare result as returned by the DatabaseProvider::prepare method.parametersA hash array with the variables to be applied to the prepared result, in the same order as they are stated in the original SQL statement, where each item in the array is a hash array with the following keys:typeOne of the available database field type constants, likeDATABASE_FIELD_TYPE_INTEGERvalueThe value of the variable.
prepare( sql )
Prepares a query so it can be later executed as a prepared query with the DatabaseProvider::execute method.
sqlThe SQL statement to prepare to be queried to the database, where all the variables are replaced by question marks.
Returns: A hash array with the following keys:
sqlThe passed SQL statement.statementA provider-specific statement object if the query has been prepared correctly, false otherwise.
prepareAndExecute( sql, parameters, setup )
Prepares and executes a prepared query
sqlThe prepared SQL statement.parametersA hash array with the variables to be applied to the prepared SQL statement, in the same order as they are stated in the SQL, with the same structure as in the DatabaseProvider::execute method.setupOptional hash array with options, same specification as DatabaseResult::$setup
Returns: A DatabaseResult object if the query was executed correctly, false otherwise.
prepareAndExecuteCache( sql, parameters, cacheTtl, cacheKeyNamingOptions, overrideCacheProviderName, isStoreInCacheWhenNoResults, setup )
Prepares and executes a prepared query implementing a caching mechanism. If the query results are stored in the cache, it retrieves them. If not in cache, it performs the query and stores the results in cache.
sqlThe SQL statement.parametersA hash array with the variables to be applied to the prepared SQL statement, in the same order as they are stated in the SQL, with the same structure as in the DatabaseProvider::execute method.cacheTtlThe TTL for the cache results. If not specified, the Database configuration keycacheDefaultTtlis used.cacheKeyNamingOptionsAn optional hash array with the cache key naming options. Cache::buildCacheKeyoverrideCacheProviderNameIf specified, the cache provider with this name will be used instead of the one in the Database configuration keycacheProviderName.isStoreInCacheWhenNoResultsWhether to store results in the cache when the query returned no rows or not.setupOptional setup keys, as specified in DatabaseResult::$setup
query( query, setup )
Performs a query to the database.
queryThe SQL query stringsetupAn optional hash array with setup options.
queryCache( sql, cacheTtl, cacheKeyNamingOptions, overrideCacheProviderName, isStoreInCacheWhenNoResults, setup )
Performs a query to the database implementing a caching mechanism. If the query results are stored in the cache, it retrieves them. If not in cache, it performs the query and stores the results in cache.
queryThe SQL statement.cacheTtlThe TTL for the cache results. If not specified, the Database configuration keycacheDefaultTtlis used.cacheKeyNamingOptionsAn optional hash array with the cache key naming options. Cache::buildCacheKeyoverrideCacheProviderNameIf specified, the cache provider with this name will be used instead of the one in the Database configuration keycacheProviderName.isStoreInCacheWhenNoResultsWhether to store results in the cache when the query returned no rows or not.setupOptional setup keys, as specified in DatabaseResult::$setup.
Returns: A provider-specific DatabaseResult object if the query was executed or retrieved from cache successfully, false otherwise.
Last updated
Was this helpful?