dodo
0.0.1
A C++ library to create containerized Linux services
|
Go to the documentation of this file.
23 #ifndef dodo_persist_sqlite_hpp
24 #define dodo_persist_sqlite_hpp
147 return sqlite3_memory_used();
155 return sqlite3_memory_highwater(0);
183 void rollback(
const std::string &sp );
199 return sqlite3_soft_heap_limit64( limit );
230 void prepare(
const std::string &sql );
238 void reset(
bool clear =
true );
317 void bind(
int position,
double value );
324 void bind(
int position,
int value );
331 void bind(
int position, int64_t value );
338 void bind(
int position,
const std::string &value );
352 void bind(
const std::string &name,
double value );
359 void bind(
const std::string &name,
int value );
366 void bind(
const std::string &name, int64_t value );
373 void bind(
const std::string &name,
const std::string &value );
422 bool isNull(
int col )
const;
436 int getInt(
int col )
const;
457 std::string
getText(
int col )
const;
virtual ~Statement()
Destructor.
static int64_t softHeapLimit(int64_t limit)
Set the SQLite soft heap limit - ask SQLite to strive to limit its memory use (caching).
void rollback()
Rollback a transaction.
void checkPointTruncate()
Issue a (WAL) truncate checpoint.
int64_t lastInsertRowid() const
Get the rowid of the last inserted row.
void enableTriggers()
Enable triggers.
Query(const Database &db)
Constructor.
void commit()
Commit a transaction.
Queries can take bind values and return select lists.
An array of Octets with size elements.
virtual ~Query()
Destructor.
@ dtUnknown
Used to indicate a DataType that could not be determined.
std::string getText(int col) const
Get string value from select list.
void enableForeignKeys()
Enable foreign key constraints.
int(* WaitHandler)(void *, int)
Prototype for wait/busy handlers.
void disableForeignKeys()
Disable foreign key constraints.
virtual ~DDL()
Destructor.
@ dtInteger
(1) Integer type (int64_t)
void releaseMemory()
Have SQLite attempt to release a much memory as possible.
int getColumnCount() const
get the number of columns in the query result set.
DataType
The data type of a select-list value.
bool step()
Step the result list, end of list returns false.
void beginExclusiveTransaction()
Begin an exclusive transaction.
sqlite3 * database_
database handle on which the stmt_ is created.
DataType getDataType(int col) const
Get the dataype of a select list column.
int execute_r()
execute and return result code.
bool isNull(int col) const
Test if the result is NULL.
void checkPointPassive()
Issue a passive checpoint.
sqlite3 * getDB() const
Return database handle.
void beginTransaction()
Begin a transaction.
void close()
A statement handle can be explicitly closed without deleting the Statement object itself.
void setUserVersion(int version)
set the user_version pragma
Persistent storage structures.
DML(const Database &db)
Constructor.
Data Modification Language statements can take bind values.
void bind(int position, double value)
Bind a double value to the bind at position.
void prepare(const std::string &sql)
Prepare a SQL statement.
static int64_t memUsed()
Get memory in use by the SQLite library.
@ dtFloat
(2) Floating point type (double)
Statement(const Database &db)
Constructor.
int execute()
Execute and return the number of rows affected.
virtual ~DML()
Destructor.
int getUserVersion() const
get the current user_version pragma (a user defined database schema version)
int64_t getInt64(int col) const
Get int64_t value from select list.
@ dtNull
(5) NULL type (unset and undefined)
void reset(bool clear=true)
Reset a SQL statement for re-execute or even re-prepare.
std::string getFileName() const
Return the database filename.
void releaseSavepoint(const std::string &sp)
Release a savepoint.
void beginImmediateTransaction()
Begin an immediate transaction.
A STL friendly wrapper around the great sqlite3.
sqlite3 * database_
The SQLite database handle.
Data Definition Language, SQL that takes no parameters, returns no data such as CREATE TABLE.
double getDouble(int col) const
Get double value from select list.
@ dtText
(3) Text type (string)
Database(const std::string &filename, WaitHandler handler=0)
Constructor with explicit wait handler.
void execute()
execute, throws Oops on error.
DDL(const Database &db)
Constructor.
void getBytes(int col, common::Bytes &bytes) const
Get Bytes value from select list.
sqlite3_stmt * stmt_
statement handle.
@ dtBlob
(4) Binary data type (Bytes)
void checkPointFull()
Issue a full checpoint.
int getInt(int col) const
Get int value from select list.
static int64_t memHighWater()
Get memory highwater by the SQLite library.
void createSavepoint(const std::string &sp)
Create a named savepoint.