KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVSQLite::column Class Reference

Detailed Description

Definition at line 113 of file SQLiteDB.h.

#include <SQLiteDB.h>

Public Member Functions

virtual ~column ()
 
template<typename T >
Tbinary_data () const
 
const KVNamedParameterdata () const
 
bool foreign_key () const
 
template<typename T >
T get_data () const
 
const char * get_declaration () const
 return declaration for column, including type & constraint
 
const char * get_table () const
 
int index () const
 
bool is_null () const
 
const char * name () const
 
template<typename T >
const columnoperator= (const T &x)
 
bool primary_key () const
 
void print () const
 
template<typename T >
void set_binary_data (T &x)
 
template<typename T >
void set_binary_data (T *x)
 
void set_constraint (const TString &c)
 
template<>
void set_data (const KVNamedParameter &)
 
template<>
void set_data (const KVNamedParameter &x)
 
template<typename T >
void set_data (const T &x)
 
void set_data_from_statement (TSQLStatement *s, int idx=-1) const
 
void set_data_in_statement (TSQLStatement *, int idx=-1) const
 
void set_foreign_key (const table &_table, const column &_column)
 
void set_foreign_key (const TString &_table, const TString &_column)
 
void set_null ()
 
void set_table (const TString &name)
 
KVSQLite_column_type type () const
 
const char * type_name () const
 

Private Member Functions

 column (int idx, const TString &name, KVSQLite_column_type type)
 
const char * _type ()
 
void init_type_map ()
 

Private Attributes

voidfBlob
 
Long_t fBlobSize
 binary data
 
TString fConstraint
 
KVNamedParameter fData
 
TString fFKcolumn
 
TString fFKtable
 
bool fForeignKey
 
int fIndex
 
bool fIsNull
 
std::pair< TString, KVSQLite_column_typefNameType
 
bool fPrimaryKey
 
TString fTable
 

Static Private Attributes

static std::map< KVSQLite::column_type::types, TStringinv_type_map
 

Friends

class table
 

Constructor & Destructor Documentation

◆ column()

KVSQLite::column::column ( int  idx,
const TString name,
KVSQLite_column_type  type 
)
inlineprivate

Definition at line 139 of file SQLiteDB.h.

◆ ~column()

virtual KVSQLite::column::~column ( )
inlinevirtual

clean up binary data

Definition at line 148 of file SQLiteDB.h.

Member Function Documentation

◆ _type()

const char * column::_type ( )
private

Definition at line 944 of file SQLiteDB.cpp.

◆ binary_data()

template<typename T >
T * KVSQLite::column::binary_data ( ) const
inline

Definition at line 259 of file SQLiteDB.h.

◆ data()

const KVNamedParameter & KVSQLite::column::data ( ) const
inline

Definition at line 249 of file SQLiteDB.h.

◆ foreign_key()

bool KVSQLite::column::foreign_key ( ) const
inline

Definition at line 245 of file SQLiteDB.h.

◆ get_data()

template<typename T >
T KVSQLite::column::get_data ( ) const
inline

Definition at line 254 of file SQLiteDB.h.

◆ get_declaration()

const char * column::get_declaration ( ) const

return declaration for column, including type & constraint

Definition at line 360 of file SQLiteDB.cpp.

◆ get_table()

const char * KVSQLite::column::get_table ( ) const
inline

return name of parent table

Definition at line 167 of file SQLiteDB.h.

◆ index()

int KVSQLite::column::index ( ) const
inline

Definition at line 177 of file SQLiteDB.h.

◆ init_type_map()

void column::init_type_map ( )
private

Definition at line 932 of file SQLiteDB.cpp.

◆ is_null()

bool KVSQLite::column::is_null ( ) const
inline

Definition at line 204 of file SQLiteDB.h.

◆ name()

const char * KVSQLite::column::name ( ) const
inline

Definition at line 154 of file SQLiteDB.h.

◆ operator=()

template<typename T >
const column & KVSQLite::column::operator= ( const T x)
inline

set data in column

Definition at line 193 of file SQLiteDB.h.

◆ primary_key()

bool KVSQLite::column::primary_key ( ) const
inline

Definition at line 241 of file SQLiteDB.h.

◆ print()

void KVSQLite::column::print ( ) const
inline

Definition at line 182 of file SQLiteDB.h.

◆ set_binary_data() [1/2]

template<typename T >
void KVSQLite::column::set_binary_data ( T x)
inline

Definition at line 210 of file SQLiteDB.h.

◆ set_binary_data() [2/2]

template<typename T >
void KVSQLite::column::set_binary_data ( T x)
inline

Definition at line 217 of file SQLiteDB.h.

◆ set_constraint()

void KVSQLite::column::set_constraint ( const TString c)
inline

set constraint for column, one of:

PRIMARY KEY
UNIQUE
CHECK
NOT NULL
DEFAULT

Definition at line 226 of file SQLiteDB.h.

◆ set_data() [1/3]

template<>
void KVSQLite::column::set_data ( const KVNamedParameter )

◆ set_data() [2/3]

template<>
void KVSQLite::column::set_data ( const KVNamedParameter x)

Definition at line 953 of file SQLiteDB.cpp.

◆ set_data() [3/3]

template<typename T >
void KVSQLite::column::set_data ( const T x)
inline

Definition at line 187 of file SQLiteDB.h.

◆ set_data_from_statement()

void column::set_data_from_statement ( TSQLStatement s,
int  idx = -1 
) const

set value of column according to value of parameter in statement

any column which has a NULL value will be given value 0, 0.0 or "" (for INTEGER, REAL or TEXT type, respectively): use column::is_null() to check if this corresponds to a null column value.

Parameters
idxif given, use it as the statement parameter index instead of the column's index in the table (case where not all columns are treated in the statement)

Definition at line 1010 of file SQLiteDB.cpp.

◆ set_data_in_statement()

void column::set_data_in_statement ( TSQLStatement s,
int  idx = -1 
) const

set value of parameter in SQLite statement corresponding to this column

Parameters
idxif given, use it as the statement parameter index instead of the column's index in the table (case where not all columns are treated in the statement)

Definition at line 967 of file SQLiteDB.cpp.

◆ set_foreign_key() [1/2]

void column::set_foreign_key ( const table _table,
const column _column 
)

declare this column to be a foreign key i.e. linked to the given _column name in another _table

Definition at line 1069 of file SQLiteDB.cpp.

◆ set_foreign_key() [2/2]

void column::set_foreign_key ( const TString _table,
const TString _column 
)

declare this column to be a foreign key i.e. linked to the given _column name in another _table

Definition at line 1054 of file SQLiteDB.cpp.

◆ set_null()

void KVSQLite::column::set_null ( )
inline

Definition at line 200 of file SQLiteDB.h.

◆ set_table()

void KVSQLite::column::set_table ( const TString name)
inline

set parent table name

Definition at line 172 of file SQLiteDB.h.

◆ type()

KVSQLite_column_type KVSQLite::column::type ( ) const
inline

Definition at line 158 of file SQLiteDB.h.

◆ type_name()

const char * KVSQLite::column::type_name ( ) const
inline

Definition at line 162 of file SQLiteDB.h.

Friends And Related Symbol Documentation

◆ table

friend class table
friend

Definition at line 120 of file SQLiteDB.h.

Member Data Documentation

◆ fBlob

void* KVSQLite::column::fBlob
mutableprivate

Definition at line 127 of file SQLiteDB.h.

◆ fBlobSize

Long_t KVSQLite::column::fBlobSize
mutableprivate

binary data

Definition at line 128 of file SQLiteDB.h.

◆ fConstraint

TString KVSQLite::column::fConstraint
private

Definition at line 123 of file SQLiteDB.h.

◆ fData

KVNamedParameter KVSQLite::column::fData
mutableprivate

Definition at line 126 of file SQLiteDB.h.

◆ fFKcolumn

TString KVSQLite::column::fFKcolumn
private

Definition at line 132 of file SQLiteDB.h.

◆ fFKtable

TString KVSQLite::column::fFKtable
private

Definition at line 131 of file SQLiteDB.h.

◆ fForeignKey

bool KVSQLite::column::fForeignKey
private

Definition at line 130 of file SQLiteDB.h.

◆ fIndex

int KVSQLite::column::fIndex
private

Definition at line 124 of file SQLiteDB.h.

◆ fIsNull

bool KVSQLite::column::fIsNull
mutableprivate

Definition at line 133 of file SQLiteDB.h.

◆ fNameType

std::pair<TString, KVSQLite_column_type> KVSQLite::column::fNameType
private

Definition at line 122 of file SQLiteDB.h.

◆ fPrimaryKey

bool KVSQLite::column::fPrimaryKey
private

Definition at line 129 of file SQLiteDB.h.

◆ fTable

TString KVSQLite::column::fTable
private

Definition at line 134 of file SQLiteDB.h.

◆ inv_type_map

std::map< KVSQLite::column_type::types, TString > column::inv_type_map
staticprivate

Definition at line 125 of file SQLiteDB.h.