diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2023-06-28 21:35:52 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2023-06-28 21:35:52 +0200 |
commit | b86540b743f1a87a163ffb811c8fe22a01fefa38 (patch) | |
tree | b47cb3bb83c2377234226fb3987ab3320a987dd9 /src/db/DatabaseTable.vala | |
parent | ac6e0b731b9f0b2efd392e3309a5c07e2a66adad (diff) | |
parent | e905d8e16eec152d19797937f13ba3cf4b8f8aca (diff) |
Merge branch 'release/debian/0.32.1-1'debian/0.32.1-1
Diffstat (limited to 'src/db/DatabaseTable.vala')
-rw-r--r-- | src/db/DatabaseTable.vala | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/db/DatabaseTable.vala b/src/db/DatabaseTable.vala index 5ec5be1..dea797a 100644 --- a/src/db/DatabaseTable.vala +++ b/src/db/DatabaseTable.vala @@ -21,12 +21,12 @@ public abstract class DatabaseTable { * tables are created on demand and tables and columns are easily ignored when already present. * However, the change should be noted in upgrade_database() as a comment. ***/ - public const int SCHEMA_VERSION = 20; - + public const int SCHEMA_VERSION = 24; + protected static Sqlite.Database db; - + private static int in_transaction = 0; - + public string table_name = null; private static void prepare_db(string filename) { @@ -287,7 +287,19 @@ public abstract class DatabaseTable { if (res != Sqlite.DONE) throw_error("DatabaseTable.update_int64_by_id_2 %s.%s".printf(table_name, column), res); } - + + protected void update_double_by_id_2(int64 id, string column, double value) throws DatabaseError { + Sqlite.Statement stmt; + prepare_update_by_id(id, column, out stmt); + + int res = stmt.bind_double(1, value); + assert(res == Sqlite.OK); + + res = stmt.step(); + if (res != Sqlite.DONE) + throw_error("DatabaseTable.update_double_by_id_2 %s.%s".printf(table_name, column), res); + } + protected void delete_by_id(int64 id) throws DatabaseError { Sqlite.Statement stmt; int res = db.prepare_v2("DELETE FROM %s WHERE id=?".printf(table_name), -1, out stmt); |