Updated to use the new wxDb/wxDbTable accessors
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7139 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -103,7 +103,7 @@ char *GetExtendedDBErrorMsg(char *ErrFile, int ErrLine)
|
|||||||
msg += ErrFile;
|
msg += ErrFile;
|
||||||
msg += " Line: ";
|
msg += " Line: ";
|
||||||
tStr.Printf("%d",ErrLine);
|
tStr.Printf("%d",ErrLine);
|
||||||
msg += tStr.GetData();
|
msg += tStr.c_str();
|
||||||
msg += "\n";
|
msg += "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ char *GetExtendedDBErrorMsg(char *ErrFile, int ErrLine)
|
|||||||
if (pDbList->PtrDb->errorList[i])
|
if (pDbList->PtrDb->errorList[i])
|
||||||
{
|
{
|
||||||
msg.Append(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");
|
msg.Append("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -187,37 +187,37 @@ bool DatabaseDemoApp::OnInit()
|
|||||||
|
|
||||||
char buffer[1000+1];
|
char buffer[1000+1];
|
||||||
fgets(buffer, sizeof(params.ODBCSource), paramFile);
|
fgets(buffer, sizeof(params.ODBCSource), paramFile);
|
||||||
buffer[strlen(buffer)-1] = '\0';
|
buffer[wxStrlen(buffer)-1] = '\0';
|
||||||
strcpy(params.ODBCSource,buffer);
|
wxStrcpy(params.ODBCSource,buffer);
|
||||||
|
|
||||||
fgets(buffer, sizeof(params.UserName), paramFile);
|
fgets(buffer, sizeof(params.UserName), paramFile);
|
||||||
buffer[strlen(buffer)-1] = '\0';
|
buffer[wxStrlen(buffer)-1] = '\0';
|
||||||
strcpy(params.UserName,buffer);
|
wxStrcpy(params.UserName,buffer);
|
||||||
|
|
||||||
fgets(buffer, sizeof(params.Password), paramFile);
|
fgets(buffer, sizeof(params.Password), paramFile);
|
||||||
buffer[strlen(buffer)-1] = '\0';
|
buffer[wxStrlen(buffer)-1] = '\0';
|
||||||
strcpy(params.Password,buffer);
|
wxStrcpy(params.Password,buffer);
|
||||||
|
|
||||||
fgets(buffer, sizeof(params.DirPath), paramFile);
|
fgets(buffer, sizeof(params.DirPath), paramFile);
|
||||||
buffer[strlen(buffer)-1] = '\0';
|
buffer[wxStrlen(buffer)-1] = '\0';
|
||||||
strcpy(params.DirPath,buffer);
|
wxStrcpy(params.DirPath,buffer);
|
||||||
|
|
||||||
fclose(paramFile);
|
fclose(paramFile);
|
||||||
|
|
||||||
// Connect to datasource
|
// Connect to datasource
|
||||||
strcpy(DbConnectInf.Dsn, params.ODBCSource); // ODBC data source name (created with ODBC Administrator under Win95/NT)
|
wxStrcpy(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
|
wxStrcpy(DbConnectInf.Uid, params.UserName); // database username - must already exist in the data source
|
||||||
strcpy(DbConnectInf.AuthStr, params.Password); // password database username
|
wxStrcpy(DbConnectInf.AuthStr, params.Password); // password database username
|
||||||
strcpy(DbConnectInf.defaultDir, params.DirPath); // path where the table exists (needed for dBase)
|
wxStrcpy(DbConnectInf.defaultDir, params.DirPath); // path where the table exists (needed for dBase)
|
||||||
|
|
||||||
READONLY_DB = wxDbGetConnection(&DbConnectInf);
|
READONLY_DB = wxDbGetConnection(&DbConnectInf);
|
||||||
if (READONLY_DB == 0)
|
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);
|
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);
|
DemoFrame->BuildParameterDialog(NULL);
|
||||||
strcpy(DbConnectInf.Dsn, "");
|
wxStrcpy(DbConnectInf.Dsn, "");
|
||||||
strcpy(DbConnectInf.Uid, "");
|
wxStrcpy(DbConnectInf.Uid, "");
|
||||||
strcpy(DbConnectInf.AuthStr, "");
|
wxStrcpy(DbConnectInf.AuthStr, "");
|
||||||
wxMessageBox("Now exiting program.\n\nRestart program to try any new settings.","Notice...",wxOK | wxICON_INFORMATION);
|
wxMessageBox("Now exiting program.\n\nRestart program to try any new settings.","Notice...",wxOK | wxICON_INFORMATION);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
@@ -278,9 +278,9 @@ void DatabaseDemoFrame::OnCloseWindow(wxCloseEvent& event)
|
|||||||
if (pEditorDlg->Close())
|
if (pEditorDlg->Close())
|
||||||
pEditorDlg = NULL;
|
pEditorDlg = NULL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
event.Veto();
|
event.Veto();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleans up the environment space allocated for the SQL/ODBC connection handle
|
// Cleans up the environment space allocated for the SQL/ODBC connection handle
|
||||||
@@ -410,7 +410,7 @@ Ccontact::~Ccontact()
|
|||||||
{
|
{
|
||||||
if (freeDbConn)
|
if (freeDbConn)
|
||||||
{
|
{
|
||||||
if (!wxDbFreeConnection(pDb))
|
if (!wxDbFreeConnection(GetDb()))
|
||||||
{
|
{
|
||||||
wxString tStr;
|
wxString tStr;
|
||||||
tStr = "Unable to Free the Ccontact data table handle\n\n";
|
tStr = "Unable to Free the Ccontact data table handle\n\n";
|
||||||
@@ -454,15 +454,15 @@ bool Ccontact::CreateIndexes(void)
|
|||||||
|
|
||||||
bool Ok = TRUE;
|
bool Ok = TRUE;
|
||||||
|
|
||||||
strcpy(idxDef[0].ColName, "IS_DEV");
|
wxStrcpy(idxDef[0].ColName, "IS_DEV");
|
||||||
idxDef[0].Ascending = TRUE;
|
idxDef[0].Ascending = TRUE;
|
||||||
|
|
||||||
strcpy(idxDef[1].ColName, "NAME");
|
wxStrcpy(idxDef[1].ColName, "NAME");
|
||||||
idxDef[1].Ascending = TRUE;
|
idxDef[1].Ascending = TRUE;
|
||||||
|
|
||||||
indexName = CONTACT_TABLE_NAME;
|
indexName = GetTableName();
|
||||||
indexName += "_IDX1";
|
indexName += "_IDX1";
|
||||||
Ok = CreateIndex((char*) (const char*) indexName, TRUE, 2, idxDef);
|
Ok = CreateIndex(indexName.c_str(), TRUE, 2, idxDef);
|
||||||
|
|
||||||
return Ok;
|
return Ok;
|
||||||
} // Ccontact::CreateIndexes()
|
} // Ccontact::CreateIndexes()
|
||||||
@@ -476,8 +476,8 @@ bool Ccontact::CreateIndexes(void)
|
|||||||
bool Ccontact::FetchByName(char *name)
|
bool Ccontact::FetchByName(char *name)
|
||||||
{
|
{
|
||||||
whereStr.Printf("NAME = '%s'",name);
|
whereStr.Printf("NAME = '%s'",name);
|
||||||
where = (char*) (const char*) this->whereStr;
|
SetWhereClause(whereStr.c_str());
|
||||||
orderBy = "";
|
SetOrderByClause("");
|
||||||
|
|
||||||
if (!Query())
|
if (!Query())
|
||||||
return(FALSE);
|
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
|
// 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
|
// 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;
|
wxString tStr;
|
||||||
tStr.Printf("Unable to open the table '%s'.\n\nTable may need to be created...?\n\n",CONTACT_TABLE_NAME);
|
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
|
// 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
|
// 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.
|
// 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;
|
wxString tStr;
|
||||||
tStr.Printf("Unable to open the table '%s'.\n\n",CONTACT_TABLE_NAME);
|
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
|
// 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
|
// 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
|
// 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
|
// 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"
|
// 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).
|
// 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
|
// 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
|
else
|
||||||
Contact->where = "";
|
Contact->SetWhereClause("");
|
||||||
|
|
||||||
// Perform the Query to get the result set.
|
// 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.
|
// 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
|
// of Ccontact is deleted. If the Commit wasn't performed, the
|
||||||
// database will automatically Rollback the changes when the database
|
// database will automatically Rollback the changes when the database
|
||||||
// connection is terminated
|
// connection is terminated
|
||||||
Contact->pDb->CommitTrans();
|
Contact->GetDb()->CommitTrans();
|
||||||
|
|
||||||
// Try to get the row that followed the just deleted row in the orderBy sequence
|
// Try to get the row that followed the just deleted row in the orderBy sequence
|
||||||
if (!GetNextRec())
|
if (!GetNextRec())
|
||||||
@@ -767,7 +767,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
// Delete failed
|
// Delete failed
|
||||||
Contact->pDb->RollbackTrans();
|
Contact->GetDb()->RollbackTrans();
|
||||||
|
|
||||||
SetMode(mView);
|
SetMode(mView);
|
||||||
return;
|
return;
|
||||||
@@ -786,7 +786,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
|
|||||||
if (!Ok)
|
if (!Ok)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!strcmp((const char*) saveName,""))
|
if (!wxStrcmp((const char*) saveName,""))
|
||||||
{
|
{
|
||||||
Contact->Initialize();
|
Contact->Initialize();
|
||||||
PutData();
|
PutData();
|
||||||
@@ -805,15 +805,15 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Previous record not available, retrieve first record in table
|
// 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 = "NAME = (SELECT MIN(NAME) FROM ";
|
||||||
Contact->whereStr += Contact->tableName;
|
Contact->whereStr += Contact->GetTableName();
|
||||||
Contact->whereStr += ")";
|
Contact->whereStr += ")";
|
||||||
Contact->where = (char*) (const char*) Contact->whereStr;
|
Contact->SetWhereClause(Contact->whereStr.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Contact->where = "";
|
Contact->SetWhereClause("");
|
||||||
|
|
||||||
if (!Contact->Query())
|
if (!Contact->Query())
|
||||||
{
|
{
|
||||||
@@ -855,19 +855,19 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
|
|||||||
{
|
{
|
||||||
// Display the query dialog box
|
// Display the query dialog box
|
||||||
char qryWhere[DB_MAX_WHERE_CLAUSE_LEN+1];
|
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};
|
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
|
// Query the first record in the new record set and
|
||||||
// display it, if the query string has changed.
|
// 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->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 = "NAME = (SELECT MIN(NAME) FROM ";
|
||||||
Contact->whereStr += CONTACT_TABLE_NAME;
|
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)
|
// Append the query where string (if there is one)
|
||||||
Contact->qryWhereStr = qryWhere;
|
Contact->qryWhereStr = qryWhere;
|
||||||
if (strlen(qryWhere))
|
if (wxStrlen(qryWhere))
|
||||||
{
|
{
|
||||||
Contact->whereStr += " WHERE ";
|
Contact->whereStr += " WHERE ";
|
||||||
Contact->whereStr += Contact->qryWhereStr;
|
Contact->whereStr += Contact->qryWhereStr;
|
||||||
@@ -883,7 +883,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
|
|||||||
// Close the expression with a right paren
|
// Close the expression with a right paren
|
||||||
Contact->whereStr += ")";
|
Contact->whereStr += ")";
|
||||||
// Requery the table
|
// Requery the table
|
||||||
Contact->where = (char*) (const char*) Contact->whereStr;
|
Contact->SetWhereClause(Contact->whereStr.c_str());
|
||||||
if (!Contact->Query())
|
if (!Contact->Query())
|
||||||
{
|
{
|
||||||
wxString tStr;
|
wxString tStr;
|
||||||
@@ -909,16 +909,16 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
|
|||||||
{
|
{
|
||||||
// Clear the additional where criteria established by the query feature
|
// Clear the additional where criteria established by the query feature
|
||||||
Contact->qryWhereStr = "";
|
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 = "NAME = (SELECT MIN(NAME) FROM ";
|
||||||
Contact->whereStr += CONTACT_TABLE_NAME;
|
Contact->whereStr += CONTACT_TABLE_NAME;
|
||||||
Contact->whereStr += ")";
|
Contact->whereStr += ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
Contact->where = (char*) (const char*) Contact->whereStr;
|
Contact->SetWhereClause(Contact->whereStr.c_str());
|
||||||
if (!Contact->Query())
|
if (!Contact->Query())
|
||||||
{
|
{
|
||||||
wxString tStr;
|
wxString tStr;
|
||||||
@@ -947,7 +947,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
|
|||||||
/* char *orderBy */ "NAME",
|
/* char *orderBy */ "NAME",
|
||||||
/* bool distinctValues */ TRUE);
|
/* bool distinctValues */ TRUE);
|
||||||
|
|
||||||
if (ListDB_Selection && strlen(ListDB_Selection))
|
if (ListDB_Selection && wxStrlen(ListDB_Selection))
|
||||||
{
|
{
|
||||||
wxString w = "NAME = '";
|
wxString w = "NAME = '";
|
||||||
w += ListDB_Selection;
|
w += ListDB_Selection;
|
||||||
@@ -1002,9 +1002,9 @@ void CeditorDlg::SetMode(enum DialogModes m)
|
|||||||
if (widgetPtrsSet)
|
if (widgetPtrsSet)
|
||||||
{
|
{
|
||||||
pCreateBtn->Enable( !edit );
|
pCreateBtn->Enable( !edit );
|
||||||
pEditBtn->Enable( !edit && (strcmp(Contact->Name,"")!=0) );
|
pEditBtn->Enable( !edit && (wxStrcmp(Contact->Name,"")!=0) );
|
||||||
pDeleteBtn->Enable( !edit && (strcmp(Contact->Name,"")!=0) );
|
pDeleteBtn->Enable( !edit && (wxStrcmp(Contact->Name,"")!=0) );
|
||||||
pCopyBtn->Enable( !edit && (strcmp(Contact->Name,"")!=0) );
|
pCopyBtn->Enable( !edit && (wxStrcmp(Contact->Name,"")!=0) );
|
||||||
pSaveBtn->Enable( edit );
|
pSaveBtn->Enable( edit );
|
||||||
pCancelBtn->Enable( edit );
|
pCancelBtn->Enable( edit );
|
||||||
pPrevBtn->Enable( !edit );
|
pPrevBtn->Enable( !edit );
|
||||||
@@ -1061,7 +1061,7 @@ bool CeditorDlg::GetData()
|
|||||||
|
|
||||||
wxString tStr;
|
wxString tStr;
|
||||||
tStr = pNameTxt->GetValue();
|
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);
|
wxMessageBox("A name is required for entry into the contact table","Notice...",wxOK | wxICON_INFORMATION);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -1133,13 +1133,13 @@ bool CeditorDlg::GetData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
tStr = pNameTxt->GetValue();
|
tStr = pNameTxt->GetValue();
|
||||||
strcpy(Contact->Name,(const char*) tStr);
|
wxStrcpy(Contact->Name,(const char*) tStr);
|
||||||
strcpy(Contact->Addr1,pAddress1Txt->GetValue());
|
wxStrcpy(Contact->Addr1,pAddress1Txt->GetValue());
|
||||||
strcpy(Contact->Addr2,pAddress2Txt->GetValue());
|
wxStrcpy(Contact->Addr2,pAddress2Txt->GetValue());
|
||||||
strcpy(Contact->City,pCityTxt->GetValue());
|
wxStrcpy(Contact->City,pCityTxt->GetValue());
|
||||||
strcpy(Contact->State,pStateTxt->GetValue());
|
wxStrcpy(Contact->State,pStateTxt->GetValue());
|
||||||
strcpy(Contact->Country,pCountryTxt->GetValue());
|
wxStrcpy(Contact->Country,pCountryTxt->GetValue());
|
||||||
strcpy(Contact->PostalCode,pPostalCodeTxt->GetValue());
|
wxStrcpy(Contact->PostalCode,pPostalCodeTxt->GetValue());
|
||||||
|
|
||||||
Contact->Contributions = atoi(pContribTxt->GetValue());
|
Contact->Contributions = atoi(pContribTxt->GetValue());
|
||||||
Contact->LinesOfCode = atol(pLinesTxt->GetValue());
|
Contact->LinesOfCode = atol(pLinesTxt->GetValue());
|
||||||
@@ -1213,11 +1213,11 @@ bool CeditorDlg::Save()
|
|||||||
|
|
||||||
if (!failed)
|
if (!failed)
|
||||||
{
|
{
|
||||||
Contact->pDb->CommitTrans();
|
Contact->GetDb()->CommitTrans();
|
||||||
SetMode(mView); // Sets the dialog mode back to viewing after save is successful
|
SetMode(mView); // Sets the dialog mode back to viewing after save is successful
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Contact->pDb->RollbackTrans();
|
Contact->GetDb()->RollbackTrans();
|
||||||
|
|
||||||
wxEndBusyCursor();
|
wxEndBusyCursor();
|
||||||
}
|
}
|
||||||
@@ -1235,10 +1235,10 @@ bool CeditorDlg::GetNextRec()
|
|||||||
{
|
{
|
||||||
wxString w;
|
wxString w;
|
||||||
|
|
||||||
if (Contact->pDb->Dbms() != dbmsPOSTGRES)
|
if (Contact->GetDb()->Dbms() != dbmsPOSTGRES)
|
||||||
{
|
{
|
||||||
w = "NAME = (SELECT MIN(NAME) FROM ";
|
w = "NAME = (SELECT MIN(NAME) FROM ";
|
||||||
w += Contact->tableName;
|
w += Contact->GetTableName();
|
||||||
w += " WHERE NAME > '";
|
w += " WHERE NAME > '";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1270,10 +1270,10 @@ bool CeditorDlg::GetPrevRec()
|
|||||||
{
|
{
|
||||||
wxString w;
|
wxString w;
|
||||||
|
|
||||||
if (Contact->pDb->Dbms() != dbmsPOSTGRES)
|
if (Contact->GetDb()->Dbms() != dbmsPOSTGRES)
|
||||||
{
|
{
|
||||||
w = "NAME = (SELECT MAX(NAME) FROM ";
|
w = "NAME = (SELECT MAX(NAME) FROM ";
|
||||||
w += Contact->tableName;
|
w += Contact->GetTableName();
|
||||||
w += " WHERE NAME < '";
|
w += " WHERE NAME < '";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1303,8 +1303,8 @@ bool CeditorDlg::GetPrevRec()
|
|||||||
*/
|
*/
|
||||||
bool CeditorDlg::GetRec(char *whereStr)
|
bool CeditorDlg::GetRec(char *whereStr)
|
||||||
{
|
{
|
||||||
Contact->where = whereStr;
|
Contact->SetWhereClause(whereStr);
|
||||||
Contact->orderBy = "NAME";
|
Contact->SetOrderByClause("NAME");
|
||||||
|
|
||||||
if (!Contact->Query())
|
if (!Contact->Query())
|
||||||
{
|
{
|
||||||
@@ -1458,7 +1458,7 @@ bool CparameterDlg::GetData()
|
|||||||
wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION);
|
wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
strcpy(wxGetApp().params.ODBCSource, tStr);
|
wxStrcpy(wxGetApp().params.ODBCSource, tStr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -1471,7 +1471,7 @@ bool CparameterDlg::GetData()
|
|||||||
wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION);
|
wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
strcpy(wxGetApp().params.UserName, tStr);
|
wxStrcpy(wxGetApp().params.UserName, tStr);
|
||||||
|
|
||||||
tStr = pParamPasswordTxt->GetValue();
|
tStr = pParamPasswordTxt->GetValue();
|
||||||
if (tStr.Length() > (sizeof(wxGetApp().params.Password)-1))
|
if (tStr.Length() > (sizeof(wxGetApp().params.Password)-1))
|
||||||
@@ -1481,7 +1481,7 @@ bool CparameterDlg::GetData()
|
|||||||
wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION);
|
wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
strcpy(wxGetApp().params.Password,tStr);
|
wxStrcpy(wxGetApp().params.Password,tStr);
|
||||||
|
|
||||||
tStr = pParamDirPathTxt->GetValue();
|
tStr = pParamDirPathTxt->GetValue();
|
||||||
tStr.Replace("\\","/");
|
tStr.Replace("\\","/");
|
||||||
@@ -1492,7 +1492,7 @@ bool CparameterDlg::GetData()
|
|||||||
wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION);
|
wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
strcpy(wxGetApp().params.DirPath,tStr);
|
wxStrcpy(wxGetApp().params.DirPath,tStr);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} // CparameterDlg::GetData()
|
} // CparameterDlg::GetData()
|
||||||
|
|
||||||
@@ -1543,7 +1543,7 @@ void CparameterDlg::FillDataSourceList()
|
|||||||
char **p = strList.ListToArray();
|
char **p = strList.ListToArray();
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; strlen(p[i]); i++)
|
for (i = 0; wxStrlen(p[i]); i++)
|
||||||
pParamODBCSourceList->Append(p[i]);
|
pParamODBCSourceList->Append(p[i]);
|
||||||
} // CparameterDlg::CparameterDlg::FillDataSourceList()
|
} // 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
|
// Initialize the WHERE clause from the string passed in
|
||||||
pWhere = pWhereArg; // Save a pointer to the output buffer
|
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;
|
wxString s;
|
||||||
s.Printf("Maximum where clause length exceeded.\nLength must be less than %d", DB_MAX_WHERE_CLAUSE_LEN+1);
|
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;
|
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
|
// If there is more than one table being queried, qualify
|
||||||
// the column names with the table name prefix.
|
// 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);
|
qualName.Printf("%s.%s", colInf[i].tableName, colInf[i].colName);
|
||||||
pQueryCol1Choice->Append(qualName);
|
pQueryCol1Choice->Append(qualName);
|
||||||
@@ -1848,7 +1848,7 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
|
|||||||
if (widgetName == pQueryDoneBtn->GetName())
|
if (widgetName == pQueryDoneBtn->GetName())
|
||||||
{
|
{
|
||||||
// Be sure the where clause will not overflow the output buffer
|
// 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;
|
wxString s;
|
||||||
s.Printf("Maximum where clause length exceeded.\nLength must be less than %d", DB_MAX_WHERE_CLAUSE_LEN+1);
|
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())
|
if (!ValidateWhereClause())
|
||||||
return;
|
return;
|
||||||
// Copy the where clause to the output buffer and exit
|
// Copy the where clause to the output buffer and exit
|
||||||
strcpy(pWhere, pQuerySqlWhereMtxt->GetValue());
|
wxStrcpy(pWhere, pQuerySqlWhereMtxt->GetValue());
|
||||||
Close();
|
Close();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1908,7 +1908,7 @@ void CqueryDlg::OnCloseWindow(wxCloseEvent& event)
|
|||||||
while (wxIsBusy())
|
while (wxIsBusy())
|
||||||
wxEndBusyCursor();
|
wxEndBusyCursor();
|
||||||
|
|
||||||
Show(FALSE);
|
Show(FALSE);
|
||||||
this->Destroy();
|
this->Destroy();
|
||||||
|
|
||||||
} // CqueryDlg::OnCloseWindow()
|
} // CqueryDlg::OnCloseWindow()
|
||||||
@@ -1931,7 +1931,7 @@ void CqueryDlg::ProcessAddBtn()
|
|||||||
if (pQueryCol2Choice->GetSelection() == 0) // "Value" is selected
|
if (pQueryCol2Choice->GetSelection() == 0) // "Value" is selected
|
||||||
{
|
{
|
||||||
// Verify that value 1 is filled in
|
// Verify that value 1 is filled in
|
||||||
if (strlen(pQueryValue1Txt->GetValue()) == 0)
|
if (wxStrlen(pQueryValue1Txt->GetValue()) == 0)
|
||||||
{
|
{
|
||||||
wxBell();
|
wxBell();
|
||||||
pQueryValue1Txt->SetFocus();
|
pQueryValue1Txt->SetFocus();
|
||||||
@@ -1939,7 +1939,7 @@ void CqueryDlg::ProcessAddBtn()
|
|||||||
}
|
}
|
||||||
// For the BETWEEN operator, value 2 must be filled in as well
|
// For the BETWEEN operator, value 2 must be filled in as well
|
||||||
if (oper == qryOpBETWEEN &&
|
if (oper == qryOpBETWEEN &&
|
||||||
strlen(pQueryValue2Txt->GetValue()) == 0)
|
wxStrlen(pQueryValue2Txt->GetValue()) == 0)
|
||||||
{
|
{
|
||||||
wxBell();
|
wxBell();
|
||||||
pQueryValue2Txt->SetFocus();
|
pQueryValue2Txt->SetFocus();
|
||||||
@@ -2047,14 +2047,14 @@ void CqueryDlg::ProcessCountBtn()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Count() with WHERE clause
|
// Count() with WHERE clause
|
||||||
wxString whereStr;
|
wxString whereStr;
|
||||||
|
|
||||||
whereStr = pQuerySqlWhereMtxt->GetValue();
|
whereStr = pQuerySqlWhereMtxt->GetValue();
|
||||||
dbTable->where = (char *)whereStr.GetData();
|
dbTable->SetWhereClause(whereStr.c_str());
|
||||||
ULONG whereCnt = dbTable->Count();
|
ULONG whereCnt = dbTable->Count();
|
||||||
|
|
||||||
// Count() of all records in the table
|
// Count() of all records in the table
|
||||||
dbTable->where = "";
|
dbTable->SetWhereClause("");
|
||||||
ULONG totalCnt = dbTable->Count();
|
ULONG totalCnt = dbTable->Count();
|
||||||
|
|
||||||
if (whereCnt > 0 || totalCnt == 0)
|
if (whereCnt > 0 || totalCnt == 0)
|
||||||
@@ -2114,7 +2114,7 @@ bool CqueryDlg::ValidateWhereClause()
|
|||||||
|
|
||||||
SQLInstallerError(1,&retcode,errMsg,500,&cb);
|
SQLInstallerError(1,&retcode,errMsg,500,&cb);
|
||||||
|
|
||||||
wxMessageBox("FAILED creating data source","FAILED");
|
wxMessageBox("FAILED creating data source","FAILED");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
wxMessageBox("SUCCEEDED creating data source","SUCCESS");
|
wxMessageBox("SUCCEEDED creating data source","SUCCESS");
|
||||||
|
@@ -105,7 +105,7 @@ char *GetExtendedDBErrorMsg2(char *ErrFile, int ErrLine)
|
|||||||
msg += ErrFile;
|
msg += ErrFile;
|
||||||
msg += " Line: ";
|
msg += " Line: ";
|
||||||
tStr.Printf("%d",ErrLine);
|
tStr.Printf("%d",ErrLine);
|
||||||
msg += tStr.GetData();
|
msg += tStr.c_str();
|
||||||
msg += "\n";
|
msg += "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ char *GetExtendedDBErrorMsg2(char *ErrFile, int ErrLine)
|
|||||||
if (pDbList->PtrDb->errorList[i])
|
if (pDbList->PtrDb->errorList[i])
|
||||||
{
|
{
|
||||||
msg.Append(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");
|
msg.Append("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,13 +149,13 @@ Clookup::Clookup(char *tblName, char *colName) : wxDbTable(READONLY_DB, tblName,
|
|||||||
|
|
||||||
// Clookup2 constructor
|
// Clookup2 constructor
|
||||||
Clookup2::Clookup2(char *tblName, char *colName1, char *colName2, wxDb *pDb)
|
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;
|
int i = 0;
|
||||||
|
|
||||||
SetColDefs (i, colName1, DB_DATA_TYPE_VARCHAR, lookupCol1, SQL_C_CHAR, LOOKUP_COL_LEN+1, FALSE, FALSE);
|
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);
|
SetColDefs (++i, colName2, DB_DATA_TYPE_VARCHAR, lookupCol2, SQL_C_CHAR, LOOKUP_COL_LEN+1, FALSE, FALSE);
|
||||||
|
|
||||||
} // Clookup2()
|
} // Clookup2()
|
||||||
@@ -174,7 +174,7 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, cha
|
|||||||
{
|
{
|
||||||
wxBeginBusyCursor();
|
wxBeginBusyCursor();
|
||||||
|
|
||||||
strcpy(ListDB_Selection,"");
|
wxStrcpy(ListDB_Selection,"");
|
||||||
widgetPtrsSet = FALSE;
|
widgetPtrsSet = FALSE;
|
||||||
lookup = 0;
|
lookup = 0;
|
||||||
lookup2 = 0;
|
lookup2 = 0;
|
||||||
@@ -204,8 +204,8 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, cha
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lookup->orderBy = orderBy;
|
lookup->SetOrderByClause(orderBy);
|
||||||
lookup->where = where;
|
lookup->SetWhereClause(where);
|
||||||
if (!lookup->Query())
|
if (!lookup->Query())
|
||||||
{
|
{
|
||||||
wxMessageBox("ODBC error during Query()","ODBC Error...");
|
wxMessageBox("ODBC error during Query()","ODBC Error...");
|
||||||
@@ -268,12 +268,12 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName,
|
|||||||
{
|
{
|
||||||
wxBeginBusyCursor();
|
wxBeginBusyCursor();
|
||||||
|
|
||||||
strcpy(ListDB_Selection,"");
|
wxStrcpy(ListDB_Selection,"");
|
||||||
strcpy(ListDB_Selection2,"");
|
wxStrcpy(ListDB_Selection2,"");
|
||||||
widgetPtrsSet = FALSE;
|
widgetPtrsSet = FALSE;
|
||||||
lookup = 0;
|
lookup = 0;
|
||||||
lookup2 = 0;
|
lookup2 = 0;
|
||||||
noDisplayCols = (strlen(dispCol2) ? 2 : 1);
|
noDisplayCols = (wxStrlen(dispCol2) ? 2 : 1);
|
||||||
col1Len = 0;
|
col1Len = 0;
|
||||||
|
|
||||||
wxFont fixedFont(12,wxMODERN,wxNORMAL,wxNORMAL);
|
wxFont fixedFont(12,wxMODERN,wxNORMAL,wxNORMAL);
|
||||||
@@ -314,14 +314,14 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
maxColLen = LOOKUP_COL_LEN;
|
maxColLen = LOOKUP_COL_LEN;
|
||||||
if (strlen(dispCol2))
|
if (wxStrlen(dispCol2))
|
||||||
{
|
{
|
||||||
wxString q = "SELECT MAX({fn LENGTH(";
|
wxString q = "SELECT MAX({fn LENGTH(";
|
||||||
q += dispCol1;
|
q += dispCol1;
|
||||||
q += ")}), NULL";
|
q += ")}), NULL";
|
||||||
q += " FROM ";
|
q += " FROM ";
|
||||||
q += tableName;
|
q += tableName;
|
||||||
if (strlen(where))
|
if (wxStrlen(where))
|
||||||
{
|
{
|
||||||
q += " WHERE ";
|
q += " WHERE ";
|
||||||
q += where;
|
q += where;
|
||||||
@@ -340,7 +340,7 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Query the actual record set
|
// 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))
|
if (!lookup2->QueryBySqlStmt(selectStmt))
|
||||||
{
|
{
|
||||||
@@ -351,8 +351,8 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName,
|
|||||||
}
|
}
|
||||||
else // Query using where and order by clauses
|
else // Query using where and order by clauses
|
||||||
{
|
{
|
||||||
lookup2->orderBy = orderBy;
|
lookup2->SetOrderByClause(orderBy);
|
||||||
lookup2->where = where;
|
lookup2->SetWhereClause(where);
|
||||||
if (!lookup2->Query(FALSE, distinctValues))
|
if (!lookup2->Query(FALSE, distinctValues))
|
||||||
{
|
{
|
||||||
wxMessageBox("ODBC error during Query()","ODBC Error...");
|
wxMessageBox("ODBC error during Query()","ODBC Error...");
|
||||||
@@ -366,9 +366,9 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName,
|
|||||||
while (lookup2->GetNext())
|
while (lookup2->GetNext())
|
||||||
{
|
{
|
||||||
s = lookup2->lookupCol1;
|
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);
|
s.Append(lookup2->lookupCol2);
|
||||||
}
|
}
|
||||||
pLookUpSelectList->Append(s);
|
pLookUpSelectList->Append(s);
|
||||||
@@ -434,25 +434,25 @@ void ClookUpDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
|
|||||||
if (pLookUpSelectList->GetSelection() != -1)
|
if (pLookUpSelectList->GetSelection() != -1)
|
||||||
{
|
{
|
||||||
if (noDisplayCols == 1)
|
if (noDisplayCols == 1)
|
||||||
strcpy (ListDB_Selection, pLookUpSelectList->GetStringSelection());
|
wxStrcpy (ListDB_Selection, pLookUpSelectList->GetStringSelection());
|
||||||
else // 2 display columns
|
else // 2 display columns
|
||||||
{
|
{
|
||||||
wxString s = pLookUpSelectList->GetStringSelection();
|
wxString s = pLookUpSelectList->GetStringSelection();
|
||||||
// Column 1
|
// Column 1
|
||||||
s = s.SubString(0, col1Len-1);
|
s = s.SubString(0, col1Len-1);
|
||||||
s = s.Strip();
|
s = s.Strip();
|
||||||
strcpy(ListDB_Selection, s);
|
wxStrcpy(ListDB_Selection, s);
|
||||||
// Column 2
|
// Column 2
|
||||||
s = pLookUpSelectList->GetStringSelection();
|
s = pLookUpSelectList->GetStringSelection();
|
||||||
s = s.Mid(col1Len + LISTDB_NO_SPACES_BETWEEN_COLS);
|
s = s.Mid(col1Len + LISTDB_NO_SPACES_BETWEEN_COLS);
|
||||||
s = s.Strip();
|
s = s.Strip();
|
||||||
strcpy(ListDB_Selection2, s);
|
wxStrcpy(ListDB_Selection2, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(ListDB_Selection,"");
|
wxStrcpy(ListDB_Selection,"");
|
||||||
strcpy(ListDB_Selection2,"");
|
wxStrcpy(ListDB_Selection2,"");
|
||||||
}
|
}
|
||||||
Close();
|
Close();
|
||||||
} // OK Button
|
} // OK Button
|
||||||
@@ -460,8 +460,8 @@ void ClookUpDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
|
|||||||
// Cancel Button
|
// Cancel Button
|
||||||
if (widgetName == pLookUpCancelBtn->GetName())
|
if (widgetName == pLookUpCancelBtn->GetName())
|
||||||
{
|
{
|
||||||
strcpy (ListDB_Selection,"");
|
wxStrcpy (ListDB_Selection,"");
|
||||||
strcpy (ListDB_Selection2,"");
|
wxStrcpy (ListDB_Selection2,"");
|
||||||
Close();
|
Close();
|
||||||
} // Cancel Button
|
} // Cancel Button
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user