Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CTextureDatabase Class Reference

#include <TextureDatabase.h>

Inheritance diagram for CTextureDatabase:
CDatabase IDatabaseQueryRuleFactory

Public Member Functions

 CTextureDatabase ()
 
 ~CTextureDatabase () override
 
bool Open () override
 
bool GetCachedTexture (const std::string &originalURL, CTextureDetails &details)
 
bool AddCachedTexture (const std::string &originalURL, const CTextureDetails &details)
 
bool SetCachedTextureValid (const std::string &originalURL, bool updateable)
 
bool ClearCachedTexture (const std::string &originalURL, std::string &cacheFile)
 
bool ClearCachedTexture (int textureID, std::string &cacheFile)
 
bool IncrementUseCount (const CTextureDetails &details)
 
bool InvalidateCachedTexture (const std::string &originalURL)
 Invalidate a previously cached texture Invalidates the texture hash, and sets the texture update time to the current time so that next texture load it will be re-cached.
 
std::string GetTextureForPath (const std::string &url, const std::string &type)
 Get a texture associated with the given path Used for retrieval of previously discovered images to save stat() on the filesystem all the time.
 
void SetTextureForPath (const std::string &url, const std::string &type, const std::string &texture)
 Set a texture associated with the given path Used for setting of previously discovered images to save stat() on the filesystem all the time. Should be used to set the actual image path, not the cached image path (the image will be cached at load time.)
 
void ClearTextureForPath (const std::string &url, const std::string &type)
 Clear a texture associated with the given path.
 
bool GetTextures (CVariant &items, const Filter &filter)
 
CDatabaseQueryRuleCreateRule () const override
 
CDatabaseQueryRuleCombinationCreateCombination () const override
 
- Public Member Functions inherited from CDatabase
 CDatabase ()
 
virtual ~CDatabase (void)
 
bool IsOpen ()
 
virtual void Close ()
 
bool Compress (bool bForce=true)
 
void Interrupt ()
 
bool Open (const DatabaseSettings &db)
 
void BeginTransaction ()
 
virtual bool CommitTransaction ()
 
void RollbackTransaction ()
 
void CopyDB (const std::string &latestDb)
 
void DropAnalytics ()
 
std::string PrepareSQL (std::string strStmt,...) const
 
std::string GetSingleValue (const std::string &strTable, const std::string &strColumn, const std::string &strWhereClause=std::string(), const std::string &strOrderBy=std::string()) const
 Get a single value from a table.
 
std::string GetSingleValue (const std::string &query) const
 
std::string GetSingleValue (const std::string &query, const std::unique_ptr< dbiplus::Dataset > &ds) const
 Get a single value from a query on a dataset.
 
int GetSingleValueInt (const std::string &strTable, const std::string &strColumn, const std::string &strWhereClause=std::string(), const std::string &strOrderBy=std::string()) const
 Get a single integer value from a table.
 
int GetSingleValueInt (const std::string &query) const
 
int GetSingleValueInt (const std::string &query, const std::unique_ptr< dbiplus::Dataset > &ds) const
 Get a single integer value from a query on a dataset.
 
bool DeleteValues (const std::string &strTable, const Filter &filter=Filter())
 Delete values from a table.
 
bool ExecuteQuery (const std::string &strQuery)
 Execute a query that does not return any result. Note that if BeginMultipleExecute() has been called, the query will be queued until CommitMultipleExecute() is called.
 
bool ResultQuery (const std::string &strQuery) const
 Execute a query that returns a result.
 
bool BeginMultipleExecute ()
 Start a multiple execution queue. Any ExecuteQuery() function following this call will be queued rather than executed until CommitMultipleExecute() is performed. NOTE: Queries that rely on any queued execute query will not function as expected during this period!
 
bool CommitMultipleExecute ()
 Commit the multiple execution queue to the database. Queries are performed within a transaction, and the transaction is rolled back should any one query fail.
 
bool QueueInsertQuery (const std::string &strQuery)
 Put an INSERT or REPLACE query in the queue.
 
bool CommitInsertQueries ()
 Commit all queries in the queue.
 
size_t GetInsertQueriesCount ()
 Get the number of INSERT queries in the queue.
 
bool QueueDeleteQuery (const std::string &strQuery)
 Put a DELETE query in the queue.
 
bool CommitDeleteQueries ()
 Commit all queued DELETE queries.
 
size_t GetDeleteQueriesCount ()
 Get the number of DELETE queries in the queue.
 
virtual bool GetFilter (CDbUrl &dbUrl, Filter &filter, SortDescription &sorting)
 
virtual bool BuildSQL (const std::string &strBaseDir, const std::string &strQuery, Filter &filter, std::string &strSQL, CDbUrl &dbUrl)
 
virtual bool BuildSQL (const std::string &strBaseDir, const std::string &strQuery, Filter &filter, std::string &strSQL, CDbUrl &dbUrl, SortDescription &sorting)
 
bool Connect (const std::string &dbName, const DatabaseSettings &db, bool create)
 
- Public Member Functions inherited from IDatabaseQueryRuleFactory
virtual ~IDatabaseQueryRuleFactory ()=default
 

Protected Member Functions

unsigned int GetURLHash (const std::string &url) const
 retrieve a hash for the given url Computes a hash of the current url to use for lookups in the database
 
void CreateTables () override
 
void CreateAnalytics () override
 
void UpdateTables (int version) override
 
int GetSchemaVersion () const override
 
const char * GetBaseDBName () const override
 
- Protected Member Functions inherited from CDatabase
void Split (const std::string &strFileNameAndPath, std::string &strPath, std::string &strFileName)
 
bool CreateDatabase ()
 Create database tables and analytics as needed. Calls CreateTables() and CreateAnalytics() on child classes.
 
virtual int GetMinSchemaVersion () const
 
int GetDBVersion ()
 
bool BuildSQL (const std::string &strQuery, const Filter &filter, std::string &strSQL) const
 

Additional Inherited Members

- Protected Attributes inherited from CDatabase
bool m_sqlite
 whether we use sqlite (defaults to true)
 
std::unique_ptr< dbiplus::Databasem_pDB
 
std::unique_ptr< dbiplus::Datasetm_pDS
 
std::unique_ptr< dbiplus::Datasetm_pDS2
 
const CProfileManagerm_profileManager
 

Constructor & Destructor Documentation

◆ CTextureDatabase()

CTextureDatabase::CTextureDatabase ( )
default

◆ ~CTextureDatabase()

CTextureDatabase::~CTextureDatabase ( )
overridedefault

Member Function Documentation

◆ AddCachedTexture()

bool CTextureDatabase::AddCachedTexture ( const std::string & originalURL,
const CTextureDetails & details )

◆ ClearCachedTexture() [1/2]

bool CTextureDatabase::ClearCachedTexture ( const std::string & originalURL,
std::string & cacheFile )

◆ ClearCachedTexture() [2/2]

bool CTextureDatabase::ClearCachedTexture ( int textureID,
std::string & cacheFile )

◆ ClearTextureForPath()

void CTextureDatabase::ClearTextureForPath ( const std::string & url,
const std::string & type )

Clear a texture associated with the given path.

Parameters
urlpath that was used to find the texture
typetype of image to associate
textureURL of the texture to associate with the path
See also
GetTextureForPath, SetTextureForPath

◆ CreateAnalytics()

void CTextureDatabase::CreateAnalytics ( )
overrideprotectedvirtual
Todo
Should the path index be a covering index? (we need only retrieve texture)

Implements CDatabase.

◆ CreateCombination()

CDatabaseQueryRuleCombination * CTextureDatabase::CreateCombination ( ) const
overridevirtual

◆ CreateRule()

CDatabaseQueryRule * CTextureDatabase::CreateRule ( ) const
overridevirtual

◆ CreateTables()

void CTextureDatabase::CreateTables ( )
overrideprotectedvirtual

Implements CDatabase.

◆ GetBaseDBName()

const char * CTextureDatabase::GetBaseDBName ( ) const
inlineoverrideprotectedvirtual

Implements CDatabase.

◆ GetCachedTexture()

bool CTextureDatabase::GetCachedTexture ( const std::string & originalURL,
CTextureDetails & details )

◆ GetSchemaVersion()

int CTextureDatabase::GetSchemaVersion ( ) const
inlineoverrideprotectedvirtual

Implements CDatabase.

◆ GetTextureForPath()

std::string CTextureDatabase::GetTextureForPath ( const std::string & url,
const std::string & type )

Get a texture associated with the given path Used for retrieval of previously discovered images to save stat() on the filesystem all the time.

Parameters
urlpath that may be associated with a texture
typetype of image to look for
Returns
URL of the texture associated with the given path

◆ GetTextures()

bool CTextureDatabase::GetTextures ( CVariant & items,
const Filter & filter )

◆ GetURLHash()

unsigned int CTextureDatabase::GetURLHash ( const std::string & url) const
protected

retrieve a hash for the given url Computes a hash of the current url to use for lookups in the database

Parameters
urlurl to hash
Returns
a hash for this url

◆ IncrementUseCount()

bool CTextureDatabase::IncrementUseCount ( const CTextureDetails & details)

◆ InvalidateCachedTexture()

bool CTextureDatabase::InvalidateCachedTexture ( const std::string & originalURL)

Invalidate a previously cached texture Invalidates the texture hash, and sets the texture update time to the current time so that next texture load it will be re-cached.

Parameters
urltexture path

◆ Open()

bool CTextureDatabase::Open ( )
overridevirtual

Reimplemented from CDatabase.

◆ SetCachedTextureValid()

bool CTextureDatabase::SetCachedTextureValid ( const std::string & originalURL,
bool updateable )

◆ SetTextureForPath()

void CTextureDatabase::SetTextureForPath ( const std::string & url,
const std::string & type,
const std::string & texture )

Set a texture associated with the given path Used for setting of previously discovered images to save stat() on the filesystem all the time. Should be used to set the actual image path, not the cached image path (the image will be cached at load time.)

Parameters
urlpath that was used to find the texture
typetype of image to associate
textureURL of the texture to associate with the path

◆ UpdateTables()

void CTextureDatabase::UpdateTables ( int version)
overrideprotectedvirtual

Reimplemented from CDatabase.


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