X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/79911be1381234527f94548518da2cdcd74ac84a..c687b303a5040da07009ea93504121aeec56682a:/samples/db/dbtest.cpp?ds=sidebyside diff --git a/samples/db/dbtest.cpp b/samples/db/dbtest.cpp index 2e0bcc003c..8b91e280cd 100644 --- a/samples/db/dbtest.cpp +++ b/samples/db/dbtest.cpp @@ -616,6 +616,22 @@ void CheckSupportForAllDataTypes(wxDb *pDb) wxLogMessage(nativeDataTypeName); } #endif +#ifdef SQL_WVARCHAR + if (DataTypeSupported(pDb,SQL_WVARCHAR, &nativeDataTypeName)) + { + nativeDataTypeName = wxT("SQL_WVARCHAR (") + nativeDataTypeName; + nativeDataTypeName += wxT(")\n"); + wxLogMessage(nativeDataTypeName); + } +#endif +#ifdef SQL_WCHAR + if (DataTypeSupported(pDb,SQL_WCHAR, &nativeDataTypeName)) + { + nativeDataTypeName = wxT("SQL_WCHAR (") + nativeDataTypeName; + nativeDataTypeName += wxT(")\n"); + wxLogMessage(nativeDataTypeName); + } +#endif wxLogMessage(wxT("Done\n")); } // CheckSupportForAllDataTypes() @@ -737,7 +753,7 @@ bool DatabaseDemoApp::ReadParamFile(Cparameters ¶ms) if ((paramFile = wxFopen(PARAM_FILENAME, wxT("r"))) == NULL) { wxString tStr; - tStr.Printf(wxT("Unable to open the parameter file '%s' for reading.\n\nYou must specify the data source, user name, and\npassword that will be used and save those settings."),PARAM_FILENAME); + tStr.Printf(wxT("Unable to open the parameter file '%s' for reading.\n\nYou must specify the data source, user name, and\npassword that will be used and save those settings."),PARAM_FILENAME.c_str()); wxMessageBox(tStr,wxT("File I/O Error..."),wxOK | wxICON_EXCLAMATION); return false; @@ -772,7 +788,7 @@ bool DatabaseDemoApp::WriteParamFile(Cparameters &WXUNUSED(params)) if ((paramFile = wxFopen(PARAM_FILENAME, wxT("wt"))) == NULL) { wxString tStr; - tStr.Printf(wxT("Unable to write/overwrite '%s'."),PARAM_FILENAME); + tStr.Printf(wxT("Unable to write/overwrite '%s'."),PARAM_FILENAME.c_str()); wxMessageBox(tStr,wxT("File I/O Error..."),wxOK | wxICON_EXCLAMATION); return false; } @@ -1287,7 +1303,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& WXUNUSED(event)) if (!Ok) return; - if (saveName.IsEmpty()) + if (saveName.empty()) { wxGetApp().Contact->Initialize(); PutData(); @@ -1403,7 +1419,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& WXUNUSED(event)) } // Enable/Disable the reset button - pResetBtn->Enable(!wxGetApp().Contact->qryWhereStr.IsEmpty()); + pResetBtn->Enable(!wxGetApp().Contact->qryWhereStr.empty()); return; } // Query button @@ -1452,7 +1468,8 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& WXUNUSED(event)) /* const wxString &orderBy */ wxT("NAME"), /* wxDb *pDb */ wxGetApp().READONLY_DB, /* const wxString &defDir */ wxGetApp().DbConnectInf->GetDefaultDir(), - /* bool distinctValues*/ true); + /* bool distinctValues*/ true, + wxEmptyString, 20); if (ListDB_Selection && wxStrlen(ListDB_Selection)) { @@ -1484,7 +1501,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& WXUNUSED(event)) if (wxGetApp().Contact->GetDb()->Catalog(wxEmptyString, wxT("catalog.txt"))) wxMessageBox(wxT("The file 'catalog.txt' was created.")); else - wxMessageBox(wxT("Creation of the file 'catalog.txt' was failed.")); + wxMessageBox(wxT("Creation of the file 'catalog.txt' failed.")); return; } @@ -1523,7 +1540,7 @@ bool CeditorDlg::Initialize() wxGetApp().DbConnectInf->GetDefaultDir())) { wxString tStr; - tStr.Printf(wxT("Unable to open the table '%s'. The table may\nneed to be created.\n\nDo you wish to try to create/clear the table?\n\n"),CONTACT_TABLE_NAME); + tStr.Printf(wxT("Unable to open the table '%s'. The table may\nneed to be created.\n\nDo you wish to try to create/clear the table?\n\n"),CONTACT_TABLE_NAME.c_str()); bool createTable = (wxMessageBox(tStr.c_str(),wxT("Confirm"),wxYES_NO|wxICON_QUESTION) == wxYES); if (!createTable) @@ -1552,7 +1569,7 @@ bool CeditorDlg::Initialize() wxGetApp().DbConnectInf->GetDefaultDir())) { wxString tStr; - tStr.Printf(wxT("Unable to open the table '%s' (likely due to\ninsufficient privileges of the logged in user).\n\n"),CONTACT_TABLE_NAME); + tStr.Printf(wxT("Unable to open the table '%s' (likely due to\ninsufficient privileges of the logged in user).\n\n"),CONTACT_TABLE_NAME.c_str()); wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__TFILE__,__LINE__), wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION); @@ -1564,7 +1581,7 @@ bool CeditorDlg::Initialize() wxGetApp().DbConnectInf->GetDefaultDir())) { wxString tStr; - tStr.Printf(wxT("Unable to open the table '%s' as the table\ndoes not appear to exist in the tablespace available\nto the currently logged in user.\n\n"),CONTACT_TABLE_NAME); + tStr.Printf(wxT("Unable to open the table '%s' as the table\ndoes not appear to exist in the tablespace available\nto the currently logged in user.\n\n"),CONTACT_TABLE_NAME.c_str()); wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__TFILE__,__LINE__), wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION); } @@ -1636,7 +1653,7 @@ bool CeditorDlg::Initialize() pPictSizeTxt = new wxTextCtrl(this, EDITOR_DIALOG_PIC_SIZE_TEXT, wxEmptyString, wxPoint(175,447), wxSize(120, 25), 0, wxDefaultValidator, wxT("PictSizeTxt")); #endif - // Now that all the widgets on the panel are created, its safe to allow ::OnCommand() to + // Now that all the widgets on the panel are created, its safe to allow ::OnCommand() to // handle all widget processing widgetPtrsSet = true; @@ -1707,7 +1724,8 @@ void CeditorDlg::OnSelectPict() if (file.IsOpened()) { - wxFileOffset iSize = file.Length(); + // assume not huge file in sample + long iSize = (long)file.Length(); if ((iSize > 0) && (iSize < MAX_PICTURE_SIZE)) { @@ -1721,7 +1739,7 @@ void CeditorDlg::OnSelectPict() wxMessageBox(wxT("Something bad happened while reading..."), wxT("BLOB Loading Error"), wxOK | wxICON_EXCLAMATION); wxString tStr; - tStr.Printf(wxT("%lu"),iSize); + tStr.Printf(wxT("%ld"),iSize); pPictSizeTxt->SetValue(tStr); } else @@ -1802,7 +1820,7 @@ void CeditorDlg::SetMode(enum DialogModes m) pPrevBtn->Enable( !edit ); pNextBtn->Enable( !edit ); pQueryBtn->Enable( !edit ); - pResetBtn->Enable( !edit && !wxGetApp().Contact->qryWhereStr.IsEmpty() ); + pResetBtn->Enable( !edit && !wxGetApp().Contact->qryWhereStr.empty() ); pNameListBtn->Enable( !edit ); } @@ -2049,7 +2067,7 @@ bool CeditorDlg::GetNextRec() w += wxT("'"); // If a query where string is currently set, append that criteria - if (!wxGetApp().Contact->qryWhereStr.IsEmpty()) + if (!wxGetApp().Contact->qryWhereStr.empty()) { w += wxT(" AND ("); w += wxGetApp().Contact->qryWhereStr; @@ -2085,7 +2103,7 @@ bool CeditorDlg::GetPrevRec() w += wxT("'"); // If a query where string is currently set, append that criteria - if (!wxGetApp().Contact->qryWhereStr.IsEmpty()) + if (!wxGetApp().Contact->qryWhereStr.empty()) { w += wxT(" AND ("); w += wxGetApp().Contact->qryWhereStr; @@ -2893,9 +2911,9 @@ END_EVENT_TABLE() CimageDlg::CimageDlg(wxWindow *parent, wxChar *pImageData, off_t iSize) : wxDialog(parent, IMAGE_DIALOG, wxT("BLOB Image"), wxDefaultPosition, wxDefaultSize), -m_pImage(NULL), +m_pDisplayBmp(NULL), m_pBmp(NULL), -m_pDisplayBmp(NULL) +m_pImage(NULL) { wxMemoryInputStream inStream(pImageData, iSize); @@ -3351,7 +3369,7 @@ bool DbGridFrame::Initialize() wxGetApp().DbConnectInf->GetDefaultDir())) { wxString tStr; - tStr.Printf(wxT("Unable to open the table '%s'.\n\n"),CONTACT_TABLE_NAME); + tStr.Printf(wxT("Unable to open the table '%s'.\n\n"),CONTACT_TABLE_NAME.c_str()); wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__TFILE__,__LINE__), wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION); }