Logo Search packages:      
Sourcecode: verlihub version File versions

nConfig::tMySQLMemoryHash< DataType, OwnerType > Class Template Reference

#include <tmysqlmemoryhash.h>

Inheritance diagram for nConfig::tMySQLMemoryHash< DataType, OwnerType >:

nConfig::tMySQLMemoryList< DataType, OwnerType > nConfig::cConfMySQL nConfig::cConfigBase nConfig::cConfigBaseBase cObj

List of all members.


Detailed Description

template<class DataType, class OwnerType>
class nConfig::tMySQLMemoryHash< DataType, OwnerType >

a list mirroring the mysql data, loaded in ram, and hashed for searching

Author:
Daniel Muller

Definition at line 26 of file tmysqlmemoryhash.h.


Public Types

typedef tMyDataType::iterator iterator
typedef tItemHash::iterator tIHIt
typedef tcHashListMap
< cConfigItemBase *, unsigned > 
tItemHash
typedef unsigned tItemHashType
typedef vector< size_t > tItemVec
typedef tItemVec::iterator tIVIt
typedef vector< DataType * > tMyDataType

Public Member Functions

cConfigItemBaseAdd (const string &, cConfigItemBase *)
template<class T>
void AddCol (const char *colName, const char *colType, const char *colDefault, bool colNull, T &var)
virtual DataType * AddData (DataType const &data)
 Add data into memory and database too, if you add twice same, it may be duplicated.
virtual void AddFields ()=0
 add all field you want in this function
void AddPrimaryKey (const char *)
void AllFields (ostream &, bool DoF=true, bool DoV=false, bool IsAff=false, string joint=string(", "))
void AllPKFields (ostream &, bool DoF=true, bool DoV=false, bool IsAff=false, string joint=string(", "))
virtual DataType * AppendData (DataType const &data)
iterator begin ()
void BindNick (int, const string &)
virtual bool CompareDataKey (const DataType &D1, const DataType &D2)
void CreateTable ()
db_iteratordb_begin ()
db_iteratordb_begin (cQuery &)
db_iteratordb_end ()
 DeclareAddMethods (double)
 DeclareAddMethods (char *)
 DeclareAddMethods (string)
 DeclareAddMethods (__int64)
 DeclareAddMethods (unsigned long)
 DeclareAddMethods (long)
 DeclareAddMethods (unsigned)
 DeclareAddMethods (int)
 DeclareAddMethods (char)
 DeclareAddMethods (bool)
virtual void DelData (DataType &data)
 Removes data from database, given probably by the PK.
void DeletePK ()
virtual void Empty ()
 empty what is in the memory storage
iterator end ()
int EndQuery (cQuery &)
int EndQuery ()
virtual std::ostream & ErrLog ()
int ErrLog (int level)
virtual DataType * FindData (DataType &ByKey)
bool InstallDefaultData ()
 load default data script from a file
virtual int Load (cQuery &)
virtual int Load ()
bool LoadPK ()
virtual std::ostream & Log ()
int Log (int level)
std::ostream & LogStream ()
virtual void OnLoadData (DataType &Data)
virtual void OnStart ()
cConfigItemBaseoperator[] (const string &)
DataType * operator[] (int i)
 Get the i-th element from the list.
virtual int ReloadAll ()
 Loads all data from the database into memory.
virtual int Save ()
void SaveData (size_t n)
 save data on n-th position
bool SavePK (bool dup=false)
void SelectFields (ostream &)
void SetBaseTo (void *new_base)
void SetClassName (const char *name)
void SetSelectOrder (const string &Order)
void SetSelectWhere (const string &Order)
virtual int Size ()
int StartQuery (cQuery &)
int StartQuery ()
int StartQuery (string query)
virtual int StrLog (std::ostream &ostr, int level)
 tMySQLMemoryHash (cMySQL &mysql, OwnerType *owner, string tablename)
virtual int UpdateData (DataType &data)
void UpdateFields (ostream &os)
bool UpdatePK (cQuery &)
bool UpdatePK ()
bool UpdatePKVar (cConfigItemBase *)
bool UpdatePKVar (const char *)
bool UpdatePKVar (const char *var_name, string &new_val)
void WherePKey (ostream &os)

Static Public Member Functions

static int GetCount ()
static void WriteStringConstant (ostream &os, const string &str)

Public Attributes

void * mBasePtr
iterator mBegin
const char * mClassName
iterator mEnd
tItemHash mhItems
cBasicItemCreator * mItemCreator
cMySQLmMySQL
cQuery mQuery
std::ostream * mToLog
tItemVec mvItems

Static Public Attributes

static const string mEmpty
static hHashStr< tItemHashType > msHasher
static int msLogLevel = 4

Protected Types

typedef tHashArray< DataType * > tDataHashArray
typedef tDataHashArray::tHashType tDataHashType

Protected Member Functions

virtual tDataHashType GetHash (DataType &data)=0

Protected Attributes

unsigned mCols
tDataHashArray mDataHash
DataType mModel
cMySQLTable mMySQLTable
string mOrderString
OwnerType * mOwner
tItemHash mPrimaryKey
string mWhereString
int ok

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index