diff --git a/samples/db/dbtest.cpp b/samples/db/dbtest.cpp index a87b5566ac..1b5522ec68 100644 --- a/samples/db/dbtest.cpp +++ b/samples/db/dbtest.cpp @@ -103,7 +103,7 @@ char *GetExtendedDBErrorMsg(char *ErrFile, int ErrLine) msg += ErrFile; msg += " Line: "; tStr.Printf("%d",ErrLine); - msg += tStr.GetData(); + msg += tStr.c_str(); msg += "\n"; } @@ -125,7 +125,7 @@ char *GetExtendedDBErrorMsg(char *ErrFile, int ErrLine) if (pDbList->PtrDb->errorList[i]) { msg.Append(pDbList->PtrDb->errorList[i]); - if (strcmp(pDbList->PtrDb->errorList[i],"") != 0) + if (wxStrcmp(pDbList->PtrDb->errorList[i],"") != 0) msg.Append("\n"); } } @@ -187,37 +187,37 @@ bool DatabaseDemoApp::OnInit() char buffer[1000+1]; fgets(buffer, sizeof(params.ODBCSource), paramFile); - buffer[strlen(buffer)-1] = '\0'; - strcpy(params.ODBCSource,buffer); + buffer[wxStrlen(buffer)-1] = '\0'; + wxStrcpy(params.ODBCSource,buffer); fgets(buffer, sizeof(params.UserName), paramFile); - buffer[strlen(buffer)-1] = '\0'; - strcpy(params.UserName,buffer); + buffer[wxStrlen(buffer)-1] = '\0'; + wxStrcpy(params.UserName,buffer); fgets(buffer, sizeof(params.Password), paramFile); - buffer[strlen(buffer)-1] = '\0'; - strcpy(params.Password,buffer); + buffer[wxStrlen(buffer)-1] = '\0'; + wxStrcpy(params.Password,buffer); fgets(buffer, sizeof(params.DirPath), paramFile); - buffer[strlen(buffer)-1] = '\0'; - strcpy(params.DirPath,buffer); + buffer[wxStrlen(buffer)-1] = '\0'; + wxStrcpy(params.DirPath,buffer); fclose(paramFile); // Connect to datasource - strcpy(DbConnectInf.Dsn, params.ODBCSource); // ODBC data source name (created with ODBC Administrator under Win95/NT) - strcpy(DbConnectInf.Uid, params.UserName); // database username - must already exist in the data source - strcpy(DbConnectInf.AuthStr, params.Password); // password database username - strcpy(DbConnectInf.defaultDir, params.DirPath); // path where the table exists (needed for dBase) + wxStrcpy(DbConnectInf.Dsn, params.ODBCSource); // ODBC data source name (created with ODBC Administrator under Win95/NT) + wxStrcpy(DbConnectInf.Uid, params.UserName); // database username - must already exist in the data source + wxStrcpy(DbConnectInf.AuthStr, params.Password); // password database username + wxStrcpy(DbConnectInf.defaultDir, params.DirPath); // path where the table exists (needed for dBase) READONLY_DB = wxDbGetConnection(&DbConnectInf); if (READONLY_DB == 0) { wxMessageBox("Unable to connect to the data source.\n\nCheck the name of your data source to verify it has been correctly entered/spelled.\n\nWith some databases, the user name and password must\nbe created with full rights to the CONTACT table prior to making a connection\n(using tools provided by the database manufacturer)", "DB CONNECTION ERROR...",wxOK | wxICON_EXCLAMATION); DemoFrame->BuildParameterDialog(NULL); - strcpy(DbConnectInf.Dsn, ""); - strcpy(DbConnectInf.Uid, ""); - strcpy(DbConnectInf.AuthStr, ""); + wxStrcpy(DbConnectInf.Dsn, ""); + wxStrcpy(DbConnectInf.Uid, ""); + wxStrcpy(DbConnectInf.AuthStr, ""); wxMessageBox("Now exiting program.\n\nRestart program to try any new settings.","Notice...",wxOK | wxICON_INFORMATION); return(FALSE); } @@ -278,9 +278,9 @@ void DatabaseDemoFrame::OnCloseWindow(wxCloseEvent& event) if (pEditorDlg->Close()) pEditorDlg = NULL; else - { + { event.Veto(); - return; + return; } // Cleans up the environment space allocated for the SQL/ODBC connection handle @@ -410,7 +410,7 @@ Ccontact::~Ccontact() { if (freeDbConn) { - if (!wxDbFreeConnection(pDb)) + if (!wxDbFreeConnection(GetDb())) { wxString tStr; tStr = "Unable to Free the Ccontact data table handle\n\n"; @@ -454,15 +454,15 @@ bool Ccontact::CreateIndexes(void) bool Ok = TRUE; - strcpy(idxDef[0].ColName, "IS_DEV"); + wxStrcpy(idxDef[0].ColName, "IS_DEV"); idxDef[0].Ascending = TRUE; - strcpy(idxDef[1].ColName, "NAME"); + wxStrcpy(idxDef[1].ColName, "NAME"); idxDef[1].Ascending = TRUE; - indexName = CONTACT_TABLE_NAME; + indexName = GetTableName(); indexName += "_IDX1"; - Ok = CreateIndex((char*) (const char*) indexName, TRUE, 2, idxDef); + Ok = CreateIndex(indexName.c_str(), TRUE, 2, idxDef); return Ok; } // Ccontact::CreateIndexes() @@ -476,8 +476,8 @@ bool Ccontact::CreateIndexes(void) bool Ccontact::FetchByName(char *name) { whereStr.Printf("NAME = '%s'",name); - where = (char*) (const char*) this->whereStr; - orderBy = ""; + SetWhereClause(whereStr.c_str()); + SetOrderByClause(""); if (!Query()) return(FALSE); @@ -529,7 +529,7 @@ CeditorDlg::CeditorDlg(wxWindow *parent) : wxPanel (parent, 1, 1, 460, 455) // Check if the table exists or not. If it doesn't, ask the user if they want to // create the table. Continue trying to create the table until it exists, or user aborts - while (!Contact->pDb->TableExists((char *)CONTACT_TABLE_NAME,DbConnectInf.Uid,DbConnectInf.defaultDir)) + while (!Contact->GetDb()->TableExists((char *)CONTACT_TABLE_NAME,DbConnectInf.Uid,DbConnectInf.defaultDir)) { wxString tStr; tStr.Printf("Unable to open the table '%s'.\n\nTable may need to be created...?\n\n",CONTACT_TABLE_NAME); @@ -555,7 +555,7 @@ CeditorDlg::CeditorDlg(wxWindow *parent) : wxPanel (parent, 1, 1, 460, 455) // Table does exist, there was some problem opening it. Currently this should // never fail, except in the case of the table not exisiting. Open() basically // only sets up variable/pointer values, other than checking for table existence. - if (Contact->pDb->TableExists((char *)CONTACT_TABLE_NAME)) + if (Contact->GetDb()->TableExists((char *)CONTACT_TABLE_NAME)) { wxString tStr; tStr.Printf("Unable to open the table '%s'.\n\n",CONTACT_TABLE_NAME); @@ -628,7 +628,7 @@ CeditorDlg::CeditorDlg(wxWindow *parent) : wxPanel (parent, 1, 1, 460, 455) // as there will only be one record being shown on the dialog at a time, this optimizes // network traffic by only returning a one row result - Contact->orderBy = "NAME"; // field name to sort by + Contact->SetOrderByClause("NAME"); // field name to sort by // The wxString "whereStr" is not a member of the wxDbTable object, it is a member variable // specifically in the Ccontact class. It is used here for simpler construction of a varying @@ -638,14 +638,14 @@ CeditorDlg::CeditorDlg(wxWindow *parent) : wxPanel (parent, 1, 1, 460, 455) // The constructed where clause below has a sub-query within it "SELECT MIN(NAME) FROM %s" // to achieve a single row (in this case the first name in alphabetical order). - if (Contact->pDb->Dbms() != dbmsPOSTGRES) + if (Contact->GetDb()->Dbms() != dbmsPOSTGRES) { - Contact->whereStr.sprintf("NAME = (SELECT MIN(NAME) FROM %s)",Contact->tableName); + Contact->whereStr.sprintf("NAME = (SELECT MIN(NAME) FROM %s)",Contact->GetTableName()); // NOTE: (const char*) returns a pointer which may not be valid later, so this is short term use only - Contact->where = (char*) (const char*) Contact->whereStr; + Contact->SetWhereClause(Contact->whereStr.c_str()); } else - Contact->where = ""; + Contact->SetWhereClause(""); // Perform the Query to get the result set. // NOTE: If there are no rows returned, that is a valid result, so Query() would return TRUE. @@ -749,7 +749,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) // of Ccontact is deleted. If the Commit wasn't performed, the // database will automatically Rollback the changes when the database // connection is terminated - Contact->pDb->CommitTrans(); + Contact->GetDb()->CommitTrans(); // Try to get the row that followed the just deleted row in the orderBy sequence if (!GetNextRec()) @@ -767,7 +767,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) } else // Delete failed - Contact->pDb->RollbackTrans(); + Contact->GetDb()->RollbackTrans(); SetMode(mView); return; @@ -786,7 +786,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) if (!Ok) return; - if (!strcmp((const char*) saveName,"")) + if (!wxStrcmp((const char*) saveName,"")) { Contact->Initialize(); PutData(); @@ -805,15 +805,15 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) } // Previous record not available, retrieve first record in table - if (Contact->pDb->Dbms() != dbmsPOSTGRES) + if (Contact->GetDb()->Dbms() != dbmsPOSTGRES) { Contact->whereStr = "NAME = (SELECT MIN(NAME) FROM "; - Contact->whereStr += Contact->tableName; + Contact->whereStr += Contact->GetTableName(); Contact->whereStr += ")"; - Contact->where = (char*) (const char*) Contact->whereStr; + Contact->SetWhereClause(Contact->whereStr.c_str()); } else - Contact->where = ""; + Contact->SetWhereClause(""); if (!Contact->Query()) { @@ -855,19 +855,19 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) { // Display the query dialog box char qryWhere[DB_MAX_WHERE_CLAUSE_LEN+1]; - strcpy(qryWhere, (const char*) Contact->qryWhereStr); + wxStrcpy(qryWhere, (const char*) Contact->qryWhereStr); char *tblName[] = {(char *)CONTACT_TABLE_NAME, 0}; - new CqueryDlg(GetParent(), Contact->pDb, tblName, qryWhere); + new CqueryDlg(GetParent(), Contact->GetDb(), tblName, qryWhere); // Query the first record in the new record set and // display it, if the query string has changed. - if (strcmp(qryWhere, (const char*) Contact->qryWhereStr)) + if (wxStrcmp(qryWhere, (const char*) Contact->qryWhereStr)) { Contact->whereStr = ""; - Contact->orderBy = "NAME"; + Contact->SetOrderByClause("NAME"); - if (Contact->pDb->Dbms() != dbmsPOSTGRES) + if (Contact->GetDb()->Dbms() != dbmsPOSTGRES) { Contact->whereStr = "NAME = (SELECT MIN(NAME) FROM "; Contact->whereStr += CONTACT_TABLE_NAME; @@ -875,7 +875,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) // Append the query where string (if there is one) Contact->qryWhereStr = qryWhere; - if (strlen(qryWhere)) + if (wxStrlen(qryWhere)) { Contact->whereStr += " WHERE "; Contact->whereStr += Contact->qryWhereStr; @@ -883,7 +883,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) // Close the expression with a right paren Contact->whereStr += ")"; // Requery the table - Contact->where = (char*) (const char*) Contact->whereStr; + Contact->SetWhereClause(Contact->whereStr.c_str()); if (!Contact->Query()) { wxString tStr; @@ -909,16 +909,16 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) { // Clear the additional where criteria established by the query feature Contact->qryWhereStr = ""; - Contact->orderBy = "NAME"; + Contact->SetOrderByClause("NAME"); - if (Contact->pDb->Dbms() != dbmsPOSTGRES) + if (Contact->GetDb()->Dbms() != dbmsPOSTGRES) { Contact->whereStr = "NAME = (SELECT MIN(NAME) FROM "; Contact->whereStr += CONTACT_TABLE_NAME; Contact->whereStr += ")"; } - Contact->where = (char*) (const char*) Contact->whereStr; + Contact->SetWhereClause(Contact->whereStr.c_str()); if (!Contact->Query()) { wxString tStr; @@ -947,7 +947,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) /* char *orderBy */ "NAME", /* bool distinctValues */ TRUE); - if (ListDB_Selection && strlen(ListDB_Selection)) + if (ListDB_Selection && wxStrlen(ListDB_Selection)) { wxString w = "NAME = '"; w += ListDB_Selection; @@ -1002,9 +1002,9 @@ void CeditorDlg::SetMode(enum DialogModes m) if (widgetPtrsSet) { pCreateBtn->Enable( !edit ); - pEditBtn->Enable( !edit && (strcmp(Contact->Name,"")!=0) ); - pDeleteBtn->Enable( !edit && (strcmp(Contact->Name,"")!=0) ); - pCopyBtn->Enable( !edit && (strcmp(Contact->Name,"")!=0) ); + pEditBtn->Enable( !edit && (wxStrcmp(Contact->Name,"")!=0) ); + pDeleteBtn->Enable( !edit && (wxStrcmp(Contact->Name,"")!=0) ); + pCopyBtn->Enable( !edit && (wxStrcmp(Contact->Name,"")!=0) ); pSaveBtn->Enable( edit ); pCancelBtn->Enable( edit ); pPrevBtn->Enable( !edit ); @@ -1061,7 +1061,7 @@ bool CeditorDlg::GetData() wxString tStr; tStr = pNameTxt->GetValue(); - if (!strcmp((const char*) tStr,"")) + if (!wxStrcmp((const char*) tStr,"")) { wxMessageBox("A name is required for entry into the contact table","Notice...",wxOK | wxICON_INFORMATION); return FALSE; @@ -1133,13 +1133,13 @@ bool CeditorDlg::GetData() } tStr = pNameTxt->GetValue(); - strcpy(Contact->Name,(const char*) tStr); - strcpy(Contact->Addr1,pAddress1Txt->GetValue()); - strcpy(Contact->Addr2,pAddress2Txt->GetValue()); - strcpy(Contact->City,pCityTxt->GetValue()); - strcpy(Contact->State,pStateTxt->GetValue()); - strcpy(Contact->Country,pCountryTxt->GetValue()); - strcpy(Contact->PostalCode,pPostalCodeTxt->GetValue()); + wxStrcpy(Contact->Name,(const char*) tStr); + wxStrcpy(Contact->Addr1,pAddress1Txt->GetValue()); + wxStrcpy(Contact->Addr2,pAddress2Txt->GetValue()); + wxStrcpy(Contact->City,pCityTxt->GetValue()); + wxStrcpy(Contact->State,pStateTxt->GetValue()); + wxStrcpy(Contact->Country,pCountryTxt->GetValue()); + wxStrcpy(Contact->PostalCode,pPostalCodeTxt->GetValue()); Contact->Contributions = atoi(pContribTxt->GetValue()); Contact->LinesOfCode = atol(pLinesTxt->GetValue()); @@ -1213,11 +1213,11 @@ bool CeditorDlg::Save() if (!failed) { - Contact->pDb->CommitTrans(); + Contact->GetDb()->CommitTrans(); SetMode(mView); // Sets the dialog mode back to viewing after save is successful } else - Contact->pDb->RollbackTrans(); + Contact->GetDb()->RollbackTrans(); wxEndBusyCursor(); } @@ -1235,10 +1235,10 @@ bool CeditorDlg::GetNextRec() { wxString w; - if (Contact->pDb->Dbms() != dbmsPOSTGRES) + if (Contact->GetDb()->Dbms() != dbmsPOSTGRES) { w = "NAME = (SELECT MIN(NAME) FROM "; - w += Contact->tableName; + w += Contact->GetTableName(); w += " WHERE NAME > '"; } else @@ -1270,10 +1270,10 @@ bool CeditorDlg::GetPrevRec() { wxString w; - if (Contact->pDb->Dbms() != dbmsPOSTGRES) + if (Contact->GetDb()->Dbms() != dbmsPOSTGRES) { w = "NAME = (SELECT MAX(NAME) FROM "; - w += Contact->tableName; + w += Contact->GetTableName(); w += " WHERE NAME < '"; } else @@ -1303,8 +1303,8 @@ bool CeditorDlg::GetPrevRec() */ bool CeditorDlg::GetRec(char *whereStr) { - Contact->where = whereStr; - Contact->orderBy = "NAME"; + Contact->SetWhereClause(whereStr); + Contact->SetOrderByClause("NAME"); if (!Contact->Query()) { @@ -1458,7 +1458,7 @@ bool CparameterDlg::GetData() wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION); return FALSE; } - strcpy(wxGetApp().params.ODBCSource, tStr); + wxStrcpy(wxGetApp().params.ODBCSource, tStr); } else return FALSE; @@ -1471,7 +1471,7 @@ bool CparameterDlg::GetData() wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION); return FALSE; } - strcpy(wxGetApp().params.UserName, tStr); + wxStrcpy(wxGetApp().params.UserName, tStr); tStr = pParamPasswordTxt->GetValue(); if (tStr.Length() > (sizeof(wxGetApp().params.Password)-1)) @@ -1481,7 +1481,7 @@ bool CparameterDlg::GetData() wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION); return FALSE; } - strcpy(wxGetApp().params.Password,tStr); + wxStrcpy(wxGetApp().params.Password,tStr); tStr = pParamDirPathTxt->GetValue(); tStr.Replace("\\","/"); @@ -1492,7 +1492,7 @@ bool CparameterDlg::GetData() wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION); return FALSE; } - strcpy(wxGetApp().params.DirPath,tStr); + wxStrcpy(wxGetApp().params.DirPath,tStr); return TRUE; } // CparameterDlg::GetData() @@ -1543,7 +1543,7 @@ void CparameterDlg::FillDataSourceList() char **p = strList.ListToArray(); int i; - for (i = 0; strlen(p[i]); i++) + for (i = 0; wxStrlen(p[i]); i++) pParamODBCSourceList->Append(p[i]); } // CparameterDlg::CparameterDlg::FillDataSourceList() @@ -1566,7 +1566,7 @@ CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, char *tblName[], char *pWhereA // Initialize the WHERE clause from the string passed in pWhere = pWhereArg; // Save a pointer to the output buffer - if (strlen(pWhere) > DB_MAX_WHERE_CLAUSE_LEN) // Check the length of the buffer passed in + if (wxStrlen(pWhere) > DB_MAX_WHERE_CLAUSE_LEN) // Check the length of the buffer passed in { wxString s; s.Printf("Maximum where clause length exceeded.\nLength must be less than %d", DB_MAX_WHERE_CLAUSE_LEN+1); @@ -1629,11 +1629,11 @@ CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, char *tblName[], char *pWhereA } int i; - for (i = 0; colInf[i].colName && strlen(colInf[i].colName); i++) + for (i = 0; colInf[i].colName && wxStrlen(colInf[i].colName); i++) { // If there is more than one table being queried, qualify // the column names with the table name prefix. - if (tblName[1] && strlen(tblName[1])) + if (tblName[1] && wxStrlen(tblName[1])) { qualName.Printf("%s.%s", colInf[i].tableName, colInf[i].colName); pQueryCol1Choice->Append(qualName); @@ -1848,7 +1848,7 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event) if (widgetName == pQueryDoneBtn->GetName()) { // Be sure the where clause will not overflow the output buffer - if (strlen(pQuerySqlWhereMtxt->GetValue()) > DB_MAX_WHERE_CLAUSE_LEN) + if (wxStrlen(pQuerySqlWhereMtxt->GetValue()) > DB_MAX_WHERE_CLAUSE_LEN) { wxString s; s.Printf("Maximum where clause length exceeded.\nLength must be less than %d", DB_MAX_WHERE_CLAUSE_LEN+1); @@ -1859,7 +1859,7 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event) if (!ValidateWhereClause()) return; // Copy the where clause to the output buffer and exit - strcpy(pWhere, pQuerySqlWhereMtxt->GetValue()); + wxStrcpy(pWhere, pQuerySqlWhereMtxt->GetValue()); Close(); return; @@ -1908,7 +1908,7 @@ void CqueryDlg::OnCloseWindow(wxCloseEvent& event) while (wxIsBusy()) wxEndBusyCursor(); - Show(FALSE); + Show(FALSE); this->Destroy(); } // CqueryDlg::OnCloseWindow() @@ -1931,7 +1931,7 @@ void CqueryDlg::ProcessAddBtn() if (pQueryCol2Choice->GetSelection() == 0) // "Value" is selected { // Verify that value 1 is filled in - if (strlen(pQueryValue1Txt->GetValue()) == 0) + if (wxStrlen(pQueryValue1Txt->GetValue()) == 0) { wxBell(); pQueryValue1Txt->SetFocus(); @@ -1939,7 +1939,7 @@ void CqueryDlg::ProcessAddBtn() } // For the BETWEEN operator, value 2 must be filled in as well if (oper == qryOpBETWEEN && - strlen(pQueryValue2Txt->GetValue()) == 0) + wxStrlen(pQueryValue2Txt->GetValue()) == 0) { wxBell(); pQueryValue2Txt->SetFocus(); @@ -2047,14 +2047,14 @@ void CqueryDlg::ProcessCountBtn() } // Count() with WHERE clause - wxString whereStr; + wxString whereStr; whereStr = pQuerySqlWhereMtxt->GetValue(); - dbTable->where = (char *)whereStr.GetData(); + dbTable->SetWhereClause(whereStr.c_str()); ULONG whereCnt = dbTable->Count(); // Count() of all records in the table - dbTable->where = ""; + dbTable->SetWhereClause(""); ULONG totalCnt = dbTable->Count(); if (whereCnt > 0 || totalCnt == 0) @@ -2114,7 +2114,7 @@ bool CqueryDlg::ValidateWhereClause() SQLInstallerError(1,&retcode,errMsg,500,&cb); - wxMessageBox("FAILED creating data source","FAILED"); + wxMessageBox("FAILED creating data source","FAILED"); } else wxMessageBox("SUCCEEDED creating data source","SUCCESS"); diff --git a/samples/db/listdb.cpp b/samples/db/listdb.cpp index 39c43be3d4..57e48dd087 100644 --- a/samples/db/listdb.cpp +++ b/samples/db/listdb.cpp @@ -105,7 +105,7 @@ char *GetExtendedDBErrorMsg2(char *ErrFile, int ErrLine) msg += ErrFile; msg += " Line: "; tStr.Printf("%d",ErrLine); - msg += tStr.GetData(); + msg += tStr.c_str(); msg += "\n"; } @@ -126,7 +126,7 @@ char *GetExtendedDBErrorMsg2(char *ErrFile, int ErrLine) if (pDbList->PtrDb->errorList[i]) { msg.Append(pDbList->PtrDb->errorList[i]); - if (strcmp(pDbList->PtrDb->errorList[i],"") != 0) + if (wxStrcmp(pDbList->PtrDb->errorList[i],"") != 0) msg.Append("\n"); } } @@ -149,13 +149,13 @@ Clookup::Clookup(char *tblName, char *colName) : wxDbTable(READONLY_DB, tblName, // Clookup2 constructor Clookup2::Clookup2(char *tblName, char *colName1, char *colName2, wxDb *pDb) - : wxDbTable(pDb, tblName, (1 + (strlen(colName2) > 0)), NULL, !wxDB_QUERY_ONLY, DbConnectInf.defaultDir) + : wxDbTable(pDb, tblName, (1 + (wxStrlen(colName2) > 0)), NULL, !wxDB_QUERY_ONLY, DbConnectInf.defaultDir) { int i = 0; SetColDefs (i, colName1, DB_DATA_TYPE_VARCHAR, lookupCol1, SQL_C_CHAR, LOOKUP_COL_LEN+1, FALSE, FALSE); - if (strlen(colName2) > 0) + if (wxStrlen(colName2) > 0) SetColDefs (++i, colName2, DB_DATA_TYPE_VARCHAR, lookupCol2, SQL_C_CHAR, LOOKUP_COL_LEN+1, FALSE, FALSE); } // Clookup2() @@ -174,7 +174,7 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, cha { wxBeginBusyCursor(); - strcpy(ListDB_Selection,""); + wxStrcpy(ListDB_Selection,""); widgetPtrsSet = FALSE; lookup = 0; lookup2 = 0; @@ -204,8 +204,8 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, cha return; } - lookup->orderBy = orderBy; - lookup->where = where; + lookup->SetOrderByClause(orderBy); + lookup->SetWhereClause(where); if (!lookup->Query()) { wxMessageBox("ODBC error during Query()","ODBC Error..."); @@ -268,12 +268,12 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, { wxBeginBusyCursor(); - strcpy(ListDB_Selection,""); - strcpy(ListDB_Selection2,""); + wxStrcpy(ListDB_Selection,""); + wxStrcpy(ListDB_Selection2,""); widgetPtrsSet = FALSE; lookup = 0; lookup2 = 0; - noDisplayCols = (strlen(dispCol2) ? 2 : 1); + noDisplayCols = (wxStrlen(dispCol2) ? 2 : 1); col1Len = 0; wxFont fixedFont(12,wxMODERN,wxNORMAL,wxNORMAL); @@ -314,14 +314,14 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, else { maxColLen = LOOKUP_COL_LEN; - if (strlen(dispCol2)) + if (wxStrlen(dispCol2)) { wxString q = "SELECT MAX({fn LENGTH("; q += dispCol1; q += ")}), NULL"; q += " FROM "; q += tableName; - if (strlen(where)) + if (wxStrlen(where)) { q += " WHERE "; q += where; @@ -340,7 +340,7 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, } // Query the actual record set - if (selectStmt && strlen(selectStmt)) // Query by sql stmt passed in + if (selectStmt && wxStrlen(selectStmt)) // Query by sql stmt passed in { if (!lookup2->QueryBySqlStmt(selectStmt)) { @@ -351,8 +351,8 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, } else // Query using where and order by clauses { - lookup2->orderBy = orderBy; - lookup2->where = where; + lookup2->SetOrderByClause(orderBy); + lookup2->SetWhereClause(where); if (!lookup2->Query(FALSE, distinctValues)) { wxMessageBox("ODBC error during Query()","ODBC Error..."); @@ -366,9 +366,9 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, while (lookup2->GetNext()) { s = lookup2->lookupCol1; - if (strlen(dispCol2)) // Append the optional column 2 + if (wxStrlen(dispCol2)) // Append the optional column 2 { - s.Append(' ', (maxColLen + LISTDB_NO_SPACES_BETWEEN_COLS - strlen(lookup2->lookupCol1))); + s.Append(' ', (maxColLen + LISTDB_NO_SPACES_BETWEEN_COLS - wxStrlen(lookup2->lookupCol1))); s.Append(lookup2->lookupCol2); } pLookUpSelectList->Append(s); @@ -434,25 +434,25 @@ void ClookUpDlg::OnCommand(wxWindow& win, wxCommandEvent& event) if (pLookUpSelectList->GetSelection() != -1) { if (noDisplayCols == 1) - strcpy (ListDB_Selection, pLookUpSelectList->GetStringSelection()); + wxStrcpy (ListDB_Selection, pLookUpSelectList->GetStringSelection()); else // 2 display columns { wxString s = pLookUpSelectList->GetStringSelection(); // Column 1 s = s.SubString(0, col1Len-1); s = s.Strip(); - strcpy(ListDB_Selection, s); + wxStrcpy(ListDB_Selection, s); // Column 2 s = pLookUpSelectList->GetStringSelection(); s = s.Mid(col1Len + LISTDB_NO_SPACES_BETWEEN_COLS); s = s.Strip(); - strcpy(ListDB_Selection2, s); + wxStrcpy(ListDB_Selection2, s); } } else { - strcpy(ListDB_Selection,""); - strcpy(ListDB_Selection2,""); + wxStrcpy(ListDB_Selection,""); + wxStrcpy(ListDB_Selection2,""); } Close(); } // OK Button @@ -460,8 +460,8 @@ void ClookUpDlg::OnCommand(wxWindow& win, wxCommandEvent& event) // Cancel Button if (widgetName == pLookUpCancelBtn->GetName()) { - strcpy (ListDB_Selection,""); - strcpy (ListDB_Selection2,""); + wxStrcpy (ListDB_Selection,""); + wxStrcpy (ListDB_Selection2,""); Close(); } // Cancel Button }