- Examples
- db_sqlite_examples.C.
Definition at line 268 of file SQLiteDB.h.
#include <SQLiteDB.h>
◆ table() [1/2]
KVSQLite::table::table |
( |
const TString & |
Name = "" | ) |
|
|
inline |
◆ table() [2/2]
◆ ~table()
virtual KVSQLite::table::~table |
( |
| ) |
|
|
inlinevirtual |
◆ add_column() [1/3]
◆ add_column() [2/3]
◆ add_column() [3/3]
add column to table. return reference to added column.
Definition at line 338 of file SQLiteDB.h.
◆ add_foreign_key() [1/2]
const column & table::add_foreign_key |
( |
const table & |
other_table, |
|
|
const column & |
other_column |
|
) |
| |
add a foreign key to the table, which is an INTEGER reference to another column in another table.
- Returns
- reference to key (cannot be modified)
- Note
- as foreign keys are only really useful if they have the same name in the child and parent tables, we set the name of the foreign key by default to that of the other_column
Definition at line 1201 of file SQLiteDB.cpp.
◆ add_foreign_key() [2/2]
add a foreign key to the table, which is an INTEGER reference to another column in another table
- Returns
- reference to key (cannot be modified)
- Note
- as foreign keys are only really useful if they have the same name in the child and parent tables, we set the name of the foreign key by default to that of the other_column
Definition at line 1177 of file SQLiteDB.cpp.
◆ add_primary_key()
add a PRIMARY KEY column to the table
- Returns
- reference to primary key (cannot be modified)
- Note
- by default this is an
INTEGER
type column
-
as it is auto-incremented with each inserted row, it should not be included in TSQLStatement used to write data to db
- Examples
- db_sqlite_examples.C.
Definition at line 1152 of file SQLiteDB.cpp.
◆ check_columns()
make sure that all parameters in the list have corresponding columns in the table
- Returns
- the number of columns to be added
Definition at line 1221 of file SQLiteDB.cpp.
◆ get_column() [1/2]
◆ get_column() [2/2]
◆ get_column_names()
Return a comma-separated list of the colum names
- Parameters
-
[in] | delim | separator to use in list (default: ",") |
[in] | exclude | list of column names to exclude from list |
Definition at line 1282 of file SQLiteDB.cpp.
◆ get_insert_command()
const char * table::get_insert_command |
( |
| ) |
const |
◆ has_column()
bool KVSQLite::table::has_column |
( |
const TString & |
name | ) |
const |
|
inline |
return true if column with given name exists
Definition at line 359 of file SQLiteDB.h.
◆ init_type_map()
void table::init_type_map |
( |
| ) |
|
|
private |
◆ is_temporary()
bool KVSQLite::table::is_temporary |
( |
| ) |
const |
|
inline |
◆ name()
const char * KVSQLite::table::name |
( |
| ) |
const |
|
inline |
◆ number_of_columns()
int KVSQLite::table::number_of_columns |
( |
| ) |
const |
|
inline |
◆ operator[]() [1/4]
◆ operator[]() [2/4]
◆ operator[]() [3/4]
◆ operator[]() [4/4]
◆ prepare_data()
fill all columns in table with data contained in KVNameValueList parameters having the same name.
any columns which do not appear in the KVNameValueList (except for PRIMARY KEY) will be set to 'null'
if required, any parameters with the same type&value as "null_value" will be set to 'null' too
Definition at line 1244 of file SQLiteDB.cpp.
◆ print()
void KVSQLite::table::print |
( |
| ) |
const |
|
inline |
◆ set_all_columns_null()
void table::set_all_columns_null |
( |
| ) |
|
set the value of all columns in the table to NULL
Definition at line 1266 of file SQLiteDB.cpp.
◆ set_insert_mode()
The insert mode determines how to deal with errors caused by constraints The possible values of i are (with corresponding SQLite meaning):
- if any data in row being inserted fails a constraint on one or more
columns, insertion fails with error
KVSQLite::insert_mode::IGNORE ("INSERT OR IGNORE INTO [
table] ...")
- if any data in row being inserted fails a constraint on one or more
columns, the row is silently ignored (existing row unchanged)
KVSQLite::insert_mode::REPLACE ("INSERT OR REPLACE INTO [
table] ...")
- if any data in row being inserted fails a constraint on one or more
columns, we replace the old row with the new one
Definition at line 308 of file SQLiteDB.h.
◆ set_name()
◆ set_temporary()
void KVSQLite::table::set_temporary |
( |
bool |
temp = true | ) |
|
|
inline |
Create a temporary table
Definition at line 327 of file SQLiteDB.h.
◆ show_columns()
void table::show_columns |
( |
| ) |
const |
◆ fColMap
std::unordered_map<std::string, int> KVSQLite::table::fColMap |
|
mutableprivate |
◆ fColumns
◆ fInsert
◆ fName
◆ fTemp
bool KVSQLite::table::fTemp |
|
private |
◆ type_map