* SYNOPSIS END
*/
-#ifdef __GNUG__
-#pragma implementation "dbtest.h"
-#endif
-
#include "wx/wxprec.h"
#ifdef __BORLANDC__
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()
bool DatabaseDemoApp::OnInit()
{
+ if ( !wxApp::OnInit() )
+ return false;
+
DbConnectInf = NULL;
Contact = NULL;
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;
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;
}
if (!Ok)
return;
- if (saveName.IsEmpty())
+ if (saveName.empty())
{
wxGetApp().Contact->Initialize();
PutData();
}
// Enable/Disable the reset button
- pResetBtn->Enable(!wxGetApp().Contact->qryWhereStr.IsEmpty());
+ pResetBtn->Enable(!wxGetApp().Contact->qryWhereStr.empty());
return;
} // Query button
/* 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))
{
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;
}
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)
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);
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);
}
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;
void CeditorDlg::OnSelectPict()
{
- wxFileDialog dlg(this, wxT("Choose an image file less than 60K"), wxEmptyString, wxEmptyString, wxT("JPEG files (*.jpg)|*.jpg|GIF files (*.gif)|*.gif|BMP files (*.bmp)|*.bmp|All Files (*.*)|*.*"), wxOPEN);
+ wxFileDialog dlg(this, wxT("Choose an image file less than 60K"), wxEmptyString, wxEmptyString, wxT("JPEG files (*.jpg)|*.jpg|GIF files (*.gif)|*.gif|BMP files (*.bmp)|*.bmp|All Files (*.*)|*.*"), wxFD_OPEN);
if (dlg.ShowModal() == wxID_OK)
{
if (file.IsOpened())
{
- off_t iSize = file.Length();
+ // assume not huge file in sample
+ long iSize = (long)file.Length();
if ((iSize > 0) && (iSize < MAX_PICTURE_SIZE))
{
- off_t iReadSize = 0;
-
- wxGetApp().Contact->BlobSize = iSize;
+ wxGetApp().Contact->BlobSize = (size_t)iSize;
memset(wxGetApp().Contact->Picture, 0, MAX_PICTURE_SIZE);
- iReadSize = file.Read(wxGetApp().Contact->Picture, iSize);
+ wxFileOffset iReadSize = file.Read(wxGetApp().Contact->Picture, (size_t)iSize);
if (iReadSize < iSize)
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
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 );
}
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;
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;
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);
if(m_pImage->Ok())
{
- m_pBmp = new wxBitmap(m_pImage);
+ m_pBmp = new wxBitmap(*m_pImage);
m_pDisplayBmp = new wxStaticBitmap(this, IMAGE_DIALOG_STATIC_BMP, *m_pBmp, wxPoint(5,5), wxDefaultSize);
SetSize(m_pBmp->GetWidth() + 10, m_pBmp->GetHeight() + 30);
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);
}