72 #include "StDbTableDescriptor.h"
73 #include "StDbManager.hh"
74 #include "StDataBaseI.hh"
76 #include "StDbBuffer.h"
79 #ifdef ST_NO_TEMPLATE_DEF_ARGS
80 typedef list<StDbTableDescriptor*,allocator<StDbTableDescriptor*> > DescList;
82 #if !defined(ST_NO_NAMESPACES)
87 #define freeze(i) str()
90 typedef list<StDbTableDescriptor*> DescList;
93 #define MAX_EID_INDECES 10
102 DescList mdescriptors;
104 char* mretString = 0;
105 int mtableCatalog = 0;
106 char* mdefaultEndDateTime = 0;
107 unsigned int mdefaultEndTime = 0;
113 void deleteDescriptors();
114 void deleteDescriptor(
int structID,
int schemaID);
121 bool checkValue(
const char* colName,
const char* colValue);
122 bool checkForNull(
const char* src);
125 char* insertNodeString(
StDbNode* node);
126 char* getFlavorQuery(
const char* flavor);
127 char* getProdTimeQuery(
unsigned int prodTime);
128 char* getElementList(
int* elements,
int num);
129 char* getElementListIN(
int* elements,
int num);
130 char* getColumnList(
StDbTable* table,
char* tableName=0,
char* funcName=0);
131 char* getEmptyString();
134 void checkTableCatalog();
135 char* checkTablePrepForQuery(
StDbTable* table,
bool checkIndexed=
false);
137 void deleteRows(
const char* tableName,
int* rowID,
int nrows);
141 int sendMess(
const char* a,
const char* b, StDbMessLevel m,
142 int lineNum=0,
const char* className=
" ",
143 const char* methName=
" ");
146 bool checkColumn(
const char* tableName,
const char* columnName);
147 bool updateEndTime(
StDbTable* table,
const char* dataTable,
unsigned int reqTime);
151 virtual int WriteDbNoIndex(
StDbTable* table,
unsigned int storeTime);
158 StDbType type, StDbDomain domain);
160 const char* typeName,
const char* domainName);
165 virtual void close();
166 virtual void clear();
169 virtual int QueryDb(
StDbNode* node);
170 virtual int QueryDb(
StDbTable* table,
unsigned int reqTime);
171 virtual int QueryDb(
StDbTable* table,
const char* whereClause);
172 virtual unsigned int* QueryDbTimes(
StDbTable* table,
const char* whereClause,
int opt=0);
173 virtual int QueryDbFunction(
StDbTable* table,
const char* whereClause,
char* funcName);
174 virtual int QueryDescriptor(
StDbTable* table);
175 virtual int WriteDb(
StDbTable* table,
unsigned int storeTime);
176 virtual int WriteDb(
StDbConfigNode* node,
int parentID,
int& configID);
179 virtual int storeTableNode(
StDbTable* table);
180 virtual bool insertNodeRelation(
int configID,
int parent,
int child);
181 virtual bool rollBack(
StDbNode* node);
184 virtual unsigned int getUnixTime(
const char* time) ;
185 virtual char* getDateTime(
unsigned int time) ;
187 virtual int* selectElements(
const char* elementName,
191 char* getDataTable(
StDbTable* table,
unsigned int time);
192 char** getDataTables(
StDbTable* table,
int& numTables);
194 void setDefaultReturnValues(
StDbTable* table,
unsigned int reqTime);
195 void setDefaultBeginTime(
StDbTable* table,
unsigned int reqTime);
196 void setDefaultEndTime(
StDbTable* table );
197 char** getIndexNames(
const char* elementName,
int& numIndexes);
204 inline char* StDbSql::mRetString(
StString& rs){
205 if(mretString)
delete [] mretString;
207 mretString =
new char[srs.length()+1];
208 strcpy(mretString,srs.c_str());
212 inline int StDbSql::sendMess(
const char* a,
const char* b, StDbMessLevel m,
int lineNum,
const char* className,
const char* methName){
213 if(m==dbMDebug && !(mgr->IsVerbose()))
return 0;
214 return mgr->printInfo(a,b,m,lineNum,className,methName);
217 inline void StDbSql::init() {
220 mdefaultEndDateTime = 0;
223 inline void StDbSql::use() { Db.setDefaultDb(mdbName); };
224 inline void StDbSql::close() { Db.Close(); };
225 inline void StDbSql::clear() { Db.Release(); buff.Raz(); };