X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/254a21292b0ccf234ed1dbc6acd37708672ffcc0..d9b0ee1eca921edab7b569859685067f280350fd:/src/common/dbgrid.cpp?ds=sidebyside diff --git a/src/common/dbgrid.cpp b/src/common/dbgrid.cpp index c413ed4691..418d445b16 100644 --- a/src/common/dbgrid.cpp +++ b/src/common/dbgrid.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: dbgrid.cpp +// Name: src/common/dbgrid.cpp // Purpose: Displays a wxDbTable in a wxGrid. // Author: Roger Gammans, Paul Gammans // Modified by: @@ -11,30 +11,24 @@ // Branched From : dbgrid.cpp,v 1.18 2000/12/19 13:00:58 /////////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "dbgrid.h" -#endif - #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif - -#if wxUSE_ODBC -#if wxUSE_GRID +#if wxUSE_ODBC && wxUSE_GRID #ifndef WX_PRECOMP #include "wx/textctrl.h" #include "wx/dc.h" + #include "wx/app.h" #endif // WX_PRECOMP #include "wx/generic/gridctrl.h" #include "wx/dbgrid.h" // DLL options compatibility check: -#include "wx/app.h" WX_CHECK_BUILD_OPTIONS("wxDbGrid") @@ -276,11 +270,16 @@ wxString wxDbGridTableBase::GetTypeName(int WXUNUSED(row), int col) switch(m_data->GetColDefs()[(m_ColInfo[col].DbCol)].SqlCtype) { case SQL_C_CHAR: +#ifdef SQL_C_WCHAR + case SQL_C_WCHAR: +#endif return wxGRID_VALUE_STRING; + case SQL_C_SHORT: case SQL_C_SSHORT: return wxGRID_VALUE_NUMBER; case SQL_C_USHORT: return wxGRID_VALUE_NUMBER; + case SQL_C_LONG: case SQL_C_SLONG: return wxGRID_VALUE_NUMBER; case SQL_C_ULONG: @@ -443,7 +442,7 @@ long wxDbGridTableBase::GetValueAsLong(int row, int col) (sqltype == SQL_C_SLONG) || (sqltype == SQL_C_ULONG)) { - wxVariant val = m_data->GetCol(m_ColInfo[col].DbCol); + wxVariant val = m_data->GetColumn(m_ColInfo[col].DbCol); return val.GetLong(); } wxFAIL_MSG (_T("unknown column, ")); @@ -468,7 +467,7 @@ double wxDbGridTableBase::GetValueAsDouble(int row, int col) (sqltype == SQL_C_FLOAT) || (sqltype == SQL_C_DOUBLE)) { - wxVariant val = m_data->GetCol(m_ColInfo[col].DbCol); + wxVariant val = m_data->GetColumn(m_ColInfo[col].DbCol); return val.GetDouble(); } wxFAIL_MSG (_T("unknown column")); @@ -491,7 +490,7 @@ bool wxDbGridTableBase::GetValueAsBool(int row, int col) (sqltype == SQL_C_SLONG) || (sqltype == SQL_C_ULONG)) { - wxVariant val = m_data->GetCol(m_ColInfo[col].DbCol); + wxVariant val = m_data->GetColumn(m_ColInfo[col].DbCol); return val.GetBool(); } wxFAIL_MSG (_T("unknown column, ")); @@ -520,7 +519,7 @@ void* wxDbGridTableBase::GetValueAsCustom(int row, int col, const wxString& type (sqltype == SQL_C_TIME) || (sqltype == SQL_C_TIMESTAMP)) { - wxVariant val = m_data->GetCol(m_ColInfo[col].DbCol); + wxVariant val = m_data->GetColumn(m_ColInfo[col].DbCol); return new wxDateTime(val.GetDateTime()); } } @@ -557,7 +556,7 @@ void wxDbGridTableBase::SetValueAsCustom(int row, int col, const wxString& typeN } wxVariant val(date); m_rowmodified = true; - m_data->SetCol(m_ColInfo[col].DbCol,val); + m_data->SetColumn(m_ColInfo[col].DbCol,val); } } wxFAIL_MSG (_T("unknown column data type")); @@ -589,7 +588,7 @@ wxString wxDbGridTableBase::GetValue(int row, int col) wxLogDebug(wxT("GetValue() on %i,%i"),row,col); ValidateRow(row); - wxVariant val = m_data->GetCol(m_ColInfo[col].DbCol); + wxVariant val = m_data->GetColumn(m_ColInfo[col].DbCol); wxLogDebug(wxT("\tReturning \"%s\"\n"),val.GetString().c_str()); return val.GetString(); @@ -604,7 +603,7 @@ void wxDbGridTableBase::SetValue(int row, int col,const wxString& value) wxVariant val(value); m_rowmodified = true; - m_data->SetCol(m_ColInfo[col].DbCol,val); + m_data->SetColumn(m_ColInfo[col].DbCol,val); } @@ -616,7 +615,7 @@ void wxDbGridTableBase::SetValueAsLong(int row, int col, long value) wxVariant val(value); m_rowmodified = true; - m_data->SetCol(m_ColInfo[col].DbCol,val); + m_data->SetColumn(m_ColInfo[col].DbCol,val); } @@ -628,7 +627,7 @@ void wxDbGridTableBase::SetValueAsDouble(int row, int col, double value) wxVariant val(value); m_rowmodified = true; - m_data->SetCol(m_ColInfo[col].DbCol,val); + m_data->SetColumn(m_ColInfo[col].DbCol,val); } @@ -641,7 +640,7 @@ void wxDbGridTableBase::SetValueAsBool(int row, int col, bool value) wxVariant val(value); m_rowmodified = true; - m_data->SetCol(m_ColInfo[col].DbCol,val); + m_data->SetColumn(m_ColInfo[col].DbCol,val); } @@ -722,8 +721,6 @@ bool wxDbGridTableBase::Writeback() const #include "wx/arrimpl.cpp" -WX_DEFINE_EXPORTED_OBJARRAY(keyarray); - -#endif // #if wxUSE_GRID -#endif // #if wxUSE_ODBC +WX_DEFINE_EXPORTED_OBJARRAY(keyarray) +#endif // wxUSE_GRID && wxUSE_ODBC