]> git.saurik.com Git - wxWidgets.git/blob - src/common/dbgrid.cpp
fixed wxTaskBarIcon compilation
[wxWidgets.git] / src / common / dbgrid.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: dbgrid.cpp
3 // Purpose: Displays a wxDbTable in a wxGrid.
4 // Author: Roger Gammans, Paul Gammans
5 // Modified by:
6 // Created:
7 // RCS-ID: $Id$
8 // Copyright: (c) 1999 The Computer Surgery (roger@computer-surgery.co.uk)
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11 // Branched From : dbgrid.cpp,v 1.18 2000/12/19 13:00:58
12 ///////////////////////////////////////////////////////////////////////////////
13
14 #ifdef __GNUG__
15 #pragma implementation "dbgrid.h"
16 #endif
17
18 #include "wx/wxprec.h"
19
20 #ifdef __BORLANDC__
21 #pragma hdrstop
22 #endif
23
24
25 #if wxUSE_ODBC
26 #if wxUSE_NEW_GRID
27
28 #ifndef WX_PRECOMP
29 #include "wx/textctrl.h"
30 #include "wx/dc.h"
31 #endif // WX_PRECOMP
32
33 #include "wx/generic/gridctrl.h"
34 #include "wx/dbgrid.h"
35
36
37 wxDbGridCellAttrProvider::wxDbGridCellAttrProvider()
38 {
39 m_data=NULL;
40 m_ColInfo=NULL;
41 }
42
43 wxDbGridCellAttrProvider::wxDbGridCellAttrProvider(wxDbTable *tab, wxDbGridColInfoBase* ColInfo)
44 {
45 m_data=tab;
46 m_ColInfo=ColInfo;
47 }
48
49 wxDbGridCellAttrProvider::~wxDbGridCellAttrProvider()
50 {
51 }
52
53 wxGridCellAttr *wxDbGridCellAttrProvider::GetAttr(int row, int col,
54 wxGridCellAttr::wxAttrKind kind) const
55 {
56 wxGridCellAttr *attr = wxGridCellAttrProvider::GetAttr(row,col,kind);
57
58 if (m_data && m_ColInfo && (m_data->GetNumberOfColumns() > m_ColInfo[col].DbCol))
59 {
60 //FIXME: this test could.
61 // ??::InsertPending == m_data->get_ModifiedStatus()
62 // and if InsertPending use colDef[].InsertAllowed
63 if (!(m_data->GetColDefs()[(m_ColInfo[col].DbCol)].Updateable))
64 {
65 switch(kind)
66 {
67 case (wxGridCellAttr::Any):
68 if (!attr)
69 {
70 attr = new wxGridCellAttr;
71 // Store so we don't keep creating / deleting this...
72 wxDbGridCellAttrProvider * self = wxConstCast(this, wxDbGridCellAttrProvider) ;
73 attr->IncRef();
74 self->SetColAttr(attr, col);
75 attr->SetReadOnly();
76 }
77 else
78 {
79 //We now must check what we were returned. and do the right thing (tm)
80 wxGridCellAttr::wxAttrKind attrkind = attr->GetKind();
81 if ((attrkind == (wxGridCellAttr::Default)) || (attrkind == (wxGridCellAttr::Cell)) ||
82 (attrkind == (wxGridCellAttr::Col)))
83 {
84 wxGridCellAttr *attrtomerge = attr;
85 attr = new wxGridCellAttr;
86 attr->SetKind(wxGridCellAttr::Merged);
87 attr->MergeWith(attrtomerge);
88 attr->SetReadOnly();
89 attrtomerge->DecRef();
90 }
91 attr->SetReadOnly();
92 }
93 break;
94 case (wxGridCellAttr::Col):
95 //As we must have a Coll, and were setting Coll attributes
96 // we can based on wxdbTable's so just set RO if attr valid
97 if (!attr)
98 {
99 attr = new wxGridCellAttr;
100 wxDbGridCellAttrProvider * self = wxConstCast(this, wxDbGridCellAttrProvider) ;
101 attr->IncRef();
102 self->SetColAttr(attr, col);
103 }
104 attr->SetReadOnly();
105 break;
106 default:
107 //Dont add RO for...
108 // wxGridCellAttr::Cell - Not required, will inherit on merge from row.
109 // wxGridCellAttr::Row - If wxDbtable ever supports row locking could add
110 // support to make RO on a row basis also.
111 // wxGridCellAttr::Default - Don't edit this ! or all cell with a attr will become readonly
112 // wxGridCellAttr::Merged - This should never be asked for.
113 break;
114 }
115 }
116
117 }
118 return attr;
119 }
120
121 void wxDbGridCellAttrProvider::AssignDbTable(wxDbTable *tab)
122 {
123 m_data = tab;
124 }
125
126 wxDbGridTableBase::wxDbGridTableBase(wxDbTable *tab, wxDbGridColInfo* ColInfo,
127 int count, bool takeOwnership) :
128 m_keys(),
129 m_data(tab),
130 m_dbowner(takeOwnership),
131 m_rowmodified(FALSE)
132 {
133
134 if (count == wxUSE_QUERY)
135 {
136 m_rowtotal = m_data ? m_data->Count() : 0;
137 }
138 else
139 {
140 m_rowtotal = count;
141 }
142 // m_keys.Size(m_rowtotal);
143 m_row = -1;
144 if (ColInfo)
145 {
146 m_nocols = ColInfo->Length();
147 m_ColInfo = new wxDbGridColInfoBase[m_nocols];
148 //Do Copy.
149 wxDbGridColInfo *ptr = ColInfo;
150 int i =0;
151 while (ptr && i < m_nocols)
152 {
153 m_ColInfo[i] = ptr->m_data;
154 ptr = ptr->m_next;
155 i++;
156 }
157 #ifdef __WXDEBUG__
158 if (ptr)
159 {
160 wxLogDebug(wxT("NoCols over length after traversing %i items"),i);
161 }
162 if (i < m_nocols)
163 {
164 wxLogDebug(wxT("NoCols under length after traversing %i items"),i);
165 }
166 #endif
167 }
168 }
169
170 wxDbGridTableBase::~wxDbGridTableBase()
171 {
172 wxDbGridCellAttrProvider *provider;
173
174 //Can't check for update here as
175
176 //FIXME: should i remove m_ColInfo and m_data from m_attrProvider if a wxDbGridAttrProvider
177 // if ((provider = dynamic_cast<wxDbGridCellAttrProvider *>(GetAttrProvider())))
178 // Using C casting for now until we can support dynamic_cast with wxWindows
179 provider = (wxDbGridCellAttrProvider *)(GetAttrProvider());
180 if (provider)
181 {
182 provider->AssignDbTable(NULL);
183 }
184 delete [] m_ColInfo;
185
186 Writeback();
187 if (m_dbowner)
188 {
189 delete m_data;
190 }
191 }
192
193 bool wxDbGridTableBase::CanHaveAttributes()
194 {
195 if (!GetAttrProvider())
196 {
197 // use the default attr provider by default
198 SetAttrProvider(new wxDbGridCellAttrProvider(m_data, m_ColInfo));
199 }
200 return TRUE;
201 }
202
203
204 bool wxDbGridTableBase::AssignDbTable(wxDbTable *tab, int count, bool takeOwnership)
205 {
206 wxDbGridCellAttrProvider *provider;
207
208 //Remove Information from grid about old data
209 if (GetView())
210 {
211 wxGrid *grid = GetView();
212 grid->BeginBatch();
213 grid->ClearSelection();
214 if (grid->IsCellEditControlEnabled())
215 {
216 grid->DisableCellEditControl();
217 }
218 wxGridTableMessage msg(this, wxGRIDTABLE_NOTIFY_ROWS_DELETED,0,m_rowtotal);
219 grid->ProcessTableMessage(msg);
220 }
221
222 //reset our internals...
223 Writeback();
224 if (m_dbowner)
225 {
226 delete m_data;
227 }
228 m_keys.Empty();
229 m_data = tab;
230 //FIXME: Remove dynamic_cast before sumision to wxwin
231 // if ((provider = dynamic_cast<wxDbGridCellAttrProvider *> (GetAttrProvider())))
232 // Using C casting for now until we can support dynamic_cast with wxWindows
233 provider = (wxDbGridCellAttrProvider *)(GetAttrProvider());
234 if (provider)
235 {
236 provider->AssignDbTable(m_data);
237 }
238
239 if (count == wxUSE_QUERY)
240 {
241 m_rowtotal = m_data ? m_data->Count() : 0;
242 }
243 else
244 {
245 m_rowtotal = count;
246 }
247 m_row = -1;
248
249 //Add Information to grid about new data
250 if (GetView())
251 {
252 wxGrid * grid = GetView();
253 wxGridTableMessage msg(this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_rowtotal);
254 grid->ProcessTableMessage(msg);
255 grid->EndBatch();
256 }
257 m_dbowner = takeOwnership;
258 m_rowmodified = FALSE;
259 return TRUE;
260 }
261
262 wxString wxDbGridTableBase::GetTypeName(int row, int col)
263 {
264 if (GetNumberCols() > col)
265 {
266 if (m_ColInfo[col].wxtypename == wxGRID_VALUE_DBAUTO)
267 {
268 if (m_data->GetNumberOfColumns() <= m_ColInfo[col].DbCol)
269 {
270 wxFAIL_MSG (_T("You can not use wxGRID_VALUE_DBAUTO for virtual columns"));
271 }
272 switch(m_data->GetColDefs()[(m_ColInfo[col].DbCol)].SqlCtype)
273 {
274 case SQL_C_CHAR:
275 return wxGRID_VALUE_STRING;
276 case SQL_C_SSHORT:
277 return wxGRID_VALUE_NUMBER;
278 case SQL_C_USHORT:
279 return wxGRID_VALUE_NUMBER;
280 case SQL_C_SLONG:
281 return wxGRID_VALUE_NUMBER;
282 case SQL_C_ULONG:
283 return wxGRID_VALUE_NUMBER;
284 case SQL_C_FLOAT:
285 return wxGRID_VALUE_FLOAT;
286 case SQL_C_DOUBLE:
287 return wxGRID_VALUE_FLOAT;
288 case SQL_C_DATE:
289 return wxGRID_VALUE_DATETIME;
290 case SQL_C_TIME:
291 return wxGRID_VALUE_DATETIME;
292 case SQL_C_TIMESTAMP:
293 return wxGRID_VALUE_DATETIME;
294 default:
295 return wxGRID_VALUE_STRING;
296 }
297 }
298 else
299 {
300 return m_ColInfo[col].wxtypename;
301 }
302 }
303 wxFAIL_MSG (_T("unknown column"));
304 return wxString();
305 }
306
307 bool wxDbGridTableBase::CanGetValueAs(int row, int col, const wxString& typeName)
308 {
309 wxLogDebug(wxT("CanGetValueAs() on %i,%i"),row,col);
310 //Is this needed? As it will be validated on GetValueAsXXXX
311 ValidateRow(row);
312
313 if (typeName == wxGRID_VALUE_STRING)
314 {
315 //FIXME ummm What about blob field etc.
316 return TRUE;
317 }
318
319 if (m_data->IsColNull(m_ColInfo[col].DbCol))
320 {
321 return FALSE;
322 }
323
324 if (m_data->GetNumberOfColumns() <= m_ColInfo[col].DbCol)
325 {
326 //If a virtual column then we can't find it's type. we have to
327 // return FALSE to get using wxVariant.
328 return FALSE;
329 }
330 int sqltype = m_data->GetColDefs()[(m_ColInfo[col].DbCol)].SqlCtype;
331
332 if (typeName == wxGRID_VALUE_DATETIME)
333 {
334 if ((sqltype == SQL_C_DATE) ||
335 (sqltype == SQL_C_TIME) ||
336 (sqltype == SQL_C_TIMESTAMP))
337 {
338 return TRUE;
339 }
340 return FALSE;
341 }
342 if (typeName == wxGRID_VALUE_NUMBER)
343 {
344 if ((sqltype == SQL_C_SSHORT) ||
345 (sqltype == SQL_C_USHORT) ||
346 (sqltype == SQL_C_SLONG) ||
347 (sqltype == SQL_C_ULONG))
348 {
349 return TRUE;
350 }
351 return FALSE;
352 }
353 if (typeName == wxGRID_VALUE_FLOAT)
354 {
355 if ((sqltype == SQL_C_SSHORT) ||
356 (sqltype == SQL_C_USHORT) ||
357 (sqltype == SQL_C_SLONG) ||
358 (sqltype == SQL_C_ULONG) ||
359 (sqltype == SQL_C_FLOAT) ||
360 (sqltype == SQL_C_DOUBLE))
361 {
362 return TRUE;
363 }
364 return FALSE;
365 }
366 return FALSE;
367 }
368
369 bool wxDbGridTableBase::CanSetValueAs(int row, int col, const wxString& typeName)
370 {
371 //Is this needed? As will be validated on SetValueAsXXXX
372 ValidateRow(row);
373
374 if (m_data->IsColNull(m_ColInfo[col].DbCol))
375 {
376 return FALSE;
377 }
378
379 if (typeName == wxGRID_VALUE_STRING)
380 {
381 //FIXME ummm What about blob field etc.
382 return TRUE;
383 }
384
385 if (!(m_data->GetColDefs()[(m_ColInfo[col].DbCol)].Updateable))
386 {
387 return FALSE;
388 }
389
390 if (m_data->GetNumberOfColumns() <= m_ColInfo[col].DbCol)
391 {
392 //If a virtual column then we can't find it's type. we have to faulse to
393 //get using wxVairent.
394 return FALSE;
395 }
396
397 int sqltype = m_data->GetColDefs()[(m_ColInfo[col].DbCol)].SqlCtype;
398 if (typeName == wxGRID_VALUE_DATETIME)
399 {
400 if ((sqltype == SQL_C_DATE) ||
401 (sqltype == SQL_C_TIME) ||
402 (sqltype == SQL_C_TIMESTAMP))
403 {
404 return TRUE;
405 }
406 return FALSE;
407 }
408 if (typeName == wxGRID_VALUE_NUMBER)
409 {
410 if ((sqltype == SQL_C_SSHORT) ||
411 (sqltype == SQL_C_USHORT) ||
412 (sqltype == SQL_C_SLONG) ||
413 (sqltype == SQL_C_ULONG))
414 {
415 return TRUE;
416 }
417 return FALSE;
418 }
419 if (typeName == wxGRID_VALUE_FLOAT)
420 {
421 if ((sqltype == SQL_C_SSHORT) ||
422 (sqltype == SQL_C_USHORT) ||
423 (sqltype == SQL_C_SLONG) ||
424 (sqltype == SQL_C_ULONG) ||
425 (sqltype == SQL_C_FLOAT) ||
426 (sqltype == SQL_C_DOUBLE))
427 {
428 return TRUE;
429 }
430 return FALSE;
431 }
432 return FALSE;
433 }
434
435 long wxDbGridTableBase::GetValueAsLong(int row, int col)
436 {
437 ValidateRow(row);
438
439 if (m_data->GetNumberOfColumns() <= m_ColInfo[col].DbCol)
440 {
441 wxFAIL_MSG (_T("You can not use GetValueAsLong for virtual columns"));
442 return 0;
443 }
444 int sqltype = m_data->GetColDefs()[(m_ColInfo[col].DbCol)].SqlCtype;
445 if ((sqltype == SQL_C_SSHORT) ||
446 (sqltype == SQL_C_USHORT) ||
447 (sqltype == SQL_C_SLONG) ||
448 (sqltype == SQL_C_ULONG))
449 {
450 wxVariant val = m_data->GetCol(m_ColInfo[col].DbCol);
451 return val.GetLong();
452 }
453 wxFAIL_MSG (_T("unknown column, "));
454 return 0;
455 }
456
457 double wxDbGridTableBase::GetValueAsDouble(int row, int col)
458 {
459 wxLogDebug(wxT("GetValueAsDouble() on %i,%i"),row,col);
460 ValidateRow(row);
461
462 if (m_data->GetNumberOfColumns() <= m_ColInfo[col].DbCol)
463 {
464 wxFAIL_MSG (_T("You can not use GetValueAsDouble for virtual columns"));
465 return 0.0;
466 }
467 int sqltype = m_data->GetColDefs()[(m_ColInfo[col].DbCol)].SqlCtype;
468 if ((sqltype == SQL_C_SSHORT) ||
469 (sqltype == SQL_C_USHORT) ||
470 (sqltype == SQL_C_SLONG) ||
471 (sqltype == SQL_C_ULONG) ||
472 (sqltype == SQL_C_FLOAT) ||
473 (sqltype == SQL_C_DOUBLE))
474 {
475 wxVariant val = m_data->GetCol(m_ColInfo[col].DbCol);
476 return val.GetDouble();
477 }
478 wxFAIL_MSG (_T("unknown column"));
479 return 0.0;
480 }
481
482 bool wxDbGridTableBase::GetValueAsBool(int row, int col)
483 {
484 wxLogDebug(wxT("GetValueAsBool() on %i,%i"),row,col);
485 ValidateRow(row);
486
487 if (m_data->GetNumberOfColumns() <= m_ColInfo[col].DbCol)
488 {
489 wxFAIL_MSG (_T("You can not use GetValueAsBool for virtual columns"));
490 return 0;
491 }
492 int sqltype = m_data->GetColDefs()[(m_ColInfo[col].DbCol)].SqlCtype;
493 if ((sqltype == SQL_C_SSHORT) ||
494 (sqltype == SQL_C_USHORT) ||
495 (sqltype == SQL_C_SLONG) ||
496 (sqltype == SQL_C_ULONG))
497 {
498 wxVariant val = m_data->GetCol(m_ColInfo[col].DbCol);
499 return val.GetBool();
500 }
501 wxFAIL_MSG (_T("unknown column, "));
502 return 0;
503 }
504
505 void* wxDbGridTableBase::GetValueAsCustom(int row, int col, const wxString& typeName)
506 {
507 wxLogDebug(wxT("GetValueAsCustom() on %i,%i"),row,col);
508 ValidateRow(row);
509
510 if (m_data->GetNumberOfColumns() <= m_ColInfo[col].DbCol)
511 {
512 wxFAIL_MSG (_T("You can not use GetValueAsCustom for virtual columns"));
513 return NULL;
514 }
515 if (m_data->IsColNull(m_ColInfo[col].DbCol))
516 return NULL;
517
518 if (typeName == wxGRID_VALUE_DATETIME)
519 {
520 wxDbColDef *pColDefs = m_data->GetColDefs();
521 int sqltype = pColDefs[(m_ColInfo[col].DbCol)].SqlCtype;
522
523 if ((sqltype == SQL_C_DATE) ||
524 (sqltype == SQL_C_TIME) ||
525 (sqltype == SQL_C_TIMESTAMP))
526 {
527 wxVariant val = m_data->GetCol(m_ColInfo[col].DbCol);
528 return new wxDateTime(val.GetDateTime());
529 }
530 }
531 wxFAIL_MSG (_T("unknown column data type "));
532 return NULL;
533 }
534
535
536 void wxDbGridTableBase::SetValueAsCustom(int row, int col, const wxString& typeName, void* value)
537 {
538 wxLogDebug(wxT("SetValueAsCustom() on %i,%i"),row,col);
539 ValidateRow(row);
540
541 if (m_data->GetNumberOfColumns() <= m_ColInfo[col].DbCol)
542 {
543 wxFAIL_MSG (_T("You can not use SetValueAsCustom for virtual columns"));
544 return;
545 }
546
547 if (typeName == wxGRID_VALUE_DATETIME)
548 {
549 int sqltype = m_data->GetColDefs()[(m_ColInfo[col].DbCol)].SqlCtype;
550 if ((sqltype == SQL_C_DATE) ||
551 (sqltype == SQL_C_TIME) ||
552 (sqltype == SQL_C_TIMESTAMP))
553 {
554 //FIXME: you can't dynamic_cast from (void *)
555 //wxDateTime *date = wxDynamicCast(value, wxDateTime);
556 wxDateTime *date = (wxDateTime *)value;
557 if (!date)
558 {
559 wxFAIL_MSG (_T("Failed to convert data"));
560 return;
561 }
562 wxVariant val(date);
563 m_rowmodified = TRUE;
564 m_data->SetCol(m_ColInfo[col].DbCol,val);
565 }
566 }
567 wxFAIL_MSG (_T("unknown column data type"));
568 return ;
569 }
570
571
572 wxString wxDbGridTableBase::GetColLabelValue(int col)
573 {
574 if (GetNumberCols() > col)
575 {
576 return m_ColInfo[col].Title;
577 }
578 wxFAIL_MSG (_T("unknown column"));
579 return wxString();
580 }
581
582 bool wxDbGridTableBase::IsEmptyCell(int row, int col)
583 {
584 wxLogDebug(wxT("IsEmtpyCell on %i,%i"),row,col);
585
586 ValidateRow(row);
587 return m_data->IsColNull(m_ColInfo[col].DbCol);
588 }
589
590
591 wxString wxDbGridTableBase::GetValue(int row, int col)
592 {
593 wxLogDebug(wxT("GetValue() on %i,%i"),row,col);
594
595 ValidateRow(row);
596 wxVariant val = m_data->GetCol(m_ColInfo[col].DbCol);
597 wxLogDebug(wxT("\tReturning \"%s\"\n"),val.GetString().c_str());
598
599 return val.GetString();
600 }
601
602
603 void wxDbGridTableBase::SetValue(int row, int col,const wxString& value)
604 {
605 wxLogDebug(wxT("SetValue() on %i,%i"),row,col);
606
607 ValidateRow(row);
608 wxVariant val(value);
609
610 m_rowmodified = TRUE;
611 m_data->SetCol(m_ColInfo[col].DbCol,val);
612 }
613
614
615 void wxDbGridTableBase::SetValueAsLong(int row, int col, long value)
616 {
617 wxLogDebug(wxT("SetValueAsLong() on %i,%i"),row,col);
618
619 ValidateRow(row);
620 wxVariant val(value);
621
622 m_rowmodified = TRUE;
623 m_data->SetCol(m_ColInfo[col].DbCol,val);
624 }
625
626
627 void wxDbGridTableBase::SetValueAsDouble(int row, int col, double value)
628 {
629 wxLogDebug(wxT("SetValueAsDouble() on %i,%i"),row,col);
630
631 ValidateRow(row);
632 wxVariant val(value);
633
634 m_rowmodified = TRUE;
635 m_data->SetCol(m_ColInfo[col].DbCol,val);
636
637 }
638
639
640 void wxDbGridTableBase::SetValueAsBool(int row, int col, bool value)
641 {
642 wxLogDebug(wxT("SetValueAsBool() on %i,%i"),row,col);
643
644 ValidateRow(row);
645 wxVariant val(value);
646
647 m_rowmodified = TRUE;
648 m_data->SetCol(m_ColInfo[col].DbCol,val);
649 }
650
651
652 void wxDbGridTableBase::ValidateRow(int row)
653 {
654 wxLogDebug(wxT("ValidateRow(%i) currently on row (%i). Array count = %i"),row,m_row,m_keys.GetCount());
655
656 if (row == m_row)
657 return;
658 Writeback();
659
660 //We add to row as Count is unsigned!
661 if ((unsigned)(row+1) > m_keys.GetCount())
662 {
663 wxLogDebug(wxT("\trow key unknown"));
664 // Extend Array, iterate through data filling with keys
665 m_data->SetRowMode(wxDbTable::WX_ROW_MODE_QUERY);
666 int trow;
667 for (trow = m_keys.GetCount(); trow <= row; trow++)
668 {
669 wxLogDebug(wxT("Fetching row %i.."), trow);
670 bool ret = m_data->GetNext();
671
672 wxLogDebug(wxT(" ...success=(%i)"),ret);
673 GenericKey k = m_data->GetKey();
674 m_keys.Add(k);
675 }
676 m_row = row;
677 }
678 else
679 {
680 wxLogDebug(wxT("\trow key known centering data"));
681 GenericKey k = m_keys.Item(row);
682 m_data->SetRowMode(wxDbTable::WX_ROW_MODE_INDIVIDUAL);
683 m_data->ClearMemberVars();
684 m_data->SetKey(k);
685 if (!m_data->QueryOnKeyFields())
686 {
687 wxDbLogExtendedErrorMsg("ODBC error during Query()\n\n", m_data->GetDb(),__FILE__,__LINE__);
688 }
689
690 m_data->GetNext();
691
692 m_row = row;
693 }
694 m_rowmodified = FALSE;
695 }
696
697 bool wxDbGridTableBase::Writeback() const
698 {
699 if (!m_rowmodified)
700 {
701 return TRUE;
702 }
703
704 bool result=TRUE;
705 wxLogDebug(wxT("\trow key unknown"));
706
707 // FIXME: this code requires dbtable support for record status
708 #if 0
709 switch (m_data->get_ModifiedStatus())
710 {
711 case wxDbTable::UpdatePending:
712 result = m_data->Update();
713 break;
714 case wxDbTable::InsertPending:
715 result = (m_data->Insert() == SQL_SUCCESS);
716 break;
717 default:
718 //Nothing
719 break;
720 }
721 #else
722 wxLogDebug(wxT("WARNING : Row writeback not implemented "));
723 #endif
724 return result;
725 }
726
727 #include <wx/arrimpl.cpp>
728
729 WX_DEFINE_OBJARRAY(keyarray);
730
731 #endif // #if wxUSE_NEW_GRID
732 #endif // #if wxUSE_ODBC
733