summaryrefslogtreecommitdiff
path: root/plugins/shotwell-data-imports/FSpotPhotoTagsTable.vala
blob: d4e820226ee1c49c52e4696eb905cc7405fef119 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* 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 "photo_tags" table, representing a single database row.
 */
public class FSpotPhotoTagRow : Object {
    public int64 photo_id;
    public int64 tag_id;
}

/**
 * This class represents the F-Spot photo_tags table.
 */
public class FSpotPhotoTagsTable : FSpotDatabaseTable<FSpotPhotoTagRow> {
    public static const string TABLE_NAME = "Photo_Tags";
    
    public FSpotPhotoTagsTable(Sqlite.Database db, FSpotDatabaseBehavior db_behavior) {
        base(db);
        set_behavior(db_behavior.get_photo_tags_behavior());
    }
}

public class FSpotPhotoTagsV0Behavior : FSpotTableBehavior<FSpotPhotoTagRow>, Object {
    private static FSpotPhotoTagsV0Behavior instance;
    
    private FSpotPhotoTagsV0Behavior() {
    }
    
    public static FSpotPhotoTagsV0Behavior get_instance() {
        if (instance == null)
            instance = new FSpotPhotoTagsV0Behavior();
        return instance;
    }
    
    public string get_table_name() {
        return FSpotPhotoTagsTable.TABLE_NAME;
    }

    public string[] list_columns() {
        return { "photo_id", "tag_id" };
    }
    
    public void build_row(Sqlite.Statement stmt, out FSpotPhotoTagRow row, int offset = 0) {
        row = new FSpotPhotoTagRow();
        row.photo_id = stmt.column_int64(offset + 0);
        row.tag_id = stmt.column_int64(offset + 1);
    }
}

}