SQL Server and (preliminary) DB2 support added

Fixed some potentially uninitialized variables


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8762 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
George Tasker
2000-11-20 17:25:04 +00:00
parent a8aa2258e8
commit e93a3a18fc

View File

@@ -125,6 +125,9 @@ wxDbTable::wxDbTable(wxDb *pwxDb, const char *tblName, const int nCols,
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;
wxStrcpy(tablePath,"");
wxStrcpy(tableName,"");
wxStrcpy(queryTableName,"");
assert (tblName); assert (tblName);
@@ -579,6 +582,10 @@ bool wxDbTable::query(int queryType, bool forUpdate, bool distinct, const char *
BuildSelectStmt(sqlStmt, queryType, distinct); BuildSelectStmt(sqlStmt, queryType, distinct);
pDb->WriteSqlLog(sqlStmt); pDb->WriteSqlLog(sqlStmt);
} }
/*
This is the block of code that got added during the 2.2.1 merge with
the 2.2 main branch that somehow got added here when it should not have. - gt
else else
wxStrcpy(sqlStmt, pSqlStmt); wxStrcpy(sqlStmt, pSqlStmt);
@@ -590,7 +597,7 @@ bool wxDbTable::query(int queryType, bool forUpdate, bool distinct, const char *
pDb->DispAllErrors(henv, hdbc, hstmt); pDb->DispAllErrors(henv, hdbc, hstmt);
return(FALSE); return(FALSE);
} }
*/
// Make sure the cursor is closed first // Make sure the cursor is closed first
if (!CloseCursor(hstmt)) if (!CloseCursor(hstmt))
return(FALSE); return(FALSE);
@@ -1034,7 +1041,10 @@ bool wxDbTable::CreateTable(bool attemptDrop)
sqlStmt += s.c_str(); sqlStmt += s.c_str();
} }
if (pDb->Dbms() == dbmsSYBASE_ASE || pDb->Dbms() == dbmsMY_SQL) if (pDb->Dbms() == dbmsDB2 ||
pDb->Dbms() == dbmsMY_SQL ||
pDb->Dbms() == dbmsSYBASE_ASE ||
pDb->Dbms() == dbmsMS_SQL_SERVER)
{ {
if (colDefs[i].KeyField) if (colDefs[i].KeyField)
{ {
@@ -1319,7 +1329,8 @@ bool wxDbTable::DropIndex(const char * idxName)
if (pDb->Dbms() == dbmsACCESS || pDb->Dbms() == dbmsMY_SQL) if (pDb->Dbms() == dbmsACCESS || pDb->Dbms() == dbmsMY_SQL)
sqlStmt.sprintf("DROP INDEX %s ON %s",idxName,tableName); sqlStmt.sprintf("DROP INDEX %s ON %s",idxName,tableName);
else if (pDb->Dbms() == dbmsSYBASE_ASE) else if ((pDb->Dbms() == dbmsMS_SQL_SERVER) ||
(pDb->Dbms() == dbmsSYBASE_ASE))
sqlStmt.sprintf("DROP INDEX %s.%s",tableName,idxName); sqlStmt.sprintf("DROP INDEX %s.%s",tableName,idxName);
else else
sqlStmt.sprintf("DROP INDEX %s",idxName); sqlStmt.sprintf("DROP INDEX %s",idxName);
@@ -1750,7 +1761,8 @@ bool wxDbTable::CanSelectForUpdate(void)
if (pDb->Dbms() == dbmsMY_SQL) if (pDb->Dbms() == dbmsMY_SQL)
return FALSE; return FALSE;
if (pDb->dbInf.posStmts & SQL_PS_SELECT_FOR_UPDATE) if ((pDb->Dbms() == dbmsORACLE) ||
(pDb->dbInf.posStmts & SQL_PS_SELECT_FOR_UPDATE))
return(TRUE); return(TRUE);
else else
return(FALSE); return(FALSE);
@@ -1890,7 +1902,7 @@ void wxDbTable::SetColDefs (int index, const char *fieldName, int dataType, void
} // wxDbTable::SetColDefs() } // wxDbTable::SetColDefs()
/********** wxDbTable::SetColDef() **********/ /********** wxDbTable::SetColDefs() **********/
wxDbColDataPtr* wxDbTable::SetColDefs(wxDbColInf *pColInfs, ULONG numCols) wxDbColDataPtr* wxDbTable::SetColDefs(wxDbColInf *pColInfs, ULONG numCols)
{ {
assert(pColInfs); assert(pColInfs);
@@ -1954,7 +1966,7 @@ wxDbColDataPtr* wxDbTable::SetColDefs (wxDbColInf *pColInfs, ULONG numCols)
return (pColDataPtrs); return (pColDataPtrs);
} // wxDbTable::SetColDef() } // wxDbTable::SetColDefs()
/********** wxDbTable::SetCursor() **********/ /********** wxDbTable::SetCursor() **********/