summaryrefslogtreecommitdiff
path: root/plugins/shotwell-data-imports/FSpotRollsTable.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2018-05-01 14:35:32 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2018-05-01 14:35:32 +0200
commite230b6f78546827521107be23797048482c8b193 (patch)
tree948c1e77382c484819ea399bba4edcdc19cc6bf0 /plugins/shotwell-data-imports/FSpotRollsTable.vala
parent211da5fc3048ca2b6ccee2166b0aaaade55cb84f (diff)
parent49120f48474fc8fdc2448c75d961bc238213cfac (diff)
Update upstream source from tag 'upstream/0.28.2'
Update to upstream version '0.28.2' with Debian dir 811236a8e9a1308bf427065dcb6270419ff4f965
Diffstat (limited to 'plugins/shotwell-data-imports/FSpotRollsTable.vala')
-rw-r--r--plugins/shotwell-data-imports/FSpotRollsTable.vala111
1 files changed, 0 insertions, 111 deletions
diff --git a/plugins/shotwell-data-imports/FSpotRollsTable.vala b/plugins/shotwell-data-imports/FSpotRollsTable.vala
deleted file mode 100644
index 8a5ee8c..0000000
--- a/plugins/shotwell-data-imports/FSpotRollsTable.vala
+++ /dev/null
@@ -1,111 +0,0 @@
-/* Copyright 2016 Software Freedom Conservancy Inc.
- *
- * This software is licensed under the GNU Lesser General Public License
- * (version 2.1 or later). See the COPYING file in this distribution.
- */
-
-namespace DataImports.FSpot.Db {
-
-/**
- * The value object for the "rolls" table, representing a single database row.
- */
-public class FSpotRollRow : Object {
- public int64 id;
- public time_t time;
-}
-
-/**
- * This class represents the F-Spot rolls table.
- */
-public class FSpotRollsTable : FSpotDatabaseTable<FSpotRollRow> {
- public const string TABLE_NAME = "Rolls";
- public const string TABLE_NAME_PRE_V5 = "Imports";
-
- public FSpotRollsTable(Sqlite.Database db, FSpotDatabaseBehavior db_behavior) {
- base(db);
- set_behavior(db_behavior.get_rolls_behavior());
- }
-
- public FSpotRollRow? get_by_id(int64 roll_id) throws DatabaseError {
- Sqlite.Statement stmt;
- FSpotRollRow? row = null;
- string column_list = get_joined_column_list();
- string sql = "SELECT %s FROM %s WHERE id=?".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.bind_int64(1, roll_id);
- if (res != Sqlite.OK)
- throw_error("Bind failed for roll_id", res);
-
- res = stmt.step();
- if (res == Sqlite.ROW)
- behavior.build_row(stmt, out row);
- else if (res == Sqlite.DONE)
- message("Could not find roll row with ID %d", (int)roll_id);
-
- return row;
- }
-}
-
-// Rolls table behavior for v0-4
-public class FSpotRollsV0Behavior : FSpotTableBehavior<FSpotRollRow>, Object {
- private static FSpotRollsV0Behavior instance;
-
- private FSpotRollsV0Behavior() {
- }
-
- public static FSpotRollsV0Behavior get_instance() {
- if (instance == null)
- instance = new FSpotRollsV0Behavior();
- return instance;
- }
-
- public string get_table_name() {
- return FSpotRollsTable.TABLE_NAME_PRE_V5;
- }
-
- public string[] list_columns() {
- return { "id", "time" };
- }
-
- public void build_row(Sqlite.Statement stmt, out FSpotRollRow row, int offset = 0) {
- row = new FSpotRollRow();
- row.id = stmt.column_int64(offset + 0);
- row.time = (time_t) stmt.column_int64(offset + 1);
- }
-}
-
-// Rolls table behavior for v5+
-// Table name changed from "imports" to "rolls"
-public class FSpotRollsV5Behavior : FSpotTableBehavior<FSpotRollRow>, Object {
- private static FSpotRollsV5Behavior instance;
-
- private FSpotRollsV5Behavior() {
- }
-
- public static FSpotRollsV5Behavior get_instance() {
- if (instance == null)
- instance = new FSpotRollsV5Behavior();
- return instance;
- }
-
- public string get_table_name() {
- return FSpotRollsTable.TABLE_NAME;
- }
-
- public string[] list_columns() {
- return { "id", "time" };
- }
-
- public void build_row(Sqlite.Statement stmt, out FSpotRollRow row, int offset = 0) {
- row = new FSpotRollRow();
- row.id = stmt.column_int64(offset + 0);
- row.time = (time_t) stmt.column_int64(offset + 1);
- }
-}
-
-}
-