]> git.saurik.com Git - wxWidgets.git/commitdiff
More changes to use the latest wxDb/wxDbTable method enhancements
authorGeorge Tasker <gtasker@allenbrook.com>
Sun, 4 Feb 2001 16:01:33 +0000 (16:01 +0000)
committerGeorge Tasker <gtasker@allenbrook.com>
Sun, 4 Feb 2001 16:01:33 +0000 (16:01 +0000)
More Unicode additions

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9291 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/db/dbtest.cpp
samples/db/dbtest.h

index 9a28a5ddadb13bfc541bdf16d8d8a17cd9f47f11..06dc1c7b124e2c34cec22840dbf15d12fa1e7df3 100644 (file)
@@ -149,15 +149,12 @@ bool DatabaseDemoApp::OnInit()
         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);
     }
@@ -1656,7 +1653,9 @@ END_EVENT_TABLE()
 
  
 // 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();
 
@@ -1667,8 +1666,8 @@ CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], wxChar *pWh
     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);
@@ -1757,7 +1756,7 @@ CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], wxChar *pWh
 
     pQueryHintMsg->SetLabel(langQRY_EQ);
 
-    pQuerySqlWhereMtxt->SetValue(pWhere);
+    pQuerySqlWhereMtxt->SetValue(pWhere.c_str());
 
     wxEndBusyCursor();
 
@@ -1955,7 +1954,7 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
         if (!ValidateWhereClause())
             return;
         // Copy the where clause to the output buffer and exit
-        wxStrcpy(pWhere, pQuerySqlWhereMtxt->GetValue());
+        pWhere = pQuerySqlWhereMtxt->GetValue();
         Close();
         return;
     }  // Done button
index 59d56bbdf0ccdf1bcc7d7ed750b35e65f879ff5c..87911415e9ea9e51f374ff13900ebd27ef8d0520 100644 (file)
@@ -431,7 +431,7 @@ class CqueryDlg : public wxDialog
         wxDbColInf  *colInf;            // Column inf. returned by db->GetColumns()
         wxDbTable   *dbTable;           // generic wxDbTable object for attaching to the table to query
         wxChar      *masterTableName;   // Name of the table that 'dbTable' will be associated with
-        wxChar      *pWhere;            // A pointer to the storage for the resulting where clause
+        wxString     pWhere;            // A pointer to the storage for the resulting where clause
         wxDb        *pDB;
 
     public:
@@ -470,7 +470,7 @@ class CqueryDlg : public wxDialog
 
         wxTextCtrl              *pFocusTxt;
 
-        CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], wxChar *pWhereArg);
+        CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], const wxString &pWhereArg);
         ~CqueryDlg();
 
         void        OnButton( wxCommandEvent &event );