delete DbConnectInf;
}
-
READONLY_DB = wxDbGetConnection(DbConnectInf);
if (READONLY_DB == 0)
{
wxMessageBox(wxT("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)"), wxT("DB CONNECTION ERROR..."),wxOK | wxICON_EXCLAMATION);
DemoFrame->BuildParameterDialog(NULL);
- DbConnectInf->SetDsn("");
- DbConnectInf->SetUid("");
- DbConnectInf->SetPassword("");
+ delete DbConnectInf;
wxMessageBox(wxT("Now exiting program.\n\nRestart program to try any new settings."),wxT("Notice..."),wxOK | wxICON_INFORMATION);
return(FALSE);
}
*/
bool Ccontact::FetchByName(const wxString &name)
{
- whereStr.Printf(wxT("NAME = '%s'"),name);
+ whereStr.Printf(wxT("NAME = '%s'"),name.c_str());
SetWhereClause(whereStr.c_str());
SetOrderByClause(wxT(""));
if (Contact->GetDb()->Dbms() != dbmsPOSTGRES && Contact->GetDb()->Dbms() != dbmsMY_SQL)
{
- Contact->whereStr.Printf(wxT("NAME = (SELECT MIN(NAME) FROM %s)"),Contact->GetTableName());
+ Contact->whereStr.Printf(wxT("NAME = (SELECT MIN(NAME) FROM %s)"),Contact->GetTableName().c_str());
// NOTE: (const wxChar*) returns a pointer which may not be valid later, so this is short term use only
Contact->SetWhereClause(Contact->whereStr);
}
// CqueryDlg() constructor
-CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], wxChar *pWhereArg) : wxDialog (parent, QUERY_DIALOG, wxT("Query"), wxPoint(-1, -1), wxSize(480, 360))
+CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[],
+ const wxString &pWhereArg) :
+ wxDialog (parent, QUERY_DIALOG, wxT("Query"), wxPoint(-1, -1), wxSize(480, 360))
{
wxBeginBusyCursor();
pDB = pDb;
// Initialize the WHERE clause from the string passed in
- pWhere = pWhereArg; // Save a pointer to the output buffer
- if (wxStrlen(pWhere) > (unsigned int)DB_MAX_WHERE_CLAUSE_LEN) // Check the length of the buffer passed in
+ pWhere = pWhereArg; // Save a pointer to the output buffer
+ if (pWhere.Length() > (unsigned int)DB_MAX_WHERE_CLAUSE_LEN) // Check the length of the buffer passed in
{
wxString s;
s.Printf(wxT("Maximum where clause length exceeded.\nLength must be less than %d"), DB_MAX_WHERE_CLAUSE_LEN+1);
pQueryHintMsg->SetLabel(langQRY_EQ);
- pQuerySqlWhereMtxt->SetValue(pWhere);
+ pQuerySqlWhereMtxt->SetValue(pWhere.c_str());
wxEndBusyCursor();
if (!ValidateWhereClause())
return;
// Copy the where clause to the output buffer and exit
- wxStrcpy(pWhere, pQuerySqlWhereMtxt->GetValue());
+ pWhere = pQuerySqlWhereMtxt->GetValue();
Close();
return;
} // Done button