Shaka Player Embedded
Public Member Functions | List of all members
shaka::js::idb::SqliteConnection Class Reference

#include <sqlite.h>

Public Member Functions

 SqliteConnection (const std::string &file_path)
 
 ~SqliteConnection ()
 
 SHAKA_NON_COPYABLE_OR_MOVABLE_TYPE (SqliteConnection)
 
DatabaseStatus Init ()
 
DatabaseStatus BeginTransaction (SqliteTransaction *transaction)
 
DatabaseStatus Flush ()
 

Detailed Description

Represents a connection to a sqlite database. This sets up the connection and ensures the correct tables exist.

Definition at line 118 of file sqlite.h.

Constructor & Destructor Documentation

§ SqliteConnection()

shaka::js::idb::SqliteConnection::SqliteConnection ( const std::string &  file_path)
explicit

Creates a new connection to the given database file.

Parameters
file_pathThe path to the database file. If the file doesn't exist, it will be created. If this is the empty string, a temporary database will be used for testing.

Definition at line 438 of file sqlite.cc.

§ ~SqliteConnection()

shaka::js::idb::SqliteConnection::~SqliteConnection ( )

Definition at line 440 of file sqlite.cc.

Member Function Documentation

§ BeginTransaction()

DatabaseStatus shaka::js::idb::SqliteConnection::BeginTransaction ( SqliteTransaction transaction)

Begins a new transaction using the given transaction object. There can only be one transaction happening at once; this will return an error if there is another transaction happening.

Definition at line 495 of file sqlite.cc.

§ Flush()

DatabaseStatus shaka::js::idb::SqliteConnection::Flush ( )

Flushes pending transactions from the journal to the database. Note this doesn't need to be called and will be handled automatically by the database ending. Also note a crash will preserve the journal and there will be no data loss.

This is called to reduce the size of the journal to make reads faster. This can be called from a background thread to periodically update the journal. Calling this will not block other transactions from completing.

Definition at line 502 of file sqlite.cc.

§ Init()

DatabaseStatus shaka::js::idb::SqliteConnection::Init ( )

Initializes the connection and sets up the database as needed. This MUST be called before calling any other method.

Definition at line 449 of file sqlite.cc.

§ SHAKA_NON_COPYABLE_OR_MOVABLE_TYPE()

shaka::js::idb::SqliteConnection::SHAKA_NON_COPYABLE_OR_MOVABLE_TYPE ( SqliteConnection  )

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