13#include <unordered_map>
16#include <KVNameValueList.h>
17#include <KVNumberList.h>
91 namespace column_type {
99 namespace insert_mode {
192 template <
typename T>
253 template <
typename T>
261 return static_cast<T*
>(
fBlob);
278 mutable std::unordered_map<std::string, int>
fColMap;
279 static std::map<TString, KVSQLite::column_type::types>
type_map;
376 std::cout <<
"Error in <KVSQLite::table::get_column(const TString&)> : "
377 <<
n <<
" is not a column of table " <<
name() << std::endl;
385 std::cout <<
name() <<
"\n";
386 for (std::vector<KVSQLite::column>::const_iterator it =
fColumns.begin(); it !=
fColumns.end(); ++it) it->print();
403 mutable std::unordered_map<std::string, KVSQLite::table>
fTables;
417 const TString& condition =
"")
const;
458 void open(
const TString& dbfile);
494 std::cout <<
"Error in <KVSQLite::database::get_table(const TString&)> : "
495 <<
name <<
" is not a table of database" << std::endl;
496 return fTables.begin()->second;
506 bool distinct =
false,
const TString& anything_else =
"")
const;
509 const TString& selection =
"",
const TString& anything_else =
"");
511 const TString& selection =
"",
const TString& anything_else =
"");
513 const TString& selection =
"",
const TString& anything_else =
"");
#define ClassDef(name, id)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
A generic named parameter storing values of different types.
void Set(const char *, const char *)
Strings used to represent a set of ranges of values.
Long_t fBlobSize
binary data
void set_binary_data(T &x)
void set_table(const TString &name)
void set_data_in_statement(TSQLStatement *, int idx=-1) const
std::pair< TString, KVSQLite_column_type > fNameType
void set_foreign_key(const TString &_table, const TString &_column)
const KVNamedParameter & data() const
KVSQLite_column_type type() const
const char * name() const
void set_binary_data(T *x)
static std::map< KVSQLite::column_type::types, TString > inv_type_map
void set_data(const T &x)
const char * get_declaration() const
return declaration for column, including type & constraint
void set_data_from_statement(TSQLStatement *s, int idx=-1) const
column(int idx, const TString &name, KVSQLite_column_type type)
const column & operator=(const T &x)
void set_constraint(const TString &c)
const char * get_table() const
const char * type_name() const
Interface to ROOT SQLite database backend.
int get_number_of_tables() const
void copy_table_data(const TString &source, const TString &destination, const TString &columns="*", const TString &selection="")
std::list< const column * > fSQLstmtCols
int count(const TString &table, const TString &column="*", const TString &selection="", bool distinct=false) const
const KVSQLite::table & operator[](const TString &name) const
database & operator=(const database &db)
database(const TString &dbfile)
TGraph * create_graph(const TString &tablename, const TString &Xcolumn, const TString &Ycolumn, const TString &selection="")
std::unique_ptr< TSQLResult > SelectRowsFromTable(const TString &table, const TString &columns="*", const TString &condition="") const
std::unique_ptr< TSQLStatement > fSQLstmt
bool update(const TString &table, const TString &columns, const TString &selection="")
void delete_data(const TString &table, const TString &selection="")
void show_tables() const
print list of tables
KVSQLite::table & get_table(const TString &name)
column & add_column(const TString &table, const TString &name, const TString &type)
void print_selection(const TString &table, const TString &columns, const TString &condition, int column_width=20) const
Print on stdout contents of database.
KVSQLite::table & operator[](const TString &name)
std::unique_ptr< TSQLiteServer > fDBserv
bool is_inserting() const
void open(const TString &dbfile)
bool has_table(const TString &table)
void end_data_insertion()
bool select_data(const TString &tables, const TString &columns="*", const TString &selection="", bool distinct=false, const TString &anything_else="") const
KVNameValueList get_name_value_list(const TString &table, const TString &name_column, const TString &value_column, const TString &selection="", const TString &anything_else="")
bool get_next_result() const
TString get_string_list(const TString &table, const TString &column, const TString &selection="", const TString &anything_else="")
void Dump() const
Print on stdout contents of database.
std::unordered_map< std::string, KVSQLite::table > fTables
database(const database &db)
void add_table(const table &)
void PrintResults(TSQLResult *tabent, int column_width=20) const
bool prepare_data_insertion(const TString &)
void clear_table(const TString &name)
Delete all data from table.
void print_selected_data(const TString &tables, const TString &columns="*", const TString &selection="", bool distinct=false, const TString &anything_else="")
Print out results of a call to select_data().
void read_table_infos()
initialise map of database tables from existing database
void add_missing_columns(const TString &table, const KVNameValueList &l)
KVNumberList get_integer_list(const TString &table, const TString &column, const TString &selection="", const TString &anything_else="")
bool is_temporary() const
const KVSQLite::column & operator[](int i) const
const column & add_foreign_key(const TString &other_table, const TString &other_column)
std::vector< KVSQLite::column > fColumns
void set_temporary(bool temp=true)
KVSQLite::column & operator[](int i)
int check_columns(const KVNameValueList &)
const column & add_primary_key(const TString &name)
const KVSQLite::column & operator[](const TString &n) const
table(const TString &Name, const std::vector< KVSQLite::column > &cols)
const char * get_insert_command() const
table(const TString &Name="")
static std::map< TString, KVSQLite::column_type::types > type_map
void set_name(const TString &name)
const char * name() const
column & add_column(const KVSQLite::column &c)
TString get_column_names(const TString &exclude="", const TString &delim=",") const
column & add_column(const TString &name, KVSQLite_column_type type)
void set_insert_mode(KVSQLite_insert_mode i)
int number_of_columns() const
KVSQLite::column & get_column(int i)
bool has_column(const TString &name) const
void prepare_data(const KVNameValueList &, const KVNamedParameter *=nullptr)
KVSQLite::column & operator[](const TString &n)
void show_columns() const
print list of columns
KVSQLite_insert_mode fInsert
void set_all_columns_null()
set the value of all columns in the table to NULL
KVSQLite::column & get_column(const TString &n)
std::unordered_map< std::string, int > fColMap
KVSQLite::column_type::types KVSQLite_column_type
KVSQLite::insert_mode::types KVSQLite_insert_mode