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