MKSQLCpp  0.1
MakeMySQLC++Classes
 All Classes Files Functions Variables Macros Pages
Public Member Functions | Private Attributes | Static Private Attributes
CGenDatabase Class Reference

Database generator class. More...

#include <CGenDatabase.h>

List of all members.

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.
CMySQLsql
 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.

Detailed Description

Database generator class.

Remarks
This class generates the source code used to work with the Databases and Tables.

Constructor & Destructor Documentation

CGenDatabase::CGenDatabase ( const char *  nDBName = NULL,
CMySQL nSQL = NULL,
bool  bShouldClearTables = false 
)

This is the constructor for the CSnortDatabase class.

Parameters:
nDBNameThe Database name to use for this instance of the class, if it's NULL then the default Database name will be used.
nSQLThe CMySQL pointer, for a connection already established. NULL means that a new one needs to be established.
bShouldClearTablesSpecifies that all of the tables should be deleted.
CGenDatabase::~CGenDatabase ( )

This is the destructor for the CGenDatabase class.


Member Function Documentation

void CGenDatabase::GenAllTableClasses ( const char *  dstDir)

This function generates all of the different table classes and the database class.

Parameters:
dstDirThis specifies the destination directory.
void CGenDatabase::GenDatabaseClass ( const char *  dstDir,
const char **  tableList,
int  numTables 
)

This function generates the database class.

Parameters:
dstDirThis is the destination directory.
tableListThis is the list of tables that are in this Database.
numTablesThis 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.

Parameters:
dstDirThis is the destination directory.
tableListThis is the list of tables that are in this Database.
numTablesThis 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.

Parameters:
dstDirThis is the destination directory.
tableListThis is the list of tables that are in this Database.
numTablesThis is the number of entries in the list.
void CGenDatabase::GenerateTableHeader ( const char *  dstDir,
struct TableInformation t 
)

This function generates the Class header file.

Parameters:
dstDirThis is the destination directory.
tThis contains the information about the table.
void CGenDatabase::GenerateTableSource ( const char *  dstDir,
struct TableInformation t 
)

This function generates the Class source file.

Parameters:
dstDirThis is the destination directory.
tThis 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.

Parameters:
doutThe destination stream that will be used.
classNameThe class name that will be used for this information.
fileExtThe extension of the file.
purposeInfoThis specifies the purpose of this file.
commentInfoThis 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.

Parameters:
doutThe destination stream that will be used.
funcNameThis is the name of the function to comment on.
commentInfoThis specifies the comments to place about the function.
parmInfoThis specifies the parameter information.
retInfoThis specifies the return information.
bool CGenDatabase::GenTableClass ( const char *  dstDir,
const char *  tblName 
)

This function generates the Class header and source files.

Parameters:
dstDirThe destination directory for the generated files.
tblNameThe name of the table to read.
Returns:
TRUE if there are no problems getting the information.
char * CGenDatabase::GetCValue ( struct FieldInformation fld)

This function generates the field entries for the field structure used for passing arguments.

Parameters:
fldThis contains the field information.
Returns:
A character string value specifying the field type.
BOOL CGenDatabase::IsCreated ( )
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.

Returns:
TRUE if the Database could either be selected or created, FALSE if not.

Member Data Documentation

bool CGenDatabase::bClearTables
private

This specifies if the tables should be cleared when the class is created.

BOOL CGenDatabase::bCreated
private

This specifies if the Database was created by this class.

const char* CGenDatabase::DBName
private

This is the Database name specified when the class is created.

const char * CGenDatabase::DBNameDefault = "mysql"
staticprivate

This is the default Database name for the class.

CMySQL* CGenDatabase::sql
private

This is the CMySQL class pointer that will be used for this instance of this class.

char CGenDatabase::tmpCString[256]
private

This is a temp string.


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