MKSQLCpp  0.1
MakeMySQLC++Classes
 All Classes Files Functions Variables Macros Pages
CGenDatabase.h
Go to the documentation of this file.
1 
7 #ifndef __CGenDatabase_H__
8 #define __CGenDatabase_H__
9 
10 #include <fstream>
11 
12 #include "CMySQL.h"
13 
14 #define VarType_Integer 0
15 #define VarType_Long 1
16 #define VarType_Double 2
17 #define VarType_Char 3
18 #define VarType_String 4
19 #define VarType_Date 5
20 #define VarType_Time 6
21 #define VarType_DateTime 7
22 #define VarType_Blob 8
23 
24 
28 {
29  char fldName[128];
30  char fldType[128];
31  char fldNull[10];
32  char fldIdx[10];
33  char fldDefault[256];
34  char fldExtra[256];
35  bool bfldSigned;
36  unsigned int tVarType;
37 };
38 
43 {
44  char tblName[128];
45  int numFields;
46  struct FieldInformation *flds[1024];
47 };
48 
54 {
55  const char *prmName;
56  const char *prmInfo;
57 };
58 
65 {
66  static const char* DBNameDefault;
67  const char * DBName;
68 
70  bool bClearTables;
71 
72  char tmpCString[256];
73 
75 public:
76  CGenDatabase(const char *nDBName=NULL,CMySQL *nSQL=NULL,bool bShouldClearTables=false);
77  ~CGenDatabase();
78 
80  BOOL IsCreated() { return bCreated; };
81 
82  BOOL SelectDB();
83  void ListTables();
84  bool ListTableInfo(const char *tblName);
85 
86  void GenFileComment(std::ofstream &dout,const char *className,const char *fileExt,const char *purposeInfo,const char *commentInfo);
87  void GenFuncComment(std::ofstream &dout,const char *funcName,const char *commentInfo,struct CommentParamInfo *parmInfo,const char *retInfo=NULL);
88  bool GenTableClass(const char *dstDir,const char *tblName);
89  void GenerateTableHeader(const char *dstDir,struct TableInformation *t);
90  char *GetCValue(struct FieldInformation *fld);
91  void GenerateTableSource(const char *dstDir,struct TableInformation *t);
92  void GenAllTableClasses(const char *dstDir);
93  void GenDatabaseClass(const char *dstDir,const char **tableList,int numTables);
94  void GenerateDatabaseHeader(const char *dstDir,const char **tableList,int numTables);
95  void GenerateDatabaseSource(const char *dstDir,const char **tableList,int numTables);
96 };
97 
98 #endif /* __CGenDatabase_H__ */