Skip to content

Commit

Permalink
Merge pull request moneymanagerex#5534 from n-stein/fix(moneymanagere…
Browse files Browse the repository at this point in the history
…x#5521)

fix(moneymanagerex#5521): update LASTUPDATEDTIME only on field change
  • Loading branch information
vomikan committed Jan 13, 2023
2 parents 64e7210 + d30ca6d commit 9b0838d
Show file tree
Hide file tree
Showing 28 changed files with 1,939 additions and 207 deletions.
4 changes: 2 additions & 2 deletions src/db/DB_Table.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// -*- C++ -*-
//=============================================================================
/**
* Copyright: (c) 2013 - 2022 Guan Lisheng (guanlisheng@gmail.com)
* Copyright: (c) 2013 - 2023 Guan Lisheng (guanlisheng@gmail.com)
* Copyright: (c) 2017 - 2018 Stefano Giorgio (stef145g)
* Copyright: (c) 2022 Mark Whalley (mark@ipx.co.uk)
*
Expand All @@ -12,7 +12,7 @@
* @brief
*
* Revision History:
* AUTO GENERATED at 2022-12-18 13:00:45.607197.
* AUTO GENERATED at 2023-01-12 21:06:50.482915.
* DO NOT EDIT!
*/
//=============================================================================
Expand Down
68 changes: 66 additions & 2 deletions src/db/DB_Table_Accountlist_V1.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// -*- C++ -*-
//=============================================================================
/**
* Copyright: (c) 2013 - 2022 Guan Lisheng (guanlisheng@gmail.com)
* Copyright: (c) 2013 - 2023 Guan Lisheng (guanlisheng@gmail.com)
* Copyright: (c) 2017 - 2018 Stefano Giorgio (stef145g)
* Copyright: (c) 2022 Mark Whalley (mark@ipx.co.uk)
*
Expand All @@ -12,7 +12,7 @@
* @brief
*
* Revision History:
* AUTO GENERATED at 2022-12-18 13:00:45.607197.
* AUTO GENERATED at 2023-01-12 21:06:50.482915.
* DO NOT EDIT!
*/
//=============================================================================
Expand Down Expand Up @@ -373,6 +373,32 @@ struct DB_Table_ACCOUNTLIST_V1 : public DB_Table
return this->id() < r->id();
}

bool equals(const Data* r) const
{
if(ACCOUNTID != r->ACCOUNTID) return false;
if(!ACCOUNTNAME.IsSameAs(r->ACCOUNTNAME)) return false;
if(!ACCOUNTTYPE.IsSameAs(r->ACCOUNTTYPE)) return false;
if(!ACCOUNTNUM.IsSameAs(r->ACCOUNTNUM)) return false;
if(!STATUS.IsSameAs(r->STATUS)) return false;
if(!NOTES.IsSameAs(r->NOTES)) return false;
if(!HELDAT.IsSameAs(r->HELDAT)) return false;
if(!WEBSITE.IsSameAs(r->WEBSITE)) return false;
if(!CONTACTINFO.IsSameAs(r->CONTACTINFO)) return false;
if(!ACCESSINFO.IsSameAs(r->ACCESSINFO)) return false;
if(INITIALBAL != r->INITIALBAL) return false;
if(!INITIALDATE.IsSameAs(r->INITIALDATE)) return false;
if(!FAVORITEACCT.IsSameAs(r->FAVORITEACCT)) return false;
if(CURRENCYID != r->CURRENCYID) return false;
if(STATEMENTLOCKED != r->STATEMENTLOCKED) return false;
if(!STATEMENTDATE.IsSameAs(r->STATEMENTDATE)) return false;
if(MINIMUMBALANCE != r->MINIMUMBALANCE) return false;
if(CREDITLIMIT != r->CREDITLIMIT) return false;
if(INTERESTRATE != r->INTERESTRATE) return false;
if(!PAYMENTDUEDATE.IsSameAs(r->PAYMENTDUEDATE)) return false;
if(MINIMUMPAYMENT != r->MINIMUMPAYMENT) return false;
return true;
}

explicit Data(Self* table = 0)
{
table_ = table;
Expand Down Expand Up @@ -916,6 +942,44 @@ struct DB_Table_ACCOUNTLIST_V1 : public DB_Table

return entity;
}
/**
* Search the database for the data record, bypassing the cache.
*/
Self::Data* get_record(int id, wxSQLite3Database* db)
{
if (id <= 0)
{
++ skip_;
return 0;
}

Self::Data* entity = 0;
wxString where = wxString::Format(" WHERE %s = ?", PRIMARY::name().utf8_str());
try
{
wxSQLite3Statement stmt = db->PrepareStatement(this->query() + where);
stmt.Bind(1, id);

wxSQLite3ResultSet q = stmt.ExecuteQuery();
if(q.NextRow())
{
entity = new Self::Data(q, this);
}
stmt.Finalize();
}
catch(const wxSQLite3Exception &e)
{
wxLogError("%s: Exception %s", this->name().utf8_str(), e.GetMessage().utf8_str());
}

if (!entity)
{
entity = this->fake_;
// wxLogError("%s: %d not found", this->name().utf8_str(), id);
}

return entity;
}

/**
* Return a list of Data records (Data_Set) derived directly from the database.
Expand Down
58 changes: 56 additions & 2 deletions src/db/DB_Table_Assets_V1.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// -*- C++ -*-
//=============================================================================
/**
* Copyright: (c) 2013 - 2022 Guan Lisheng (guanlisheng@gmail.com)
* Copyright: (c) 2013 - 2023 Guan Lisheng (guanlisheng@gmail.com)
* Copyright: (c) 2017 - 2018 Stefano Giorgio (stef145g)
* Copyright: (c) 2022 Mark Whalley (mark@ipx.co.uk)
*
Expand All @@ -12,7 +12,7 @@
* @brief
*
* Revision History:
* AUTO GENERATED at 2022-12-18 13:00:45.607197.
* AUTO GENERATED at 2023-01-12 21:06:50.482915.
* DO NOT EDIT!
*/
//=============================================================================
Expand Down Expand Up @@ -273,6 +273,22 @@ struct DB_Table_ASSETS_V1 : public DB_Table
return this->id() < r->id();
}

bool equals(const Data* r) const
{
if(ASSETID != r->ASSETID) return false;
if(!STARTDATE.IsSameAs(r->STARTDATE)) return false;
if(!ASSETNAME.IsSameAs(r->ASSETNAME)) return false;
if(!ASSETSTATUS.IsSameAs(r->ASSETSTATUS)) return false;
if(CURRENCYID != r->CURRENCYID) return false;
if(!VALUECHANGEMODE.IsSameAs(r->VALUECHANGEMODE)) return false;
if(VALUE != r->VALUE) return false;
if(!VALUECHANGE.IsSameAs(r->VALUECHANGE)) return false;
if(!NOTES.IsSameAs(r->NOTES)) return false;
if(VALUECHANGERATE != r->VALUECHANGERATE) return false;
if(!ASSETTYPE.IsSameAs(r->ASSETTYPE)) return false;
return true;
}

explicit Data(Self* table = 0)
{
table_ = table;
Expand Down Expand Up @@ -692,6 +708,44 @@ struct DB_Table_ASSETS_V1 : public DB_Table

return entity;
}
/**
* Search the database for the data record, bypassing the cache.
*/
Self::Data* get_record(int id, wxSQLite3Database* db)
{
if (id <= 0)
{
++ skip_;
return 0;
}

Self::Data* entity = 0;
wxString where = wxString::Format(" WHERE %s = ?", PRIMARY::name().utf8_str());
try
{
wxSQLite3Statement stmt = db->PrepareStatement(this->query() + where);
stmt.Bind(1, id);

wxSQLite3ResultSet q = stmt.ExecuteQuery();
if(q.NextRow())
{
entity = new Self::Data(q, this);
}
stmt.Finalize();
}
catch(const wxSQLite3Exception &e)
{
wxLogError("%s: Exception %s", this->name().utf8_str(), e.GetMessage().utf8_str());
}

if (!entity)
{
entity = this->fake_;
// wxLogError("%s: %d not found", this->name().utf8_str(), id);
}

return entity;
}

/**
* Return a list of Data records (Data_Set) derived directly from the database.
Expand Down
52 changes: 50 additions & 2 deletions src/db/DB_Table_Attachment_V1.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// -*- C++ -*-
//=============================================================================
/**
* Copyright: (c) 2013 - 2022 Guan Lisheng (guanlisheng@gmail.com)
* Copyright: (c) 2013 - 2023 Guan Lisheng (guanlisheng@gmail.com)
* Copyright: (c) 2017 - 2018 Stefano Giorgio (stef145g)
* Copyright: (c) 2022 Mark Whalley (mark@ipx.co.uk)
*
Expand All @@ -12,7 +12,7 @@
* @brief
*
* Revision History:
* AUTO GENERATED at 2022-12-18 13:00:45.607197.
* AUTO GENERATED at 2023-01-12 21:06:50.482915.
* DO NOT EDIT!
*/
//=============================================================================
Expand Down Expand Up @@ -213,6 +213,16 @@ struct DB_Table_ATTACHMENT_V1 : public DB_Table
return this->id() < r->id();
}

bool equals(const Data* r) const
{
if(ATTACHMENTID != r->ATTACHMENTID) return false;
if(!REFTYPE.IsSameAs(r->REFTYPE)) return false;
if(REFID != r->REFID) return false;
if(!DESCRIPTION.IsSameAs(r->DESCRIPTION)) return false;
if(!FILENAME.IsSameAs(r->FILENAME)) return false;
return true;
}

explicit Data(Self* table = 0)
{
table_ = table;
Expand Down Expand Up @@ -558,6 +568,44 @@ struct DB_Table_ATTACHMENT_V1 : public DB_Table

return entity;
}
/**
* Search the database for the data record, bypassing the cache.
*/
Self::Data* get_record(int id, wxSQLite3Database* db)
{
if (id <= 0)
{
++ skip_;
return 0;
}

Self::Data* entity = 0;
wxString where = wxString::Format(" WHERE %s = ?", PRIMARY::name().utf8_str());
try
{
wxSQLite3Statement stmt = db->PrepareStatement(this->query() + where);
stmt.Bind(1, id);

wxSQLite3ResultSet q = stmt.ExecuteQuery();
if(q.NextRow())
{
entity = new Self::Data(q, this);
}
stmt.Finalize();
}
catch(const wxSQLite3Exception &e)
{
wxLogError("%s: Exception %s", this->name().utf8_str(), e.GetMessage().utf8_str());
}

if (!entity)
{
entity = this->fake_;
// wxLogError("%s: %d not found", this->name().utf8_str(), id);
}

return entity;
}

/**
* Return a list of Data records (Data_Set) derived directly from the database.
Expand Down
63 changes: 61 additions & 2 deletions src/db/DB_Table_Billsdeposits_V1.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// -*- C++ -*-
//=============================================================================
/**
* Copyright: (c) 2013 - 2022 Guan Lisheng (guanlisheng@gmail.com)
* Copyright: (c) 2013 - 2023 Guan Lisheng (guanlisheng@gmail.com)
* Copyright: (c) 2017 - 2018 Stefano Giorgio (stef145g)
* Copyright: (c) 2022 Mark Whalley (mark@ipx.co.uk)
*
Expand All @@ -12,7 +12,7 @@
* @brief
*
* Revision History:
* AUTO GENERATED at 2022-12-18 13:00:45.607197.
* AUTO GENERATED at 2023-01-12 21:06:50.482915.
* DO NOT EDIT!
*/
//=============================================================================
Expand Down Expand Up @@ -323,6 +323,27 @@ struct DB_Table_BILLSDEPOSITS_V1 : public DB_Table
return this->id() < r->id();
}

bool equals(const Data* r) const
{
if(BDID != r->BDID) return false;
if(ACCOUNTID != r->ACCOUNTID) return false;
if(TOACCOUNTID != r->TOACCOUNTID) return false;
if(PAYEEID != r->PAYEEID) return false;
if(!TRANSCODE.IsSameAs(r->TRANSCODE)) return false;
if(TRANSAMOUNT != r->TRANSAMOUNT) return false;
if(!STATUS.IsSameAs(r->STATUS)) return false;
if(!TRANSACTIONNUMBER.IsSameAs(r->TRANSACTIONNUMBER)) return false;
if(!NOTES.IsSameAs(r->NOTES)) return false;
if(CATEGID != r->CATEGID) return false;
if(!TRANSDATE.IsSameAs(r->TRANSDATE)) return false;
if(FOLLOWUPID != r->FOLLOWUPID) return false;
if(TOTRANSAMOUNT != r->TOTRANSAMOUNT) return false;
if(REPEATS != r->REPEATS) return false;
if(!NEXTOCCURRENCEDATE.IsSameAs(r->NEXTOCCURRENCEDATE)) return false;
if(NUMOCCURRENCES != r->NUMOCCURRENCES) return false;
return true;
}

explicit Data(Self* table = 0)
{
table_ = table;
Expand Down Expand Up @@ -808,6 +829,44 @@ struct DB_Table_BILLSDEPOSITS_V1 : public DB_Table

return entity;
}
/**
* Search the database for the data record, bypassing the cache.
*/
Self::Data* get_record(int id, wxSQLite3Database* db)
{
if (id <= 0)
{
++ skip_;
return 0;
}

Self::Data* entity = 0;
wxString where = wxString::Format(" WHERE %s = ?", PRIMARY::name().utf8_str());
try
{
wxSQLite3Statement stmt = db->PrepareStatement(this->query() + where);
stmt.Bind(1, id);

wxSQLite3ResultSet q = stmt.ExecuteQuery();
if(q.NextRow())
{
entity = new Self::Data(q, this);
}
stmt.Finalize();
}
catch(const wxSQLite3Exception &e)
{
wxLogError("%s: Exception %s", this->name().utf8_str(), e.GetMessage().utf8_str());
}

if (!entity)
{
entity = this->fake_;
// wxLogError("%s: %d not found", this->name().utf8_str(), id);
}

return entity;
}

/**
* Return a list of Data records (Data_Set) derived directly from the database.
Expand Down
Loading

0 comments on commit 9b0838d

Please sign in to comment.