diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2018-05-01 14:43:08 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2018-05-01 14:43:08 +0200 |
commit | 2b3f22361da0c1d8e6ce70d71352821758186db7 (patch) | |
tree | 5d10633b47369b3aa52a05bf889ede0dbe5ee108 /plugins/shotwell-data-imports/FSpotDatabaseTable.vala | |
parent | 211da5fc3048ca2b6ccee2166b0aaaade55cb84f (diff) | |
parent | dc6c76eb04dfe3d4262a1806808f0bc0bf523238 (diff) |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'plugins/shotwell-data-imports/FSpotDatabaseTable.vala')
-rw-r--r-- | plugins/shotwell-data-imports/FSpotDatabaseTable.vala | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/plugins/shotwell-data-imports/FSpotDatabaseTable.vala b/plugins/shotwell-data-imports/FSpotDatabaseTable.vala deleted file mode 100644 index f2bcdc9..0000000 --- a/plugins/shotwell-data-imports/FSpotDatabaseTable.vala +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright 2016 Software Freedom Conservancy Inc. - * - * This software is licensed under the GNU LGPL (version 2.1 or later). - * See the COPYING file in this distribution. - */ - -namespace DataImports.FSpot.Db { - -/** - * This class represents a generic F-Spot table. - */ -public abstract class FSpotDatabaseTable<T> : ImportableDatabaseTable { - protected unowned Sqlite.Database fspot_db; - protected FSpotTableBehavior<T> behavior; - - public FSpotDatabaseTable(Sqlite.Database db) { - this.fspot_db = db; - } - - public void set_behavior(FSpotTableBehavior<T> behavior) { - this.behavior = behavior; - set_table_name(behavior.get_table_name()); - } - - public FSpotTableBehavior<T> get_behavior() { - return behavior; - } - - protected string get_joined_column_list(bool with_table = false) { - string[] columns = behavior.list_columns(); - if (with_table) - for (int i = 0; i < columns.length; i++) - columns[i] = "%s.%s".printf(table_name, columns[i]); - return string.joinv(", ", columns); - } - - protected int select_all(out Sqlite.Statement stmt) throws DatabaseError { - string column_list = get_joined_column_list(); - string sql = "SELECT %s FROM %s".printf(column_list, table_name); - - int res = fspot_db.prepare_v2(sql, -1, out stmt); - if (res != Sqlite.OK) - throw_error("Statement failed: %s".printf(sql), res); - - res = stmt.step(); - if (res != Sqlite.ROW && res != Sqlite.DONE) - throw_error("select_all %s %s".printf(table_name, column_list), res); - - return res; - } -} - -} - |