Kodi Documentation  18.0
Kodi is an open source media player and entertainment hub.
PVR::CPVREpgDatabase Class Reference

#include <EpgDatabase.h>

Inheritance diagram for PVR::CPVREpgDatabase:
CDatabase

Public Member Functions

 CPVREpgDatabase (void)=default
 Create a new instance of the EPG database. More...
 
 ~CPVREpgDatabase (void) override=default
 Destroy this instance. More...
 
bool Open () override
 Open the database. More...
 
void Close () override
 Close the database. More...
 
void Lock ()
 Lock the database. More...
 
void Unlock ()
 Unlock the database. More...
 
int GetSchemaVersion (void) const override
 Get the minimal database version that is required to operate correctly. More...
 
const char * GetBaseDBName (void) const override
 Get the default sqlite database filename. More...
 
EPG methods
bool DeleteEpg (void)
 Remove all EPG information from the database. More...
 
bool Delete (const CPVREpg &table)
 Delete an EPG table. More...
 
bool DeleteEpgEntries (const CDateTime &maxEndTime)
 Erase all EPG entries with an end time less than the given time. More...
 
bool Delete (const CPVREpgInfoTag &tag)
 Remove a single EPG entry. More...
 
std::vector< CPVREpgPtrGet (const CPVREpgContainer &container)
 Get all EPG tables from the database. Does not get the EPG tables' entries. More...
 
std::vector< CPVREpgInfoTagPtrGet (const CPVREpg &epg)
 Get all EPG entries for a table. More...
 
bool GetLastEpgScanTime (int iEpgId, CDateTime *lastScan)
 Get the last stored EPG scan time. More...
 
bool PersistLastEpgScanTime (int iEpgId=0, bool bQueueWrite=false)
 Update the last scan time. More...
 
int Persist (const CPVREpg &epg, bool bQueueWrite=false)
 Persist an EPG table. It's entries are not persisted. More...
 
int Persist (const CPVREpgInfoTag &tag, bool bSingleUpdate=true)
 Persist an infotag. More...
 
int GetLastEPGId (void)
 
- 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 ()
 
bool InTransaction ()
 
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())
 Get a single value from a table. More...
 
std::string GetSingleValue (const std::string &query)
 
std::string GetSingleValue (const std::string &query, std::unique_ptr< dbiplus::Dataset > &ds)
 Get a single value from a query on a dataset. More...
 
bool DeleteValues (const std::string &strTable, const Filter &filter=Filter())
 Delete values from a table. More...
 
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. More...
 
bool ResultQuery (const std::string &strQuery)
 Execute a query that returns a result. More...
 
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! More...
 
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. More...
 
bool QueueInsertQuery (const std::string &strQuery)
 Put an INSERT or REPLACE query in the queue. More...
 
bool CommitInsertQueries ()
 Commit all queries in the queue. More...
 
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)
 

Additional Inherited Members

- Public Types inherited from CDatabase
typedef struct CDatabase::DatasetFieldInfo DatasetFieldInfo
 
- 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. More...
 
int GetDBVersion ()
 
bool BuildSQL (const std::string &strQuery, const Filter &filter, std::string &strSQL)
 
- Protected Attributes inherited from CDatabase
bool m_sqlite
 whether we use sqlite (defaults to true) More...
 
std::unique_ptr< dbiplus::Databasem_pDB
 
std::unique_ptr< dbiplus::Datasetm_pDS
 
std::unique_ptr< dbiplus::Datasetm_pDS2
 
const CProfileManagerm_profileManager
 

Detailed Description

The EPG database

Constructor & Destructor Documentation

§ CPVREpgDatabase()

PVR::CPVREpgDatabase::CPVREpgDatabase ( void  )
default

Create a new instance of the EPG database.

§ ~CPVREpgDatabase()

PVR::CPVREpgDatabase::~CPVREpgDatabase ( void  )
overridedefault

Destroy this instance.

Member Function Documentation

§ Close()

void CPVREpgDatabase::Close ( void  )
overridevirtual

Close the database.

Reimplemented from CDatabase.

§ Delete() [1/2]

bool CPVREpgDatabase::Delete ( const CPVREpg table)

Delete an EPG table.

Parameters
tableThe table to remove.
Returns
True if the table was removed successfully, false otherwise.

§ Delete() [2/2]

bool CPVREpgDatabase::Delete ( const CPVREpgInfoTag tag)

Remove a single EPG entry.

Parameters
tagThe entry to remove.
Returns
True if it was removed successfully, false otherwise.

§ DeleteEpg()

bool CPVREpgDatabase::DeleteEpg ( void  )

Remove all EPG information from the database.

Returns
True if the EPG information was erased, false otherwise.

§ DeleteEpgEntries()

bool CPVREpgDatabase::DeleteEpgEntries ( const CDateTime maxEndTime)

Erase all EPG entries with an end time less than the given time.

Parameters
maxEndTimeThe maximum allowed end time.
Returns
True if the entries were removed successfully, false otherwise.

§ Get() [1/2]

std::vector< CPVREpgPtr > CPVREpgDatabase::Get ( const CPVREpgContainer container)

Get all EPG tables from the database. Does not get the EPG tables' entries.

Parameters
containerThe container to get the EPG tables for.
Returns
The entries.

§ Get() [2/2]

std::vector< CPVREpgInfoTagPtr > CPVREpgDatabase::Get ( const CPVREpg epg)

Get all EPG entries for a table.

Parameters
epgThe EPG table to get the entries for.
Returns
The entries.

§ GetBaseDBName()

const char* PVR::CPVREpgDatabase::GetBaseDBName ( void  ) const
inlineoverridevirtual

Get the default sqlite database filename.

Returns
The default filename.

Implements CDatabase.

§ GetLastEPGId()

int CPVREpgDatabase::GetLastEPGId ( void  )
Returns
Last EPG id in the database

§ GetLastEpgScanTime()

bool CPVREpgDatabase::GetLastEpgScanTime ( int  iEpgId,
CDateTime lastScan 
)

Get the last stored EPG scan time.

Parameters
iEpgIdThe table to update the time for. Use 0 for a global value.
lastScanThe last scan time or -1 if it wasn't found.
Returns
True if the time was fetched successfully, false otherwise.

§ GetSchemaVersion()

int PVR::CPVREpgDatabase::GetSchemaVersion ( void  ) const
inlineoverridevirtual

Get the minimal database version that is required to operate correctly.

Returns
The minimal database version.

Implements CDatabase.

§ Lock()

void CPVREpgDatabase::Lock ( )

Lock the database.

§ Open()

bool CPVREpgDatabase::Open ( )
overridevirtual

Open the database.

Returns
True if it was opened successfully, false otherwise.

Reimplemented from CDatabase.

§ Persist() [1/2]

int CPVREpgDatabase::Persist ( const CPVREpg epg,
bool  bQueueWrite = false 
)

Persist an EPG table. It's entries are not persisted.

Parameters
epgThe table to persist.
bQueueWriteDon't execute the query immediately but queue it if true.
Returns
The database ID of this entry or 0 if bSingleUpdate is false and the query was queued.

§ Persist() [2/2]

int CPVREpgDatabase::Persist ( const CPVREpgInfoTag tag,
bool  bSingleUpdate = true 
)

Persist an infotag.

Parameters
tagThe tag to persist.
bSingleUpdateIf true, this is a single update and the query will be executed immediately.
Returns
The database ID of this entry or 0 if bSingleUpdate is false and the query was queued.

§ PersistLastEpgScanTime()

bool CPVREpgDatabase::PersistLastEpgScanTime ( int  iEpgId = 0,
bool  bQueueWrite = false 
)

Update the last scan time.

Parameters
iEpgIdThe table to update the time for. Use 0 for a global value.
bQueueWriteDon't execute the query immediately but queue it if true.
Returns
True if it was updated successfully, false otherwise.

§ Unlock()

void CPVREpgDatabase::Unlock ( )

Unlock the database.


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