Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
#include <PVRDatabase.h>
Public Member Functions | |
CPVRDatabase ()=default | |
Create a new instance of the PVR database. | |
~CPVRDatabase () override=default | |
bool | Open () override |
Open the database. | |
void | Close () override |
Close the database. | |
void | Lock () |
Lock the database. | |
void | Unlock () |
Unlock the database. | |
int | GetSchemaVersion () const override |
Get the minimal database version that is required to operate correctly. | |
const char * | GetBaseDBName () const override |
Get the default sqlite database filename. | |
Channel methods | |
bool | DeleteChannels () |
Remove all channels from the database. | |
int | Get (bool bRadio, const std::vector< std::shared_ptr< CPVRClient > > &clients, std::map< std::pair< int, int >, std::shared_ptr< CPVRChannel > > &results) const |
Get channels from the database. | |
bool | Persist (CPVRChannel &channel, bool bCommit) |
Add or update a channel entry in the database. | |
bool | QueueDeleteQuery (const CPVRChannel &channel) |
Remove a channel entry from the database. | |
Channel group member methods | |
bool | QueueDeleteQuery (const CPVRChannelGroupMember &groupMember) |
Remove a channel group member entry from the database. | |
Channel provider methods | |
bool | DeleteProviders () |
Remove all providers from the database. | |
bool | Persist (CPVRProvider &provider, bool updateRecord=false) |
Add or update a provider entry in the database. | |
bool | Delete (const CPVRProvider &provider) |
Remove a provider entry from the database. | |
bool | Get (CPVRProviders &results, const std::vector< std::shared_ptr< CPVRClient > > &clients) const |
Get the list of providers from the database. | |
int | GetMaxProviderId () const |
Get the maximum provider id in the database. | |
Channel group methods | |
bool | DeleteChannelGroups () |
Remove all channel groups from the database. | |
bool | Delete (const CPVRChannelGroup &group) |
Delete a channel group and all its members from the database. | |
int | GetLocalGroups (CPVRChannelGroups &results) const |
Get all local channel groups. | |
int | Get (CPVRChannelGroups &results, const std::vector< std::shared_ptr< CPVRClient > > &clients) const |
Get client-supplied channel groups. | |
std::vector< std::shared_ptr< CPVRChannelGroupMember > > | Get (const CPVRChannelGroup &group, const std::vector< std::shared_ptr< CPVRClient > > &clients) const |
Get the members of a channel group. | |
bool | Persist (CPVRChannelGroup &group) |
Add or update a channel group entry in the database. | |
bool | ResetEPG () |
Reset all epg ids to 0. | |
Timer methods | |
std::vector< std::shared_ptr< CPVRTimerInfoTag > > | GetTimers (CPVRTimers &timers, const std::vector< std::shared_ptr< CPVRClient > > &clients) const |
Get the timers. | |
bool | Persist (CPVRTimerInfoTag &timer) |
Add or update a timer entry in the database. | |
bool | Delete (const CPVRTimerInfoTag &timer) |
Remove a timer from the database. | |
bool | DeleteTimers () |
Remove all timer entries from the database. | |
Public Member Functions inherited from CDatabase | |
CDatabase () | |
virtual | ~CDatabase (void) |
bool | IsOpen () |
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) |
Client methods | |
bool | DeleteClients () |
Remove all client entries from the database. | |
bool | Persist (const CPVRClient &client) |
Add or update a client entry in the database. | |
bool | Delete (const CPVRClient &client) |
Remove a client entry from the database. | |
int | GetPriority (const CPVRClient &client) const |
Get the priority for a given client from the database. | |
CDateTime | GetDateTimeFirstChannelsAdded (const CPVRClient &client) const |
Get the date and time first channels were added for the given client. | |
int | GetClientID (const std::string &addonID, unsigned int instanceID) |
Get the numeric client ID for given addon ID and instance ID from the database. | |
bool | UpdateLastWatched (const CPVRChannel &channel, int groupId) |
Updates the last watched timestamp for the channel. | |
bool | UpdateLastWatched (const CPVRChannelGroup &group) |
Updates the last watched timestamp for the channel group. | |
bool | UpdateLastOpened (const CPVRChannelGroup &group) |
Updates the last opened timestamp for the channel group. | |
Additional Inherited Members | |
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. | |
int | GetDBVersion () |
bool | BuildSQL (const std::string &strQuery, const Filter &filter, std::string &strSQL) const |
Protected Attributes inherited from CDatabase | |
bool | m_sqlite |
whether we use sqlite (defaults to true) | |
std::unique_ptr< dbiplus::Database > | m_pDB |
std::unique_ptr< dbiplus::Dataset > | m_pDS |
std::unique_ptr< dbiplus::Dataset > | m_pDS2 |
const CProfileManager & | m_profileManager |
|
default |
Create a new instance of the PVR database.
|
overridedefault |
bool CPVRDatabase::Delete | ( | const CPVRChannelGroup & | group | ) |
Delete a channel group and all its members from the database.
group | The group to delete. |
bool CPVRDatabase::Delete | ( | const CPVRClient & | client | ) |
Remove a client entry from the database.
client | The client to remove. |
bool CPVRDatabase::Delete | ( | const CPVRProvider & | provider | ) |
Remove a provider entry from the database.
provider | The provider to remove. |
bool CPVRDatabase::Delete | ( | const CPVRTimerInfoTag & | timer | ) |
Remove a timer from the database.
timer | The timer to remove. |
bool CPVRDatabase::DeleteChannelGroups | ( | ) |
Remove all channel groups from the database.
bool CPVRDatabase::DeleteChannels | ( | ) |
Remove all channels from the database.
bool CPVRDatabase::DeleteClients | ( | ) |
Remove all client entries from the database.
bool CPVRDatabase::DeleteProviders | ( | ) |
Remove all providers from the database.
bool CPVRDatabase::DeleteTimers | ( | ) |
Remove all timer entries from the database.
int CPVRDatabase::Get | ( | bool | bRadio, |
const std::vector< std::shared_ptr< CPVRClient > > & | clients, | ||
std::map< std::pair< int, int >, std::shared_ptr< CPVRChannel > > & | results ) const |
Get channels from the database.
bRadio | Whether to fetch radio or TV channels. |
clients | The PVR clients the channels should be loaded for. Leave empty for all clients. |
results | The container for the channels. |
std::vector< std::shared_ptr< CPVRChannelGroupMember > > CPVRDatabase::Get | ( | const CPVRChannelGroup & | group, |
const std::vector< std::shared_ptr< CPVRClient > > & | clients ) const |
Get the members of a channel group.
group | The group to get the members for. |
clients | The PVR clients the group members should be loaded for. Leave empty for all clients. |
int CPVRDatabase::Get | ( | CPVRChannelGroups & | results, |
const std::vector< std::shared_ptr< CPVRClient > > & | clients ) const |
Get client-supplied channel groups.
results | The container to store the results in. |
clients | The PVR clients the groups should be loaded for. Leave empty for all clients. |
bool CPVRDatabase::Get | ( | CPVRProviders & | results, |
const std::vector< std::shared_ptr< CPVRClient > > & | clients ) const |
Get the list of providers from the database.
results | The providers to store the results in. |
clients | The PVR clients the providers should be loaded for. Leave empty for all clients. |
|
inlineoverridevirtual |
Get the numeric client ID for given addon ID and instance ID from the database.
addonID | The addon ID. |
instanceID | The instance ID. |
CDateTime CPVRDatabase::GetDateTimeFirstChannelsAdded | ( | const CPVRClient & | client | ) | const |
Get the date and time first channels were added for the given client.
client | The client. |
int CPVRDatabase::GetLocalGroups | ( | CPVRChannelGroups & | results | ) | const |
Get all local channel groups.
results | The container to store the results in. |
int CPVRDatabase::GetMaxProviderId | ( | ) | const |
Get the maximum provider id in the database.
int CPVRDatabase::GetPriority | ( | const CPVRClient & | client | ) | const |
Get the priority for a given client from the database.
client | The client. |
|
inlineoverridevirtual |
Get the minimal database version that is required to operate correctly.
Implements CDatabase.
std::vector< std::shared_ptr< CPVRTimerInfoTag > > CPVRDatabase::GetTimers | ( | CPVRTimers & | timers, |
const std::vector< std::shared_ptr< CPVRClient > > & | clients ) const |
Get the timers.
timers | The container for the timers. |
clients | The PVR clients the timers should be loaded for. Leave empty for all clients. |
void CPVRDatabase::Lock | ( | ) |
Lock the database.
|
overridevirtual |
Open the database.
Reimplemented from CDatabase.
bool CPVRDatabase::Persist | ( | const CPVRClient & | client | ) |
Add or update a client entry in the database.
client | The client to persist. |
bool CPVRDatabase::Persist | ( | CPVRChannel & | channel, |
bool | bCommit ) |
Add or update a channel entry in the database.
channel | The channel to persist. |
bCommit | queue only or queue and commit |
bool CPVRDatabase::Persist | ( | CPVRChannelGroup & | group | ) |
Add or update a channel group entry in the database.
group | The group to persist. |
bool CPVRDatabase::Persist | ( | CPVRProvider & | provider, |
bool | updateRecord = false ) |
Add or update a provider entry in the database.
provider | The provider to persist. |
updateRecord | True if record to be updated, false for insert |
bool CPVRDatabase::Persist | ( | CPVRTimerInfoTag & | timer | ) |
Add or update a timer entry in the database.
channel | The timer to persist. |
bool CPVRDatabase::QueueDeleteQuery | ( | const CPVRChannel & | channel | ) |
Remove a channel entry from the database.
channel | The channel to remove. |
bool CPVRDatabase::QueueDeleteQuery | ( | const CPVRChannelGroupMember & | groupMember | ) |
Remove a channel group member entry from the database.
groupMember | The group member to remove. |
bool CPVRDatabase::ResetEPG | ( | ) |
Reset all epg ids to 0.
void CPVRDatabase::Unlock | ( | ) |
Unlock the database.
bool CPVRDatabase::UpdateLastOpened | ( | const CPVRChannelGroup & | group | ) |
Updates the last opened timestamp for the channel group.
group | the group |
bool CPVRDatabase::UpdateLastWatched | ( | const CPVRChannel & | channel, |
int | groupId ) |
Updates the last watched timestamp for the channel.
channel | the channel |
groupId | the id of the group used to watch the channel |
bool CPVRDatabase::UpdateLastWatched | ( | const CPVRChannelGroup & | group | ) |
Updates the last watched timestamp for the channel group.
group | the group |