diff --git a/include/wx/db.h b/include/wx/db.h index 0c03ddaf46..52bbfd9516 100644 --- a/include/wx/db.h +++ b/include/wx/db.h @@ -93,7 +93,7 @@ enum enumDummy {enumDum1}; #define FALSE 0 #endif -const int DB_PATH_MAX = 254; +const int wxDB_PATH_MAX = 254; extern char const *SQL_LOG_FILENAME; extern char const *SQL_CATALOG_FILENAME; @@ -243,7 +243,7 @@ struct wxDbConnectInf char fileType[SQL_MAX_DSN_LENGTH+1]; // Not sure what the max length is // Optionals needed for some databases like dBase - char defaultDir[DB_PATH_MAX]; // Directory that db file resides in + char defaultDir[wxDB_PATH_MAX]; // Directory that db file resides in }; struct wxDbSqlTypeInfo @@ -534,6 +534,8 @@ bool WXDLLEXPORT wxDbGetDataSource(HENV henv, char *Dsn, SWORD DsnMax, char *DsD //################################################################################# // Backward compability structures/classes. This will eventually go away +const int DB_PATH_MAX = wxDB_PATH_MAX; + typedef wxDb wxDB; typedef wxDbTableInf wxTableInf; typedef wxDbColInf wxColInf; diff --git a/include/wx/dbtable.h b/include/wx/dbtable.h index a92ef0c87b..78aaffe00d 100644 --- a/include/wx/dbtable.h +++ b/include/wx/dbtable.h @@ -43,10 +43,10 @@ #include "db.h" #endif -const int ROWID_LEN = 24; // 18 is the max, 24 is in case it gets larger -const int DEFAULT_CURSOR = 0; -const bool QUERY_ONLY = TRUE; -const bool DISABLE_VIEW = TRUE; +const int wxDB_ROWID_LEN = 24; // 18 is the max, 24 is in case it gets larger +const int wxDB_DEFAULT_CURSOR = 0; +const bool wxDB_QUERY_ONLY = TRUE; +const bool wxDB_DISABLE_VIEW = TRUE; // The following class is used to define a column of a table. // The wxDbTable constructor will dynamically allocate as many of @@ -129,7 +129,7 @@ public: int noCols; // # of columns in the table bool queryOnly; // Query Only, no inserts, updates or deletes - char tablePath[DB_PATH_MAX]; // needed for dBase tables + char tablePath[wxDB_PATH_MAX]; // needed for dBase tables // Column Definitions wxDbColDef *colDefs; // Array of wxDbColDef structures @@ -144,7 +144,7 @@ public: // Public member functions wxDbTable(wxDb *pwxDb, const char *tblName, const int nCols, - const char *qryTblName = 0, bool qryOnly = !QUERY_ONLY, const char *tblPath=NULL); + const char *qryTblName = 0, bool qryOnly = !wxDB_QUERY_ONLY, const char *tblPath=NULL); virtual ~wxDbTable(); bool Open(void); bool CreateTable(bool attemptDrop=TRUE); @@ -191,7 +191,7 @@ public: HSTMT *NewCursor(bool setCursor = FALSE, bool bindColumns = TRUE); bool DeleteCursor(HSTMT *hstmtDel); - void SetCursor(HSTMT *hstmtActivate = (void **) DEFAULT_CURSOR); + void SetCursor(HSTMT *hstmtActivate = (void **) wxDB_DEFAULT_CURSOR); HSTMT GetCursor(void) { return(hstmt); } ULONG Count(const char *args="*"); int DB_STATUS(void) { return(pDb->DB_STATUS); } @@ -221,6 +221,12 @@ typedef wxDbColDef CcolDef; typedef wxDbColDataPtr wxColDataPtr; typedef wxDbColDataPtr CcolDataPtr; +const int ROWID = wxDB_ROWID_LEN; +const int DEFAULT_CURSOR = wxDB_DEFAULT_CURSOR; +const bool QUERY_ONLY = wxDB_QUERY_ONLY; +const bool DISABLE_VIEW = wxDB_DISABLE_VIEW; + + #endif #endif diff --git a/src/common/db.cpp b/src/common/db.cpp index 376f5a5987..354f611664 100644 --- a/src/common/db.cpp +++ b/src/common/db.cpp @@ -104,7 +104,7 @@ char const *SQL_CATALOG_FILENAME = "catalog.txt"; // SQL Log defaults to be used by GetDbConnection wxDbSqlLogState SQLLOGstate = sqlLogOFF; -//char SQLLOGfn[DB_PATH_MAX+1] = SQL_LOG_FILENAME; +//char SQLLOGfn[wxDB_PATH_MAX+1] = SQL_LOG_FILENAME; wxChar *SQLLOGfn = (wxChar*) SQL_LOG_FILENAME; // The wxDb::errorList is copied to this variable when the wxDb object diff --git a/src/common/dbtable.cpp b/src/common/dbtable.cpp index 10eca760cc..51c2b61a4e 100644 --- a/src/common/dbtable.cpp +++ b/src/common/dbtable.cpp @@ -1408,12 +1408,12 @@ void wxDbTable::GetUpdateStmt(char *pSqlStmt, int typeOfUpd, const char *pWhereC if (CanUpdByROWID()) { SDWORD cb; - char rowid[ROWID_LEN]; + char rowid[wxDB_ROWID_LEN]; // Get the ROWID value. If not successful retreiving the ROWID, // simply fall down through the code and build the WHERE clause // based on the key fields. - if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, (UCHAR*) rowid, ROWID_LEN, &cb) == SQL_SUCCESS) + if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, (UCHAR*) rowid, wxDB_ROWID_LEN, &cb) == SQL_SUCCESS) { wxStrcat(pSqlStmt, "ROWID = '"); wxStrcat(pSqlStmt, rowid); @@ -1464,12 +1464,12 @@ void wxDbTable::GetDeleteStmt(char *pSqlStmt, int typeOfDel, const char *pWhereC if (CanUpdByROWID()) { SDWORD cb; - char rowid[ROWID_LEN]; + char rowid[wxDB_ROWID_LEN]; // Get the ROWID value. If not successful retreiving the ROWID, // simply fall down through the code and build the WHERE clause // based on the key fields. - if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, (UCHAR*) rowid, ROWID_LEN, &cb) == SQL_SUCCESS) + if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, (UCHAR*) rowid, wxDB_ROWID_LEN, &cb) == SQL_SUCCESS) { wxStrcat(pSqlStmt, "ROWID = '"); wxStrcat(pSqlStmt, rowid); @@ -1819,7 +1819,7 @@ wxDbColDataPtr* wxDbTable::SetColDefs (wxDbColInf *pColInfs, ULONG numCols) /********** wxDbTable::SetCursor() **********/ void wxDbTable::SetCursor(HSTMT *hstmtActivate) { - if (hstmtActivate == DEFAULT_CURSOR) + if (hstmtActivate == wxDB_DEFAULT_CURSOR) hstmt = *hstmtDefault; else hstmt = *hstmtActivate; @@ -1912,12 +1912,12 @@ bool wxDbTable::Refresh(void) if (CanUpdByROWID()) { SDWORD cb; - char rowid[ROWID_LEN+1]; + char rowid[wxDB_ROWID_LEN+1]; // Get the ROWID value. If not successful retreiving the ROWID, // simply fall down through the code and build the WHERE clause // based on the key fields. - if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, (UCHAR*) rowid, ROWID_LEN, &cb) == SQL_SUCCESS) + if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, (UCHAR*) rowid, wxDB_ROWID_LEN, &cb) == SQL_SUCCESS) { wxStrcat(whereClause, queryTableName); wxStrcat(whereClause, ".ROWID = '");