Changed the 'true's and 'false's back to TRUE and FALSE

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10540 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
George Tasker
2001-06-11 16:54:28 +00:00
parent 5524217904
commit a144affed2
6 changed files with 288 additions and 288 deletions

View File

@@ -98,7 +98,7 @@ enum enumDummy {enumDum1};
#define SQL_C_BLOB SQL_VARBINARY #define SQL_C_BLOB SQL_VARBINARY
#endif #endif
#endif #endif
/*
#ifndef TRUE #ifndef TRUE
#define TRUE true #define TRUE true
#endif #endif
@@ -106,7 +106,7 @@ enum enumDummy {enumDum1};
#ifndef FALSE #ifndef FALSE
#define FALSE false #define FALSE false
#endif #endif
*/
const int wxDB_PATH_MAX = 254; const int wxDB_PATH_MAX = 254;
extern wxChar const *SQL_LOG_FILENAME; extern wxChar const *SQL_LOG_FILENAME;
@@ -586,7 +586,7 @@ public:
bool DispAllErrors(HENV aHenv, HDBC aHdbc = SQL_NULL_HDBC, HSTMT aHstmt = SQL_NULL_HSTMT); bool DispAllErrors(HENV aHenv, HDBC aHdbc = SQL_NULL_HDBC, HSTMT aHstmt = SQL_NULL_HSTMT);
bool GetNextError(HENV aHenv, HDBC aHdbc = SQL_NULL_HDBC, HSTMT aHstmt = SQL_NULL_HSTMT); bool GetNextError(HENV aHenv, HDBC aHdbc = SQL_NULL_HDBC, HSTMT aHstmt = SQL_NULL_HSTMT);
void DispNextError(void); void DispNextError(void);
bool CreateView(const wxString &viewName, const wxString &colList, const wxString &pSqlStmt, bool attemptDrop=true); bool CreateView(const wxString &viewName, const wxString &colList, const wxString &pSqlStmt, bool attemptDrop=TRUE);
bool DropView(const wxString &viewName); bool DropView(const wxString &viewName);
bool ExecSql(const wxString &pSqlStmt); bool ExecSql(const wxString &pSqlStmt);
bool GetNext(void); bool GetNext(void);
@@ -628,7 +628,7 @@ public:
{ logError(errMsg, SQLState); } { logError(errMsg, SQLState); }
void SetDebugErrorMessages(bool state) { silent = !state; } void SetDebugErrorMessages(bool state) { silent = !state; }
bool SetSqlLogging(wxDbSqlLogState state, const wxString &filename = SQL_LOG_FILENAME, bool SetSqlLogging(wxDbSqlLogState state, const wxString &filename = SQL_LOG_FILENAME,
bool append = false); bool append = FALSE);
bool WriteSqlLog(const wxString &logMsg); bool WriteSqlLog(const wxString &logMsg);
wxDBMS Dbms(void); wxDBMS Dbms(void);
@@ -697,7 +697,7 @@ bool WXDLLEXPORT wxDbSqlLog(wxDbSqlLogState state, const wxString &filename =
#if 0 #if 0
// MSW/VC6 ONLY!!! Experimental // MSW/VC6 ONLY!!! Experimental
int WXDLLEXPORT wxDbCreateDataSource(const wxString &driverName, const wxString &dsn, const wxString &description=wxEmptyString, int WXDLLEXPORT wxDbCreateDataSource(const wxString &driverName, const wxString &dsn, const wxString &description=wxEmptyString,
bool sysDSN=false, const wxString &defDir=wxEmptyString, wxWindow *parent=NULL); bool sysDSN=FALSE, const wxString &defDir=wxEmptyString, wxWindow *parent=NULL);
#endif #endif
// This routine allows you to query a driver manager // This routine allows you to query a driver manager

View File

@@ -106,7 +106,7 @@ class wxDbGridTableBase : public wxGridTableBase
{ {
public: public:
wxDbGridTableBase(wxDbTable *tab, wxDbGridColInfo *ColInfo, wxDbGridTableBase(wxDbTable *tab, wxDbGridColInfo *ColInfo,
int count = wxUSE_QUERY, bool takeOwnership = true); int count = wxUSE_QUERY, bool takeOwnership = TRUE);
~wxDbGridTableBase(); ~wxDbGridTableBase();
virtual int GetNumberRows() virtual int GetNumberRows()
@@ -138,12 +138,12 @@ public:
virtual wxString wxDbGridTableBase::GetColLabelValue(int col); virtual wxString wxDbGridTableBase::GetColLabelValue(int col);
virtual bool AssignDbTable(wxDbTable *tab, int count = wxUSE_QUERY, bool takeOwnership=true); virtual bool AssignDbTable(wxDbTable *tab, int count = wxUSE_QUERY, bool takeOwnership=TRUE);
virtual void ValidateRow(int row); virtual void ValidateRow(int row);
virtual bool UpdateRow(int row) const virtual bool UpdateRow(int row) const
{ {
if (m_row != row) if (m_row != row)
return true; return TRUE;
else else
return Writeback(); return Writeback();
} }

View File

@@ -41,8 +41,8 @@
const int wxDB_ROWID_LEN = 24; // 18 is the max, 24 is in case it gets larger const int wxDB_ROWID_LEN = 24; // 18 is the max, 24 is in case it gets larger
const int wxDB_DEFAULT_CURSOR = 0; const int wxDB_DEFAULT_CURSOR = 0;
const bool wxDB_QUERY_ONLY = true; const bool wxDB_QUERY_ONLY = TRUE;
const bool wxDB_DISABLE_VIEW = true; const bool wxDB_DISABLE_VIEW = TRUE;
// Used to indicate end of a variable length list of // Used to indicate end of a variable length list of
// column numbers passed to member functions // column numbers passed to member functions
@@ -64,7 +64,7 @@ public:
SWORD SqlCtype; // C data type; e.g. SQL_C_LONG SWORD SqlCtype; // C data type; e.g. SQL_C_LONG
void *PtrDataObj; // Address of the data object void *PtrDataObj; // Address of the data object
int SzDataObj; // Size, in bytes, of the data object int SzDataObj; // Size, in bytes, of the data object
bool KeyField; // true if this column is part of the PRIMARY KEY to the table; Date fields should NOT be KeyFields. bool KeyField; // TRUE if this column is part of the PRIMARY KEY to the table; Date fields should NOT be KeyFields.
bool Updateable; // Specifies whether this column is updateable bool Updateable; // Specifies whether this column is updateable
bool InsertAllowed; // Specifies whether this column should be included in an INSERT statement bool InsertAllowed; // Specifies whether this column should be included in an INSERT statement
bool DerivedCol; // Specifies whether this column is a derived value bool DerivedCol; // Specifies whether this column is a derived value
@@ -199,11 +199,11 @@ public:
virtual ~wxDbTable(); virtual ~wxDbTable();
bool Open(bool checkPrivileges=false, bool checkTableExists=true); bool Open(bool checkPrivileges=FALSE, bool checkTableExists=TRUE);
bool CreateTable(bool attemptDrop=true); bool CreateTable(bool attemptDrop=TRUE);
bool DropTable(void); bool DropTable(void);
bool CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCols, bool CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCols,
wxDbIdxDef *pIdxDefs, bool attemptDrop=true); wxDbIdxDef *pIdxDefs, bool attemptDrop=TRUE);
bool DropIndex(const wxString &idxName); bool DropIndex(const wxString &idxName);
// Accessors // Accessors
@@ -246,10 +246,10 @@ public:
bool Delete(void); bool Delete(void);
bool DeleteWhere(const wxString &pWhereClause); bool DeleteWhere(const wxString &pWhereClause);
bool DeleteMatching(void); bool DeleteMatching(void);
virtual bool Query(bool forUpdate = false, bool distinct = false); virtual bool Query(bool forUpdate = FALSE, bool distinct = FALSE);
bool QueryBySqlStmt(const wxString &pSqlStmt); bool QueryBySqlStmt(const wxString &pSqlStmt);
bool QueryMatching(bool forUpdate = false, bool distinct = false); bool QueryMatching(bool forUpdate = FALSE, bool distinct = FALSE);
bool QueryOnKeyFields(bool forUpdate = false, bool distinct = false); bool QueryOnKeyFields(bool forUpdate = FALSE, bool distinct = FALSE);
bool Refresh(void); bool Refresh(void);
bool GetNext(void) { return(getRec(SQL_FETCH_NEXT)); } bool GetNext(void) { return(getRec(SQL_FETCH_NEXT)); }
bool operator++(int) { return(getRec(SQL_FETCH_NEXT)); } bool operator++(int) { return(getRec(SQL_FETCH_NEXT)); }
@@ -273,8 +273,8 @@ public:
void BuildUpdateStmt(wxString &pSqlStmt, int typeOfUpd, const wxString &pWhereClause=""); void BuildUpdateStmt(wxString &pSqlStmt, int typeOfUpd, const wxString &pWhereClause="");
void BuildUpdateStmt(wxChar *pSqlStmt, int typeOfUpd, const wxString &pWhereClause=""); void BuildUpdateStmt(wxChar *pSqlStmt, int typeOfUpd, const wxString &pWhereClause="");
void BuildWhereClause(wxString &pWhereClause, int typeOfWhere, const wxString &qualTableName="", bool useLikeComparison=false); void BuildWhereClause(wxString &pWhereClause, int typeOfWhere, const wxString &qualTableName="", bool useLikeComparison=FALSE);
void BuildWhereClause(wxChar *pWhereClause, int typeOfWhere, const wxString &qualTableName="", bool useLikeComparison=false); void BuildWhereClause(wxChar *pWhereClause, int typeOfWhere, const wxString &qualTableName="", bool useLikeComparison=FALSE);
#if wxODBC_BACKWARD_COMPATABILITY #if wxODBC_BACKWARD_COMPATABILITY
// The following member functions are deprecated. You should use the BuildXxxxxStmt functions (above) // The following member functions are deprecated. You should use the BuildXxxxxStmt functions (above)
@@ -285,42 +285,42 @@ public:
void GetUpdateStmt(char *pSqlStmt, int typeOfUpd, const char *pWhereClause = NULL) void GetUpdateStmt(char *pSqlStmt, int typeOfUpd, const char *pWhereClause = NULL)
{ BuildUpdateStmt(pSqlStmt,typeOfUpd,pWhereClause); } { BuildUpdateStmt(pSqlStmt,typeOfUpd,pWhereClause); }
void GetWhereClause(char *pWhereClause, int typeOfWhere, void GetWhereClause(char *pWhereClause, int typeOfWhere,
const char *qualTableName = NULL, bool useLikeComparison=false) const char *qualTableName = NULL, bool useLikeComparison=FALSE)
{ BuildWhereClause(pWhereClause,typeOfWhere,qualTableName,useLikeComparison); } { BuildWhereClause(pWhereClause,typeOfWhere,qualTableName,useLikeComparison); }
#endif #endif
bool CanSelectForUpdate(void); bool CanSelectForUpdate(void);
bool CanUpdByROWID(void); bool CanUpdByROWID(void);
void ClearMemberVar(UWORD colNo, bool setToNull=false); void ClearMemberVar(UWORD colNo, bool setToNull=FALSE);
void ClearMemberVars(bool setToNull=false); void ClearMemberVars(bool setToNull=FALSE);
bool SetQueryTimeout(UDWORD nSeconds); bool SetQueryTimeout(UDWORD nSeconds);
wxDbColDef *GetColDefs() { return colDefs; } wxDbColDef *GetColDefs() { return colDefs; }
void SetColDefs(UWORD index, const wxString &fieldName, int dataType, void SetColDefs(UWORD index, const wxString &fieldName, int dataType,
void *pData, SWORD cType, void *pData, SWORD cType,
int size, bool keyField = false, bool upd = true, int size, bool keyField = FALSE, bool upd = TRUE,
bool insAllow = true, bool derivedCol = false); bool insAllow = TRUE, bool derivedCol = FALSE);
wxDbColDataPtr *SetColDefs(wxDbColInf *colInfs, UWORD numCols); wxDbColDataPtr *SetColDefs(wxDbColInf *colInfs, UWORD numCols);
bool CloseCursor(HSTMT cursor); bool CloseCursor(HSTMT cursor);
bool DeleteCursor(HSTMT *hstmtDel); bool DeleteCursor(HSTMT *hstmtDel);
void SetCursor(HSTMT *hstmtActivate = (void **) wxDB_DEFAULT_CURSOR); void SetCursor(HSTMT *hstmtActivate = (void **) wxDB_DEFAULT_CURSOR);
HSTMT GetCursor(void) { return(hstmt); } HSTMT GetCursor(void) { return(hstmt); }
HSTMT *GetNewCursor(bool setCursor = false, bool bindColumns = true); HSTMT *GetNewCursor(bool setCursor = FALSE, bool bindColumns = TRUE);
#if wxODBC_BACKWARD_COMPATABILITY #if wxODBC_BACKWARD_COMPATABILITY
// The following member function is deprecated. You should use the GetNewCursor // The following member function is deprecated. You should use the GetNewCursor
HSTMT *NewCursor(bool setCursor = false, bool bindColumns = true) { return GetNewCursor(setCursor,bindColumns); } HSTMT *NewCursor(bool setCursor = FALSE, bool bindColumns = TRUE) { return GetNewCursor(setCursor,bindColumns); }
#endif #endif
ULONG Count(const wxString &args="*"); ULONG Count(const wxString &args="*");
int DB_STATUS(void) { return(pDb->DB_STATUS); } int DB_STATUS(void) { return(pDb->DB_STATUS); }
bool IsColNull(UWORD colNo) const; bool IsColNull(UWORD colNo) const;
bool SetColNull(UWORD colNo, bool set=true); bool SetColNull(UWORD colNo, bool set=TRUE);
bool SetColNull(const wxString &colName, bool set=true); bool SetColNull(const wxString &colName, bool set=TRUE);
#if wxODBC_BACKWARD_COMPATABILITY #if wxODBC_BACKWARD_COMPATABILITY
// The following member functions are deprecated. You should use the SetColNull() // The following member functions are deprecated. You should use the SetColNull()
bool SetNull(int colNo, bool set=true) { return (SetNull(colNo,set)); } bool SetNull(int colNo, bool set=TRUE) { return (SetNull(colNo,set)); }
bool SetNull(const char *colName, bool set=true) { return (SetNull(colName,set)); } bool SetNull(const char *colName, bool set=TRUE) { return (SetNull(colName,set)); }
#endif #endif
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
ULONG GetTableID() { return tableID; } ULONG GetTableID() { return tableID; }

View File

@@ -113,7 +113,7 @@ typedef struct
wxDbConnectInf::wxDbConnectInf() wxDbConnectInf::wxDbConnectInf()
{ {
Henv = 0; Henv = 0;
freeHenvOnDestroy = false; freeHenvOnDestroy = FALSE;
Initialize(); Initialize();
} // Constructor } // Constructor
@@ -125,7 +125,7 @@ wxDbConnectInf::wxDbConnectInf(HENV henv, const wxString &dsn, const wxString &u
const wxString &fileType, const wxString &description) const wxString &fileType, const wxString &description)
{ {
Henv = 0; Henv = 0;
freeHenvOnDestroy = false; freeHenvOnDestroy = FALSE;
Initialize(); Initialize();
@@ -156,7 +156,7 @@ wxDbConnectInf::~wxDbConnectInf()
/********** wxDbConnectInf::Initialize() **********/ /********** wxDbConnectInf::Initialize() **********/
bool wxDbConnectInf::Initialize() bool wxDbConnectInf::Initialize()
{ {
freeHenvOnDestroy = false; freeHenvOnDestroy = FALSE;
if (freeHenvOnDestroy && Henv) if (freeHenvOnDestroy && Henv)
FreeHenv(); FreeHenv();
@@ -169,7 +169,7 @@ bool wxDbConnectInf::Initialize()
FileType.Empty(); FileType.Empty();
DefaultDir.Empty(); DefaultDir.Empty();
return true; return TRUE;
} // wxDbConnectInf::Initialize() } // wxDbConnectInf::Initialize()
@@ -184,12 +184,12 @@ bool wxDbConnectInf::AllocHenv()
if (SQLAllocEnv(&Henv) != SQL_SUCCESS) if (SQLAllocEnv(&Henv) != SQL_SUCCESS)
{ {
wxLogDebug(wxT("A problem occured while trying to get a connection to the data source")); wxLogDebug(wxT("A problem occured while trying to get a connection to the data source"));
return false; return FALSE;
} }
freeHenvOnDestroy = true; freeHenvOnDestroy = TRUE;
return true; return TRUE;
} // wxDbConnectInf::AllocHenv() } // wxDbConnectInf::AllocHenv()
@@ -201,7 +201,7 @@ void wxDbConnectInf::FreeHenv()
SQLFreeEnv(Henv); SQLFreeEnv(Henv);
Henv = 0; Henv = 0;
freeHenvOnDestroy = false; freeHenvOnDestroy = FALSE;
} // wxDbConnectInf::FreeHenv() } // wxDbConnectInf::FreeHenv()
@@ -347,7 +347,7 @@ int wxDbColFor::Format(int Nation, int dbDataType, SWORD sqlDataType,
s_Field.Printf(wxT("Unknown Format(%d)-SQL(%d)"),dbDataType,sqlDataType); // s_Field.Printf(wxT("Unknown Format(%d)-SQL(%d)"),dbDataType,sqlDataType); //
break; break;
}; };
return true; return TRUE;
} // wxDbColFor::Format() } // wxDbColFor::Format()
@@ -389,7 +389,7 @@ bool wxDbColInf::Initialize()
FkTableName[0] = 0; FkTableName[0] = 0;
pColFor = NULL; pColFor = NULL;
return true; return TRUE;
} // wxDbColInf::Initialize() } // wxDbColInf::Initialize()
@@ -417,7 +417,7 @@ bool wxDbTableInf::Initialize()
numCols = 0; numCols = 0;
pColInf = NULL; pColInf = NULL;
return true; return TRUE;
} // wxDbTableInf::Initialize() } // wxDbTableInf::Initialize()
@@ -445,7 +445,7 @@ bool wxDbInf::Initialize()
numTables = 0; numTables = 0;
pTableInf = NULL; pTableInf = NULL;
return true; return TRUE;
} // wxDbInf::Initialize() } // wxDbInf::Initialize()
@@ -526,7 +526,7 @@ void wxDb::initialize()
typeInfBlob.MaximumScale = 0; typeInfBlob.MaximumScale = 0;
// Error reporting is turned OFF by default // Error reporting is turned OFF by default
silent = true; silent = TRUE;
// Allocate a data source connection handle // Allocate a data source connection handle
if (SQLAllocConnect(henv, &hdbc) != SQL_SUCCESS) if (SQLAllocConnect(henv, &hdbc) != SQL_SUCCESS)
@@ -536,8 +536,8 @@ void wxDb::initialize()
DB_STATUS = 0; DB_STATUS = 0;
// Mark database as not open as of yet // Mark database as not open as of yet
dbIsOpen = false; dbIsOpen = FALSE;
dbIsCached = false; dbIsCached = FALSE;
} // wxDb::initialize() } // wxDb::initialize()
@@ -623,7 +623,7 @@ bool wxDb::Open(const wxString &Dsn, const wxString &Uid, const wxString &AuthSt
*/ */
// Mark database as open // Mark database as open
dbIsOpen = true; dbIsOpen = TRUE;
// Allocate a statement handle for the database connection // Allocate a statement handle for the database connection
if (SQLAllocStmt(hdbc, &hstmt) != SQL_SUCCESS) if (SQLAllocStmt(hdbc, &hstmt) != SQL_SUCCESS)
@@ -631,11 +631,11 @@ bool wxDb::Open(const wxString &Dsn, const wxString &Uid, const wxString &AuthSt
// Set Connection Options // Set Connection Options
if (!setConnectionOptions()) if (!setConnectionOptions())
return(false); return(FALSE);
// Query the data source for inf. about itself // Query the data source for inf. about itself
if (!getDbInfo()) if (!getDbInfo())
return(false); return(FALSE);
// Query the data source regarding data type information // Query the data source regarding data type information
@@ -681,7 +681,7 @@ bool wxDb::Open(const wxString &Dsn, const wxString &Uid, const wxString &AuthSt
// VARCHAR = Variable length character string // VARCHAR = Variable length character string
if (!getDataTypeInfo(SQL_VARCHAR, typeInfVarchar)) if (!getDataTypeInfo(SQL_VARCHAR, typeInfVarchar))
if (!getDataTypeInfo(SQL_CHAR, typeInfVarchar)) if (!getDataTypeInfo(SQL_CHAR, typeInfVarchar))
return(false); return(FALSE);
else else
typeInfVarchar.FsqlType = SQL_CHAR; typeInfVarchar.FsqlType = SQL_CHAR;
else else
@@ -693,7 +693,7 @@ bool wxDb::Open(const wxString &Dsn, const wxString &Uid, const wxString &AuthSt
if (!getDataTypeInfo(SQL_FLOAT,typeInfFloat)) if (!getDataTypeInfo(SQL_FLOAT,typeInfFloat))
if (!getDataTypeInfo(SQL_DECIMAL,typeInfFloat)) if (!getDataTypeInfo(SQL_DECIMAL,typeInfFloat))
if (!getDataTypeInfo(SQL_NUMERIC,typeInfFloat)) if (!getDataTypeInfo(SQL_NUMERIC,typeInfFloat))
return(false); return(FALSE);
else else
typeInfFloat.FsqlType = SQL_NUMERIC; typeInfFloat.FsqlType = SQL_NUMERIC;
else else
@@ -711,7 +711,7 @@ bool wxDb::Open(const wxString &Dsn, const wxString &Uid, const wxString &AuthSt
// If SQL_INTEGER is not supported, use the floating point // If SQL_INTEGER is not supported, use the floating point
// data type to store integers as well as floats // data type to store integers as well as floats
if (!getDataTypeInfo(typeInfFloat.FsqlType, typeInfInteger)) if (!getDataTypeInfo(typeInfFloat.FsqlType, typeInfInteger))
return(false); return(FALSE);
else else
typeInfInteger.FsqlType = typeInfFloat.FsqlType; typeInfInteger.FsqlType = typeInfFloat.FsqlType;
} }
@@ -722,14 +722,14 @@ bool wxDb::Open(const wxString &Dsn, const wxString &Uid, const wxString &AuthSt
if (Dbms() != dbmsDBASE) if (Dbms() != dbmsDBASE)
{ {
if (!getDataTypeInfo(SQL_TIMESTAMP,typeInfDate)) if (!getDataTypeInfo(SQL_TIMESTAMP,typeInfDate))
return(false); return(FALSE);
else else
typeInfDate.FsqlType = SQL_TIMESTAMP; typeInfDate.FsqlType = SQL_TIMESTAMP;
} }
else else
{ {
if (!getDataTypeInfo(SQL_DATE,typeInfDate)) if (!getDataTypeInfo(SQL_DATE,typeInfDate))
return(false); return(FALSE);
else else
typeInfDate.FsqlType = SQL_DATE; typeInfDate.FsqlType = SQL_DATE;
} }
@@ -737,7 +737,7 @@ bool wxDb::Open(const wxString &Dsn, const wxString &Uid, const wxString &AuthSt
if (!getDataTypeInfo(SQL_LONGVARBINARY, typeInfBlob)) if (!getDataTypeInfo(SQL_LONGVARBINARY, typeInfBlob))
{ {
if (!getDataTypeInfo(SQL_VARBINARY,typeInfBlob)) if (!getDataTypeInfo(SQL_VARBINARY,typeInfBlob))
return(false); return(FALSE);
else else
typeInfBlob.FsqlType = SQL_VARBINARY; typeInfBlob.FsqlType = SQL_VARBINARY;
} }
@@ -756,7 +756,7 @@ bool wxDb::Open(const wxString &Dsn, const wxString &Uid, const wxString &AuthSt
#endif #endif
// Completed Successfully // Completed Successfully
return(true); return(TRUE);
} // wxDb::Open() } // wxDb::Open()
@@ -807,7 +807,7 @@ bool wxDb::Open(wxDb *copyDb)
*/ */
// Mark database as open // Mark database as open
dbIsOpen = true; dbIsOpen = TRUE;
// Allocate a statement handle for the database connection // Allocate a statement handle for the database connection
if (SQLAllocStmt(hdbc, &hstmt) != SQL_SUCCESS) if (SQLAllocStmt(hdbc, &hstmt) != SQL_SUCCESS)
@@ -815,7 +815,7 @@ bool wxDb::Open(wxDb *copyDb)
// Set Connection Options // Set Connection Options
if (!setConnectionOptions()) if (!setConnectionOptions())
return(false); return(FALSE);
// Instead of Querying the data source for info about itself, it can just be copied // Instead of Querying the data source for info about itself, it can just be copied
// from the wxDb instance that was passed in (copyDb). // from the wxDb instance that was passed in (copyDb).
@@ -896,7 +896,7 @@ bool wxDb::Open(wxDb *copyDb)
#endif #endif
// Completed Successfully // Completed Successfully
return(true); return(TRUE);
} // wxDb::Open() 2 } // wxDb::Open() 2
@@ -963,7 +963,7 @@ bool wxDb::setConnectionOptions(void)
#endif #endif
// Completed Successfully // Completed Successfully
return(true); return(TRUE);
} // wxDb::setConnectionOptions() } // wxDb::setConnectionOptions()
@@ -1273,7 +1273,7 @@ bool wxDb::getDbInfo(void)
#endif #endif
// Completed Successfully // Completed Successfully
return(true); return(TRUE);
} // wxDb::getDbInfo() } // wxDb::getDbInfo()
@@ -1302,7 +1302,7 @@ bool wxDb::getDataTypeInfo(SWORD fSqlType, wxDbSqlTypeInfo &structSQLTypeInfo)
#endif #endif
DispAllErrors(henv, hdbc, hstmt); DispAllErrors(henv, hdbc, hstmt);
SQLFreeStmt(hstmt, SQL_CLOSE); SQLFreeStmt(hstmt, SQL_CLOSE);
return(false); return(FALSE);
} }
wxChar typeName[DB_TYPE_NAME_LEN+1]; wxChar typeName[DB_TYPE_NAME_LEN+1];
@@ -1358,7 +1358,7 @@ bool wxDb::getDataTypeInfo(SWORD fSqlType, wxDbSqlTypeInfo &structSQLTypeInfo)
return(DispAllErrors(henv, hdbc, hstmt)); return(DispAllErrors(henv, hdbc, hstmt));
// Completed Successfully // Completed Successfully
return(true); return(TRUE);
} // wxDb::getDataTypeInfo() } // wxDb::getDataTypeInfo()
@@ -1415,7 +1415,7 @@ void wxDb::Close(void)
wxStrcpy(DBerrorList[i], errorList[i]); wxStrcpy(DBerrorList[i], errorList[i]);
dbmsType = dbmsUNIDENTIFIED; dbmsType = dbmsUNIDENTIFIED;
dbIsOpen = false; dbIsOpen = FALSE;
} // wxDb::Close() } // wxDb::Close()
@@ -1431,7 +1431,7 @@ bool wxDb::CommitTrans(void)
} }
// Completed successfully // Completed successfully
return(true); return(TRUE);
} // wxDb::CommitTrans() } // wxDb::CommitTrans()
@@ -1444,7 +1444,7 @@ bool wxDb::RollbackTrans(void)
return(DispAllErrors(henv, hdbc)); return(DispAllErrors(henv, hdbc));
// Completed successfully // Completed successfully
return(true); return(TRUE);
} // wxDb::RollbackTrans() } // wxDb::RollbackTrans()
@@ -1461,7 +1461,7 @@ bool wxDb::DispAllErrors(HENV aHenv, HDBC aHdbc, HSTMT aHstmt)
* If in DBDEBUG_CONSOLE mode, the constructed string will be displayed in the console * If in DBDEBUG_CONSOLE mode, the constructed string will be displayed in the console
* window and program execution will be paused until the user presses a key. * window and program execution will be paused until the user presses a key.
* *
* This function always returns a false, so that functions which call this function * This function always returns a FALSE, so that functions which call this function
* can have a line like "return (DispAllErrors(henv, hdbc));" to indicate the failure * can have a line like "return (DispAllErrors(henv, hdbc));" to indicate the failure
* of the users request, so that the calling code can then process the error msg log * of the users request, so that the calling code can then process the error msg log
*/ */
@@ -1487,7 +1487,7 @@ bool wxDb::DispAllErrors(HENV aHenv, HDBC aHdbc, HSTMT aHstmt)
} }
} }
return(false); // This function always returns false. return(FALSE); // This function always returns FALSE.
} // wxDb::DispAllErrors() } // wxDb::DispAllErrors()
@@ -1496,9 +1496,9 @@ bool wxDb::DispAllErrors(HENV aHenv, HDBC aHdbc, HSTMT aHstmt)
bool wxDb::GetNextError(HENV aHenv, HDBC aHdbc, HSTMT aHstmt) bool wxDb::GetNextError(HENV aHenv, HDBC aHdbc, HSTMT aHstmt)
{ {
if (SQLError(aHenv, aHdbc, aHstmt, (UCHAR FAR *) sqlState, &nativeError, (UCHAR FAR *) errorMsg, SQL_MAX_MESSAGE_LENGTH - 1, &cbErrorMsg) == SQL_SUCCESS) if (SQLError(aHenv, aHdbc, aHstmt, (UCHAR FAR *) sqlState, &nativeError, (UCHAR FAR *) errorMsg, SQL_MAX_MESSAGE_LENGTH - 1, &cbErrorMsg) == SQL_SUCCESS)
return(true); return(TRUE);
else else
return(false); return(FALSE);
} // wxDb::GetNextError() } // wxDb::GetNextError()
@@ -1805,7 +1805,7 @@ bool wxDb::CreateView(const wxString &viewName, const wxString &colList,
// Drop the view first // Drop the view first
if (attemptDrop && !DropView(viewName)) if (attemptDrop && !DropView(viewName))
return false; return FALSE;
// Build the create view statement // Build the create view statement
sqlStmt = wxT("CREATE VIEW "); sqlStmt = wxT("CREATE VIEW ");
@@ -1836,7 +1836,7 @@ bool wxDb::CreateView(const wxString &viewName, const wxString &colList,
bool wxDb::DropView(const wxString &viewName) bool wxDb::DropView(const wxString &viewName)
{ {
/* /*
* NOTE: This function returns true if the View does not exist, but * NOTE: This function returns TRUE if the View does not exist, but
* only for identified databases. Code will need to be added * only for identified databases. Code will need to be added
* below for any other databases when those databases are defined * below for any other databases when those databases are defined
* to handle this situation consistently * to handle this situation consistently
@@ -1863,16 +1863,16 @@ bool wxDb::DropView(const wxString &viewName)
DispNextError(); DispNextError();
DispAllErrors(henv, hdbc, hstmt); DispAllErrors(henv, hdbc, hstmt);
RollbackTrans(); RollbackTrans();
return(false); return(FALSE);
} }
} }
} }
// Commit the transaction // Commit the transaction
if (!CommitTrans()) if (!CommitTrans())
return(false); return(FALSE);
return true; return TRUE;
} // wxDb::DropView() } // wxDb::DropView()
@@ -1888,12 +1888,12 @@ bool wxDb::ExecSql(const wxString &pSqlStmt)
if (retcode == SQL_SUCCESS || if (retcode == SQL_SUCCESS ||
(Dbms() == dbmsDB2 && (retcode == SQL_SUCCESS_WITH_INFO || retcode == SQL_NO_DATA_FOUND))) (Dbms() == dbmsDB2 && (retcode == SQL_SUCCESS_WITH_INFO || retcode == SQL_NO_DATA_FOUND)))
{ {
return(true); return(TRUE);
} }
else else
{ {
DispAllErrors(henv, hdbc, hstmt); DispAllErrors(henv, hdbc, hstmt);
return(false); return(FALSE);
} }
} // wxDb::ExecSql() } // wxDb::ExecSql()
@@ -1903,11 +1903,11 @@ bool wxDb::ExecSql(const wxString &pSqlStmt)
bool wxDb::GetNext(void) bool wxDb::GetNext(void)
{ {
if (SQLFetch(hstmt) == SQL_SUCCESS) if (SQLFetch(hstmt) == SQL_SUCCESS)
return(true); return(TRUE);
else else
{ {
DispAllErrors(henv, hdbc, hstmt); DispAllErrors(henv, hdbc, hstmt);
return(false); return(FALSE);
} }
} // wxDb::GetNext() } // wxDb::GetNext()
@@ -1920,11 +1920,11 @@ bool wxDb::GetData(UWORD colNo, SWORD cType, PTR pData, SDWORD maxLen, SDWORD FA
wxASSERT(cbReturned); wxASSERT(cbReturned);
if (SQLGetData(hstmt, colNo, cType, pData, maxLen, cbReturned) == SQL_SUCCESS) if (SQLGetData(hstmt, colNo, cType, pData, maxLen, cbReturned) == SQL_SUCCESS)
return(true); return(TRUE);
else else
{ {
DispAllErrors(henv, hdbc, hstmt); DispAllErrors(henv, hdbc, hstmt);
return(false); return(FALSE);
} }
} // wxDb::GetData() } // wxDb::GetData()
@@ -2064,7 +2064,7 @@ int wxDb::GetKeyFields(const wxString &tableName, wxDbColInf* colInf, UWORD noCo
} // while } // while
SQLFreeStmt(hstmt, SQL_CLOSE); /* Close the cursor (the hstmt is still allocated). */ SQLFreeStmt(hstmt, SQL_CLOSE); /* Close the cursor (the hstmt is still allocated). */
return true; return TRUE;
} // wxDb::GetKeyFields() } // wxDb::GetKeyFields()
@@ -2982,7 +2982,7 @@ bool wxDb::Catalog(const wxChar *userID, const wxString &fileName)
FILE *fp = fopen(fileName.c_str(),wxT("wt")); FILE *fp = fopen(fileName.c_str(),wxT("wt"));
if (fp == NULL) if (fp == NULL)
return(false); return(FALSE);
SQLFreeStmt(hstmt, SQL_CLOSE); SQLFreeStmt(hstmt, SQL_CLOSE);
@@ -3013,7 +3013,7 @@ bool wxDb::Catalog(const wxChar *userID, const wxString &fileName)
{ {
DispAllErrors(henv, hdbc, hstmt); DispAllErrors(henv, hdbc, hstmt);
fclose(fp); fclose(fp);
return(false); return(FALSE);
} }
wxString outStr; wxString outStr;
@@ -3055,7 +3055,7 @@ bool wxDb::Catalog(const wxChar *userID, const wxString &fileName)
{ {
SQLFreeStmt(hstmt, SQL_CLOSE); SQLFreeStmt(hstmt, SQL_CLOSE);
fclose(fp); fclose(fp);
return(false); return(FALSE);
} }
cnt++; cnt++;
} }
@@ -3073,7 +3073,7 @@ bool wxDb::Catalog(const wxChar *userID, const wxString &fileName)
bool wxDb::TableExists(const wxString &tableName, const wxChar *userID, const wxString &tablePath) bool wxDb::TableExists(const wxString &tableName, const wxChar *userID, const wxString &tablePath)
/* /*
* Table name can refer to a table, view, alias or synonym. Returns true * Table name can refer to a table, view, alias or synonym. Returns TRUE
* if the object exists in the database. This function does not indicate * if the object exists in the database. This function does not indicate
* whether or not the user has privleges to query or perform other functions * whether or not the user has privleges to query or perform other functions
* on the table. * on the table.
@@ -3150,7 +3150,7 @@ bool wxDb::TableExists(const wxString &tableName, const wxChar *userID, const wx
SQLFreeStmt(hstmt, SQL_CLOSE); SQLFreeStmt(hstmt, SQL_CLOSE);
return(true); return(TRUE);
} // wxDb::TableExists() } // wxDb::TableExists()
@@ -3211,30 +3211,30 @@ bool wxDb::TablePrivileges(const wxString &tableName, const wxString &priv, cons
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO))
return(DispAllErrors(henv, hdbc, hstmt)); return(DispAllErrors(henv, hdbc, hstmt));
bool failed = false; bool failed = FALSE;
retcode = SQLFetch(hstmt); retcode = SQLFetch(hstmt);
while (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) while (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
{ {
if (SQLGetData(hstmt, 1, SQL_C_CHAR, (UCHAR*) result.tableQual, sizeof(result.tableQual), &cbRetVal) != SQL_SUCCESS) if (SQLGetData(hstmt, 1, SQL_C_CHAR, (UCHAR*) result.tableQual, sizeof(result.tableQual), &cbRetVal) != SQL_SUCCESS)
failed = true; failed = TRUE;
if (!failed && SQLGetData(hstmt, 2, SQL_C_CHAR, (UCHAR*) result.tableOwner, sizeof(result.tableOwner), &cbRetVal) != SQL_SUCCESS) if (!failed && SQLGetData(hstmt, 2, SQL_C_CHAR, (UCHAR*) result.tableOwner, sizeof(result.tableOwner), &cbRetVal) != SQL_SUCCESS)
failed = true; failed = TRUE;
if (!failed && SQLGetData(hstmt, 3, SQL_C_CHAR, (UCHAR*) result.tableName, sizeof(result.tableName), &cbRetVal) != SQL_SUCCESS) if (!failed && SQLGetData(hstmt, 3, SQL_C_CHAR, (UCHAR*) result.tableName, sizeof(result.tableName), &cbRetVal) != SQL_SUCCESS)
failed = true; failed = TRUE;
if (!failed && SQLGetData(hstmt, 4, SQL_C_CHAR, (UCHAR*) result.grantor, sizeof(result.grantor), &cbRetVal) != SQL_SUCCESS) if (!failed && SQLGetData(hstmt, 4, SQL_C_CHAR, (UCHAR*) result.grantor, sizeof(result.grantor), &cbRetVal) != SQL_SUCCESS)
failed = true; failed = TRUE;
if (!failed && SQLGetData(hstmt, 5, SQL_C_CHAR, (UCHAR*) result.grantee, sizeof(result.grantee), &cbRetVal) != SQL_SUCCESS) if (!failed && SQLGetData(hstmt, 5, SQL_C_CHAR, (UCHAR*) result.grantee, sizeof(result.grantee), &cbRetVal) != SQL_SUCCESS)
failed = true; failed = TRUE;
if (!failed && SQLGetData(hstmt, 6, SQL_C_CHAR, (UCHAR*) result.privilege, sizeof(result.privilege), &cbRetVal) != SQL_SUCCESS) if (!failed && SQLGetData(hstmt, 6, SQL_C_CHAR, (UCHAR*) result.privilege, sizeof(result.privilege), &cbRetVal) != SQL_SUCCESS)
failed = true; failed = TRUE;
if (!failed && SQLGetData(hstmt, 7, SQL_C_CHAR, (UCHAR*) result.grantable, sizeof(result.grantable), &cbRetVal) != SQL_SUCCESS) if (!failed && SQLGetData(hstmt, 7, SQL_C_CHAR, (UCHAR*) result.grantable, sizeof(result.grantable), &cbRetVal) != SQL_SUCCESS)
failed = true; failed = TRUE;
if (failed) if (failed)
{ {
@@ -3246,31 +3246,31 @@ bool wxDb::TablePrivileges(const wxString &tableName, const wxString &priv, cons
result.grantor, result.grantee); result.grantor, result.grantee);
#endif #endif
if (UserID.IsSameAs(result.tableOwner,false)) if (UserID.IsSameAs(result.tableOwner,FALSE))
{ {
SQLFreeStmt(hstmt, SQL_CLOSE); SQLFreeStmt(hstmt, SQL_CLOSE);
return true; return TRUE;
} }
if (UserID.IsSameAs(result.grantee,false) && if (UserID.IsSameAs(result.grantee,FALSE) &&
!wxStrcmp(result.privilege,priv)) !wxStrcmp(result.privilege,priv))
{ {
SQLFreeStmt(hstmt, SQL_CLOSE); SQLFreeStmt(hstmt, SQL_CLOSE);
return true; return TRUE;
} }
if (!wxStrcmp(result.grantee,curRole) && if (!wxStrcmp(result.grantee,curRole) &&
!wxStrcmp(result.privilege,priv)) !wxStrcmp(result.privilege,priv))
{ {
SQLFreeStmt(hstmt, SQL_CLOSE); SQLFreeStmt(hstmt, SQL_CLOSE);
return true; return TRUE;
} }
retcode = SQLFetch(hstmt); retcode = SQLFetch(hstmt);
} }
SQLFreeStmt(hstmt, SQL_CLOSE); SQLFreeStmt(hstmt, SQL_CLOSE);
return false; return FALSE;
} // wxDb::TablePrivileges } // wxDb::TablePrivileges
@@ -3287,7 +3287,7 @@ bool wxDb::SetSqlLogging(wxDbSqlLogState state, const wxString &filename, bool a
{ {
fpSqlLog = fopen(filename, (append ? wxT("at") : wxT("wt"))); fpSqlLog = fopen(filename, (append ? wxT("at") : wxT("wt")));
if (fpSqlLog == NULL) if (fpSqlLog == NULL)
return(false); return(FALSE);
} }
} }
else // sqlLogOFF else // sqlLogOFF
@@ -3295,13 +3295,13 @@ bool wxDb::SetSqlLogging(wxDbSqlLogState state, const wxString &filename, bool a
if (fpSqlLog) if (fpSqlLog)
{ {
if (fclose(fpSqlLog)) if (fclose(fpSqlLog))
return(false); return(FALSE);
fpSqlLog = 0; fpSqlLog = 0;
} }
} }
sqlLogState = state; sqlLogState = state;
return(true); return(TRUE);
} // wxDb::SetSqlLogging() } // wxDb::SetSqlLogging()
@@ -3312,16 +3312,16 @@ bool wxDb::WriteSqlLog(const wxString &logMsg)
wxASSERT(logMsg.Length()); wxASSERT(logMsg.Length());
if (fpSqlLog == 0 || sqlLogState == sqlLogOFF) if (fpSqlLog == 0 || sqlLogState == sqlLogOFF)
return(false); return(FALSE);
if (fputs(wxT("\n"), fpSqlLog) == EOF) if (fputs(wxT("\n"), fpSqlLog) == EOF)
return(false); return(FALSE);
if (fputs(logMsg, fpSqlLog) == EOF) if (fputs(logMsg, fpSqlLog) == EOF)
return(false); return(FALSE);
if (fputs(wxT("\n"), fpSqlLog) == EOF) if (fputs(wxT("\n"), fpSqlLog) == EOF)
return(false); return(FALSE);
return(true); return(TRUE);
} // wxDb::WriteSqlLog() } // wxDb::WriteSqlLog()
@@ -3349,7 +3349,7 @@ wxDBMS wxDb::Dbms(void)
* - Does not support the SQL_TIMESTAMP structure * - Does not support the SQL_TIMESTAMP structure
* - Supports only one cursor and one connect (apparently? with Microsoft driver only?) * - Supports only one cursor and one connect (apparently? with Microsoft driver only?)
* - Does not automatically create the primary index if the 'keyField' param of SetColDef * - Does not automatically create the primary index if the 'keyField' param of SetColDef
* is true. The user must create ALL indexes from their program. * is TRUE. The user must create ALL indexes from their program.
* - Table names can only be 8 characters long * - Table names can only be 8 characters long
* - Column names can only be 10 characters long * - Column names can only be 10 characters long
* *
@@ -3365,7 +3365,7 @@ wxDBMS wxDb::Dbms(void)
* *
* MY_SQL * MY_SQL
* - If a column is part of the Primary Key, the column cannot be NULL * - If a column is part of the Primary Key, the column cannot be NULL
* - Cannot support selecting for update [::CanSelectForUpdate()]. Always returns false * - Cannot support selecting for update [::CanSelectForUpdate()]. Always returns FALSE
* - Columns that are part of primary or secondary keys must be defined as being NOT NULL * - Columns that are part of primary or secondary keys must be defined as being NOT NULL
* when they are created. Some code is added in ::CreateIndex to try to adjust the * when they are created. Some code is added in ::CreateIndex to try to adjust the
* column definition if it is not defined correctly, but it is experimental * column definition if it is not defined correctly, but it is experimental
@@ -3473,7 +3473,7 @@ bool wxDb::ModifyColumn(const wxString &tableName, const wxString &columnName,
// Must specify a columnLength if modifying a VARCHAR type column // Must specify a columnLength if modifying a VARCHAR type column
if (dataType == DB_DATA_TYPE_VARCHAR && !columnLength) if (dataType == DB_DATA_TYPE_VARCHAR && !columnLength)
return false; return FALSE;
wxString dataTypeName; wxString dataTypeName;
wxString sqlStmt; wxString sqlStmt;
@@ -3497,7 +3497,7 @@ bool wxDb::ModifyColumn(const wxString &tableName, const wxString &columnName,
dataTypeName = typeInfBlob.TypeName; dataTypeName = typeInfBlob.TypeName;
break; break;
default: default:
return false; return FALSE;
} }
// Set the modify or alter syntax depending on the type of database connected to // Set the modify or alter syntax depending on the type of database connected to
@@ -3510,7 +3510,7 @@ bool wxDb::ModifyColumn(const wxString &tableName, const wxString &columnName,
alterSlashModify = "ALTER COLUMN"; alterSlashModify = "ALTER COLUMN";
break; break;
case dbmsUNIDENTIFIED : case dbmsUNIDENTIFIED :
return false; return FALSE;
case dbmsSYBASE_ASA : case dbmsSYBASE_ASA :
case dbmsSYBASE_ASE : case dbmsSYBASE_ASE :
case dbmsMY_SQL : case dbmsMY_SQL :
@@ -3568,7 +3568,7 @@ wxDb WXDLLEXPORT *wxDbGetConnection(wxDbConnectInf *pDbConfig, bool FwdOnlyCurso
(pList->PtrDb->FwdOnlyCursors() == FwdOnlyCursors) && (pList->PtrDb->FwdOnlyCursors() == FwdOnlyCursors) &&
(!wxStrcmp(pDbConfig->GetDsn(), pList->Dsn))) // Found a free connection (!wxStrcmp(pDbConfig->GetDsn(), pList->Dsn))) // Found a free connection
{ {
pList->Free = false; pList->Free = FALSE;
return(pList->PtrDb); return(pList->PtrDb);
} }
@@ -3598,14 +3598,14 @@ wxDb WXDLLEXPORT *wxDbGetConnection(wxDbConnectInf *pDbConfig, bool FwdOnlyCurso
// Initialize new node in the linked list // Initialize new node in the linked list
pList->PtrNext = 0; pList->PtrNext = 0;
pList->Free = false; pList->Free = FALSE;
pList->Dsn = pDbConfig->GetDsn(); pList->Dsn = pDbConfig->GetDsn();
pList->Uid = pDbConfig->GetUserID(); pList->Uid = pDbConfig->GetUserID();
pList->AuthStr = pDbConfig->GetPassword(); pList->AuthStr = pDbConfig->GetPassword();
pList->PtrDb = new wxDb(pDbConfig->GetHenv(), FwdOnlyCursors); pList->PtrDb = new wxDb(pDbConfig->GetHenv(), FwdOnlyCursors);
bool opened = false; bool opened = FALSE;
if (!matchingDbConnection) if (!matchingDbConnection)
opened = pList->PtrDb->Open(pDbConfig->GetDsn(), pDbConfig->GetUserID(), pDbConfig->GetPassword()); opened = pList->PtrDb->Open(pDbConfig->GetDsn(), pDbConfig->GetUserID(), pDbConfig->GetPassword());
@@ -3615,8 +3615,8 @@ wxDb WXDLLEXPORT *wxDbGetConnection(wxDbConnectInf *pDbConfig, bool FwdOnlyCurso
// Connect to the datasource // Connect to the datasource
if (opened) if (opened)
{ {
pList->PtrDb->setCached(true); // Prevent a user from deleting a cached connection pList->PtrDb->setCached(TRUE); // Prevent a user from deleting a cached connection
pList->PtrDb->SetSqlLogging(SQLLOGstate,SQLLOGfn,true); pList->PtrDb->SetSqlLogging(SQLLOGstate,SQLLOGfn,TRUE);
return(pList->PtrDb); return(pList->PtrDb);
} }
else // Unable to connect, destroy list item else // Unable to connect, destroy list item
@@ -3644,11 +3644,11 @@ bool WXDLLEXPORT wxDbFreeConnection(wxDb *pDb)
for (pList = PtrBegDbList; pList; pList = pList->PtrNext) for (pList = PtrBegDbList; pList; pList = pList->PtrNext)
{ {
if (pList->PtrDb == pDb) // Found it, now free it!!! if (pList->PtrDb == pDb) // Found it, now free it!!!
return (pList->Free = true); return (pList->Free = TRUE);
} }
// Never found the database object, return failure // Never found the database object, return failure
return(false); return(FALSE);
} // wxDbFreeConnection() } // wxDbFreeConnection()
@@ -3664,7 +3664,7 @@ void WXDLLEXPORT wxDbCloseConnections(void)
pNext = pList->PtrNext; // Save the pointer to next pNext = pList->PtrNext; // Save the pointer to next
pList->PtrDb->CommitTrans(); // Commit any open transactions on wxDb object pList->PtrDb->CommitTrans(); // Commit any open transactions on wxDb object
pList->PtrDb->Close(); // Close the wxDb object pList->PtrDb->Close(); // Close the wxDb object
pList->PtrDb->setCached(false); // Allows deletion of the wxDb instance pList->PtrDb->setCached(FALSE); // Allows deletion of the wxDb instance
delete pList->PtrDb; // Deletes the wxDb object delete pList->PtrDb; // Deletes the wxDb object
delete pList; // Deletes the linked list object delete pList; // Deletes the linked list object
} }
@@ -3684,7 +3684,7 @@ int WXDLLEXPORT wxDbConnectionsInUse(void)
// Scan the linked list counting db connections that are currently in use // Scan the linked list counting db connections that are currently in use
for (pList = PtrBegDbList; pList; pList = pList->PtrNext) for (pList = PtrBegDbList; pList; pList = pList->PtrNext)
{ {
if (pList->Free == false) if (pList->Free == FALSE)
cnt++; cnt++;
} }
@@ -3742,20 +3742,20 @@ const wxChar WXDLLEXPORT *wxDbLogExtendedErrorMsg(const wxChar *userText, wxDb *
/********** wxDbSqlLog() **********/ /********** wxDbSqlLog() **********/
bool wxDbSqlLog(wxDbSqlLogState state, const wxChar *filename) bool wxDbSqlLog(wxDbSqlLogState state, const wxChar *filename)
{ {
bool append = false; bool append = FALSE;
wxDbList *pList; wxDbList *pList;
for (pList = PtrBegDbList; pList; pList = pList->PtrNext) for (pList = PtrBegDbList; pList; pList = pList->PtrNext)
{ {
if (!pList->PtrDb->SetSqlLogging(state,filename,append)) if (!pList->PtrDb->SetSqlLogging(state,filename,append))
return(false); return(FALSE);
append = true; append = TRUE;
} }
SQLLOGstate = state; SQLLOGstate = state;
SQLLOGfn = filename; SQLLOGfn = filename;
return(true); return(TRUE);
} // wxDbSqlLog() } // wxDbSqlLog()
@@ -3771,7 +3771,7 @@ int wxDbCreateDataSource(const wxString &driverName, const wxString &dsn, const
* ODBC driver must be ODBC 3.0 compliant to use this function * ODBC driver must be ODBC 3.0 compliant to use this function
*/ */
{ {
int result = false; int result = FALSE;
//!!!! ONLY FUNCTIONAL UNDER MSW with VC6 !!!! //!!!! ONLY FUNCTIONAL UNDER MSW with VC6 !!!!
#ifdef __VISUALC__ #ifdef __VISUALC__
@@ -3793,7 +3793,7 @@ int wxDbCreateDataSource(const wxString &driverName, const wxString &dsn, const
int k; int k;
do do
{ {
k = setupStr.Find((wxChar)2,true); k = setupStr.Find((wxChar)2,TRUE);
if (k != wxNOT_FOUND) if (k != wxNOT_FOUND)
setupStr[(UINT)k] = wxT('\0'); setupStr[(UINT)k] = wxT('\0');
} }
@@ -3827,14 +3827,14 @@ int wxDbCreateDataSource(const wxString &driverName, const wxString &dsn, const
} }
} }
else else
result = true; result = TRUE;
#else #else
// Using iODBC/unixODBC or some other compiler which does not support the APIs // Using iODBC/unixODBC or some other compiler which does not support the APIs
// necessary to use this function, so this function is not supported // necessary to use this function, so this function is not supported
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
wxLogDebug(wxT("wxDbCreateDataSource() not available except under VC++/MSW"),wxT("ODBC DEBUG MESSAGE")); wxLogDebug(wxT("wxDbCreateDataSource() not available except under VC++/MSW"),wxT("ODBC DEBUG MESSAGE"));
#endif #endif
result = false; result = FALSE;
#endif // __VISUALC__ #endif // __VISUALC__
return result; return result;
@@ -3855,9 +3855,9 @@ bool wxDbGetDataSource(HENV henv, wxChar *Dsn, SWORD DsnMax, wxChar *DsDesc,
if (SQLDataSources(henv, direction, (UCHAR FAR *) Dsn, DsnMax, &cb1, if (SQLDataSources(henv, direction, (UCHAR FAR *) Dsn, DsnMax, &cb1,
(UCHAR FAR *) DsDesc, DsDescMax, &cb2) == SQL_SUCCESS) (UCHAR FAR *) DsDesc, DsDescMax, &cb2) == SQL_SUCCESS)
return(true); return(TRUE);
else else
return(false); return(FALSE);
} // wxDbGetDataSource() } // wxDbGetDataSource()

View File

@@ -128,7 +128,7 @@ wxDbGridTableBase::wxDbGridTableBase(wxDbTable *tab, wxDbGridColInfo* ColInfo,
m_keys(), m_keys(),
m_data(tab), m_data(tab),
m_dbowner(takeOwnership), m_dbowner(takeOwnership),
m_rowmodified(false) m_rowmodified(FALSE)
{ {
if (count == wxUSE_QUERY) if (count == wxUSE_QUERY)
@@ -197,7 +197,7 @@ bool wxDbGridTableBase::CanHaveAttributes()
// use the default attr provider by default // use the default attr provider by default
SetAttrProvider(new wxDbGridCellAttrProvider(m_data, m_ColInfo)); SetAttrProvider(new wxDbGridCellAttrProvider(m_data, m_ColInfo));
} }
return true; return TRUE;
} }
@@ -255,8 +255,8 @@ bool wxDbGridTableBase::AssignDbTable(wxDbTable *tab, int count, bool takeOwners
grid->EndBatch(); grid->EndBatch();
} }
m_dbowner = takeOwnership; m_dbowner = takeOwnership;
m_rowmodified = false; m_rowmodified = FALSE;
return true; return TRUE;
} }
wxString wxDbGridTableBase::GetTypeName(int row, int col) wxString wxDbGridTableBase::GetTypeName(int row, int col)
@@ -327,19 +327,19 @@ bool wxDbGridTableBase::CanGetValueAs(int row, int col, const wxString& typeName
if (typeName == wxGRID_VALUE_STRING) if (typeName == wxGRID_VALUE_STRING)
{ {
//FIXME ummm What about blob field etc. //FIXME ummm What about blob field etc.
return true; return TRUE;
} }
if (m_data->IsColNull(m_ColInfo[col].DbCol)) if (m_data->IsColNull(m_ColInfo[col].DbCol))
{ {
return false; return FALSE;
} }
if (m_data->GetNumberOfColumns() <= m_ColInfo[col].DbCol) if (m_data->GetNumberOfColumns() <= m_ColInfo[col].DbCol)
{ {
//If a virtual column then we can't find it's type. we have to //If a virtual column then we can't find it's type. we have to
// return false to get using wxVariant. // return FALSE to get using wxVariant.
return false; return FALSE;
} }
int sqltype = m_data->GetColDefs()[(m_ColInfo[col].DbCol)].SqlCtype; int sqltype = m_data->GetColDefs()[(m_ColInfo[col].DbCol)].SqlCtype;
@@ -349,9 +349,9 @@ bool wxDbGridTableBase::CanGetValueAs(int row, int col, const wxString& typeName
(sqltype == SQL_C_TIME) || (sqltype == SQL_C_TIME) ||
(sqltype == SQL_C_TIMESTAMP)) (sqltype == SQL_C_TIMESTAMP))
{ {
return true; return TRUE;
} }
return false; return FALSE;
} }
if (typeName == wxGRID_VALUE_NUMBER) if (typeName == wxGRID_VALUE_NUMBER)
{ {
@@ -360,9 +360,9 @@ bool wxDbGridTableBase::CanGetValueAs(int row, int col, const wxString& typeName
(sqltype == SQL_C_SLONG) || (sqltype == SQL_C_SLONG) ||
(sqltype == SQL_C_ULONG)) (sqltype == SQL_C_ULONG))
{ {
return true; return TRUE;
} }
return false; return FALSE;
} }
if (typeName == wxGRID_VALUE_FLOAT) if (typeName == wxGRID_VALUE_FLOAT)
{ {
@@ -373,11 +373,11 @@ bool wxDbGridTableBase::CanGetValueAs(int row, int col, const wxString& typeName
(sqltype == SQL_C_FLOAT) || (sqltype == SQL_C_FLOAT) ||
(sqltype == SQL_C_DOUBLE)) (sqltype == SQL_C_DOUBLE))
{ {
return true; return TRUE;
} }
return false; return FALSE;
} }
return false; return FALSE;
} }
bool wxDbGridTableBase::CanSetValueAs(int row, int col, const wxString& typeName) bool wxDbGridTableBase::CanSetValueAs(int row, int col, const wxString& typeName)
@@ -387,25 +387,25 @@ bool wxDbGridTableBase::CanSetValueAs(int row, int col, const wxString& typeName
if (m_data->IsColNull(m_ColInfo[col].DbCol)) if (m_data->IsColNull(m_ColInfo[col].DbCol))
{ {
return false; return FALSE;
} }
if (typeName == wxGRID_VALUE_STRING) if (typeName == wxGRID_VALUE_STRING)
{ {
//FIXME ummm What about blob field etc. //FIXME ummm What about blob field etc.
return true; return TRUE;
} }
if (!(m_data->GetColDefs()[(m_ColInfo[col].DbCol)].Updateable)) if (!(m_data->GetColDefs()[(m_ColInfo[col].DbCol)].Updateable))
{ {
return false; return FALSE;
} }
if (m_data->GetNumberOfColumns() <= m_ColInfo[col].DbCol) if (m_data->GetNumberOfColumns() <= m_ColInfo[col].DbCol)
{ {
//If a virtual column then we can't find it's type. we have to faulse to //If a virtual column then we can't find it's type. we have to faulse to
//get using wxVairent. //get using wxVairent.
return false; return FALSE;
} }
int sqltype = m_data->GetColDefs()[(m_ColInfo[col].DbCol)].SqlCtype; int sqltype = m_data->GetColDefs()[(m_ColInfo[col].DbCol)].SqlCtype;
@@ -415,9 +415,9 @@ bool wxDbGridTableBase::CanSetValueAs(int row, int col, const wxString& typeName
(sqltype == SQL_C_TIME) || (sqltype == SQL_C_TIME) ||
(sqltype == SQL_C_TIMESTAMP)) (sqltype == SQL_C_TIMESTAMP))
{ {
return true; return TRUE;
} }
return false; return FALSE;
} }
if (typeName == wxGRID_VALUE_NUMBER) if (typeName == wxGRID_VALUE_NUMBER)
{ {
@@ -426,9 +426,9 @@ bool wxDbGridTableBase::CanSetValueAs(int row, int col, const wxString& typeName
(sqltype == SQL_C_SLONG) || (sqltype == SQL_C_SLONG) ||
(sqltype == SQL_C_ULONG)) (sqltype == SQL_C_ULONG))
{ {
return true; return TRUE;
} }
return false; return FALSE;
} }
if (typeName == wxGRID_VALUE_FLOAT) if (typeName == wxGRID_VALUE_FLOAT)
{ {
@@ -439,11 +439,11 @@ bool wxDbGridTableBase::CanSetValueAs(int row, int col, const wxString& typeName
(sqltype == SQL_C_FLOAT) || (sqltype == SQL_C_FLOAT) ||
(sqltype == SQL_C_DOUBLE)) (sqltype == SQL_C_DOUBLE))
{ {
return true; return TRUE;
} }
return false; return FALSE;
} }
return false; return FALSE;
} }
long wxDbGridTableBase::GetValueAsLong(int row, int col) long wxDbGridTableBase::GetValueAsLong(int row, int col)
@@ -574,7 +574,7 @@ void wxDbGridTableBase::SetValueAsCustom(int row, int col, const wxString& typeN
return; return;
} }
wxVariant val(date); wxVariant val(date);
m_rowmodified = true; m_rowmodified = TRUE;
m_data->SetCol(m_ColInfo[col].DbCol,val); m_data->SetCol(m_ColInfo[col].DbCol,val);
} }
} }
@@ -621,7 +621,7 @@ void wxDbGridTableBase::SetValue(int row, int col,const wxString& value)
ValidateRow(row); ValidateRow(row);
wxVariant val(value); wxVariant val(value);
m_rowmodified = true; m_rowmodified = TRUE;
m_data->SetCol(m_ColInfo[col].DbCol,val); m_data->SetCol(m_ColInfo[col].DbCol,val);
} }
@@ -633,7 +633,7 @@ void wxDbGridTableBase::SetValueAsLong(int row, int col, long value)
ValidateRow(row); ValidateRow(row);
wxVariant val(value); wxVariant val(value);
m_rowmodified = true; m_rowmodified = TRUE;
m_data->SetCol(m_ColInfo[col].DbCol,val); m_data->SetCol(m_ColInfo[col].DbCol,val);
} }
@@ -645,7 +645,7 @@ void wxDbGridTableBase::SetValueAsDouble(int row, int col, double value)
ValidateRow(row); ValidateRow(row);
wxVariant val(value); wxVariant val(value);
m_rowmodified = true; m_rowmodified = TRUE;
m_data->SetCol(m_ColInfo[col].DbCol,val); m_data->SetCol(m_ColInfo[col].DbCol,val);
} }
@@ -658,7 +658,7 @@ void wxDbGridTableBase::SetValueAsBool(int row, int col, bool value)
ValidateRow(row); ValidateRow(row);
wxVariant val(value); wxVariant val(value);
m_rowmodified = true; m_rowmodified = TRUE;
m_data->SetCol(m_ColInfo[col].DbCol,val); m_data->SetCol(m_ColInfo[col].DbCol,val);
} }
@@ -705,17 +705,17 @@ void wxDbGridTableBase::ValidateRow(int row)
m_row = row; m_row = row;
} }
m_rowmodified = false; m_rowmodified = FALSE;
} }
bool wxDbGridTableBase::Writeback() const bool wxDbGridTableBase::Writeback() const
{ {
if (!m_rowmodified) if (!m_rowmodified)
{ {
return true; return TRUE;
} }
bool result=true; bool result=TRUE;
wxLogDebug(wxT("\trow key unknown")); wxLogDebug(wxT("\trow key unknown"));
// FIXME: this code requires dbtable support for record status // FIXME: this code requires dbtable support for record status

View File

@@ -91,14 +91,14 @@ bool wxDbColDef::Initialize()
SqlCtype = SQL_C_LONG; SqlCtype = SQL_C_LONG;
PtrDataObj = NULL; PtrDataObj = NULL;
SzDataObj = 0; SzDataObj = 0;
KeyField = false; KeyField = FALSE;
Updateable = false; Updateable = FALSE;
InsertAllowed = false; InsertAllowed = FALSE;
DerivedCol = false; DerivedCol = FALSE;
CbValue = 0; CbValue = 0;
Null = false; Null = FALSE;
return true; return TRUE;
} // wxDbColDef::Initialize() } // wxDbColDef::Initialize()
@@ -150,9 +150,9 @@ bool wxDbTable::initialize(wxDb *pwxDb, const wxString &tblName, const UWORD num
where.Empty(); // Where clause where.Empty(); // Where clause
orderBy.Empty(); // Order By clause orderBy.Empty(); // Order By clause
from.Empty(); // From clause from.Empty(); // From clause
selectForUpdate = false; // SELECT ... FOR UPDATE; Indicates whether to include the FOR UPDATE phrase selectForUpdate = FALSE; // SELECT ... FOR UPDATE; Indicates whether to include the FOR UPDATE phrase
queryOnly = qryOnly; queryOnly = qryOnly;
insertable = true; insertable = TRUE;
tablePath.Empty(); tablePath.Empty();
tableName.Empty(); tableName.Empty();
queryTableName.Empty(); queryTableName.Empty();
@@ -161,7 +161,7 @@ bool wxDbTable::initialize(wxDb *pwxDb, const wxString &tblName, const UWORD num
wxASSERT(pDb); wxASSERT(pDb);
if (!pDb) if (!pDb)
return false; return FALSE;
tableName = tblName; // Table Name tableName = tblName; // Table Name
if (tblPath.Length()) if (tblPath.Length())
@@ -258,7 +258,7 @@ bool wxDbTable::initialize(wxDb *pwxDb, const wxString &tblName, const UWORD num
{ {
// Should never happen // Should never happen
pDb->GetNextError(henv, hdbc, hstmtInternal); pDb->GetNextError(henv, hdbc, hstmtInternal);
return false; return FALSE;
} }
} }
} }
@@ -287,11 +287,11 @@ bool wxDbTable::initialize(wxDb *pwxDb, const wxString &tblName, const UWORD num
} }
// Make the default cursor the active cursor // Make the default cursor the active cursor
hstmtDefault = GetNewCursor(false,false); hstmtDefault = GetNewCursor(FALSE,FALSE);
wxASSERT(hstmtDefault); wxASSERT(hstmtDefault);
hstmt = *hstmtDefault; hstmt = *hstmtDefault;
return true; return TRUE;
} // wxDbTable::initialize() } // wxDbTable::initialize()
@@ -308,8 +308,8 @@ void wxDbTable::cleanup()
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
if (tableID) if (tableID)
{ {
TablesInUse.DeleteContents(true); TablesInUse.DeleteContents(TRUE);
bool found = false; bool found = FALSE;
wxNode *pNode; wxNode *pNode;
pNode = TablesInUse.First(); pNode = TablesInUse.First();
@@ -317,7 +317,7 @@ void wxDbTable::cleanup()
{ {
if (((wxTablesInUse *)pNode->Data())->tableID == tableID) if (((wxTablesInUse *)pNode->Data())->tableID == tableID)
{ {
found = true; found = TRUE;
if (!TablesInUse.DeleteNode(pNode)) if (!TablesInUse.DeleteNode(pNode))
wxLogDebug (s,wxT("Unable to delete node!")); wxLogDebug (s,wxT("Unable to delete node!"));
} }
@@ -402,7 +402,7 @@ bool wxDbTable::bindParams(bool forUpdate)
{ {
wxASSERT(!queryOnly); wxASSERT(!queryOnly);
if (queryOnly) if (queryOnly)
return(false); return(FALSE);
SWORD fSqlType = 0; SWORD fSqlType = 0;
UDWORD precision = 0; UDWORD precision = 0;
@@ -500,7 +500,7 @@ bool wxDbTable::bindParams(bool forUpdate)
} }
// Completed successfully // Completed successfully
return(true); return(TRUE);
} // wxDbTable::bindParams() } // wxDbTable::bindParams()
@@ -508,14 +508,14 @@ bool wxDbTable::bindParams(bool forUpdate)
/********** wxDbTable::bindInsertParams() **********/ /********** wxDbTable::bindInsertParams() **********/
bool wxDbTable::bindInsertParams(void) bool wxDbTable::bindInsertParams(void)
{ {
return bindParams(false); return bindParams(FALSE);
} // wxDbTable::bindInsertParams() } // wxDbTable::bindInsertParams()
/********** wxDbTable::bindUpdateParams() **********/ /********** wxDbTable::bindUpdateParams() **********/
bool wxDbTable::bindUpdateParams(void) bool wxDbTable::bindUpdateParams(void)
{ {
return bindParams(true); return bindParams(TRUE);
} // wxDbTable::bindUpdateParams() } // wxDbTable::bindUpdateParams()
@@ -534,7 +534,7 @@ bool wxDbTable::bindCols(HSTMT cursor)
} }
// Completed successfully // Completed successfully
return(true); return(TRUE);
} // wxDbTable::bindCols() } // wxDbTable::bindCols()
@@ -554,7 +554,7 @@ bool wxDbTable::getRec(UWORD fetchType)
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO) if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
{ {
if (retcode == SQL_NO_DATA_FOUND) if (retcode == SQL_NO_DATA_FOUND)
return(false); return(FALSE);
else else
return(pDb->DispAllErrors(henv, hdbc, hstmt)); return(pDb->DispAllErrors(henv, hdbc, hstmt));
} }
@@ -574,7 +574,7 @@ bool wxDbTable::getRec(UWORD fetchType)
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO) if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
{ {
if (retcode == SQL_NO_DATA_FOUND) if (retcode == SQL_NO_DATA_FOUND)
return(false); return(FALSE);
else else
return(pDb->DispAllErrors(henv, hdbc, hstmt)); return(pDb->DispAllErrors(henv, hdbc, hstmt));
} }
@@ -589,7 +589,7 @@ bool wxDbTable::getRec(UWORD fetchType)
} }
// Completed successfully // Completed successfully
return(true); return(TRUE);
} // wxDbTable::getRec() } // wxDbTable::getRec()
@@ -607,7 +607,7 @@ bool wxDbTable::execDelete(const wxString &pSqlStmt)
retcode == SQL_SUCCESS_WITH_INFO) retcode == SQL_SUCCESS_WITH_INFO)
{ {
// Record deleted successfully // Record deleted successfully
return(true); return(TRUE);
} }
// Problem deleting record // Problem deleting record
@@ -629,7 +629,7 @@ bool wxDbTable::execUpdate(const wxString &pSqlStmt)
retcode == SQL_SUCCESS_WITH_INFO) retcode == SQL_SUCCESS_WITH_INFO)
{ {
// Record updated successfully // Record updated successfully
return(true); return(TRUE);
} }
// Problem updating record // Problem updating record
@@ -647,7 +647,7 @@ bool wxDbTable::query(int queryType, bool forUpdate, bool distinct, const wxStri
// The user may wish to select for update, but the DBMS may not be capable // The user may wish to select for update, but the DBMS may not be capable
selectForUpdate = CanSelectForUpdate(); selectForUpdate = CanSelectForUpdate();
else else
selectForUpdate = false; selectForUpdate = FALSE;
// Set the SQL SELECT string // Set the SQL SELECT string
if (queryType != DB_SELECT_STATEMENT) // A select statement was not passed in, if (queryType != DB_SELECT_STATEMENT) // A select statement was not passed in,
@@ -658,7 +658,7 @@ bool wxDbTable::query(int queryType, bool forUpdate, bool distinct, const wxStri
// Make sure the cursor is closed first // Make sure the cursor is closed first
if (!CloseCursor(hstmt)) if (!CloseCursor(hstmt))
return(false); return(FALSE);
// Execute the SQL SELECT statement // Execute the SQL SELECT statement
int retcode; int retcode;
@@ -667,7 +667,7 @@ bool wxDbTable::query(int queryType, bool forUpdate, bool distinct, const wxStri
return(pDb->DispAllErrors(henv, hdbc, hstmt)); return(pDb->DispAllErrors(henv, hdbc, hstmt));
// Completed successfully // Completed successfully
return(true); return(TRUE);
} // wxDbTable::query() } // wxDbTable::query()
@@ -679,7 +679,7 @@ bool wxDbTable::query(int queryType, bool forUpdate, bool distinct, const wxStri
bool wxDbTable::Open(bool checkPrivileges, bool checkTableExists) bool wxDbTable::Open(bool checkPrivileges, bool checkTableExists)
{ {
if (!pDb) if (!pDb)
return false; return FALSE;
int i; int i;
wxString sqlStmt; wxString sqlStmt;
@@ -733,7 +733,7 @@ bool wxDbTable::Open(bool checkPrivileges, bool checkTableExists)
p += s; p += s;
pDb->LogError(p.GetData()); pDb->LogError(p.GetData());
return(false); return(FALSE);
} }
// Bind the member variables for field exchange between // Bind the member variables for field exchange between
@@ -741,17 +741,17 @@ bool wxDbTable::Open(bool checkPrivileges, bool checkTableExists)
if (!queryOnly) if (!queryOnly)
{ {
if (!bindInsertParams()) // Inserts if (!bindInsertParams()) // Inserts
return(false); return(FALSE);
if (!bindUpdateParams()) // Updates if (!bindUpdateParams()) // Updates
return(false); return(FALSE);
} }
if (!bindCols(*hstmtDefault)) // Selects if (!bindCols(*hstmtDefault)) // Selects
return(false); return(FALSE);
if (!bindCols(hstmtInternal)) // Internal use only if (!bindCols(hstmtInternal)) // Internal use only
return(false); return(FALSE);
/* /*
* Do NOT bind the hstmtCount cursor!!! * Do NOT bind the hstmtCount cursor!!!
@@ -760,7 +760,7 @@ bool wxDbTable::Open(bool checkPrivileges, bool checkTableExists)
// Build an insert statement using parameter markers // Build an insert statement using parameter markers
if (!queryOnly && noCols > 0) if (!queryOnly && noCols > 0)
{ {
bool needComma = false; bool needComma = FALSE;
sqlStmt.Printf(wxT("INSERT INTO %s ("), tableName.c_str()); sqlStmt.Printf(wxT("INSERT INTO %s ("), tableName.c_str());
for (i = 0; i < noCols; i++) for (i = 0; i < noCols; i++)
{ {
@@ -769,9 +769,9 @@ bool wxDbTable::Open(bool checkPrivileges, bool checkTableExists)
if (needComma) if (needComma)
sqlStmt += wxT(","); sqlStmt += wxT(",");
sqlStmt += colDefs[i].ColName; sqlStmt += colDefs[i].ColName;
needComma = true; needComma = TRUE;
} }
needComma = false; needComma = FALSE;
sqlStmt += wxT(") VALUES ("); sqlStmt += wxT(") VALUES (");
int insertableCount = 0; int insertableCount = 0;
@@ -783,7 +783,7 @@ bool wxDbTable::Open(bool checkPrivileges, bool checkTableExists)
if (needComma) if (needComma)
sqlStmt += wxT(","); sqlStmt += wxT(",");
sqlStmt += wxT("?"); sqlStmt += wxT("?");
needComma = true; needComma = TRUE;
insertableCount++; insertableCount++;
} }
sqlStmt += wxT(")"); sqlStmt += wxT(")");
@@ -795,11 +795,11 @@ bool wxDbTable::Open(bool checkPrivileges, bool checkTableExists)
return(pDb->DispAllErrors(henv, hdbc, hstmtInsert)); return(pDb->DispAllErrors(henv, hdbc, hstmtInsert));
} }
else else
insertable= false; insertable= FALSE;
} }
// Completed successfully // Completed successfully
return(true); return(TRUE);
} // wxDbTable::Open() } // wxDbTable::Open()
@@ -818,7 +818,7 @@ bool wxDbTable::QueryBySqlStmt(const wxString &pSqlStmt)
{ {
pDb->WriteSqlLog(pSqlStmt); pDb->WriteSqlLog(pSqlStmt);
return(query(DB_SELECT_STATEMENT, false, false, pSqlStmt)); return(query(DB_SELECT_STATEMENT, FALSE, FALSE, pSqlStmt));
} // wxDbTable::QueryBySqlStmt() } // wxDbTable::QueryBySqlStmt()
@@ -847,7 +847,7 @@ bool wxDbTable::GetPrev(void)
if (pDb->FwdOnlyCursors()) if (pDb->FwdOnlyCursors())
{ {
wxFAIL_MSG(wxT("GetPrev()::Backward scrolling cursors are not enabled for this instance of wxDbTable")); wxFAIL_MSG(wxT("GetPrev()::Backward scrolling cursors are not enabled for this instance of wxDbTable"));
return false; return FALSE;
} }
else else
return(getRec(SQL_FETCH_PRIOR)); return(getRec(SQL_FETCH_PRIOR));
@@ -861,7 +861,7 @@ bool wxDbTable::operator--(int)
if (pDb->FwdOnlyCursors()) if (pDb->FwdOnlyCursors())
{ {
wxFAIL_MSG(wxT("operator--:Backward scrolling cursors are not enabled for this instance of wxDbTable")); wxFAIL_MSG(wxT("operator--:Backward scrolling cursors are not enabled for this instance of wxDbTable"));
return false; return FALSE;
} }
else else
return(getRec(SQL_FETCH_PRIOR)); return(getRec(SQL_FETCH_PRIOR));
@@ -875,7 +875,7 @@ bool wxDbTable::GetFirst(void)
if (pDb->FwdOnlyCursors()) if (pDb->FwdOnlyCursors())
{ {
wxFAIL_MSG(wxT("GetFirst():Backward scrolling cursors are not enabled for this instance of wxDbTable")); wxFAIL_MSG(wxT("GetFirst():Backward scrolling cursors are not enabled for this instance of wxDbTable"));
return false; return FALSE;
} }
else else
return(getRec(SQL_FETCH_FIRST)); return(getRec(SQL_FETCH_FIRST));
@@ -889,7 +889,7 @@ bool wxDbTable::GetLast(void)
if (pDb->FwdOnlyCursors()) if (pDb->FwdOnlyCursors())
{ {
wxFAIL_MSG(wxT("GetLast()::Backward scrolling cursors are not enabled for this instance of wxDbTable")); wxFAIL_MSG(wxT("GetLast()::Backward scrolling cursors are not enabled for this instance of wxDbTable"));
return false; return FALSE;
} }
else else
return(getRec(SQL_FETCH_LAST)); return(getRec(SQL_FETCH_LAST));
@@ -982,13 +982,13 @@ void wxDbTable::BuildSelectStmt(wxString &pSqlStmt, int typeOfSelect, bool disti
// Was a FROM clause specified to join tables to the base table? // Was a FROM clause specified to join tables to the base table?
// Available for ::Query() only!!! // Available for ::Query() only!!!
bool appendFromClause = false; bool appendFromClause = FALSE;
#if wxODBC_BACKWARD_COMPATABILITY #if wxODBC_BACKWARD_COMPATABILITY
if (typeOfSelect == DB_SELECT_WHERE && from && wxStrlen(from)) if (typeOfSelect == DB_SELECT_WHERE && from && wxStrlen(from))
appendFromClause = true; appendFromClause = TRUE;
#else #else
if (typeOfSelect == DB_SELECT_WHERE && from.Length()) if (typeOfSelect == DB_SELECT_WHERE && from.Length())
appendFromClause = true; appendFromClause = TRUE;
#endif #endif
// Add the column list // Add the column list
@@ -1108,7 +1108,7 @@ void wxDbTable::BuildUpdateStmt(wxString &pSqlStmt, int typeOfUpd, const wxStrin
wxString whereClause; wxString whereClause;
whereClause.Empty(); whereClause.Empty();
bool firstColumn = true; bool firstColumn = TRUE;
pSqlStmt.Printf(wxT("UPDATE %s SET "), tableName.Upper().c_str()); pSqlStmt.Printf(wxT("UPDATE %s SET "), tableName.Upper().c_str());
@@ -1122,7 +1122,7 @@ void wxDbTable::BuildUpdateStmt(wxString &pSqlStmt, int typeOfUpd, const wxStrin
if (!firstColumn) if (!firstColumn)
pSqlStmt += wxT(","); pSqlStmt += wxT(",");
else else
firstColumn = false; firstColumn = FALSE;
pSqlStmt += colDefs[i].ColName; pSqlStmt += colDefs[i].ColName;
pSqlStmt += wxT(" = ?"); pSqlStmt += wxT(" = ?");
} }
@@ -1181,7 +1181,7 @@ void wxDbTable::BuildWhereClause(wxString &pWhereClause, int typeOfWhere,
* They are not included as part of the where clause. * They are not included as part of the where clause.
*/ */
{ {
bool moreThanOneColumn = false; bool moreThanOneColumn = FALSE;
wxString colValue; wxString colValue;
// Loop through the columns building a where clause as you go // Loop through the columns building a where clause as you go
@@ -1199,7 +1199,7 @@ void wxDbTable::BuildWhereClause(wxString &pWhereClause, int typeOfWhere,
if (moreThanOneColumn) if (moreThanOneColumn)
pWhereClause += wxT(" AND "); pWhereClause += wxT(" AND ");
else else
moreThanOneColumn = true; moreThanOneColumn = TRUE;
// Concatenate where phrase for the column // Concatenate where phrase for the column
if (qualTableName.Length()) if (qualTableName.Length())
{ {
@@ -1275,7 +1275,7 @@ bool wxDbTable::CloseCursor(HSTMT cursor)
return(pDb->DispAllErrors(henv, hdbc, cursor)); return(pDb->DispAllErrors(henv, hdbc, cursor));
// Completed successfully // Completed successfully
return(true); return(TRUE);
} // wxDbTable::CloseCursor() } // wxDbTable::CloseCursor()
@@ -1284,7 +1284,7 @@ bool wxDbTable::CloseCursor(HSTMT cursor)
bool wxDbTable::CreateTable(bool attemptDrop) bool wxDbTable::CreateTable(bool attemptDrop)
{ {
if (!pDb) if (!pDb)
return false; return FALSE;
int i, j; int i, j;
wxString sqlStmt; wxString sqlStmt;
@@ -1295,7 +1295,7 @@ bool wxDbTable::CreateTable(bool attemptDrop)
// Drop table first // Drop table first
if (attemptDrop && !DropTable()) if (attemptDrop && !DropTable())
return false; return FALSE;
// Create the table // Create the table
#ifdef DBDEBUG_CONSOLE #ifdef DBDEBUG_CONSOLE
@@ -1328,7 +1328,7 @@ bool wxDbTable::CreateTable(bool attemptDrop)
#endif #endif
// Build a CREATE TABLE string from the colDefs structure. // Build a CREATE TABLE string from the colDefs structure.
bool needComma = false; bool needComma = FALSE;
sqlStmt.Printf(wxT("CREATE TABLE %s ("), tableName.c_str()); sqlStmt.Printf(wxT("CREATE TABLE %s ("), tableName.c_str());
for (i = 0; i < noCols; i++) for (i = 0; i < noCols; i++)
@@ -1382,7 +1382,7 @@ bool wxDbTable::CreateTable(bool attemptDrop)
} }
} }
needComma = true; needComma = TRUE;
} }
// If there is a primary key defined, include it in the create statement // If there is a primary key defined, include it in the create statement
for (i = j = 0; i < noCols; i++) for (i = j = 0; i < noCols; i++)
@@ -1460,17 +1460,17 @@ bool wxDbTable::CreateTable(bool attemptDrop)
pDb->DispAllErrors(henv, hdbc, hstmt); pDb->DispAllErrors(henv, hdbc, hstmt);
pDb->RollbackTrans(); pDb->RollbackTrans();
CloseCursor(hstmt); CloseCursor(hstmt);
return(false); return(FALSE);
} }
// Commit the transaction and close the cursor // Commit the transaction and close the cursor
if (!pDb->CommitTrans()) if (!pDb->CommitTrans())
return(false); return(FALSE);
if (!CloseCursor(hstmt)) if (!CloseCursor(hstmt))
return(false); return(FALSE);
// Database table created successfully // Database table created successfully
return(true); return(TRUE);
} // wxDbTable::CreateTable() } // wxDbTable::CreateTable()
@@ -1478,7 +1478,7 @@ bool wxDbTable::CreateTable(bool attemptDrop)
/********** wxDbTable::DropTable() **********/ /********** wxDbTable::DropTable() **********/
bool wxDbTable::DropTable() bool wxDbTable::DropTable()
{ {
// NOTE: This function returns true if the Table does not exist, but // NOTE: This function returns TRUE if the Table does not exist, but
// only for identified databases. Code will need to be added // only for identified databases. Code will need to be added
// below for any other databases when those databases are defined // below for any other databases when those databases are defined
// to handle this situation consistently // to handle this situation consistently
@@ -1514,18 +1514,18 @@ bool wxDbTable::DropTable()
pDb->DispAllErrors(henv, hdbc, hstmt); pDb->DispAllErrors(henv, hdbc, hstmt);
pDb->RollbackTrans(); pDb->RollbackTrans();
// CloseCursor(hstmt); // CloseCursor(hstmt);
return(false); return(FALSE);
} }
} }
} }
// Commit the transaction and close the cursor // Commit the transaction and close the cursor
if (! pDb->CommitTrans()) if (! pDb->CommitTrans())
return(false); return(FALSE);
if (! CloseCursor(hstmt)) if (! CloseCursor(hstmt))
return(false); return(FALSE);
return(true); return(TRUE);
} // wxDbTable::DropTable() } // wxDbTable::DropTable()
@@ -1537,7 +1537,7 @@ bool wxDbTable::CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCol
// Drop the index first // Drop the index first
if (attemptDrop && !DropIndex(idxName)) if (attemptDrop && !DropIndex(idxName))
return (false); return (FALSE);
// MySQL (and possibly Sybase ASE?? - gt) require that any columns which are used as portions // MySQL (and possibly Sybase ASE?? - gt) require that any columns which are used as portions
// of an index have the columns defined as "NOT NULL". During initial table creation though, // of an index have the columns defined as "NOT NULL". During initial table creation though,
@@ -1551,11 +1551,11 @@ bool wxDbTable::CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCol
{ {
wxString sqlStmt; wxString sqlStmt;
int i; int i;
bool ok = true; bool ok = TRUE;
for (i = 0; i < noIdxCols && ok; i++) for (i = 0; i < noIdxCols && ok; i++)
{ {
int j = 0; int j = 0;
bool found = false; bool found = FALSE;
// Find the column definition that has the ColName that matches the // Find the column definition that has the ColName that matches the
// index column name. We need to do this to get the DB_DATA_TYPE of // index column name. We need to do this to get the DB_DATA_TYPE of
// the index column, as MySQL's syntax for the ALTER column requires // the index column, as MySQL's syntax for the ALTER column requires
@@ -1563,7 +1563,7 @@ bool wxDbTable::CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCol
while (!found && (j < this->noCols)) while (!found && (j < this->noCols))
{ {
if (wxStrcmp(colDefs[j].ColName,pIdxDefs[i].ColName) == 0) if (wxStrcmp(colDefs[j].ColName,pIdxDefs[i].ColName) == 0)
found = true; found = TRUE;
if (!found) if (!found)
j++; j++;
} }
@@ -1584,14 +1584,14 @@ bool wxDbTable::CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCol
} }
} }
else else
ok = false; ok = FALSE;
} }
if (ok) if (ok)
pDb->CommitTrans(); pDb->CommitTrans();
else else
{ {
pDb->RollbackTrans(); pDb->RollbackTrans();
return(false); return(FALSE);
} }
} }
@@ -1643,17 +1643,17 @@ bool wxDbTable::CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCol
pDb->DispAllErrors(henv, hdbc, hstmt); pDb->DispAllErrors(henv, hdbc, hstmt);
pDb->RollbackTrans(); pDb->RollbackTrans();
CloseCursor(hstmt); CloseCursor(hstmt);
return(false); return(FALSE);
} }
// Commit the transaction and close the cursor // Commit the transaction and close the cursor
if (! pDb->CommitTrans()) if (! pDb->CommitTrans())
return(false); return(FALSE);
if (! CloseCursor(hstmt)) if (! CloseCursor(hstmt))
return(false); return(FALSE);
// Index Created Successfully // Index Created Successfully
return(true); return(TRUE);
} // wxDbTable::CreateIndex() } // wxDbTable::CreateIndex()
@@ -1661,7 +1661,7 @@ bool wxDbTable::CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCol
/********** wxDbTable::DropIndex() **********/ /********** wxDbTable::DropIndex() **********/
bool wxDbTable::DropIndex(const wxString &idxName) bool wxDbTable::DropIndex(const wxString &idxName)
{ {
// NOTE: This function returns true if the Index does not exist, but // NOTE: This function returns TRUE if the Index does not exist, but
// only for identified databases. Code will need to be added // only for identified databases. Code will need to be added
// below for any other databases when those databases are defined // below for any other databases when those databases are defined
// to handle this situation consistently // to handle this situation consistently
@@ -1703,18 +1703,18 @@ bool wxDbTable::DropIndex(const wxString &idxName)
pDb->DispAllErrors(henv, hdbc, hstmt); pDb->DispAllErrors(henv, hdbc, hstmt);
pDb->RollbackTrans(); pDb->RollbackTrans();
CloseCursor(hstmt); CloseCursor(hstmt);
return(false); return(FALSE);
} }
} }
} }
// Commit the transaction and close the cursor // Commit the transaction and close the cursor
if (! pDb->CommitTrans()) if (! pDb->CommitTrans())
return(false); return(FALSE);
if (! CloseCursor(hstmt)) if (! CloseCursor(hstmt))
return(false); return(FALSE);
return(true); return(TRUE);
} // wxDbTable::DropIndex() } // wxDbTable::DropIndex()
@@ -1724,7 +1724,7 @@ bool wxDbTable::SetOrderByColNums(UWORD first, ... )
int colNo = first; // using 'int' to be able to look for wxDB_NO_MORE_COLUN_NUMBERS int colNo = first; // using 'int' to be able to look for wxDB_NO_MORE_COLUN_NUMBERS
va_list argptr; va_list argptr;
bool abort = false; bool abort = FALSE;
wxString tempStr; wxString tempStr;
va_start(argptr, first); /* Initialize variable arguments. */ va_start(argptr, first); /* Initialize variable arguments. */
@@ -1736,7 +1736,7 @@ bool wxDbTable::SetOrderByColNums(UWORD first, ... )
// Valid columns are 0 thru noCols-1 // Valid columns are 0 thru noCols-1
if (colNo >= noCols || colNo < 0) if (colNo >= noCols || colNo < 0)
{ {
abort = true; abort = TRUE;
continue; continue;
} }
@@ -1791,7 +1791,7 @@ bool wxDbTable::Update(void)
{ {
wxASSERT(!queryOnly); wxASSERT(!queryOnly);
if (queryOnly) if (queryOnly)
return(false); return(FALSE);
wxString sqlStmt; wxString sqlStmt;
@@ -1815,7 +1815,7 @@ bool wxDbTable::Update(const wxString &pSqlStmt)
{ {
wxASSERT(!queryOnly); wxASSERT(!queryOnly);
if (queryOnly) if (queryOnly)
return(false); return(FALSE);
pDb->WriteSqlLog(pSqlStmt); pDb->WriteSqlLog(pSqlStmt);
@@ -1829,7 +1829,7 @@ bool wxDbTable::UpdateWhere(const wxString &pWhereClause)
{ {
wxASSERT(!queryOnly); wxASSERT(!queryOnly);
if (queryOnly) if (queryOnly)
return(false); return(FALSE);
wxString sqlStmt; wxString sqlStmt;
@@ -1853,7 +1853,7 @@ bool wxDbTable::Delete(void)
{ {
wxASSERT(!queryOnly); wxASSERT(!queryOnly);
if (queryOnly) if (queryOnly)
return(false); return(FALSE);
wxString sqlStmt; wxString sqlStmt;
sqlStmt.Empty(); sqlStmt.Empty();
@@ -1874,7 +1874,7 @@ bool wxDbTable::DeleteWhere(const wxString &pWhereClause)
{ {
wxASSERT(!queryOnly); wxASSERT(!queryOnly);
if (queryOnly) if (queryOnly)
return(false); return(FALSE);
wxString sqlStmt; wxString sqlStmt;
sqlStmt.Empty(); sqlStmt.Empty();
@@ -1895,7 +1895,7 @@ bool wxDbTable::DeleteMatching(void)
{ {
wxASSERT(!queryOnly); wxASSERT(!queryOnly);
if (queryOnly) if (queryOnly)
return(false); return(FALSE);
wxString sqlStmt; wxString sqlStmt;
sqlStmt.Empty(); sqlStmt.Empty();
@@ -1915,7 +1915,7 @@ bool wxDbTable::DeleteMatching(void)
bool wxDbTable::IsColNull(UWORD colNo) const bool wxDbTable::IsColNull(UWORD colNo) const
{ {
/* /*
This logic is just not right. It would indicate true This logic is just not right. It would indicate TRUE
if a numeric field were set to a value of 0. if a numeric field were set to a value of 0.
switch(colDefs[colNo].SqlCtype) switch(colDefs[colNo].SqlCtype)
@@ -1938,11 +1938,11 @@ bool wxDbTable::IsColNull(UWORD colNo) const
TIMESTAMP_STRUCT *pDt; TIMESTAMP_STRUCT *pDt;
pDt = (TIMESTAMP_STRUCT *) colDefs[colNo].PtrDataObj; pDt = (TIMESTAMP_STRUCT *) colDefs[colNo].PtrDataObj;
if (pDt->year == 0 && pDt->month == 0 && pDt->day == 0) if (pDt->year == 0 && pDt->month == 0 && pDt->day == 0)
return(true); return(TRUE);
else else
return(false); return(FALSE);
default: default:
return(true); return(TRUE);
} }
*/ */
return (colDefs[colNo].Null); return (colDefs[colNo].Null);
@@ -1953,16 +1953,16 @@ bool wxDbTable::IsColNull(UWORD colNo) const
bool wxDbTable::CanSelectForUpdate(void) bool wxDbTable::CanSelectForUpdate(void)
{ {
if (queryOnly) if (queryOnly)
return false; return FALSE;
if (pDb->Dbms() == dbmsMY_SQL) if (pDb->Dbms() == dbmsMY_SQL)
return false; return FALSE;
if ((pDb->Dbms() == dbmsORACLE) || if ((pDb->Dbms() == dbmsORACLE) ||
(pDb->dbInf.posStmts & SQL_PS_SELECT_FOR_UPDATE)) (pDb->dbInf.posStmts & SQL_PS_SELECT_FOR_UPDATE))
return(true); return(TRUE);
else else
return(false); return(FALSE);
} // wxDbTable::CanSelectForUpdate() } // wxDbTable::CanSelectForUpdate()
@@ -1971,15 +1971,15 @@ bool wxDbTable::CanSelectForUpdate(void)
bool wxDbTable::CanUpdByROWID(void) bool wxDbTable::CanUpdByROWID(void)
{ {
/* /*
* NOTE: Returning false for now until this can be debugged, * NOTE: Returning FALSE for now until this can be debugged,
* as the ROWID is not getting updated correctly * as the ROWID is not getting updated correctly
*/ */
return false; return FALSE;
/* /*
if (pDb->Dbms() == dbmsORACLE) if (pDb->Dbms() == dbmsORACLE)
return(true); return(TRUE);
else else
return(false); return(FALSE);
*/ */
} // wxDbTable::CanUpdByROWID() } // wxDbTable::CanUpdByROWID()
@@ -1988,9 +1988,9 @@ bool wxDbTable::CanUpdByROWID(void)
bool wxDbTable::IsCursorClosedOnCommit(void) bool wxDbTable::IsCursorClosedOnCommit(void)
{ {
if (pDb->dbInf.cursorCommitBehavior == SQL_CB_PRESERVE) if (pDb->dbInf.cursorCommitBehavior == SQL_CB_PRESERVE)
return(false); return(FALSE);
else else
return(true); return(TRUE);
} // wxDbTable::IsCursorClosedOnCommit() } // wxDbTable::IsCursorClosedOnCommit()
@@ -2067,7 +2067,7 @@ bool wxDbTable::SetQueryTimeout(UDWORD nSeconds)
return(pDb->DispAllErrors(henv, hdbc, hstmtInternal)); return(pDb->DispAllErrors(henv, hdbc, hstmtInternal));
// Completed Successfully // Completed Successfully
return(true); return(TRUE);
} // wxDbTable::SetQueryTimeout() } // wxDbTable::SetQueryTimeout()
@@ -2101,8 +2101,8 @@ void wxDbTable::SetColDefs(UWORD index, const wxString &fieldName, int dataType,
// Derived columns by definition would NOT be "Insertable" or "Updateable" // Derived columns by definition would NOT be "Insertable" or "Updateable"
if (derivedCol) if (derivedCol)
{ {
colDefs[index].Updateable = false; colDefs[index].Updateable = FALSE;
colDefs[index].InsertAllowed = false; colDefs[index].InsertAllowed = FALSE;
} }
else else
{ {
@@ -2110,7 +2110,7 @@ void wxDbTable::SetColDefs(UWORD index, const wxString &fieldName, int dataType,
colDefs[index].InsertAllowed = insAllow; colDefs[index].InsertAllowed = insAllow;
} }
colDefs[index].Null = false; colDefs[index].Null = FALSE;
} // wxDbTable::SetColDefs() } // wxDbTable::SetColDefs()
@@ -2246,7 +2246,7 @@ ULONG wxDbTable::Count(const wxString &args)
// Initialize the Count cursor if it's not already initialized // Initialize the Count cursor if it's not already initialized
if (!hstmtCount) if (!hstmtCount)
{ {
hstmtCount = GetNewCursor(false,false); hstmtCount = GetNewCursor(FALSE,FALSE);
wxASSERT(hstmtCount); wxASSERT(hstmtCount);
if (!hstmtCount) if (!hstmtCount)
return(0); return(0);
@@ -2286,7 +2286,7 @@ ULONG wxDbTable::Count(const wxString &args)
/********** wxDbTable::Refresh() **********/ /********** wxDbTable::Refresh() **********/
bool wxDbTable::Refresh(void) bool wxDbTable::Refresh(void)
{ {
bool result = true; bool result = TRUE;
// Switch to the internal cursor so any active cursors are not corrupted // Switch to the internal cursor so any active cursors are not corrupted
HSTMT currCursor = GetCursor(); HSTMT currCursor = GetCursor();
@@ -2329,10 +2329,10 @@ bool wxDbTable::Refresh(void)
where = whereClause; where = whereClause;
orderBy.Empty(); orderBy.Empty();
if (!Query()) if (!Query())
result = false; result = FALSE;
if (result && !GetNext()) if (result && !GetNext())
result = false; result = FALSE;
// Switch back to original cursor // Switch back to original cursor
SetCursor(&currCursor); SetCursor(&currCursor);
@@ -2357,11 +2357,11 @@ bool wxDbTable::SetColNull(UWORD colNo, bool set)
{ {
colDefs[colNo].Null = set; colDefs[colNo].Null = set;
if (set) // Blank out the values in the member variable if (set) // Blank out the values in the member variable
ClearMemberVar(colNo,false); // Must call with false, or infinite recursion will happen ClearMemberVar(colNo,FALSE); // Must call with FALSE, or infinite recursion will happen
return(true); return(TRUE);
} }
else else
return(false); return(FALSE);
} // wxDbTable::SetColNull() } // wxDbTable::SetColNull()
@@ -2380,11 +2380,11 @@ bool wxDbTable::SetColNull(const wxString &colName, bool set)
{ {
colDefs[i].Null = set; colDefs[i].Null = set;
if (set) // Blank out the values in the member variable if (set) // Blank out the values in the member variable
ClearMemberVar(i,false); // Must call with false, or infinite recursion will happen ClearMemberVar(i,FALSE); // Must call with FALSE, or infinite recursion will happen
return(true); return(TRUE);
} }
else else
return(false); return(FALSE);
} // wxDbTable::SetColNull() } // wxDbTable::SetColNull()
@@ -2431,7 +2431,7 @@ HSTMT *wxDbTable::GetNewCursor(bool setCursor, bool bindColumns)
/********** wxDbTable::DeleteCursor() **********/ /********** wxDbTable::DeleteCursor() **********/
bool wxDbTable::DeleteCursor(HSTMT *hstmtDel) bool wxDbTable::DeleteCursor(HSTMT *hstmtDel)
{ {
bool result = true; bool result = TRUE;
if (!hstmtDel) // Cursor already deleted if (!hstmtDel) // Cursor already deleted
return(result); return(result);
@@ -2444,7 +2444,7 @@ ODBC 3.0 says to use this form
if (SQLFreeStmt(*hstmtDel, SQL_DROP) != SQL_SUCCESS) if (SQLFreeStmt(*hstmtDel, SQL_DROP) != SQL_SUCCESS)
{ {
pDb->DispAllErrors(henv, hdbc); pDb->DispAllErrors(henv, hdbc);
result = false; result = FALSE;
} }
delete hstmtDel; delete hstmtDel;
@@ -2461,7 +2461,7 @@ void wxDbTable::SetRowMode(const rowmode_t rowmode)
{ {
if (!m_hstmtGridQuery) if (!m_hstmtGridQuery)
{ {
m_hstmtGridQuery = GetNewCursor(false,false); m_hstmtGridQuery = GetNewCursor(FALSE,FALSE);
if (!bindCols(*m_hstmtGridQuery)) if (!bindCols(*m_hstmtGridQuery))
return; return;
} }
@@ -2555,7 +2555,7 @@ void wxDbTable::SetCol(const int col, const wxVariant val)
{ {
//Returns null if invalid! //Returns null if invalid!
if (!dateval.ParseDate(val.GetString())) if (!dateval.ParseDate(val.GetString()))
SetColNull(col,true); SetColNull(col,TRUE);
} }
switch (colDefs[col].SqlCtype) switch (colDefs[col].SqlCtype)
@@ -2668,7 +2668,7 @@ void wxDbTable::SetKey(const GenericKey& k)
{ {
if (colDefs[i].KeyField) if (colDefs[i].KeyField)
{ {
SetColNull(i, false); SetColNull(i, FALSE);
memcpy(colDefs[i].PtrDataObj, blkptr, colDefs[i].SzDataObj); memcpy(colDefs[i].PtrDataObj, blkptr, colDefs[i].SzDataObj);
blkptr += colDefs[i].SzDataObj; blkptr += colDefs[i].SzDataObj;
} }