Money Manager EX
An easy to use, money management application built with wxWidgets
DB_Table_Accountlist_V1.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 //=============================================================================
18 //=============================================================================
19 #pragma once
20 
21 #include "DB_Table.h"
22 
24 {
25  struct Data;
27 
29  struct Data_Set : public std::vector<Self::Data>
30  {
32  wxString to_json() const
33  {
34  StringBuffer json_buffer;
35  PrettyWriter<StringBuffer> json_writer(json_buffer);
36 
37  json_writer.StartArray();
38  for (const auto & item: *this)
39  {
40  json_writer.StartObject();
41  item.as_json(json_writer);
42  json_writer.EndObject();
43  }
44  json_writer.EndArray();
45 
46  return json_buffer.GetString();
47  }
48  };
49 
51  typedef std::vector<Self::Data*> Cache;
52  typedef std::map<int64, Self::Data*> Index_By_Id;
53  Cache cache_;
54  Index_By_Id index_by_id_;
55  Data* fake_; // in case the entity not found
56 
59  {
60  delete this->fake_;
61  destroy_cache();
62  }
63 
66  {
67  std::for_each(cache_.begin(), cache_.end(), std::mem_fn(&Data::destroy));
68  cache_.clear();
69  index_by_id_.clear(); // no memory release since it just stores pointer and the according objects are in cache
70  }
71 
73  bool ensure(wxSQLite3Database* db)
74  {
75  if (!exists(db))
76  {
77  try
78  {
79  db->ExecuteUpdate("CREATE TABLE ACCOUNTLIST_V1(ACCOUNTID integer primary key, ACCOUNTNAME TEXT COLLATE NOCASE NOT NULL UNIQUE, ACCOUNTTYPE TEXT NOT NULL /* Cash, Checking, Term, Investment, Credit Card, Loan, Asset, Shares */, ACCOUNTNUM TEXT, STATUS TEXT NOT NULL /* Open, Closed */, NOTES TEXT, HELDAT TEXT, WEBSITE TEXT, CONTACTINFO TEXT, ACCESSINFO TEXT, INITIALBAL numeric, INITIALDATE TEXT, FAVORITEACCT TEXT NOT NULL, CURRENCYID integer NOT NULL, STATEMENTLOCKED integer, STATEMENTDATE TEXT, MINIMUMBALANCE numeric, CREDITLIMIT numeric, INTERESTRATE numeric, PAYMENTDUEDATE text, MINIMUMPAYMENT numeric)");
80  this->ensure_data(db);
81  }
82  catch(const wxSQLite3Exception &e)
83  {
84  wxLogError("ACCOUNTLIST_V1: Exception %s", e.GetMessage().utf8_str());
85  return false;
86  }
87  }
88 
89  this->ensure_index(db);
90 
91  return true;
92  }
93 
94  bool ensure_index(wxSQLite3Database* db)
95  {
96  try
97  {
98  db->ExecuteUpdate("CREATE INDEX IF NOT EXISTS IDX_ACCOUNTLIST_ACCOUNTTYPE ON ACCOUNTLIST_V1(ACCOUNTTYPE)");
99  }
100  catch(const wxSQLite3Exception &e)
101  {
102  wxLogError("ACCOUNTLIST_V1: Exception %s", e.GetMessage().utf8_str());
103  return false;
104  }
105 
106  return true;
107  }
108 
109  void ensure_data(wxSQLite3Database* db)
110  {
111  db->Begin();
112  db->Commit();
113  }
114 
115  struct ACCOUNTID : public DB_Column<int64>
116  {
117  static wxString name() { return "ACCOUNTID"; }
118  explicit ACCOUNTID(const int64 &v, OP op = EQUAL): DB_Column<int64>(v, op) {}
119  };
120 
121  struct ACCOUNTNAME : public DB_Column<wxString>
122  {
123  static wxString name() { return "ACCOUNTNAME"; }
124  explicit ACCOUNTNAME(const wxString &v, OP op = EQUAL): DB_Column<wxString>(v, op) {}
125  };
126 
127  struct ACCOUNTTYPE : public DB_Column<wxString>
128  {
129  static wxString name() { return "ACCOUNTTYPE"; }
130  explicit ACCOUNTTYPE(const wxString &v, OP op = EQUAL): DB_Column<wxString>(v, op) {}
131  };
132 
133  struct ACCOUNTNUM : public DB_Column<wxString>
134  {
135  static wxString name() { return "ACCOUNTNUM"; }
136  explicit ACCOUNTNUM(const wxString &v, OP op = EQUAL): DB_Column<wxString>(v, op) {}
137  };
138 
139  struct STATUS : public DB_Column<wxString>
140  {
141  static wxString name() { return "STATUS"; }
142  explicit STATUS(const wxString &v, OP op = EQUAL): DB_Column<wxString>(v, op) {}
143  };
144 
145  struct NOTES : public DB_Column<wxString>
146  {
147  static wxString name() { return "NOTES"; }
148  explicit NOTES(const wxString &v, OP op = EQUAL): DB_Column<wxString>(v, op) {}
149  };
150 
151  struct HELDAT : public DB_Column<wxString>
152  {
153  static wxString name() { return "HELDAT"; }
154  explicit HELDAT(const wxString &v, OP op = EQUAL): DB_Column<wxString>(v, op) {}
155  };
156 
157  struct WEBSITE : public DB_Column<wxString>
158  {
159  static wxString name() { return "WEBSITE"; }
160  explicit WEBSITE(const wxString &v, OP op = EQUAL): DB_Column<wxString>(v, op) {}
161  };
162 
163  struct CONTACTINFO : public DB_Column<wxString>
164  {
165  static wxString name() { return "CONTACTINFO"; }
166  explicit CONTACTINFO(const wxString &v, OP op = EQUAL): DB_Column<wxString>(v, op) {}
167  };
168 
169  struct ACCESSINFO : public DB_Column<wxString>
170  {
171  static wxString name() { return "ACCESSINFO"; }
172  explicit ACCESSINFO(const wxString &v, OP op = EQUAL): DB_Column<wxString>(v, op) {}
173  };
174 
175  struct INITIALBAL : public DB_Column<double>
176  {
177  static wxString name() { return "INITIALBAL"; }
178  explicit INITIALBAL(const double &v, OP op = EQUAL): DB_Column<double>(v, op) {}
179  };
180 
181  struct INITIALDATE : public DB_Column<wxString>
182  {
183  static wxString name() { return "INITIALDATE"; }
184  explicit INITIALDATE(const wxString &v, OP op = EQUAL): DB_Column<wxString>(v, op) {}
185  };
186 
187  struct FAVORITEACCT : public DB_Column<wxString>
188  {
189  static wxString name() { return "FAVORITEACCT"; }
190  explicit FAVORITEACCT(const wxString &v, OP op = EQUAL): DB_Column<wxString>(v, op) {}
191  };
192 
193  struct CURRENCYID : public DB_Column<int64>
194  {
195  static wxString name() { return "CURRENCYID"; }
196  explicit CURRENCYID(const int64 &v, OP op = EQUAL): DB_Column<int64>(v, op) {}
197  };
198 
199  struct STATEMENTLOCKED : public DB_Column<int64>
200  {
201  static wxString name() { return "STATEMENTLOCKED"; }
202  explicit STATEMENTLOCKED(const int64 &v, OP op = EQUAL): DB_Column<int64>(v, op) {}
203  };
204 
205  struct STATEMENTDATE : public DB_Column<wxString>
206  {
207  static wxString name() { return "STATEMENTDATE"; }
208  explicit STATEMENTDATE(const wxString &v, OP op = EQUAL): DB_Column<wxString>(v, op) {}
209  };
210 
211  struct MINIMUMBALANCE : public DB_Column<double>
212  {
213  static wxString name() { return "MINIMUMBALANCE"; }
214  explicit MINIMUMBALANCE(const double &v, OP op = EQUAL): DB_Column<double>(v, op) {}
215  };
216 
217  struct CREDITLIMIT : public DB_Column<double>
218  {
219  static wxString name() { return "CREDITLIMIT"; }
220  explicit CREDITLIMIT(const double &v, OP op = EQUAL): DB_Column<double>(v, op) {}
221  };
222 
223  struct INTERESTRATE : public DB_Column<double>
224  {
225  static wxString name() { return "INTERESTRATE"; }
226  explicit INTERESTRATE(const double &v, OP op = EQUAL): DB_Column<double>(v, op) {}
227  };
228 
229  struct PAYMENTDUEDATE : public DB_Column<wxString>
230  {
231  static wxString name() { return "PAYMENTDUEDATE"; }
232  explicit PAYMENTDUEDATE(const wxString &v, OP op = EQUAL): DB_Column<wxString>(v, op) {}
233  };
234 
235  struct MINIMUMPAYMENT : public DB_Column<double>
236  {
237  static wxString name() { return "MINIMUMPAYMENT"; }
238  explicit MINIMUMPAYMENT(const double &v, OP op = EQUAL): DB_Column<double>(v, op) {}
239  };
240 
242  enum COLUMN
243  {
249  , COL_NOTES = 5
265  };
266 
268  static wxString column_to_name(const COLUMN col)
269  {
270  switch(col)
271  {
272  case COL_ACCOUNTID: return "ACCOUNTID";
273  case COL_ACCOUNTNAME: return "ACCOUNTNAME";
274  case COL_ACCOUNTTYPE: return "ACCOUNTTYPE";
275  case COL_ACCOUNTNUM: return "ACCOUNTNUM";
276  case COL_STATUS: return "STATUS";
277  case COL_NOTES: return "NOTES";
278  case COL_HELDAT: return "HELDAT";
279  case COL_WEBSITE: return "WEBSITE";
280  case COL_CONTACTINFO: return "CONTACTINFO";
281  case COL_ACCESSINFO: return "ACCESSINFO";
282  case COL_INITIALBAL: return "INITIALBAL";
283  case COL_INITIALDATE: return "INITIALDATE";
284  case COL_FAVORITEACCT: return "FAVORITEACCT";
285  case COL_CURRENCYID: return "CURRENCYID";
286  case COL_STATEMENTLOCKED: return "STATEMENTLOCKED";
287  case COL_STATEMENTDATE: return "STATEMENTDATE";
288  case COL_MINIMUMBALANCE: return "MINIMUMBALANCE";
289  case COL_CREDITLIMIT: return "CREDITLIMIT";
290  case COL_INTERESTRATE: return "INTERESTRATE";
291  case COL_PAYMENTDUEDATE: return "PAYMENTDUEDATE";
292  case COL_MINIMUMPAYMENT: return "MINIMUMPAYMENT";
293  default: break;
294  }
295 
296  return "UNKNOWN";
297  }
298 
300  static COLUMN name_to_column(const wxString& name)
301  {
302  if ("ACCOUNTID" == name) return COL_ACCOUNTID;
303  else if ("ACCOUNTNAME" == name) return COL_ACCOUNTNAME;
304  else if ("ACCOUNTTYPE" == name) return COL_ACCOUNTTYPE;
305  else if ("ACCOUNTNUM" == name) return COL_ACCOUNTNUM;
306  else if ("STATUS" == name) return COL_STATUS;
307  else if ("NOTES" == name) return COL_NOTES;
308  else if ("HELDAT" == name) return COL_HELDAT;
309  else if ("WEBSITE" == name) return COL_WEBSITE;
310  else if ("CONTACTINFO" == name) return COL_CONTACTINFO;
311  else if ("ACCESSINFO" == name) return COL_ACCESSINFO;
312  else if ("INITIALBAL" == name) return COL_INITIALBAL;
313  else if ("INITIALDATE" == name) return COL_INITIALDATE;
314  else if ("FAVORITEACCT" == name) return COL_FAVORITEACCT;
315  else if ("CURRENCYID" == name) return COL_CURRENCYID;
316  else if ("STATEMENTLOCKED" == name) return COL_STATEMENTLOCKED;
317  else if ("STATEMENTDATE" == name) return COL_STATEMENTDATE;
318  else if ("MINIMUMBALANCE" == name) return COL_MINIMUMBALANCE;
319  else if ("CREDITLIMIT" == name) return COL_CREDITLIMIT;
320  else if ("INTERESTRATE" == name) return COL_INTERESTRATE;
321  else if ("PAYMENTDUEDATE" == name) return COL_PAYMENTDUEDATE;
322  else if ("MINIMUMPAYMENT" == name) return COL_MINIMUMPAYMENT;
323 
324  return COLUMN(-1);
325  }
326 
328  struct Data
329  {
330  friend struct DB_Table_ACCOUNTLIST_V1;
332  Self* table_;
333 
334  int64 ACCOUNTID;// primary key
335  wxString ACCOUNTNAME;
336  wxString ACCOUNTTYPE;
337  wxString ACCOUNTNUM;
338  wxString STATUS;
339  wxString NOTES;
340  wxString HELDAT;
341  wxString WEBSITE;
342  wxString CONTACTINFO;
343  wxString ACCESSINFO;
344  double INITIALBAL;
345  wxString INITIALDATE;
346  wxString FAVORITEACCT;
349  wxString STATEMENTDATE;
351  double CREDITLIMIT;
352  double INTERESTRATE;
353  wxString PAYMENTDUEDATE;
355 
356  int64 id() const
357  {
358  return ACCOUNTID;
359  }
360 
361  void id(const int64 id)
362  {
363  ACCOUNTID = id;
364  }
365 
366  auto operator < (const Data& other) const
367  {
368  return this->id() < other.id();
369  }
370 
371  auto operator < (const Data* other) const
372  {
373  return this->id() < other->id();
374  }
375 
376  bool equals(const Data* r) const
377  {
378  if(ACCOUNTID != r->ACCOUNTID) return false;
379  if(!ACCOUNTNAME.IsSameAs(r->ACCOUNTNAME)) return false;
380  if(!ACCOUNTTYPE.IsSameAs(r->ACCOUNTTYPE)) return false;
381  if(!ACCOUNTNUM.IsSameAs(r->ACCOUNTNUM)) return false;
382  if(!STATUS.IsSameAs(r->STATUS)) return false;
383  if(!NOTES.IsSameAs(r->NOTES)) return false;
384  if(!HELDAT.IsSameAs(r->HELDAT)) return false;
385  if(!WEBSITE.IsSameAs(r->WEBSITE)) return false;
386  if(!CONTACTINFO.IsSameAs(r->CONTACTINFO)) return false;
387  if(!ACCESSINFO.IsSameAs(r->ACCESSINFO)) return false;
388  if(INITIALBAL != r->INITIALBAL) return false;
389  if(!INITIALDATE.IsSameAs(r->INITIALDATE)) return false;
390  if(!FAVORITEACCT.IsSameAs(r->FAVORITEACCT)) return false;
391  if(CURRENCYID != r->CURRENCYID) return false;
392  if(STATEMENTLOCKED != r->STATEMENTLOCKED) return false;
393  if(!STATEMENTDATE.IsSameAs(r->STATEMENTDATE)) return false;
394  if(MINIMUMBALANCE != r->MINIMUMBALANCE) return false;
395  if(CREDITLIMIT != r->CREDITLIMIT) return false;
396  if(INTERESTRATE != r->INTERESTRATE) return false;
397  if(!PAYMENTDUEDATE.IsSameAs(r->PAYMENTDUEDATE)) return false;
398  if(MINIMUMPAYMENT != r->MINIMUMPAYMENT) return false;
399  return true;
400  }
401 
402  explicit Data(Self* table = nullptr )
403  {
404  table_ = table;
405 
406  ACCOUNTID = -1;
407  INITIALBAL = 0.0;
408  CURRENCYID = -1;
409  STATEMENTLOCKED = -1;
410  MINIMUMBALANCE = 0.0;
411  CREDITLIMIT = 0.0;
412  INTERESTRATE = 0.0;
413  MINIMUMPAYMENT = 0.0;
414  }
415 
416  explicit Data(wxSQLite3ResultSet& q, Self* table = nullptr )
417  {
418  table_ = table;
419 
420  ACCOUNTID = q.GetInt64(0); // ACCOUNTID
421  ACCOUNTNAME = q.GetString(1); // ACCOUNTNAME
422  ACCOUNTTYPE = q.GetString(2); // ACCOUNTTYPE
423  ACCOUNTNUM = q.GetString(3); // ACCOUNTNUM
424  STATUS = q.GetString(4); // STATUS
425  NOTES = q.GetString(5); // NOTES
426  HELDAT = q.GetString(6); // HELDAT
427  WEBSITE = q.GetString(7); // WEBSITE
428  CONTACTINFO = q.GetString(8); // CONTACTINFO
429  ACCESSINFO = q.GetString(9); // ACCESSINFO
430  INITIALBAL = q.GetDouble(10); // INITIALBAL
431  INITIALDATE = q.GetString(11); // INITIALDATE
432  FAVORITEACCT = q.GetString(12); // FAVORITEACCT
433  CURRENCYID = q.GetInt64(13); // CURRENCYID
434  STATEMENTLOCKED = q.GetInt64(14); // STATEMENTLOCKED
435  STATEMENTDATE = q.GetString(15); // STATEMENTDATE
436  MINIMUMBALANCE = q.GetDouble(16); // MINIMUMBALANCE
437  CREDITLIMIT = q.GetDouble(17); // CREDITLIMIT
438  INTERESTRATE = q.GetDouble(18); // INTERESTRATE
439  PAYMENTDUEDATE = q.GetString(19); // PAYMENTDUEDATE
440  MINIMUMPAYMENT = q.GetDouble(20); // MINIMUMPAYMENT
441  }
442 
443  Data(const Data& other) = default;
444 
445  Data& operator=(const Data& other)
446  {
447  if (this == &other) return *this;
448 
449  ACCOUNTID = other.ACCOUNTID;
450  ACCOUNTNAME = other.ACCOUNTNAME;
451  ACCOUNTTYPE = other.ACCOUNTTYPE;
452  ACCOUNTNUM = other.ACCOUNTNUM;
453  STATUS = other.STATUS;
454  NOTES = other.NOTES;
455  HELDAT = other.HELDAT;
456  WEBSITE = other.WEBSITE;
457  CONTACTINFO = other.CONTACTINFO;
458  ACCESSINFO = other.ACCESSINFO;
459  INITIALBAL = other.INITIALBAL;
460  INITIALDATE = other.INITIALDATE;
461  FAVORITEACCT = other.FAVORITEACCT;
462  CURRENCYID = other.CURRENCYID;
463  STATEMENTLOCKED = other.STATEMENTLOCKED;
464  STATEMENTDATE = other.STATEMENTDATE;
465  MINIMUMBALANCE = other.MINIMUMBALANCE;
466  CREDITLIMIT = other.CREDITLIMIT;
467  INTERESTRATE = other.INTERESTRATE;
468  PAYMENTDUEDATE = other.PAYMENTDUEDATE;
469  MINIMUMPAYMENT = other.MINIMUMPAYMENT;
470  return *this;
471  }
472 
473  template<typename C>
474  bool match(const C &) const
475  {
476  return false;
477  }
478 
479  bool match(const Self::ACCOUNTID &in) const
480  {
481  return this->ACCOUNTID == in.v_;
482  }
483 
484  bool match(const Self::ACCOUNTNAME &in) const
485  {
486  return this->ACCOUNTNAME.CmpNoCase(in.v_) == 0;
487  }
488 
489  bool match(const Self::ACCOUNTTYPE &in) const
490  {
491  return this->ACCOUNTTYPE.CmpNoCase(in.v_) == 0;
492  }
493 
494  bool match(const Self::ACCOUNTNUM &in) const
495  {
496  return this->ACCOUNTNUM.CmpNoCase(in.v_) == 0;
497  }
498 
499  bool match(const Self::STATUS &in) const
500  {
501  return this->STATUS.CmpNoCase(in.v_) == 0;
502  }
503 
504  bool match(const Self::NOTES &in) const
505  {
506  return this->NOTES.CmpNoCase(in.v_) == 0;
507  }
508 
509  bool match(const Self::HELDAT &in) const
510  {
511  return this->HELDAT.CmpNoCase(in.v_) == 0;
512  }
513 
514  bool match(const Self::WEBSITE &in) const
515  {
516  return this->WEBSITE.CmpNoCase(in.v_) == 0;
517  }
518 
519  bool match(const Self::CONTACTINFO &in) const
520  {
521  return this->CONTACTINFO.CmpNoCase(in.v_) == 0;
522  }
523 
524  bool match(const Self::ACCESSINFO &in) const
525  {
526  return this->ACCESSINFO.CmpNoCase(in.v_) == 0;
527  }
528 
529  bool match(const Self::INITIALBAL &in) const
530  {
531  return this->INITIALBAL == in.v_;
532  }
533 
534  bool match(const Self::INITIALDATE &in) const
535  {
536  return this->INITIALDATE.CmpNoCase(in.v_) == 0;
537  }
538 
539  bool match(const Self::FAVORITEACCT &in) const
540  {
541  return this->FAVORITEACCT.CmpNoCase(in.v_) == 0;
542  }
543 
544  bool match(const Self::CURRENCYID &in) const
545  {
546  return this->CURRENCYID == in.v_;
547  }
548 
549  bool match(const Self::STATEMENTLOCKED &in) const
550  {
551  return this->STATEMENTLOCKED == in.v_;
552  }
553 
554  bool match(const Self::STATEMENTDATE &in) const
555  {
556  return this->STATEMENTDATE.CmpNoCase(in.v_) == 0;
557  }
558 
559  bool match(const Self::MINIMUMBALANCE &in) const
560  {
561  return this->MINIMUMBALANCE == in.v_;
562  }
563 
564  bool match(const Self::CREDITLIMIT &in) const
565  {
566  return this->CREDITLIMIT == in.v_;
567  }
568 
569  bool match(const Self::INTERESTRATE &in) const
570  {
571  return this->INTERESTRATE == in.v_;
572  }
573 
574  bool match(const Self::PAYMENTDUEDATE &in) const
575  {
576  return this->PAYMENTDUEDATE.CmpNoCase(in.v_) == 0;
577  }
578 
579  bool match(const Self::MINIMUMPAYMENT &in) const
580  {
581  return this->MINIMUMPAYMENT == in.v_;
582  }
583 
584  // Return the data record as a json string
585  wxString to_json() const
586  {
587  StringBuffer json_buffer;
588  PrettyWriter<StringBuffer> json_writer(json_buffer);
589 
590  json_writer.StartObject();
591  this->as_json(json_writer);
592  json_writer.EndObject();
593 
594  return json_buffer.GetString();
595  }
596 
597  // Add the field data as json key:value pairs
598  void as_json(PrettyWriter<StringBuffer>& json_writer) const
599  {
600  json_writer.Key("ACCOUNTID");
601  json_writer.Int64(this->ACCOUNTID.GetValue());
602  json_writer.Key("ACCOUNTNAME");
603  json_writer.String(this->ACCOUNTNAME.utf8_str());
604  json_writer.Key("ACCOUNTTYPE");
605  json_writer.String(this->ACCOUNTTYPE.utf8_str());
606  json_writer.Key("ACCOUNTNUM");
607  json_writer.String(this->ACCOUNTNUM.utf8_str());
608  json_writer.Key("STATUS");
609  json_writer.String(this->STATUS.utf8_str());
610  json_writer.Key("NOTES");
611  json_writer.String(this->NOTES.utf8_str());
612  json_writer.Key("HELDAT");
613  json_writer.String(this->HELDAT.utf8_str());
614  json_writer.Key("WEBSITE");
615  json_writer.String(this->WEBSITE.utf8_str());
616  json_writer.Key("CONTACTINFO");
617  json_writer.String(this->CONTACTINFO.utf8_str());
618  json_writer.Key("ACCESSINFO");
619  json_writer.String(this->ACCESSINFO.utf8_str());
620  json_writer.Key("INITIALBAL");
621  json_writer.Double(this->INITIALBAL);
622  json_writer.Key("INITIALDATE");
623  json_writer.String(this->INITIALDATE.utf8_str());
624  json_writer.Key("FAVORITEACCT");
625  json_writer.String(this->FAVORITEACCT.utf8_str());
626  json_writer.Key("CURRENCYID");
627  json_writer.Int64(this->CURRENCYID.GetValue());
628  json_writer.Key("STATEMENTLOCKED");
629  json_writer.Int64(this->STATEMENTLOCKED.GetValue());
630  json_writer.Key("STATEMENTDATE");
631  json_writer.String(this->STATEMENTDATE.utf8_str());
632  json_writer.Key("MINIMUMBALANCE");
633  json_writer.Double(this->MINIMUMBALANCE);
634  json_writer.Key("CREDITLIMIT");
635  json_writer.Double(this->CREDITLIMIT);
636  json_writer.Key("INTERESTRATE");
637  json_writer.Double(this->INTERESTRATE);
638  json_writer.Key("PAYMENTDUEDATE");
639  json_writer.String(this->PAYMENTDUEDATE.utf8_str());
640  json_writer.Key("MINIMUMPAYMENT");
641  json_writer.Double(this->MINIMUMPAYMENT);
642  }
643 
644  row_t to_row_t() const
645  {
646  row_t row;
647  row(L"ACCOUNTID") = ACCOUNTID.GetValue();
648  row(L"ACCOUNTNAME") = ACCOUNTNAME;
649  row(L"ACCOUNTTYPE") = ACCOUNTTYPE;
650  row(L"ACCOUNTNUM") = ACCOUNTNUM;
651  row(L"STATUS") = STATUS;
652  row(L"NOTES") = NOTES;
653  row(L"HELDAT") = HELDAT;
654  row(L"WEBSITE") = WEBSITE;
655  row(L"CONTACTINFO") = CONTACTINFO;
656  row(L"ACCESSINFO") = ACCESSINFO;
657  row(L"INITIALBAL") = INITIALBAL;
658  row(L"INITIALDATE") = INITIALDATE;
659  row(L"FAVORITEACCT") = FAVORITEACCT;
660  row(L"CURRENCYID") = CURRENCYID.GetValue();
661  row(L"STATEMENTLOCKED") = STATEMENTLOCKED.GetValue();
662  row(L"STATEMENTDATE") = STATEMENTDATE;
663  row(L"MINIMUMBALANCE") = MINIMUMBALANCE;
664  row(L"CREDITLIMIT") = CREDITLIMIT;
665  row(L"INTERESTRATE") = INTERESTRATE;
666  row(L"PAYMENTDUEDATE") = PAYMENTDUEDATE;
667  row(L"MINIMUMPAYMENT") = MINIMUMPAYMENT;
668  return row;
669  }
670 
671  void to_template(html_template& t) const
672  {
673  t(L"ACCOUNTID") = ACCOUNTID.GetValue();
674  t(L"ACCOUNTNAME") = ACCOUNTNAME;
675  t(L"ACCOUNTTYPE") = ACCOUNTTYPE;
676  t(L"ACCOUNTNUM") = ACCOUNTNUM;
677  t(L"STATUS") = STATUS;
678  t(L"NOTES") = NOTES;
679  t(L"HELDAT") = HELDAT;
680  t(L"WEBSITE") = WEBSITE;
681  t(L"CONTACTINFO") = CONTACTINFO;
682  t(L"ACCESSINFO") = ACCESSINFO;
683  t(L"INITIALBAL") = INITIALBAL;
684  t(L"INITIALDATE") = INITIALDATE;
685  t(L"FAVORITEACCT") = FAVORITEACCT;
686  t(L"CURRENCYID") = CURRENCYID.GetValue();
687  t(L"STATEMENTLOCKED") = STATEMENTLOCKED.GetValue();
688  t(L"STATEMENTDATE") = STATEMENTDATE;
689  t(L"MINIMUMBALANCE") = MINIMUMBALANCE;
690  t(L"CREDITLIMIT") = CREDITLIMIT;
691  t(L"INTERESTRATE") = INTERESTRATE;
692  t(L"PAYMENTDUEDATE") = PAYMENTDUEDATE;
693  t(L"MINIMUMPAYMENT") = MINIMUMPAYMENT;
694  }
695 
697  bool save(wxSQLite3Database* db, bool force_insert = false)
698  {
699  if (db && db->IsReadOnly()) return false;
700  if (!table_ || !db)
701  {
702  wxLogError("can not save ACCOUNTLIST_V1");
703  return false;
704  }
705 
706  return table_->save(this, db, force_insert);
707  }
708 
710  bool remove(wxSQLite3Database* db)
711  {
712  if (!table_ || !db)
713  {
714  wxLogError("can not remove ACCOUNTLIST_V1");
715  return false;
716  }
717 
718  return table_->remove(this, db);
719  }
720 
721  void destroy()
722  {
723  delete this;
724  }
725  };
726 
727  enum
728  {
730  };
731 
732  size_t num_columns() const { return NUM_COLUMNS; }
733 
735  wxString name() const { return "ACCOUNTLIST_V1"; }
736 
737  DB_Table_ACCOUNTLIST_V1() : fake_(new Data())
738  {
739  query_ = "SELECT ACCOUNTID, ACCOUNTNAME, ACCOUNTTYPE, ACCOUNTNUM, STATUS, NOTES, HELDAT, WEBSITE, CONTACTINFO, ACCESSINFO, INITIALBAL, INITIALDATE, FAVORITEACCT, CURRENCYID, STATEMENTLOCKED, STATEMENTDATE, MINIMUMBALANCE, CREDITLIMIT, INTERESTRATE, PAYMENTDUEDATE, MINIMUMPAYMENT FROM ACCOUNTLIST_V1 ";
740  }
741 
744  {
745  Self::Data* entity = new Self::Data(this);
746  cache_.push_back(entity);
747  return entity;
748  }
749 
751  Self::Data* clone(const Data* e)
752  {
753  Self::Data* entity = create();
754  *entity = *e;
755  entity->id(-1);
756  return entity;
757  }
758 
764  bool save(Self::Data* entity, wxSQLite3Database* db, bool force_insert = false)
765  {
766  wxString sql = wxEmptyString;
767  if (entity->id() <= 0 || force_insert) // new & insert
768  {
769  sql = "INSERT INTO ACCOUNTLIST_V1(ACCOUNTNAME, ACCOUNTTYPE, ACCOUNTNUM, STATUS, NOTES, HELDAT, WEBSITE, CONTACTINFO, ACCESSINFO, INITIALBAL, INITIALDATE, FAVORITEACCT, CURRENCYID, STATEMENTLOCKED, STATEMENTDATE, MINIMUMBALANCE, CREDITLIMIT, INTERESTRATE, PAYMENTDUEDATE, MINIMUMPAYMENT, ACCOUNTID) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
770  }
771  else
772  {
773  sql = "UPDATE ACCOUNTLIST_V1 SET ACCOUNTNAME = ?, ACCOUNTTYPE = ?, ACCOUNTNUM = ?, STATUS = ?, NOTES = ?, HELDAT = ?, WEBSITE = ?, CONTACTINFO = ?, ACCESSINFO = ?, INITIALBAL = ?, INITIALDATE = ?, FAVORITEACCT = ?, CURRENCYID = ?, STATEMENTLOCKED = ?, STATEMENTDATE = ?, MINIMUMBALANCE = ?, CREDITLIMIT = ?, INTERESTRATE = ?, PAYMENTDUEDATE = ?, MINIMUMPAYMENT = ? WHERE ACCOUNTID = ?";
774  }
775 
776  try
777  {
778  wxSQLite3Statement stmt = db->PrepareStatement(sql);
779 
780  stmt.Bind(1, entity->ACCOUNTNAME);
781  stmt.Bind(2, entity->ACCOUNTTYPE);
782  stmt.Bind(3, entity->ACCOUNTNUM);
783  stmt.Bind(4, entity->STATUS);
784  stmt.Bind(5, entity->NOTES);
785  stmt.Bind(6, entity->HELDAT);
786  stmt.Bind(7, entity->WEBSITE);
787  stmt.Bind(8, entity->CONTACTINFO);
788  stmt.Bind(9, entity->ACCESSINFO);
789  stmt.Bind(10, entity->INITIALBAL);
790  stmt.Bind(11, entity->INITIALDATE);
791  stmt.Bind(12, entity->FAVORITEACCT);
792  stmt.Bind(13, entity->CURRENCYID);
793  stmt.Bind(14, entity->STATEMENTLOCKED);
794  stmt.Bind(15, entity->STATEMENTDATE);
795  stmt.Bind(16, entity->MINIMUMBALANCE);
796  stmt.Bind(17, entity->CREDITLIMIT);
797  stmt.Bind(18, entity->INTERESTRATE);
798  stmt.Bind(19, entity->PAYMENTDUEDATE);
799  stmt.Bind(20, entity->MINIMUMPAYMENT);
800  stmt.Bind(21, entity->id() > 0 ? entity->ACCOUNTID : newId());
801 
802  stmt.ExecuteUpdate();
803  stmt.Finalize();
804 
805  if (entity->id() > 0) // existent
806  {
807  for(Cache::iterator it = cache_.begin(); it != cache_.end(); ++ it)
808  {
809  Self::Data* e = *it;
810  if (e->id() == entity->id())
811  *e = *entity; // in-place update
812  }
813  }
814  }
815  catch(const wxSQLite3Exception &e)
816  {
817  wxLogError("ACCOUNTLIST_V1: Exception %s, %s", e.GetMessage().utf8_str(), entity->to_json());
818  return false;
819  }
820 
821  if (entity->id() <= 0)
822  {
823  entity->id(db->GetLastRowId());
824  index_by_id_.insert(std::make_pair(entity->id(), entity));
825  }
826  return true;
827  }
828 
830  bool remove(const int64 id, wxSQLite3Database* db)
831  {
832  if (id <= 0) return false;
833  try
834  {
835  wxString sql = "DELETE FROM ACCOUNTLIST_V1 WHERE ACCOUNTID = ?";
836  wxSQLite3Statement stmt = db->PrepareStatement(sql);
837  stmt.Bind(1, id);
838  stmt.ExecuteUpdate();
839  stmt.Finalize();
840 
841  Cache c;
842  for(Cache::iterator it = cache_.begin(); it != cache_.end(); ++ it)
843  {
844  Self::Data* entity = *it;
845  if (entity->id() == id)
846  {
847  index_by_id_.erase(entity->id());
848  delete entity;
849  }
850  else
851  {
852  c.push_back(entity);
853  }
854  }
855  cache_.clear();
856  cache_.swap(c);
857  }
858  catch(const wxSQLite3Exception &e)
859  {
860  wxLogError("ACCOUNTLIST_V1: Exception %s", e.GetMessage().utf8_str());
861  return false;
862  }
863 
864  return true;
865  }
866 
868  bool remove(Self::Data* entity, wxSQLite3Database* db)
869  {
870  if (remove(entity->id(), db))
871  {
872  entity->id(-1);
873  return true;
874  }
875 
876  return false;
877  }
878 
879  template<typename... Args>
880  Self::Data* get_one(const Args& ... args)
881  {
882  for (auto& [_, item] : index_by_id_)
883  {
884  if (item->id() > 0 && match(item, args...))
885  {
886  ++ hit_;
887  return item;
888  }
889  }
890 
891  ++ miss_;
892 
893  return 0;
894  }
895 
900  Self::Data* get(const int64 id, wxSQLite3Database* db)
901  {
902  if (id <= 0)
903  {
904  ++ skip_;
905  return nullptr;
906  }
907 
908  if (auto it = index_by_id_.find(id); it != index_by_id_.end())
909  {
910  ++ hit_;
911  return it->second;
912  }
913 
914  ++ miss_;
915  Self::Data* entity = nullptr;
916  wxString where = wxString::Format(" WHERE %s = ?", PRIMARY::name().utf8_str());
917  try
918  {
919  wxSQLite3Statement stmt = db->PrepareStatement(this->query() + where);
920  stmt.Bind(1, id);
921 
922  wxSQLite3ResultSet q = stmt.ExecuteQuery();
923  if(q.NextRow())
924  {
925  entity = new Self::Data(q, this);
926  cache_.push_back(entity);
927  index_by_id_.insert(std::make_pair(id, entity));
928  }
929  stmt.Finalize();
930  }
931  catch(const wxSQLite3Exception &e)
932  {
933  wxLogError("%s: Exception %s", this->name().utf8_str(), e.GetMessage().utf8_str());
934  }
935 
936  if (!entity)
937  {
938  entity = this->fake_;
939  // wxLogError("%s: %d not found", this->name().utf8_str(), id);
940  }
941 
942  return entity;
943  }
947  Self::Data* get_record(const int64 id, wxSQLite3Database* db)
948  {
949  if (id <= 0)
950  {
951  ++ skip_;
952  return nullptr;
953  }
954 
955  Self::Data* entity = nullptr;
956  wxString where = wxString::Format(" WHERE %s = ?", PRIMARY::name().utf8_str());
957  try
958  {
959  wxSQLite3Statement stmt = db->PrepareStatement(this->query() + where);
960  stmt.Bind(1, id);
961 
962  wxSQLite3ResultSet q = stmt.ExecuteQuery();
963  if(q.NextRow())
964  {
965  entity = new Self::Data(q, this);
966  }
967  stmt.Finalize();
968  }
969  catch(const wxSQLite3Exception &e)
970  {
971  wxLogError("%s: Exception %s", this->name().utf8_str(), e.GetMessage().utf8_str());
972  }
973 
974  if (!entity)
975  {
976  entity = this->fake_;
977  // wxLogError("%s: %d not found", this->name().utf8_str(), id);
978  }
979 
980  return entity;
981  }
982 
987  const Data_Set all(wxSQLite3Database* db, const COLUMN col = COLUMN(0), const bool asc = true)
988  {
989  Data_Set result;
990  try
991  {
992  wxSQLite3ResultSet q = db->ExecuteQuery(col == COLUMN(0) ? this->query() : this->query() + " ORDER BY " + column_to_name(col) + " COLLATE NOCASE " + (asc ? " ASC " : " DESC "));
993 
994  while(q.NextRow())
995  {
996  Self::Data entity(q, this);
997  result.push_back(std::move(entity));
998  }
999 
1000  q.Finalize();
1001  }
1002  catch(const wxSQLite3Exception &e)
1003  {
1004  wxLogError("%s: Exception %s", this->name().utf8_str(), e.GetMessage().utf8_str());
1005  }
1006 
1007  return result;
1008  }
1009 };
1010 
bool exists(wxSQLite3Database *db) const
Definition: DB_Table.h:65
Definition: DB_Table_Accountlist_V1.h:145
bool match(const DATA *data, const Arg1 &arg1)
Definition: DB_Table.h:170
bool save(Self::Data *entity, wxSQLite3Database *db, bool force_insert=false)
Saves the Data record to the database table.
Definition: DB_Table_Accountlist_V1.h:764
wxString STATUS
Definition: DB_Table_Accountlist_V1.h:338
double MINIMUMBALANCE
Definition: DB_Table_Accountlist_V1.h:350
bool remove(const int64 id, wxSQLite3Database *db)
Remove the Data record from the database and the memory table (cache)
Definition: DB_Table_Accountlist_V1.h:830
static wxString name()
Definition: DB_Table_Accountlist_V1.h:117
Definition: DB_Table_Accountlist_V1.h:255
int64 STATEMENTLOCKED
Definition: DB_Table_Accountlist_V1.h:348
size_t num_columns() const
Definition: DB_Table_Accountlist_V1.h:732
wxString to_json() const
Definition: DB_Table_Accountlist_V1.h:585
bool match(const C &) const
Definition: DB_Table_Accountlist_V1.h:474
Self::Data * create()
Create a new Data record and add to memory table (cache)
Definition: DB_Table_Accountlist_V1.h:743
wxString WEBSITE
Definition: DB_Table_Accountlist_V1.h:341
bool match(const Self::CURRENCYID &in) const
Definition: DB_Table_Accountlist_V1.h:544
STATUS(const wxString &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:142
Copyright: (c) 2013 - 2025 Guan Lisheng (guanlisheng@gmail.com) Copyright: (c) 2017 - 2018 Stefano Gi...
Definition: DB_Table_Accountlist_V1.h:258
V v_
Definition: DB_Table.h:47
Definition: DB_Table_Accountlist_V1.h:23
bool match(const Self::INITIALBAL &in) const
Definition: DB_Table_Accountlist_V1.h:529
double INTERESTRATE
Definition: DB_Table_Accountlist_V1.h:352
size_t hit_
Definition: DB_Table.h:60
static wxString name()
Definition: DB_Table_Accountlist_V1.h:171
Definition: DB_Table_Accountlist_V1.h:263
Definition: DB_Table_Accountlist_V1.h:249
const Data_Set all(wxSQLite3Database *db, const COLUMN col=COLUMN(0), const bool asc=true)
Return a list of Data records (Data_Set) derived directly from the database.
Definition: DB_Table_Accountlist_V1.h:987
Definition: DB_Table_Accountlist_V1.h:264
Data * fake_
Definition: DB_Table_Accountlist_V1.h:55
INITIALBAL(const double &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:178
Definition: DB_Table_Accountlist_V1.h:133
OP
Definition: DB_Table.h:42
Definition: DB_Table_Accountlist_V1.h:193
ACCOUNTID(const int64 &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:118
static wxString name()
Definition: DB_Table_Accountlist_V1.h:153
static wxString name()
Definition: DB_Table_Accountlist_V1.h:189
static wxString column_to_name(const COLUMN col)
Returns the column name as a string.
Definition: DB_Table_Accountlist_V1.h:268
Definition: DB_Table_Accountlist_V1.h:257
static wxString name()
Definition: DB_Table_Accountlist_V1.h:165
Definition: DB_Table_Accountlist_V1.h:121
WEBSITE(const wxString &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:160
Data is a single record in the database table.
Definition: DB_Table_Accountlist_V1.h:328
wxString PAYMENTDUEDATE
Definition: DB_Table_Accountlist_V1.h:353
bool match(const Self::CONTACTINFO &in) const
Definition: DB_Table_Accountlist_V1.h:519
static wxString name()
Definition: DB_Table_Accountlist_V1.h:231
Definition: DB_Table_Accountlist_V1.h:175
Definition: DB_Table_Accountlist_V1.h:151
bool match(const Self::STATEMENTDATE &in) const
Definition: DB_Table_Accountlist_V1.h:554
wxString to_json() const
Return the data records as a json array string.
Definition: DB_Table_Accountlist_V1.h:32
wxString name() const
Name of the table.
Definition: DB_Table_Accountlist_V1.h:735
Definition: DB_Table_Accountlist_V1.h:259
wxString ACCOUNTNUM
Definition: DB_Table_Accountlist_V1.h:337
static int64 newId()
Definition: DB_Table.h:75
ACCOUNTTYPE(const wxString &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:130
id
Definition: constants.h:125
Definition: DB_Table_Accountlist_V1.h:260
Definition: DB_Table_Accountlist_V1.h:253
bool match(const Self::WEBSITE &in) const
Definition: DB_Table_Accountlist_V1.h:514
Definition: DB_Table_Accountlist_V1.h:217
static wxString name()
Definition: DB_Table_Accountlist_V1.h:225
bool equals(const Data *r) const
Definition: DB_Table_Accountlist_V1.h:376
bool match(const Self::CREDITLIMIT &in) const
Definition: DB_Table_Accountlist_V1.h:564
A container to hold list of Data records for the table.
Definition: DB_Table_Accountlist_V1.h:29
Definition: DB_Table_Accountlist_V1.h:211
Definition: DB_Table_Accountlist_V1.h:205
bool match(const Self::MINIMUMPAYMENT &in) const
Definition: DB_Table_Accountlist_V1.h:579
Definition: DB_Table_Accountlist_V1.h:261
static wxString name()
Definition: DB_Table_Accountlist_V1.h:147
void ensure_data(wxSQLite3Database *db)
Definition: DB_Table_Accountlist_V1.h:109
Definition: DB_Table_Accountlist_V1.h:248
Definition: DB_Table_Accountlist_V1.h:244
bool ensure_index(wxSQLite3Database *db)
Definition: DB_Table_Accountlist_V1.h:94
double MINIMUMPAYMENT
Definition: DB_Table_Accountlist_V1.h:354
DB_Table_ACCOUNTLIST_V1()
Definition: DB_Table_Accountlist_V1.h:737
row_t to_row_t() const
Definition: DB_Table_Accountlist_V1.h:644
bool match(const Self::FAVORITEACCT &in) const
Definition: DB_Table_Accountlist_V1.h:539
Definition: DB_Table_Accountlist_V1.h:247
size_t skip_
Definition: DB_Table.h:60
ACCOUNTNUM(const wxString &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:136
void id(const int64 id)
Definition: DB_Table_Accountlist_V1.h:361
bool match(const Self::PAYMENTDUEDATE &in) const
Definition: DB_Table_Accountlist_V1.h:574
int64 CURRENCYID
Definition: DB_Table_Accountlist_V1.h:347
std::map< int64, Self::Data * > Index_By_Id
Definition: DB_Table_Accountlist_V1.h:52
bool match(const Self::INITIALDATE &in) const
Definition: DB_Table_Accountlist_V1.h:534
Definition: DB_Table_Accountlist_V1.h:181
static wxString name()
Definition: DB_Table_Accountlist_V1.h:177
bool ensure(wxSQLite3Database *db)
Creates the database table if the table does not exist.
Definition: DB_Table_Accountlist_V1.h:73
CONTACTINFO(const wxString &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:166
void destroy_cache()
Removes all records stored in memory (cache) for the table.
Definition: DB_Table_Accountlist_V1.h:65
CURRENCYID(const int64 &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:196
Definition: DB_Table_Accountlist_V1.h:157
bool match(const Self::ACCOUNTID &in) const
Definition: DB_Table_Accountlist_V1.h:479
void as_json(PrettyWriter< StringBuffer > &json_writer) const
Definition: DB_Table_Accountlist_V1.h:598
static COLUMN name_to_column(const wxString &name)
Returns the column number from the given column name.
Definition: DB_Table_Accountlist_V1.h:300
static wxString name()
Definition: DB_Table_Accountlist_V1.h:237
~DB_Table_ACCOUNTLIST_V1()
Destructor: clears any data records stored in memory.
Definition: DB_Table_Accountlist_V1.h:58
Data(Self *table=nullptr)
Definition: DB_Table_Accountlist_V1.h:402
ACCESSINFO(const wxString &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:172
Definition: DB_Table_Accountlist_V1.h:729
wxString ACCOUNTTYPE
Definition: DB_Table_Accountlist_V1.h:336
bool match(const Self::STATEMENTLOCKED &in) const
Definition: DB_Table_Accountlist_V1.h:549
Definition: DB_Table.h:42
Definition: DB_Table_Accountlist_V1.h:115
DB_Table_ACCOUNTLIST_V1 Self
Definition: DB_Table_Accountlist_V1.h:25
Definition: DB_Table.h:45
Definition: DB_Table_Accountlist_V1.h:245
double INITIALBAL
Definition: DB_Table_Accountlist_V1.h:344
wxString STATEMENTDATE
Definition: DB_Table_Accountlist_V1.h:349
Definition: DB_Table_Accountlist_V1.h:251
Definition: DB_Table_Accountlist_V1.h:223
virtual wxString query() const
Definition: DB_Table.h:61
Data(wxSQLite3ResultSet &q, Self *table=nullptr)
Definition: DB_Table_Accountlist_V1.h:416
Self::Data * get_one(const Args &... args)
Definition: DB_Table_Accountlist_V1.h:880
INTERESTRATE(const double &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:226
static wxString name()
Definition: DB_Table_Accountlist_V1.h:135
std::vector< Self::Data * > Cache
A container to hold a list of Data record pointers for the table in memory.
Definition: DB_Table_Accountlist_V1.h:51
Definition: DB_Table_Accountlist_V1.h:229
bool match(const Self::NOTES &in) const
Definition: DB_Table_Accountlist_V1.h:504
static wxString name()
Definition: DB_Table_Accountlist_V1.h:141
static wxString name()
Definition: DB_Table_Accountlist_V1.h:213
wxString ACCESSINFO
Definition: DB_Table_Accountlist_V1.h:343
Definition: DB_Table_Accountlist_V1.h:246
double CREDITLIMIT
Definition: DB_Table_Accountlist_V1.h:351
void destroy()
Definition: DB_Table_Accountlist_V1.h:721
wxString INITIALDATE
Definition: DB_Table_Accountlist_V1.h:345
size_t miss_
Definition: DB_Table.h:60
Definition: DB_Table_Accountlist_V1.h:127
bool save(wxSQLite3Database *db, bool force_insert=false)
Save the record instance in memory to the database.
Definition: DB_Table_Accountlist_V1.h:697
bool match(const Self::MINIMUMBALANCE &in) const
Definition: DB_Table_Accountlist_V1.h:559
int64 id() const
Definition: DB_Table_Accountlist_V1.h:356
Self::Data * clone(const Data *e)
Create a copy of the Data record and add to memory table (cache)
Definition: DB_Table_Accountlist_V1.h:751
static wxString name()
Definition: DB_Table_Accountlist_V1.h:195
CREDITLIMIT(const double &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:220
ACCOUNTNAME(const wxString &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:124
wxString ACCOUNTNAME
Definition: DB_Table_Accountlist_V1.h:335
bool match(const Self::ACCOUNTNUM &in) const
Definition: DB_Table_Accountlist_V1.h:494
STATEMENTLOCKED(const int64 &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:202
Definition: DB_Table_Accountlist_V1.h:262
Definition: DB_Table_Accountlist_V1.h:199
Definition: DB_Table_Accountlist_V1.h:163
wxString CONTACTINFO
Definition: DB_Table_Accountlist_V1.h:342
Definition: DB_Table_Accountlist_V1.h:235
bool match(const Self::HELDAT &in) const
Definition: DB_Table_Accountlist_V1.h:509
void to_template(html_template &t) const
Definition: DB_Table_Accountlist_V1.h:671
FAVORITEACCT(const wxString &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:190
bool match(const Self::INTERESTRATE &in) const
Definition: DB_Table_Accountlist_V1.h:569
static wxString name()
Definition: DB_Table_Accountlist_V1.h:159
static wxString name()
Definition: DB_Table_Accountlist_V1.h:129
Self::Data * get_record(const int64 id, wxSQLite3Database *db)
Search the database for the data record, bypassing the cache.
Definition: DB_Table_Accountlist_V1.h:947
HELDAT(const wxString &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:154
COLUMN
Definition: DB_Table_Accountlist_V1.h:242
wxString NOTES
Definition: DB_Table_Accountlist_V1.h:339
static wxString name()
Definition: DB_Table_Accountlist_V1.h:123
bool match(const Self::ACCOUNTNAME &in) const
Definition: DB_Table_Accountlist_V1.h:484
Definition: DB_Table.h:55
bool match(const Self::STATUS &in) const
Definition: DB_Table_Accountlist_V1.h:499
static wxString name()
Definition: DB_Table_Accountlist_V1.h:219
Data & operator=(const Data &other)
Definition: DB_Table_Accountlist_V1.h:445
Definition: DB_Table_Accountlist_V1.h:252
int64 ACCOUNTID
Definition: DB_Table_Accountlist_V1.h:334
Definition: DB_Table_Accountlist_V1.h:169
MINIMUMPAYMENT(const double &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:238
Definition: DB_Table_Accountlist_V1.h:139
MINIMUMBALANCE(const double &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:214
wxString HELDAT
Definition: DB_Table_Accountlist_V1.h:340
Index_By_Id index_by_id_
Definition: DB_Table_Accountlist_V1.h:54
PAYMENTDUEDATE(const wxString &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:232
wxLongLong int64
Definition: customfieldlistdialog.h:26
ACCOUNTID PRIMARY
Definition: DB_Table_Accountlist_V1.h:241
INITIALDATE(const wxString &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:184
Self * table_
This is a instance pointer to itself in memory.
Definition: DB_Table_Accountlist_V1.h:332
STATEMENTDATE(const wxString &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:208
static wxString name()
Definition: DB_Table_Accountlist_V1.h:201
wxString query_
Definition: DB_Table.h:58
Definition: DB_Table_Accountlist_V1.h:250
NOTES(const wxString &v, OP op=EQUAL)
Definition: DB_Table_Accountlist_V1.h:148
bool match(const Self::ACCOUNTTYPE &in) const
Definition: DB_Table_Accountlist_V1.h:489
bool match(const Self::ACCESSINFO &in) const
Definition: DB_Table_Accountlist_V1.h:524
wxString FAVORITEACCT
Definition: DB_Table_Accountlist_V1.h:346
Cache cache_
Definition: DB_Table_Accountlist_V1.h:53
Definition: DB_Table_Accountlist_V1.h:187
static wxString name()
Definition: DB_Table_Accountlist_V1.h:183
Definition: DB_Table_Accountlist_V1.h:256
Definition: DB_Table_Accountlist_V1.h:254
static wxString name()
Definition: DB_Table_Accountlist_V1.h:207