Database generator class. More...
#include <CGenDatabase.h>
Public Member Functions | |
CGenDatabase (const char *nDBName=NULL, CMySQL *nSQL=NULL, bool bShouldClearTables=false) | |
This is the constructor for the CSnortDatabase class. | |
~CGenDatabase () | |
This is the destructor for the CGenDatabase class. | |
BOOL | IsCreated () |
This function returns the value of bCreated. | |
BOOL | SelectDB () |
This function selects the Default database for all operations. | |
void | ListTables () |
This function lists all the tables for the current database. | |
bool | ListTableInfo (const char *tblName) |
void | GenFileComment (std::ofstream &dout, const char *className, const char *fileExt, const char *purposeInfo, const char *commentInfo) |
This function generates the Comment informatio for the top of a file. | |
void | GenFuncComment (std::ofstream &dout, const char *funcName, const char *commentInfo, struct CommentParamInfo *parmInfo, const char *retInfo=NULL) |
This function generates the Comment informatio for the top of a file. | |
bool | GenTableClass (const char *dstDir, const char *tblName) |
This function generates the Class header and source files. | |
void | GenerateTableHeader (const char *dstDir, struct TableInformation *t) |
This function generates the Class header file. | |
char * | GetCValue (struct FieldInformation *fld) |
This function generates the field entries for the field structure used for passing arguments. | |
void | GenerateTableSource (const char *dstDir, struct TableInformation *t) |
This function generates the Class source file. | |
void | GenAllTableClasses (const char *dstDir) |
This function generates all of the different table classes and the database class. | |
void | GenDatabaseClass (const char *dstDir, const char **tableList, int numTables) |
This function generates the database class. | |
void | GenerateDatabaseHeader (const char *dstDir, const char **tableList, int numTables) |
This function generates the Class header file. | |
void | GenerateDatabaseSource (const char *dstDir, const char **tableList, int numTables) |
This function generates the Class source file. |
Private Attributes | |
const char * | DBName |
This is the Database name specified when the class is created. | |
BOOL | bCreated |
This specifies if the Database was created by this class. | |
bool | bClearTables |
This specifies if the tables should be cleared when the class is created. | |
char | tmpCString [256] |
This is a temp string. | |
CMySQL * | sql |
This is the CMySQL class pointer that will be used for this instance of this class. |
Static Private Attributes | |
static const char * | DBNameDefault = "mysql" |
This is the default Database name for the class. |
Database generator class.
CGenDatabase::CGenDatabase | ( | const char * | nDBName = NULL , |
CMySQL * | nSQL = NULL , |
||
bool | bShouldClearTables = false |
||
) |
This is the constructor for the CSnortDatabase class.
nDBName | The Database name to use for this instance of the class, if it's NULL then the default Database name will be used. |
nSQL | The CMySQL pointer, for a connection already established. NULL means that a new one needs to be established. |
bShouldClearTables | Specifies that all of the tables should be deleted. |
CGenDatabase::~CGenDatabase | ( | ) |
This is the destructor for the CGenDatabase class.
void CGenDatabase::GenAllTableClasses | ( | const char * | dstDir | ) |
This function generates all of the different table classes and the database class.
dstDir | This specifies the destination directory. |
void CGenDatabase::GenDatabaseClass | ( | const char * | dstDir, |
const char ** | tableList, | ||
int | numTables | ||
) |
This function generates the database class.
dstDir | This is the destination directory. |
tableList | This is the list of tables that are in this Database. |
numTables | This is the number of entries in the list. |
void CGenDatabase::GenerateDatabaseHeader | ( | const char * | dstDir, |
const char ** | tableList, | ||
int | numTables | ||
) |
This function generates the Class header file.
dstDir | This is the destination directory. |
tableList | This is the list of tables that are in this Database. |
numTables | This is the number of entries in the list. |
void CGenDatabase::GenerateDatabaseSource | ( | const char * | dstDir, |
const char ** | tableList, | ||
int | numTables | ||
) |
This function generates the Class source file.
dstDir | This is the destination directory. |
tableList | This is the list of tables that are in this Database. |
numTables | This is the number of entries in the list. |
void CGenDatabase::GenerateTableHeader | ( | const char * | dstDir, |
struct TableInformation * | t | ||
) |
This function generates the Class header file.
dstDir | This is the destination directory. |
t | This contains the information about the table. |
void CGenDatabase::GenerateTableSource | ( | const char * | dstDir, |
struct TableInformation * | t | ||
) |
This function generates the Class source file.
dstDir | This is the destination directory. |
t | This contains the information about the table. |
void CGenDatabase::GenFileComment | ( | std::ofstream & | dout, |
const char * | className, | ||
const char * | fileExt, | ||
const char * | purposeInfo, | ||
const char * | commentInfo | ||
) |
This function generates the Comment informatio for the top of a file.
dout | The destination stream that will be used. |
className | The class name that will be used for this information. |
fileExt | The extension of the file. |
purposeInfo | This specifies the purpose of this file. |
commentInfo | This specifies the comments to place about the file. |
void CGenDatabase::GenFuncComment | ( | std::ofstream & | dout, |
const char * | funcName, | ||
const char * | commentInfo, | ||
struct CommentParamInfo * | parmInfo, | ||
const char * | retInfo = NULL |
||
) |
This function generates the Comment informatio for the top of a file.
dout | The destination stream that will be used. |
funcName | This is the name of the function to comment on. |
commentInfo | This specifies the comments to place about the function. |
parmInfo | This specifies the parameter information. |
retInfo | This specifies the return information. |
bool CGenDatabase::GenTableClass | ( | const char * | dstDir, |
const char * | tblName | ||
) |
This function generates the Class header and source files.
dstDir | The destination directory for the generated files. |
tblName | The name of the table to read. |
char * CGenDatabase::GetCValue | ( | struct FieldInformation * | fld | ) |
This function generates the field entries for the field structure used for passing arguments.
fld | This contains the field information. |
|
inline |
This function returns the value of bCreated.
bool CGenDatabase::ListTableInfo | ( | const char * | tblName | ) |
void CGenDatabase::ListTables | ( | ) |
This function lists all the tables for the current database.
BOOL CGenDatabase::SelectDB | ( | ) |
This function selects the Default database for all operations.
|
private |
This specifies if the tables should be cleared when the class is created.
|
private |
This specifies if the Database was created by this class.
|
private |
This is the Database name specified when the class is created.
|
staticprivate |
This is the default Database name for the class.
|
private |
This is the CMySQL class pointer that will be used for this instance of this class.
|
private |
This is a temp string.