Removed tabs and cleaned up indentations.
Added SQL_LOG_FILENAME and SQL_CATALOG_FILENAME constants to remove embedded text filenames git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5754 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -67,25 +67,11 @@
|
||||
typedef double SDOUBLE;
|
||||
typedef unsigned int UINT;
|
||||
#define ULONG UDWORD
|
||||
/*
|
||||
#ifdef __UNIX__
|
||||
# ifndef strnicmp
|
||||
# define strnicmp strncasecmp
|
||||
# endif
|
||||
# ifndef stricmp
|
||||
# define stricmp strcasecmp
|
||||
# endif
|
||||
#elif defined(__WXMAC__)
|
||||
#else
|
||||
# include <io.h>
|
||||
#endif
|
||||
*/
|
||||
|
||||
#ifndef wxODBC_FWD_ONLY_CURSORS
|
||||
#define wxODBC_FWD_ONLY_CURSORS 1
|
||||
#endif
|
||||
|
||||
|
||||
enum enumDummy {enumDum1};
|
||||
|
||||
#define SQL_C_BOOLEAN(datatype) (sizeof(datatype) == 1 ? SQL_C_UTINYINT : (sizeof(datatype) == 2 ? SQL_C_USHORT : SQL_C_ULONG))
|
||||
@@ -103,6 +89,9 @@ enum enumDummy {enumDum1};
|
||||
|
||||
const int DB_PATH_MAX = 254;
|
||||
|
||||
char * const SQL_LOG_FILENAME = "sqllog.txt";
|
||||
char * const SQL_CATALOG_FILENAME = "catalog.txt";
|
||||
|
||||
// Database Globals
|
||||
const int DB_TYPE_NAME_LEN = 40;
|
||||
const int DB_MAX_STATEMENT_LEN = 2048;
|
||||
@@ -235,6 +224,7 @@ enum ODBC_ERRORS
|
||||
DB_ERR_TIMEOUT_EXPIRED // SqlState = 'S1T00'
|
||||
};
|
||||
|
||||
|
||||
struct DbStuff
|
||||
{
|
||||
HENV Henv;
|
||||
@@ -249,6 +239,7 @@ struct DbStuff
|
||||
char defaultDir[DB_PATH_MAX]; // Directory that db file resides in
|
||||
};
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char TypeName[DB_TYPE_NAME_LEN];
|
||||
@@ -259,22 +250,25 @@ typedef struct
|
||||
short MaximumScale;
|
||||
} SqlTypeInfo;
|
||||
|
||||
|
||||
class WXDLLEXPORT wxColFor
|
||||
{
|
||||
public:
|
||||
wxString s_Field; // Formated String for Output
|
||||
wxString s_Format[7]; // Formated Objekts - TIMESTAMP has the biggest (7)
|
||||
wxString s_Menge[7]; // Formated Objekts - amount of things that can be formatted
|
||||
int i_Menge[7]; // Formated Objekts - TT MM YYYY HH MM SS m
|
||||
wxString s_Format[7]; // Formated Objects - TIMESTAMP has the biggest (7)
|
||||
wxString s_Menge[7]; // Formated Objects - amount of things that can be formatted
|
||||
int i_Menge[7]; // Formated Objects - TT MM YYYY HH MM SS m
|
||||
int i_Nation; // 0 = timestamp , 1=EU, 2=UK, 3=International, 4=US
|
||||
int i_dbDataType; // conversion of the 'sqlDataType' to the generic data type used by these classes
|
||||
SWORD i_sqlDataType;
|
||||
|
||||
wxColFor();
|
||||
~wxColFor();
|
||||
|
||||
int Format(int Nation, int dbDataType, SWORD sqlDataType, short columnSize, short decimalDigits);
|
||||
};
|
||||
|
||||
|
||||
class WXDLLEXPORT wxColInf
|
||||
{
|
||||
public:
|
||||
@@ -299,8 +293,9 @@ public:
|
||||
wxColFor *pColFor; // How should this columns be formatted
|
||||
};
|
||||
|
||||
|
||||
class WXDLLEXPORT wxTableInf // Description of a Table
|
||||
{ // mj10777 : used in wxDbInf and GetCatalog(..)
|
||||
{
|
||||
public:
|
||||
char tableName[DB_MAX_TABLE_NAME_LEN+1];
|
||||
char tableType[254+1]; // "TABLE" or "SYSTEM TABLE" etc.
|
||||
@@ -309,8 +304,9 @@ public:
|
||||
wxColInf *pColInf; // pColInf = NULL ; User can later call GetColumns(..);
|
||||
};
|
||||
|
||||
|
||||
class WXDLLEXPORT wxDbInf // Description of a Database
|
||||
{ // mj10777 : used in GetCatalog(..)
|
||||
{
|
||||
public:
|
||||
char catalog[128+1];
|
||||
char schema[128+1];
|
||||
@@ -318,12 +314,17 @@ public:
|
||||
wxTableInf *pTableInf; // pTableInf = new wxTableInf[numTables];
|
||||
};
|
||||
|
||||
|
||||
enum sqlLog
|
||||
{
|
||||
sqlLogOFF,
|
||||
sqlLogON
|
||||
};
|
||||
|
||||
|
||||
// These are the databases currently tested and working with these classes
|
||||
// See the comments in wxDB::Dbms() for exceptions/issues with
|
||||
// each of these database engines
|
||||
enum dbms
|
||||
{
|
||||
dbmsUNIDENTIFIED,
|
||||
@@ -338,8 +339,10 @@ enum dbms
|
||||
dbmsINFORMIX
|
||||
};
|
||||
|
||||
|
||||
typedef enum dbms DBMS;
|
||||
|
||||
|
||||
// The wxDB::errorList is copied to this variable when the wxDB object
|
||||
// is closed. This way, the error list is still available after the
|
||||
// database object is closed. This is necessary if the database
|
||||
@@ -349,11 +352,13 @@ typedef enum dbms DBMS;
|
||||
// this variable.
|
||||
extern char DBerrorList[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN];
|
||||
|
||||
|
||||
// Backward compability for Remstar classes. This
|
||||
// will eventually go away, so the wxColXxxx classes
|
||||
// should be used
|
||||
typedef wxColInf CcolInf;
|
||||
|
||||
|
||||
class WXDLLEXPORT wxDB
|
||||
{
|
||||
private:
|
||||
@@ -365,6 +370,7 @@ private:
|
||||
char *authStr; // Authorization string (password)
|
||||
FILE *fpSqlLog; // Sql Log file pointer
|
||||
enum sqlLog sqlLogState; // On or Off
|
||||
bool fwdOnlyCursors;
|
||||
|
||||
// Private member functions
|
||||
bool getDbInfo(void);
|
||||
@@ -372,10 +378,7 @@ private:
|
||||
bool setConnectionOptions(void);
|
||||
void logError(const char *errMsg, const char *SQLState);
|
||||
|
||||
bool fwdOnlyCursors;
|
||||
|
||||
public:
|
||||
|
||||
// The following structure contains database information gathered from the
|
||||
// datasource when the datasource is first opened.
|
||||
struct
|
||||
@@ -455,7 +458,7 @@ public:
|
||||
bool Grant(int privileges, const char *tableName, const char *userList = "PUBLIC");
|
||||
int TranslateSqlState(const char *SQLState);
|
||||
wxDbInf *GetCatalog(char *userID);
|
||||
bool Catalog(const char *userID=NULL, const char *fileName = "Catalog.txt");
|
||||
bool Catalog(const char *userID=NULL, const char *fileName = SQL_CATALOG_FILENAME);
|
||||
int GetKeyFields(char *tableName, wxColInf* colInf,int nocols);
|
||||
wxColInf *GetColumns(char *tableName[], const char *userID=NULL);
|
||||
wxColInf *GetColumns(char *tableName, int *numCols, const char *userID=NULL);
|
||||
@@ -470,11 +473,10 @@ public:
|
||||
HSTMT GetHSTMT(void) {return hstmt;}
|
||||
bool TableExists(const char *tableName, const char *userID=NULL, const char *path=NULL); // Table name can refer to a table, view, alias or synonym
|
||||
void LogError(const char *errMsg, const char *SQLState = 0) {logError(errMsg, SQLState);}
|
||||
bool SqlLog(enum sqlLog state, const char *filename = "sqllog.txt", bool append = FALSE);
|
||||
bool SqlLog(enum sqlLog state, const char *filename = SQL_LOG_FILENAME, bool append = FALSE);
|
||||
bool WriteSqlLog(const char *logMsg);
|
||||
DBMS Dbms(void);
|
||||
bool FwdOnlyCursors(void) {return fwdOnlyCursors;}
|
||||
|
||||
}; // wxDB
|
||||
|
||||
// This structure forms a node in a linked list. The linked list of "DbList" objects
|
||||
@@ -512,8 +514,10 @@ bool WXDLLEXPORT FreeDbConnection(wxDB *pDb);
|
||||
void WXDLLEXPORT CloseDbConnections(void);
|
||||
int WXDLLEXPORT NumberDbConnectionsInUse(void);
|
||||
|
||||
|
||||
// This function sets the sql log state for all open wxDB objects
|
||||
bool SqlLog(enum sqlLog state, const char *filename = "sqllog.txt");
|
||||
bool SqlLog(enum sqlLog state, const char *filename = SQL_LOG_FILENAME);
|
||||
|
||||
|
||||
// This routine allows you to query a driver manager
|
||||
// for a list of available datasources. Call this routine
|
||||
|
@@ -72,6 +72,7 @@ public:
|
||||
bool Null; // NOT FULLY IMPLEMENTED - Allows NULL values in Inserts and Updates
|
||||
}; // wxColDef
|
||||
|
||||
|
||||
class WXDLLEXPORT wxColDataPtr
|
||||
{
|
||||
public:
|
||||
@@ -96,10 +97,10 @@ public:
|
||||
bool Ascending;
|
||||
}; // CidxDef
|
||||
|
||||
|
||||
class WXDLLEXPORT wxTable
|
||||
{
|
||||
private:
|
||||
|
||||
ULONG tableID; // Used for debugging. This can help to match up mismatched constructors/destructors
|
||||
|
||||
// Private member variables
|
||||
@@ -115,7 +116,6 @@ private:
|
||||
bool query(int queryType, bool forUpdate, bool distinct, char *pSqlStmt = 0);
|
||||
|
||||
public:
|
||||
|
||||
// Pointer to the database object this table belongs to
|
||||
wxDB *pDb;
|
||||
|
||||
@@ -194,8 +194,6 @@ public:
|
||||
void SetColDefs (int index, const char *fieldName, int dataType, void *pData, int cType,
|
||||
int size, bool keyField = FALSE, bool upd = TRUE,
|
||||
bool insAllow = TRUE, bool derivedCol = FALSE);
|
||||
// BJO20000121 : new prototype
|
||||
// bool SetColDefs (wxColInf *colInfs, ULONG numCols, wxColDataPtr *pColDataPtrs);
|
||||
wxColDataPtr* SetColDefs (wxColInf *colInfs, ULONG numCols);
|
||||
|
||||
HSTMT *NewCursor(bool setCursor = FALSE, bool bindColumns = TRUE);
|
||||
|
Reference in New Issue
Block a user