![]() |
KaliVeda
Toolkit for HIC analysis
|
Definition at line 296 of file SQLiteDB.h.
#include <SQLiteDB.h>
Private Member Functions | |
void | init_type_map () |
void | set_foreign_key_back_references () |
Private Attributes | |
std::unordered_map< std::string, int > | fColMap |
std::vector< KVSQLite::column > | fColumns |
database * | fDB = nullptr |
std::vector< foreign_key_constraint > | fForeignKeys |
KVSQLite_insert_mode | fInsert |
TString | fName |
TString | fPrimaryKey |
bool | fTemp |
Static Private Attributes | |
static std::map< TString, KVSQLite::column_type::types > | type_map |
Friends | |
class | database |
Table in an SQLite database. More... | |
|
inline |
Definition at line 318 of file SQLiteDB.h.
|
inline |
Definition at line 324 of file SQLiteDB.h.
|
inline |
Definition at line 327 of file SQLiteDB.h.
|
inlinevirtual |
Definition at line 331 of file SQLiteDB.h.
column & KVSQLite::table::add_column | ( | const KVSQLite::column & | c | ) |
add column to table
Definition at line 1623 of file SQLiteDB.cpp.
add column to table
Definition at line 1641 of file SQLiteDB.cpp.
|
inline |
add column to table. return reference to added column.
Definition at line 374 of file SQLiteDB.h.
int KVSQLite::table::check_columns | ( | const KVNameValueList & | l | ) |
make sure that all parameters in the list have corresponding columns in the table
Definition at line 1718 of file SQLiteDB.cpp.
void KVSQLite::table::foreign_key | ( | const TString & | child_key, |
const TString & | parent_table, | ||
const TString & | parent_key | ||
) |
add a FOREIGN KEY constraint to the table.
The child key(s) should first be declared using add_column()
Definition at line 1674 of file SQLiteDB.cpp.
|
inline |
Definition at line 407 of file SQLiteDB.h.
|
inline |
Definition at line 389 of file SQLiteDB.h.
TString KVSQLite::table::get_column_names | ( | const TString & | exclude = "" , |
const TString & | delim = "," |
||
) | const |
Return a comma-separated list of the colum names
[in] | delim | separator to use in list (default: ",") |
[in] | exclude | list of column names to exclude from list |
Definition at line 1779 of file SQLiteDB.cpp.
const char * KVSQLite::table::get_insert_command | ( | ) | const |
Definition at line 476 of file SQLiteDB.cpp.
TString KVSQLite::table::get_table_creation_command | ( | ) | const |
Create and fill SQLite command to create this table, i.e.
Definition at line 1551 of file SQLiteDB.cpp.
|
inline |
return true if column with given name exists
Definition at line 393 of file SQLiteDB.h.
|
inline |
Definition at line 462 of file SQLiteDB.h.
|
inline |
Definition at line 458 of file SQLiteDB.h.
|
private |
Definition at line 1508 of file SQLiteDB.cpp.
void KVSQLite::table::insert_single_row | ( | ) |
use to add single row data to table. see prepare_insert_single_row() for usage.
Definition at line 1829 of file SQLiteDB.cpp.
|
inline |
Definition at line 368 of file SQLiteDB.h.
|
inline |
Definition at line 333 of file SQLiteDB.h.
|
inline |
Definition at line 422 of file SQLiteDB.h.
|
inline |
Definition at line 399 of file SQLiteDB.h.
|
inline |
Definition at line 403 of file SQLiteDB.h.
|
inline |
Definition at line 385 of file SQLiteDB.h.
|
inline |
Definition at line 381 of file SQLiteDB.h.
void KVSQLite::table::prepare_data | ( | const KVNameValueList & | l, |
const KVNamedParameter * | null_value = nullptr |
||
) |
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 1741 of file SQLiteDB.cpp.
void KVSQLite::table::prepare_insert_single_row | ( | ) |
call before setting data in individual columns and then calling insert_single_row()
Definition at line 1810 of file SQLiteDB.cpp.
Define PRIMARY KEY column(s) for table. If more than one column is used, separate names with commas.
Translates to SQLite statement:
We detect the case where a single INTEGER column is used as PRIMARY KEY: In SQLite, a column with type INTEGER PRIMARY KEY is an alias for the ROWID. On an INSERT, if the ROWID or INTEGER PRIMARY KEY column is not explicitly given a value, then it will be filled automatically with an unused integer, usually one more than the largest ROWID currently in use. This is true regardless of whether or not the AUTOINCREMENT keyword is used. The AUTOINCREMENT keyword imposes extra CPU, memory, disk space, and disk I/O overhead and should be avoided if not strictly needed. It is usually not needed.
Definition at line 432 of file SQLiteDB.h.
|
inline |
Definition at line 417 of file SQLiteDB.h.
void KVSQLite::table::set_all_columns_null | ( | ) |
set the value of all columns in the table to NULL
Definition at line 1763 of file SQLiteDB.cpp.
|
private |
called by database::add_table
for any foreign key defined for this table, we set up a back reference in the parent table
Definition at line 1525 of file SQLiteDB.cpp.
|
inline |
The insert mode determines how to deal with errors caused by constraints The possible values of i are (with corresponding SQLite meaning):
Definition at line 344 of file SQLiteDB.h.
Definition at line 337 of file SQLiteDB.h.
|
inline |
Create a temporary table
Definition at line 363 of file SQLiteDB.h.
void KVSQLite::table::show_columns | ( | ) | const |
print list of columns
Definition at line 1603 of file SQLiteDB.cpp.
|
mutableprivate |
Definition at line 308 of file SQLiteDB.h.
|
mutableprivate |
Definition at line 307 of file SQLiteDB.h.
|
private |
Definition at line 304 of file SQLiteDB.h.
|
private |
Definition at line 311 of file SQLiteDB.h.
|
private |
Definition at line 306 of file SQLiteDB.h.
|
private |
Definition at line 305 of file SQLiteDB.h.
|
private |
Definition at line 310 of file SQLiteDB.h.
|
private |
Definition at line 312 of file SQLiteDB.h.
|
staticprivate |
Definition at line 309 of file SQLiteDB.h.