From 143bfc9f801c84428074312d661f8e08803df83b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 20 Aug 2016 15:09:31 +0200 Subject: Imported Upstream version 0.23.5 --- src/db/DatabaseTable.c | 2638 ++++++++++++ src/db/DatabaseTable.vala | 7 + src/db/Db.c | 852 ++++ src/db/Db.vala | 2 +- src/db/EventTable.c | 1877 +++++++++ src/db/PhotoTable.c | 9397 +++++++++++++++++++++++++++++++++++++++++++ src/db/PhotoTable.vala | 27 + src/db/SavedSearchDBTable.c | 4793 ++++++++++++++++++++++ src/db/TagTable.c | 2248 +++++++++++ src/db/TombstoneTable.c | 1295 ++++++ src/db/VersionTable.c | 614 +++ src/db/VideoTable.c | 3373 ++++++++++++++++ src/db/mk/db.mk | 35 - 13 files changed, 27122 insertions(+), 36 deletions(-) create mode 100644 src/db/DatabaseTable.c create mode 100644 src/db/Db.c create mode 100644 src/db/EventTable.c create mode 100644 src/db/PhotoTable.c create mode 100644 src/db/SavedSearchDBTable.c create mode 100644 src/db/TagTable.c create mode 100644 src/db/TombstoneTable.c create mode 100644 src/db/VersionTable.c create mode 100644 src/db/VideoTable.c delete mode 100644 src/db/mk/db.mk (limited to 'src/db') diff --git a/src/db/DatabaseTable.c b/src/db/DatabaseTable.c new file mode 100644 index 0000000..4e0ada2 --- /dev/null +++ b/src/db/DatabaseTable.c @@ -0,0 +1,2638 @@ +/* DatabaseTable.c generated by valac 0.32.1, the Vala compiler + * generated from DatabaseTable.vala, do not modify */ + +/* 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + + +#define TYPE_DATABASE_TABLE (database_table_get_type ()) +#define DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATABASE_TABLE, DatabaseTable)) +#define DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATABASE_TABLE, DatabaseTableClass)) +#define IS_DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATABASE_TABLE)) +#define IS_DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATABASE_TABLE)) +#define DATABASE_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATABASE_TABLE, DatabaseTableClass)) + +typedef struct _DatabaseTable DatabaseTable; +typedef struct _DatabaseTableClass DatabaseTableClass; +typedef struct _DatabaseTablePrivate DatabaseTablePrivate; +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _sqlite3_close0(var) ((var == NULL) ? NULL : (var = (sqlite3_close (var), NULL))) +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) +#define _sqlite3_finalize0(var) ((var == NULL) ? NULL : (var = (sqlite3_finalize (var), NULL))) +typedef struct _ParamSpecDatabaseTable ParamSpecDatabaseTable; +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); +#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } +#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } +#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +typedef enum { + DATABASE_ERROR_ERROR, + DATABASE_ERROR_BACKING, + DATABASE_ERROR_MEMORY, + DATABASE_ERROR_ABORT, + DATABASE_ERROR_LIMITS, + DATABASE_ERROR_TYPESPEC +} DatabaseError; +#define DATABASE_ERROR database_error_quark () +struct _DatabaseTable { + GTypeInstance parent_instance; + volatile int ref_count; + DatabaseTablePrivate * priv; + gchar* table_name; +}; + +struct _DatabaseTableClass { + GTypeClass parent_class; + void (*finalize) (DatabaseTable *self); +}; + +struct _ParamSpecDatabaseTable { + GParamSpec parent_instance; +}; + + +static gpointer database_table_parent_class = NULL; +extern sqlite3* database_table_db; +sqlite3* database_table_db = NULL; +static gint database_table_in_transaction; +static gint database_table_in_transaction = 0; + +GQuark database_error_quark (void); +gpointer database_table_ref (gpointer instance); +void database_table_unref (gpointer instance); +GParamSpec* param_spec_database_table (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_database_table (GValue* value, gpointer v_object); +void value_take_database_table (GValue* value, gpointer v_object); +gpointer value_get_database_table (const GValue* value); +GType database_table_get_type (void) G_GNUC_CONST; +enum { + DATABASE_TABLE_DUMMY_PROPERTY +}; +#define DATABASE_TABLE_SCHEMA_VERSION 20 +static void database_table_prepare_db (const gchar* filename); +void app_window_panic (const gchar* msg); +#define DB_IN_MEMORY_NAME ":memory:" +void database_table_on_trace (const gchar* message); +void database_table_init (const gchar* filename); +void database_table_warning (const gchar* op, gint res); +void database_table_terminate (void); +void database_table_fatal (const gchar* op, gint res); +void database_table_set_table_name (DatabaseTable* self, const gchar* table_name); +void database_table_throw_error (const gchar* method, gint res, GError** error); +gboolean database_table_exists_by_id (DatabaseTable* self, gint64 id); +gboolean database_table_select_by_id (DatabaseTable* self, gint64 id, const gchar* columns, sqlite3_stmt** stmt); +static void database_table_prepare_update_by_id (DatabaseTable* self, gint64 id, const gchar* column, sqlite3_stmt** stmt); +static gboolean database_table_execute_update_by_id (DatabaseTable* self, sqlite3_stmt* stmt); +gboolean database_table_update_text_by_id (DatabaseTable* self, gint64 id, const gchar* column, const gchar* text); +void database_table_update_text_by_id_2 (DatabaseTable* self, gint64 id, const gchar* column, const gchar* text, GError** error); +gboolean database_table_update_int_by_id (DatabaseTable* self, gint64 id, const gchar* column, gint value); +void database_table_update_int_by_id_2 (DatabaseTable* self, gint64 id, const gchar* column, gint value, GError** error); +gboolean database_table_update_int64_by_id (DatabaseTable* self, gint64 id, const gchar* column, gint64 value); +void database_table_update_int64_by_id_2 (DatabaseTable* self, gint64 id, const gchar* column, gint64 value, GError** error); +void database_table_delete_by_id (DatabaseTable* self, gint64 id, GError** error); +gboolean database_table_has_column (const gchar* table_name, const gchar* column_name); +gboolean database_table_has_table (const gchar* table_name); +gboolean database_table_add_column (const gchar* table_name, const gchar* column_name, const gchar* column_constraints); +gboolean database_table_ensure_column (const gchar* table_name, const gchar* column_name, const gchar* column_constraints, const gchar* upgrade_msg); +gint database_table_get_row_count (DatabaseTable* self); +void database_table_begin_transaction (void); +void database_table_commit_transaction (GError** error); +DatabaseTable* database_table_construct (GType object_type); +static void database_table_finalize (DatabaseTable* obj); + + +GQuark database_error_quark (void) { + return g_quark_from_static_string ("database_error-quark"); +} + + +static void database_table_prepare_db (const gchar* filename) { + gint res = 0; + const gchar* _tmp0_ = NULL; + sqlite3* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + const gchar* _tmp9_ = NULL; + GError * _inner_error_ = NULL; +#line 32 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (filename != NULL); +#line 34 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = filename; +#line 34 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp2_ = sqlite3_open_v2 (_tmp0_, &_tmp1_, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); +#line 34 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_close0 (database_table_db); +#line 34 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_db = _tmp1_; +#line 34 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp2_; +#line 36 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = res; +#line 36 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp3_ != SQLITE_OK) { +#line 147 "DatabaseTable.c" + const gchar* _tmp4_ = NULL; + const gchar* _tmp5_ = NULL; + gint _tmp6_ = 0; + gchar* _tmp7_ = NULL; + gchar* _tmp8_ = NULL; +#line 37 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp4_ = _ ("Unable to open/create photo database %s: error code %d"); +#line 37 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp5_ = filename; +#line 37 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp6_ = res; +#line 37 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp7_ = g_strdup_printf (_tmp4_, _tmp5_, _tmp6_); +#line 37 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp8_ = _tmp7_; +#line 37 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + app_window_panic (_tmp8_); +#line 37 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (_tmp8_); +#line 167 "DatabaseTable.c" + } +#line 41 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp9_ = filename; +#line 41 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (g_strcmp0 (_tmp9_, DB_IN_MEMORY_NAME) != 0) { +#line 173 "DatabaseTable.c" + { + GFile* file_db = NULL; + const gchar* _tmp10_ = NULL; + GFile* _tmp11_ = NULL; + GFileInfo* info = NULL; + GFile* _tmp12_ = NULL; + GFileInfo* _tmp13_ = NULL; + GFileInfo* _tmp14_ = NULL; + gboolean _tmp15_ = FALSE; +#line 43 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp10_ = filename; +#line 43 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp11_ = g_file_new_for_path (_tmp10_); +#line 43 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + file_db = _tmp11_; +#line 44 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp12_ = file_db; +#line 44 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp13_ = g_file_query_info (_tmp12_, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, G_FILE_QUERY_INFO_NONE, NULL, &_inner_error_); +#line 44 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + info = _tmp13_; +#line 44 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 44 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_object_unref0 (file_db); +#line 199 "DatabaseTable.c" + goto __catch13_g_error; + } +#line 45 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp14_ = info; +#line 45 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp15_ = g_file_info_get_attribute_boolean (_tmp14_, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE); +#line 45 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (!_tmp15_) { +#line 208 "DatabaseTable.c" + const gchar* _tmp16_ = NULL; + const gchar* _tmp17_ = NULL; + gchar* _tmp18_ = NULL; + gchar* _tmp19_ = NULL; +#line 46 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp16_ = _ ("Unable to write to photo database file:\n %s"); +#line 46 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp17_ = filename; +#line 46 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp18_ = g_strdup_printf (_tmp16_, _tmp17_); +#line 46 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp19_ = _tmp18_; +#line 46 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + app_window_panic (_tmp19_); +#line 46 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (_tmp19_); +#line 225 "DatabaseTable.c" + } +#line 42 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_object_unref0 (info); +#line 42 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_object_unref0 (file_db); +#line 231 "DatabaseTable.c" + } + goto __finally13; + __catch13_g_error: + { + GError* e = NULL; + const gchar* _tmp20_ = NULL; + const gchar* _tmp21_ = NULL; + GError* _tmp22_ = NULL; + const gchar* _tmp23_ = NULL; + gchar* _tmp24_ = NULL; + gchar* _tmp25_ = NULL; +#line 42 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + e = _inner_error_; +#line 42 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _inner_error_ = NULL; +#line 48 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp20_ = _ ("Error accessing database file:\n %s\n\nError was: \n%s"); +#line 48 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp21_ = filename; +#line 48 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp22_ = e; +#line 48 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp23_ = _tmp22_->message; +#line 48 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp24_ = g_strdup_printf (_tmp20_, _tmp21_, _tmp23_); +#line 48 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp25_ = _tmp24_; +#line 48 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + app_window_panic (_tmp25_); +#line 48 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (_tmp25_); +#line 42 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_error_free0 (e); +#line 265 "DatabaseTable.c" + } + __finally13: +#line 42 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 42 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 42 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_clear_error (&_inner_error_); +#line 42 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 276 "DatabaseTable.c" + } + } +} + + +void database_table_on_trace (const gchar* message) { + const gchar* _tmp0_ = NULL; +#line 57 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (message != NULL); +#line 58 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = message; +#line 58 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_debug ("DatabaseTable.vala:58: SQLITE: %s", _tmp0_); +#line 290 "DatabaseTable.c" +} + + +static gint _sqlite3_exec (sqlite3* self, const gchar* sql, sqlite3_callback callback, void* callback_target, gchar** errmsg) { + gchar* _vala_errmsg = NULL; + gint result = 0; + const gchar* sqlite_errmsg = NULL; + gint ec = 0; + const gchar* _tmp0_ = NULL; + sqlite3_callback _tmp1_ = NULL; + void* _tmp1__target = NULL; + const gchar* _tmp2_ = NULL; + gint _tmp3_ = 0; + const gchar* _tmp6_ = NULL; +#line 34 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + g_return_val_if_fail (self != NULL, 0); +#line 34 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + g_return_val_if_fail (sql != NULL, 0); +#line 36 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + _tmp0_ = sql; +#line 36 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + _tmp1_ = callback; +#line 36 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + _tmp1__target = callback_target; +#line 36 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + _tmp3_ = sqlite3_exec (self, _tmp0_, _tmp1_, _tmp1__target, (char**) (&_tmp2_)); +#line 36 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + sqlite_errmsg = _tmp2_; +#line 36 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + ec = _tmp3_; +#line 37 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + if ((&_vala_errmsg) != NULL) { +#line 323 "DatabaseTable.c" + const gchar* _tmp4_ = NULL; + gchar* _tmp5_ = NULL; +#line 38 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + _tmp4_ = sqlite_errmsg; +#line 38 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + _tmp5_ = g_strdup (_tmp4_); +#line 38 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + _g_free0 (_vala_errmsg); +#line 38 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + _vala_errmsg = _tmp5_; +#line 334 "DatabaseTable.c" + } +#line 40 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + _tmp6_ = sqlite_errmsg; +#line 40 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + sqlite3_free ((void*) _tmp6_); +#line 41 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + result = ec; +#line 41 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + if (errmsg) { +#line 41 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + *errmsg = _vala_errmsg; +#line 346 "DatabaseTable.c" + } else { +#line 41 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + _g_free0 (_vala_errmsg); +#line 350 "DatabaseTable.c" + } +#line 41 "/usr/share/vala-0.32/vapi/sqlite3.vapi" + return result; +#line 354 "DatabaseTable.c" +} + + +void database_table_init (const gchar* filename) { + const gchar* _tmp0_ = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp1_ = NULL; + sqlite3_stmt* _tmp2_ = NULL; + gint _tmp3_ = 0; + gint _tmp4_ = 0; + sqlite3* _tmp19_ = NULL; + gint _tmp20_ = 0; + gint _tmp21_ = 0; + GError * _inner_error_ = NULL; +#line 61 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (filename != NULL); +#line 63 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = filename; +#line 63 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_prepare_db (_tmp0_); +#line 67 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = database_table_db; +#line 67 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = sqlite3_prepare_v2 (_tmp1_, "CREATE TABLE IF NOT EXISTS VersionTable (" "id INTEGER PRIMARY KEY, " "schema_version INTEGER, " "app_version TEXT, " "user_data TEXT NULL" ")", -1, &_tmp2_, NULL); +#line 67 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 67 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + stmt = _tmp2_; +#line 67 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp3_; +#line 75 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp4_ = res; +#line 75 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp4_ != SQLITE_OK) { +#line 390 "DatabaseTable.c" + gchar* backup_path = NULL; + const gchar* _tmp5_ = NULL; + gchar* _tmp6_ = NULL; +#line 76 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_close0 (database_table_db); +#line 76 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_db = NULL; +#line 78 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp5_ = filename; +#line 78 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp6_ = g_strconcat (_tmp5_, ".bak", NULL); +#line 78 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + backup_path = _tmp6_; +#line 404 "DatabaseTable.c" + { + GFile* src = NULL; + const gchar* _tmp7_ = NULL; + GFile* _tmp8_ = NULL; + GFile* dest = NULL; + const gchar* _tmp9_ = NULL; + GFile* _tmp10_ = NULL; + GFile* _tmp11_ = NULL; + GFile* _tmp12_ = NULL; + const gchar* _tmp13_ = NULL; +#line 81 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp7_ = backup_path; +#line 81 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp8_ = g_file_new_for_commandline_arg (_tmp7_); +#line 81 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + src = _tmp8_; +#line 82 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp9_ = filename; +#line 82 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp10_ = g_file_new_for_commandline_arg (_tmp9_); +#line 82 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + dest = _tmp10_; +#line 83 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp11_ = src; +#line 83 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp12_ = dest; +#line 83 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_file_copy (_tmp11_, _tmp12_, G_FILE_COPY_OVERWRITE | G_FILE_COPY_ALL_METADATA, NULL, NULL, NULL, &_inner_error_); +#line 83 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 83 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_object_unref0 (dest); +#line 83 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_object_unref0 (src); +#line 439 "DatabaseTable.c" + goto __catch14_g_error; + } +#line 86 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp13_ = filename; +#line 86 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_prepare_db (_tmp13_); +#line 80 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_object_unref0 (dest); +#line 80 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_object_unref0 (src); +#line 450 "DatabaseTable.c" + } + goto __finally14; + __catch14_g_error: + { + GError* _error_ = NULL; + const gchar* _tmp14_ = NULL; + GError* _tmp15_ = NULL; + const gchar* _tmp16_ = NULL; + gchar* _tmp17_ = NULL; + gchar* _tmp18_ = NULL; +#line 80 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _error_ = _inner_error_; +#line 80 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _inner_error_ = NULL; +#line 88 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp14_ = _ ("Unable to restore photo database %s"); +#line 88 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp15_ = _error_; +#line 88 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp16_ = _tmp15_->message; +#line 88 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp17_ = g_strdup_printf (_tmp14_, _tmp16_); +#line 88 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp18_ = _tmp17_; +#line 88 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + app_window_panic (_tmp18_); +#line 88 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (_tmp18_); +#line 80 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_error_free0 (_error_); +#line 481 "DatabaseTable.c" + } + __finally14: +#line 80 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 80 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (backup_path); +#line 80 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 80 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 80 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_clear_error (&_inner_error_); +#line 80 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 496 "DatabaseTable.c" + } +#line 75 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (backup_path); +#line 500 "DatabaseTable.c" + } +#line 94 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp19_ = database_table_db; +#line 94 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp20_ = _sqlite3_exec (_tmp19_, "PRAGMA synchronous=OFF", NULL, NULL, NULL); +#line 94 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp20_; +#line 95 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp21_ = res; +#line 95 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp21_ != SQLITE_OK) { +#line 512 "DatabaseTable.c" + gint _tmp22_ = 0; +#line 96 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp22_ = res; +#line 96 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_warning ("Unable to disable synchronous mode", _tmp22_); +#line 518 "DatabaseTable.c" + } +#line 61 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 522 "DatabaseTable.c" +} + + +void database_table_terminate (void) { +#line 101 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_close0 (database_table_db); +#line 101 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_db = NULL; +#line 531 "DatabaseTable.c" +} + + +void database_table_fatal (const gchar* op, gint res) { + const gchar* _tmp0_ = NULL; + gint _tmp1_ = 0; + sqlite3* _tmp2_ = NULL; + const gchar* _tmp3_ = NULL; +#line 105 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (op != NULL); +#line 106 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = op; +#line 106 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = res; +#line 106 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp2_ = database_table_db; +#line 106 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = sqlite3_errmsg (_tmp2_); +#line 106 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_error ("DatabaseTable.vala:106: %s: [%d] %s", _tmp0_, _tmp1_, _tmp3_); +#line 552 "DatabaseTable.c" +} + + +void database_table_warning (const gchar* op, gint res) { + const gchar* _tmp0_ = NULL; + gint _tmp1_ = 0; + sqlite3* _tmp2_ = NULL; + const gchar* _tmp3_ = NULL; +#line 110 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (op != NULL); +#line 111 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = op; +#line 111 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = res; +#line 111 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp2_ = database_table_db; +#line 111 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = sqlite3_errmsg (_tmp2_); +#line 111 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_warning ("DatabaseTable.vala:111: %s: [%d] %s", _tmp0_, _tmp1_, _tmp3_); +#line 573 "DatabaseTable.c" +} + + +void database_table_set_table_name (DatabaseTable* self, const gchar* table_name) { + const gchar* _tmp0_ = NULL; + gchar* _tmp1_ = NULL; +#line 114 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (IS_DATABASE_TABLE (self)); +#line 114 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (table_name != NULL); +#line 115 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = table_name; +#line 115 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = g_strdup (_tmp0_); +#line 115 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (self->table_name); +#line 115 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + self->table_name = _tmp1_; +#line 592 "DatabaseTable.c" +} + + +void database_table_throw_error (const gchar* method, gint res, GError** error) { + gchar* msg = NULL; + const gchar* _tmp0_ = NULL; + gint _tmp1_ = 0; + sqlite3* _tmp2_ = NULL; + const gchar* _tmp3_ = NULL; + gchar* _tmp4_ = NULL; + gint _tmp5_ = 0; + GError * _inner_error_ = NULL; +#line 120 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (method != NULL); +#line 121 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = method; +#line 121 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = res; +#line 121 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp2_ = database_table_db; +#line 121 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = sqlite3_errmsg (_tmp2_); +#line 121 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp4_ = g_strdup_printf ("(%s) [%d] - %s", _tmp0_, _tmp1_, _tmp3_); +#line 121 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + msg = _tmp4_; +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp5_ = res; +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + switch (_tmp5_) { +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_OK: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_DONE: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_ROW: +#line 629 "DatabaseTable.c" + { +#line 127 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (msg); +#line 127 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 635 "DatabaseTable.c" + } +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_PERM: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_BUSY: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_READONLY: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_IOERR: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_CORRUPT: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_CANTOPEN: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_NOLFS: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_AUTH: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_FORMAT: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_NOTADB: +#line 657 "DatabaseTable.c" + { + const gchar* _tmp6_ = NULL; + GError* _tmp7_ = NULL; +#line 139 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp6_ = msg; +#line 139 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp7_ = g_error_new_literal (DATABASE_ERROR, DATABASE_ERROR_BACKING, _tmp6_); +#line 139 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _inner_error_ = _tmp7_; +#line 139 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 139 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_propagate_error (error, _inner_error_); +#line 139 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (msg); +#line 139 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 675 "DatabaseTable.c" + } else { +#line 139 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (msg); +#line 139 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 139 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_clear_error (&_inner_error_); +#line 139 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 685 "DatabaseTable.c" + } + } +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_NOMEM: +#line 690 "DatabaseTable.c" + { + const gchar* _tmp8_ = NULL; + GError* _tmp9_ = NULL; +#line 142 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp8_ = msg; +#line 142 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp9_ = g_error_new_literal (DATABASE_ERROR, DATABASE_ERROR_MEMORY, _tmp8_); +#line 142 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _inner_error_ = _tmp9_; +#line 142 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 142 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_propagate_error (error, _inner_error_); +#line 142 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (msg); +#line 142 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 708 "DatabaseTable.c" + } else { +#line 142 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (msg); +#line 142 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 142 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_clear_error (&_inner_error_); +#line 142 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 718 "DatabaseTable.c" + } + } +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_ABORT: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_LOCKED: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_INTERRUPT: +#line 727 "DatabaseTable.c" + { + const gchar* _tmp10_ = NULL; + GError* _tmp11_ = NULL; +#line 147 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp10_ = msg; +#line 147 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp11_ = g_error_new_literal (DATABASE_ERROR, DATABASE_ERROR_ABORT, _tmp10_); +#line 147 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _inner_error_ = _tmp11_; +#line 147 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 147 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_propagate_error (error, _inner_error_); +#line 147 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (msg); +#line 147 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 745 "DatabaseTable.c" + } else { +#line 147 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (msg); +#line 147 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 147 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_clear_error (&_inner_error_); +#line 147 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 755 "DatabaseTable.c" + } + } +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_FULL: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_EMPTY: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_TOOBIG: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_CONSTRAINT: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_RANGE: +#line 768 "DatabaseTable.c" + { + const gchar* _tmp12_ = NULL; + GError* _tmp13_ = NULL; +#line 154 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp12_ = msg; +#line 154 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp13_ = g_error_new_literal (DATABASE_ERROR, DATABASE_ERROR_LIMITS, _tmp12_); +#line 154 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _inner_error_ = _tmp13_; +#line 154 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 154 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_propagate_error (error, _inner_error_); +#line 154 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (msg); +#line 154 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 786 "DatabaseTable.c" + } else { +#line 154 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (msg); +#line 154 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 154 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_clear_error (&_inner_error_); +#line 154 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 796 "DatabaseTable.c" + } + } +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_SCHEMA: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_MISMATCH: +#line 803 "DatabaseTable.c" + { + const gchar* _tmp14_ = NULL; + GError* _tmp15_ = NULL; +#line 158 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp14_ = msg; +#line 158 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp15_ = g_error_new_literal (DATABASE_ERROR, DATABASE_ERROR_TYPESPEC, _tmp14_); +#line 158 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _inner_error_ = _tmp15_; +#line 158 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 158 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_propagate_error (error, _inner_error_); +#line 158 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (msg); +#line 158 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 821 "DatabaseTable.c" + } else { +#line 158 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (msg); +#line 158 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 158 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_clear_error (&_inner_error_); +#line 158 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 831 "DatabaseTable.c" + } + } + default: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_ERROR: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_INTERNAL: +#line 123 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + case SQLITE_MISUSE: +#line 841 "DatabaseTable.c" + { + const gchar* _tmp16_ = NULL; + GError* _tmp17_ = NULL; +#line 164 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp16_ = msg; +#line 164 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp17_ = g_error_new_literal (DATABASE_ERROR, DATABASE_ERROR_ERROR, _tmp16_); +#line 164 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _inner_error_ = _tmp17_; +#line 164 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 164 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_propagate_error (error, _inner_error_); +#line 164 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (msg); +#line 164 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 859 "DatabaseTable.c" + } else { +#line 164 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (msg); +#line 164 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 164 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_clear_error (&_inner_error_); +#line 164 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 869 "DatabaseTable.c" + } + } + } +#line 120 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (msg); +#line 875 "DatabaseTable.c" +} + + +gboolean database_table_exists_by_id (DatabaseTable* self, gint64 id) { + gboolean result = FALSE; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + gchar* _tmp2_ = NULL; + gchar* _tmp3_ = NULL; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + gint _tmp7_ = 0; + sqlite3_stmt* _tmp8_ = NULL; + gint64 _tmp9_ = 0LL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + sqlite3_stmt* _tmp12_ = NULL; + gint _tmp13_ = 0; + gboolean _tmp14_ = FALSE; + gint _tmp15_ = 0; + gint _tmp24_ = 0; +#line 168 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (IS_DATABASE_TABLE (self), FALSE); +#line 170 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = database_table_db; +#line 170 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = self->table_name; +#line 170 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp2_ = g_strdup_printf ("SELECT id FROM %s WHERE id=?", _tmp1_); +#line 170 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = _tmp2_; +#line 170 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp5_ = sqlite3_prepare_v2 (_tmp0_, _tmp3_, -1, &_tmp4_, NULL); +#line 170 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 170 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + stmt = _tmp4_; +#line 170 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp6_ = _tmp5_; +#line 170 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (_tmp3_); +#line 170 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp6_; +#line 171 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp7_ = res; +#line 171 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (_tmp7_ == SQLITE_OK, "res == Sqlite.OK"); +#line 173 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp8_ = stmt; +#line 173 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp9_ = id; +#line 173 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp10_ = sqlite3_bind_int64 (_tmp8_, 1, _tmp9_); +#line 173 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp10_; +#line 174 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp11_ = res; +#line 174 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (_tmp11_ == SQLITE_OK, "res == Sqlite.OK"); +#line 176 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp12_ = stmt; +#line 176 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp13_ = sqlite3_step (_tmp12_); +#line 176 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp13_; +#line 177 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp15_ = res; +#line 177 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp15_ != SQLITE_ROW) { +#line 948 "DatabaseTable.c" + gint _tmp16_ = 0; +#line 177 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp16_ = res; +#line 177 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp14_ = _tmp16_ != SQLITE_DONE; +#line 954 "DatabaseTable.c" + } else { +#line 177 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp14_ = FALSE; +#line 958 "DatabaseTable.c" + } +#line 177 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp14_) { +#line 962 "DatabaseTable.c" + gint64 _tmp17_ = 0LL; + gchar* _tmp18_ = NULL; + gchar* _tmp19_ = NULL; + const gchar* _tmp20_ = NULL; + gchar* _tmp21_ = NULL; + gchar* _tmp22_ = NULL; + gint _tmp23_ = 0; +#line 178 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp17_ = id; +#line 178 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp18_ = g_strdup_printf ("%" G_GINT64_FORMAT, _tmp17_); +#line 178 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp19_ = _tmp18_; +#line 178 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp20_ = self->table_name; +#line 178 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp21_ = g_strdup_printf ("exists_by_id [%s] %s", _tmp19_, _tmp20_); +#line 178 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp22_ = _tmp21_; +#line 178 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp23_ = res; +#line 178 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_fatal (_tmp22_, _tmp23_); +#line 178 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (_tmp22_); +#line 178 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (_tmp19_); +#line 990 "DatabaseTable.c" + } +#line 180 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp24_ = res; +#line 180 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + result = _tmp24_ == SQLITE_ROW; +#line 180 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 180 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return result; +#line 1000 "DatabaseTable.c" +} + + +gboolean database_table_select_by_id (DatabaseTable* self, gint64 id, const gchar* columns, sqlite3_stmt** stmt) { + sqlite3_stmt* _vala_stmt = NULL; + gboolean result = FALSE; + gchar* sql = NULL; + const gchar* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + gchar* _tmp2_ = NULL; + gint res = 0; + sqlite3* _tmp3_ = NULL; + const gchar* _tmp4_ = NULL; + sqlite3_stmt* _tmp5_ = NULL; + gint _tmp6_ = 0; + gint _tmp7_ = 0; + sqlite3_stmt* _tmp8_ = NULL; + gint64 _tmp9_ = 0LL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + sqlite3_stmt* _tmp12_ = NULL; + gint _tmp13_ = 0; + gboolean _tmp14_ = FALSE; + gint _tmp15_ = 0; + gint _tmp25_ = 0; +#line 183 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (IS_DATABASE_TABLE (self), FALSE); +#line 183 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (columns != NULL, FALSE); +#line 184 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = columns; +#line 184 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = self->table_name; +#line 184 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp2_ = g_strdup_printf ("SELECT %s FROM %s WHERE id=?", _tmp0_, _tmp1_); +#line 184 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + sql = _tmp2_; +#line 186 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = database_table_db; +#line 186 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp4_ = sql; +#line 186 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp6_ = sqlite3_prepare_v2 (_tmp3_, _tmp4_, -1, &_tmp5_, NULL); +#line 186 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (_vala_stmt); +#line 186 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_stmt = _tmp5_; +#line 186 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp6_; +#line 187 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp7_ = res; +#line 187 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (_tmp7_ == SQLITE_OK, "res == Sqlite.OK"); +#line 189 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp8_ = _vala_stmt; +#line 189 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp9_ = id; +#line 189 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp10_ = sqlite3_bind_int64 (_tmp8_, 1, _tmp9_); +#line 189 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp10_; +#line 190 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp11_ = res; +#line 190 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (_tmp11_ == SQLITE_OK, "res == Sqlite.OK"); +#line 192 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp12_ = _vala_stmt; +#line 192 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp13_ = sqlite3_step (_tmp12_); +#line 192 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp13_; +#line 193 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp15_ = res; +#line 193 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp15_ != SQLITE_ROW) { +#line 1076 "DatabaseTable.c" + gint _tmp16_ = 0; +#line 193 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp16_ = res; +#line 193 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp14_ = _tmp16_ != SQLITE_DONE; +#line 1082 "DatabaseTable.c" + } else { +#line 193 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp14_ = FALSE; +#line 1086 "DatabaseTable.c" + } +#line 193 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp14_) { +#line 1090 "DatabaseTable.c" + gint64 _tmp17_ = 0LL; + gchar* _tmp18_ = NULL; + gchar* _tmp19_ = NULL; + const gchar* _tmp20_ = NULL; + const gchar* _tmp21_ = NULL; + gchar* _tmp22_ = NULL; + gchar* _tmp23_ = NULL; + gint _tmp24_ = 0; +#line 194 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp17_ = id; +#line 194 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp18_ = g_strdup_printf ("%" G_GINT64_FORMAT, _tmp17_); +#line 194 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp19_ = _tmp18_; +#line 194 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp20_ = self->table_name; +#line 194 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp21_ = columns; +#line 194 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp22_ = g_strdup_printf ("select_by_id [%s] %s %s", _tmp19_, _tmp20_, _tmp21_); +#line 194 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp23_ = _tmp22_; +#line 194 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp24_ = res; +#line 194 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_fatal (_tmp23_, _tmp24_); +#line 194 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (_tmp23_); +#line 194 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (_tmp19_); +#line 1121 "DatabaseTable.c" + } +#line 196 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp25_ = res; +#line 196 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + result = _tmp25_ == SQLITE_ROW; +#line 196 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (sql); +#line 196 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (stmt) { +#line 196 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + *stmt = _vala_stmt; +#line 1133 "DatabaseTable.c" + } else { +#line 196 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (_vala_stmt); +#line 1137 "DatabaseTable.c" + } +#line 196 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return result; +#line 1141 "DatabaseTable.c" +} + + +static void database_table_prepare_update_by_id (DatabaseTable* self, gint64 id, const gchar* column, sqlite3_stmt** stmt) { + sqlite3_stmt* _vala_stmt = NULL; + gchar* sql = NULL; + const gchar* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + gchar* _tmp2_ = NULL; + gint res = 0; + sqlite3* _tmp3_ = NULL; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + gint64 _tmp7_ = 0LL; + gint _tmp8_ = 0; + gint _tmp9_ = 0; +#line 200 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (IS_DATABASE_TABLE (self)); +#line 200 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (column != NULL); +#line 201 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = self->table_name; +#line 201 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = column; +#line 201 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp2_ = g_strdup_printf ("UPDATE %s SET %s=? WHERE id=?", _tmp0_, _tmp1_); +#line 201 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + sql = _tmp2_; +#line 203 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = database_table_db; +#line 203 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp5_ = sqlite3_prepare_v2 (_tmp3_, sql, -1, &_tmp4_, NULL); +#line 203 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (_vala_stmt); +#line 203 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_stmt = _tmp4_; +#line 203 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp5_; +#line 204 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp6_ = res; +#line 204 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (_tmp6_ == SQLITE_OK, "res == Sqlite.OK"); +#line 206 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp7_ = id; +#line 206 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp8_ = sqlite3_bind_int64 (_vala_stmt, 2, _tmp7_); +#line 206 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp8_; +#line 207 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp9_ = res; +#line 207 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (_tmp9_ == SQLITE_OK, "res == Sqlite.OK"); +#line 200 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (sql); +#line 200 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (stmt) { +#line 200 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + *stmt = _vala_stmt; +#line 1201 "DatabaseTable.c" + } else { +#line 200 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (_vala_stmt); +#line 1205 "DatabaseTable.c" + } +} + + +static gboolean database_table_execute_update_by_id (DatabaseTable* self, sqlite3_stmt* stmt) { + gboolean result = FALSE; + gint res = 0; + sqlite3_stmt* _tmp0_ = NULL; + gint _tmp1_ = 0; + gint _tmp2_ = 0; +#line 210 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (IS_DATABASE_TABLE (self), FALSE); +#line 210 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (stmt != NULL, FALSE); +#line 211 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = stmt; +#line 211 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = sqlite3_step (_tmp0_); +#line 211 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp1_; +#line 212 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp2_ = res; +#line 212 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp2_ != SQLITE_DONE) { +#line 1230 "DatabaseTable.c" + gint _tmp3_ = 0; +#line 213 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = res; +#line 213 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_fatal ("execute_update_by_id", _tmp3_); +#line 215 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + result = FALSE; +#line 215 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return result; +#line 1240 "DatabaseTable.c" + } +#line 218 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + result = TRUE; +#line 218 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return result; +#line 1246 "DatabaseTable.c" +} + + +gboolean database_table_update_text_by_id (DatabaseTable* self, gint64 id, const gchar* column, const gchar* text) { + gboolean result = FALSE; + sqlite3_stmt* stmt = NULL; + gint64 _tmp0_ = 0LL; + const gchar* _tmp1_ = NULL; + sqlite3_stmt* _tmp2_ = NULL; + gint res = 0; + const gchar* _tmp3_ = NULL; + gchar* _tmp4_ = NULL; + GDestroyNotify _tmp5_ = NULL; + gint _tmp6_ = 0; + gboolean _tmp7_ = FALSE; +#line 221 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (IS_DATABASE_TABLE (self), FALSE); +#line 221 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (column != NULL, FALSE); +#line 221 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (text != NULL, FALSE); +#line 223 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = id; +#line 223 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = column; +#line 223 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_prepare_update_by_id (self, _tmp0_, _tmp1_, &_tmp2_); +#line 223 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 223 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + stmt = _tmp2_; +#line 225 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = text; +#line 225 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp4_ = g_strdup (_tmp3_); +#line 225 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp5_ = g_free; +#line 225 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp6_ = sqlite3_bind_text (stmt, 1, _tmp4_, -1, _tmp5_); +#line 225 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp6_; +#line 226 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (res == SQLITE_OK, "res == Sqlite.OK"); +#line 228 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp7_ = database_table_execute_update_by_id (self, stmt); +#line 228 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + result = _tmp7_; +#line 228 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 228 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return result; +#line 1298 "DatabaseTable.c" +} + + +void database_table_update_text_by_id_2 (DatabaseTable* self, gint64 id, const gchar* column, const gchar* text, GError** error) { + sqlite3_stmt* stmt = NULL; + gint64 _tmp0_ = 0LL; + const gchar* _tmp1_ = NULL; + sqlite3_stmt* _tmp2_ = NULL; + gint res = 0; + sqlite3_stmt* _tmp3_ = NULL; + const gchar* _tmp4_ = NULL; + gchar* _tmp5_ = NULL; + GDestroyNotify _tmp6_ = NULL; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + sqlite3_stmt* _tmp9_ = NULL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + GError * _inner_error_ = NULL; +#line 231 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (IS_DATABASE_TABLE (self)); +#line 231 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (column != NULL); +#line 231 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (text != NULL); +#line 233 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = id; +#line 233 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = column; +#line 233 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_prepare_update_by_id (self, _tmp0_, _tmp1_, &_tmp2_); +#line 233 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 233 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + stmt = _tmp2_; +#line 235 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = stmt; +#line 235 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp4_ = text; +#line 235 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp5_ = g_strdup (_tmp4_); +#line 235 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp6_ = g_free; +#line 235 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp7_ = sqlite3_bind_text (_tmp3_, 1, _tmp5_, -1, _tmp6_); +#line 235 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp7_; +#line 236 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp8_ = res; +#line 236 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (_tmp8_ == SQLITE_OK, "res == Sqlite.OK"); +#line 238 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp9_ = stmt; +#line 238 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp10_ = sqlite3_step (_tmp9_); +#line 238 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp10_; +#line 239 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp11_ = res; +#line 239 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp11_ != SQLITE_DONE) { +#line 1360 "DatabaseTable.c" + const gchar* _tmp12_ = NULL; + const gchar* _tmp13_ = NULL; + gchar* _tmp14_ = NULL; + gchar* _tmp15_ = NULL; + gint _tmp16_ = 0; +#line 240 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp12_ = self->table_name; +#line 240 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp13_ = column; +#line 240 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp14_ = g_strdup_printf ("DatabaseTable.update_text_by_id_2 %s.%s", _tmp12_, _tmp13_); +#line 240 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp15_ = _tmp14_; +#line 240 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp16_ = res; +#line 240 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_throw_error (_tmp15_, _tmp16_, &_inner_error_); +#line 240 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (_tmp15_); +#line 240 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 240 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 240 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_propagate_error (error, _inner_error_); +#line 240 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 240 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 1390 "DatabaseTable.c" + } else { +#line 240 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 240 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 240 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_clear_error (&_inner_error_); +#line 240 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 1400 "DatabaseTable.c" + } + } + } +#line 231 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 1406 "DatabaseTable.c" +} + + +gboolean database_table_update_int_by_id (DatabaseTable* self, gint64 id, const gchar* column, gint value) { + gboolean result = FALSE; + sqlite3_stmt* stmt = NULL; + gint64 _tmp0_ = 0LL; + const gchar* _tmp1_ = NULL; + sqlite3_stmt* _tmp2_ = NULL; + gint res = 0; + gint _tmp3_ = 0; + gint _tmp4_ = 0; + gboolean _tmp5_ = FALSE; +#line 243 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (IS_DATABASE_TABLE (self), FALSE); +#line 243 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (column != NULL, FALSE); +#line 245 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = id; +#line 245 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = column; +#line 245 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_prepare_update_by_id (self, _tmp0_, _tmp1_, &_tmp2_); +#line 245 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 245 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + stmt = _tmp2_; +#line 247 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = value; +#line 247 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp4_ = sqlite3_bind_int (stmt, 1, _tmp3_); +#line 247 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp4_; +#line 248 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (res == SQLITE_OK, "res == Sqlite.OK"); +#line 250 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp5_ = database_table_execute_update_by_id (self, stmt); +#line 250 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + result = _tmp5_; +#line 250 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 250 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return result; +#line 1450 "DatabaseTable.c" +} + + +void database_table_update_int_by_id_2 (DatabaseTable* self, gint64 id, const gchar* column, gint value, GError** error) { + sqlite3_stmt* stmt = NULL; + gint64 _tmp0_ = 0LL; + const gchar* _tmp1_ = NULL; + sqlite3_stmt* _tmp2_ = NULL; + gint res = 0; + sqlite3_stmt* _tmp3_ = NULL; + gint _tmp4_ = 0; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + sqlite3_stmt* _tmp7_ = NULL; + gint _tmp8_ = 0; + gint _tmp9_ = 0; + GError * _inner_error_ = NULL; +#line 253 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (IS_DATABASE_TABLE (self)); +#line 253 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (column != NULL); +#line 255 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = id; +#line 255 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = column; +#line 255 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_prepare_update_by_id (self, _tmp0_, _tmp1_, &_tmp2_); +#line 255 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 255 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + stmt = _tmp2_; +#line 257 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = stmt; +#line 257 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp4_ = value; +#line 257 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp5_ = sqlite3_bind_int (_tmp3_, 1, _tmp4_); +#line 257 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp5_; +#line 258 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp6_ = res; +#line 258 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (_tmp6_ == SQLITE_OK, "res == Sqlite.OK"); +#line 260 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp7_ = stmt; +#line 260 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp8_ = sqlite3_step (_tmp7_); +#line 260 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp8_; +#line 261 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp9_ = res; +#line 261 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp9_ != SQLITE_DONE) { +#line 1504 "DatabaseTable.c" + const gchar* _tmp10_ = NULL; + const gchar* _tmp11_ = NULL; + gchar* _tmp12_ = NULL; + gchar* _tmp13_ = NULL; + gint _tmp14_ = 0; +#line 262 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp10_ = self->table_name; +#line 262 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp11_ = column; +#line 262 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp12_ = g_strdup_printf ("DatabaseTable.update_int_by_id_2 %s.%s", _tmp10_, _tmp11_); +#line 262 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp13_ = _tmp12_; +#line 262 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp14_ = res; +#line 262 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_throw_error (_tmp13_, _tmp14_, &_inner_error_); +#line 262 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (_tmp13_); +#line 262 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 262 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 262 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_propagate_error (error, _inner_error_); +#line 262 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 262 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 1534 "DatabaseTable.c" + } else { +#line 262 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 262 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 262 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_clear_error (&_inner_error_); +#line 262 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 1544 "DatabaseTable.c" + } + } + } +#line 253 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 1550 "DatabaseTable.c" +} + + +gboolean database_table_update_int64_by_id (DatabaseTable* self, gint64 id, const gchar* column, gint64 value) { + gboolean result = FALSE; + sqlite3_stmt* stmt = NULL; + gint64 _tmp0_ = 0LL; + const gchar* _tmp1_ = NULL; + sqlite3_stmt* _tmp2_ = NULL; + gint res = 0; + gint64 _tmp3_ = 0LL; + gint _tmp4_ = 0; + gboolean _tmp5_ = FALSE; +#line 265 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (IS_DATABASE_TABLE (self), FALSE); +#line 265 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (column != NULL, FALSE); +#line 267 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = id; +#line 267 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = column; +#line 267 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_prepare_update_by_id (self, _tmp0_, _tmp1_, &_tmp2_); +#line 267 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 267 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + stmt = _tmp2_; +#line 269 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = value; +#line 269 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp4_ = sqlite3_bind_int64 (stmt, 1, _tmp3_); +#line 269 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp4_; +#line 270 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (res == SQLITE_OK, "res == Sqlite.OK"); +#line 272 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp5_ = database_table_execute_update_by_id (self, stmt); +#line 272 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + result = _tmp5_; +#line 272 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 272 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return result; +#line 1594 "DatabaseTable.c" +} + + +void database_table_update_int64_by_id_2 (DatabaseTable* self, gint64 id, const gchar* column, gint64 value, GError** error) { + sqlite3_stmt* stmt = NULL; + gint64 _tmp0_ = 0LL; + const gchar* _tmp1_ = NULL; + sqlite3_stmt* _tmp2_ = NULL; + gint res = 0; + sqlite3_stmt* _tmp3_ = NULL; + gint64 _tmp4_ = 0LL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + sqlite3_stmt* _tmp7_ = NULL; + gint _tmp8_ = 0; + gint _tmp9_ = 0; + GError * _inner_error_ = NULL; +#line 275 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (IS_DATABASE_TABLE (self)); +#line 275 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (column != NULL); +#line 277 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = id; +#line 277 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = column; +#line 277 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_prepare_update_by_id (self, _tmp0_, _tmp1_, &_tmp2_); +#line 277 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 277 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + stmt = _tmp2_; +#line 279 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = stmt; +#line 279 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp4_ = value; +#line 279 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp5_ = sqlite3_bind_int64 (_tmp3_, 1, _tmp4_); +#line 279 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp5_; +#line 280 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp6_ = res; +#line 280 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (_tmp6_ == SQLITE_OK, "res == Sqlite.OK"); +#line 282 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp7_ = stmt; +#line 282 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp8_ = sqlite3_step (_tmp7_); +#line 282 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp8_; +#line 283 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp9_ = res; +#line 283 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp9_ != SQLITE_DONE) { +#line 1648 "DatabaseTable.c" + const gchar* _tmp10_ = NULL; + const gchar* _tmp11_ = NULL; + gchar* _tmp12_ = NULL; + gchar* _tmp13_ = NULL; + gint _tmp14_ = 0; +#line 284 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp10_ = self->table_name; +#line 284 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp11_ = column; +#line 284 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp12_ = g_strdup_printf ("DatabaseTable.update_int64_by_id_2 %s.%s", _tmp10_, _tmp11_); +#line 284 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp13_ = _tmp12_; +#line 284 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp14_ = res; +#line 284 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_throw_error (_tmp13_, _tmp14_, &_inner_error_); +#line 284 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (_tmp13_); +#line 284 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 284 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 284 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_propagate_error (error, _inner_error_); +#line 284 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 284 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 1678 "DatabaseTable.c" + } else { +#line 284 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 284 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 284 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_clear_error (&_inner_error_); +#line 284 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 1688 "DatabaseTable.c" + } + } + } +#line 275 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 1694 "DatabaseTable.c" +} + + +void database_table_delete_by_id (DatabaseTable* self, gint64 id, GError** error) { + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + gchar* _tmp2_ = NULL; + gchar* _tmp3_ = NULL; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + gint _tmp7_ = 0; + sqlite3_stmt* _tmp8_ = NULL; + gint64 _tmp9_ = 0LL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + sqlite3_stmt* _tmp12_ = NULL; + gint _tmp13_ = 0; + gint _tmp14_ = 0; + GError * _inner_error_ = NULL; +#line 287 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (IS_DATABASE_TABLE (self)); +#line 289 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = database_table_db; +#line 289 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = self->table_name; +#line 289 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp2_ = g_strdup_printf ("DELETE FROM %s WHERE id=?", _tmp1_); +#line 289 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = _tmp2_; +#line 289 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp5_ = sqlite3_prepare_v2 (_tmp0_, _tmp3_, -1, &_tmp4_, NULL); +#line 289 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 289 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + stmt = _tmp4_; +#line 289 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp6_ = _tmp5_; +#line 289 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (_tmp3_); +#line 289 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp6_; +#line 290 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp7_ = res; +#line 290 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (_tmp7_ == SQLITE_OK, "res == Sqlite.OK"); +#line 292 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp8_ = stmt; +#line 292 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp9_ = id; +#line 292 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp10_ = sqlite3_bind_int64 (_tmp8_, 1, _tmp9_); +#line 292 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp10_; +#line 293 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp11_ = res; +#line 293 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (_tmp11_ == SQLITE_OK, "res == Sqlite.OK"); +#line 295 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp12_ = stmt; +#line 295 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp13_ = sqlite3_step (_tmp12_); +#line 295 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp13_; +#line 296 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp14_ = res; +#line 296 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp14_ != SQLITE_DONE) { +#line 1765 "DatabaseTable.c" + const gchar* _tmp15_ = NULL; + gchar* _tmp16_ = NULL; + gchar* _tmp17_ = NULL; + gint _tmp18_ = 0; +#line 297 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp15_ = self->table_name; +#line 297 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp16_ = g_strdup_printf ("%s.remove", _tmp15_); +#line 297 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp17_ = _tmp16_; +#line 297 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp18_ = res; +#line 297 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_throw_error (_tmp17_, _tmp18_, &_inner_error_); +#line 297 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (_tmp17_); +#line 297 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 297 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 297 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_propagate_error (error, _inner_error_); +#line 297 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 297 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 1792 "DatabaseTable.c" + } else { +#line 297 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 297 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 297 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_clear_error (&_inner_error_); +#line 297 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 1802 "DatabaseTable.c" + } + } + } +#line 287 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 1808 "DatabaseTable.c" +} + + +gboolean database_table_has_column (const gchar* table_name, const gchar* column_name) { + gboolean result = FALSE; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + gchar* _tmp2_ = NULL; + gchar* _tmp3_ = NULL; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + gint _tmp7_ = 0; +#line 300 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (table_name != NULL, FALSE); +#line 300 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (column_name != NULL, FALSE); +#line 302 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = database_table_db; +#line 302 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = table_name; +#line 302 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp2_ = g_strdup_printf ("PRAGMA table_info(%s)", _tmp1_); +#line 302 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = _tmp2_; +#line 302 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp5_ = sqlite3_prepare_v2 (_tmp0_, _tmp3_, -1, &_tmp4_, NULL); +#line 302 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 302 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + stmt = _tmp4_; +#line 302 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp6_ = _tmp5_; +#line 302 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (_tmp3_); +#line 302 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp6_; +#line 303 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp7_ = res; +#line 303 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (_tmp7_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1852 "DatabaseTable.c" + { + gboolean _tmp8_ = FALSE; +#line 305 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp8_ = TRUE; +#line 305 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + while (TRUE) { +#line 1859 "DatabaseTable.c" + sqlite3_stmt* _tmp9_ = NULL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; +#line 305 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (!_tmp8_) { +#line 1865 "DatabaseTable.c" + } +#line 305 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp8_ = FALSE; +#line 306 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp9_ = stmt; +#line 306 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp10_ = sqlite3_step (_tmp9_); +#line 306 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp10_; +#line 307 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp11_ = res; +#line 307 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp11_ == SQLITE_DONE) { +#line 308 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + break; +#line 1881 "DatabaseTable.c" + } else { + gint _tmp12_ = 0; +#line 309 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp12_ = res; +#line 309 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp12_ != SQLITE_ROW) { +#line 1888 "DatabaseTable.c" + const gchar* _tmp13_ = NULL; + gchar* _tmp14_ = NULL; + gchar* _tmp15_ = NULL; + gint _tmp16_ = 0; +#line 310 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp13_ = table_name; +#line 310 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp14_ = g_strdup_printf ("has_column %s", _tmp13_); +#line 310 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp15_ = _tmp14_; +#line 310 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp16_ = res; +#line 310 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_fatal (_tmp15_, _tmp16_); +#line 310 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (_tmp15_); +#line 312 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + break; +#line 1907 "DatabaseTable.c" + } else { + gchar* column = NULL; + sqlite3_stmt* _tmp17_ = NULL; + const gchar* _tmp18_ = NULL; + gchar* _tmp19_ = NULL; + gboolean _tmp20_ = FALSE; + const gchar* _tmp21_ = NULL; +#line 314 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp17_ = stmt; +#line 314 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp18_ = sqlite3_column_text (_tmp17_, 1); +#line 314 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp19_ = g_strdup (_tmp18_); +#line 314 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + column = _tmp19_; +#line 315 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp21_ = column; +#line 315 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp21_ != NULL) { +#line 1927 "DatabaseTable.c" + const gchar* _tmp22_ = NULL; + const gchar* _tmp23_ = NULL; +#line 315 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp22_ = column; +#line 315 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp23_ = column_name; +#line 315 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp20_ = g_strcmp0 (_tmp22_, _tmp23_) == 0; +#line 1936 "DatabaseTable.c" + } else { +#line 315 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp20_ = FALSE; +#line 1940 "DatabaseTable.c" + } +#line 315 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp20_) { +#line 316 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + result = TRUE; +#line 316 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (column); +#line 316 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 316 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return result; +#line 1952 "DatabaseTable.c" + } +#line 309 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (column); +#line 1956 "DatabaseTable.c" + } + } + } + } +#line 320 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + result = FALSE; +#line 320 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 320 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return result; +#line 1967 "DatabaseTable.c" +} + + +gboolean database_table_has_table (const gchar* table_name) { + gboolean result = FALSE; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + gchar* _tmp2_ = NULL; + gchar* _tmp3_ = NULL; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + gint _tmp9_ = 0; +#line 323 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (table_name != NULL, FALSE); +#line 325 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = database_table_db; +#line 325 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = table_name; +#line 325 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp2_ = g_strdup_printf ("PRAGMA table_info(%s)", _tmp1_); +#line 325 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = _tmp2_; +#line 325 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp5_ = sqlite3_prepare_v2 (_tmp0_, _tmp3_, -1, &_tmp4_, NULL); +#line 325 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 325 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + stmt = _tmp4_; +#line 325 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp6_ = _tmp5_; +#line 325 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (_tmp3_); +#line 325 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp6_; +#line 326 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp7_ = res; +#line 326 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (_tmp7_ == SQLITE_OK, "res == Sqlite.OK"); +#line 328 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp8_ = sqlite3_step (stmt); +#line 328 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp8_; +#line 330 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp9_ = res; +#line 330 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + result = _tmp9_ != SQLITE_DONE; +#line 330 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 330 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return result; +#line 2023 "DatabaseTable.c" +} + + +gboolean database_table_add_column (const gchar* table_name, const gchar* column_name, const gchar* column_constraints) { + gboolean result = FALSE; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + const gchar* _tmp2_ = NULL; + const gchar* _tmp3_ = NULL; + gchar* _tmp4_ = NULL; + gchar* _tmp5_ = NULL; + sqlite3_stmt* _tmp6_ = NULL; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + gint _tmp9_ = 0; + sqlite3_stmt* _tmp10_ = NULL; + gint _tmp11_ = 0; + gint _tmp12_ = 0; +#line 333 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (table_name != NULL, FALSE); +#line 333 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (column_name != NULL, FALSE); +#line 333 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (column_constraints != NULL, FALSE); +#line 335 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = database_table_db; +#line 335 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = table_name; +#line 335 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp2_ = column_name; +#line 335 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = column_constraints; +#line 335 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp4_ = g_strdup_printf ("ALTER TABLE %s ADD COLUMN %s %s", _tmp1_, _tmp2_, _tmp3_); +#line 335 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp5_ = _tmp4_; +#line 335 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp7_ = sqlite3_prepare_v2 (_tmp0_, _tmp5_, -1, &_tmp6_, NULL); +#line 335 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 335 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + stmt = _tmp6_; +#line 335 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp8_ = _tmp7_; +#line 335 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (_tmp5_); +#line 335 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp8_; +#line 337 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp9_ = res; +#line 337 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (_tmp9_ == SQLITE_OK, "res == Sqlite.OK"); +#line 339 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp10_ = stmt; +#line 339 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp11_ = sqlite3_step (_tmp10_); +#line 339 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp11_; +#line 340 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp12_ = res; +#line 340 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp12_ != SQLITE_DONE) { +#line 2088 "DatabaseTable.c" + const gchar* _tmp13_ = NULL; + const gchar* _tmp14_ = NULL; + const gchar* _tmp15_ = NULL; + gint _tmp16_ = 0; + sqlite3* _tmp17_ = NULL; + const gchar* _tmp18_ = NULL; +#line 341 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp13_ = table_name; +#line 341 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp14_ = column_name; +#line 341 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp15_ = column_constraints; +#line 341 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp16_ = res; +#line 341 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp17_ = database_table_db; +#line 341 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp18_ = sqlite3_errmsg (_tmp17_); +#line 341 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_critical ("DatabaseTable.vala:341: Unable to add column %s %s %s: (%d) %s", _tmp13_, _tmp14_, _tmp15_, _tmp16_, _tmp18_); +#line 344 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + result = FALSE; +#line 344 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 344 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return result; +#line 2115 "DatabaseTable.c" + } +#line 347 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + result = TRUE; +#line 347 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 347 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return result; +#line 2123 "DatabaseTable.c" +} + + +gboolean database_table_ensure_column (const gchar* table_name, const gchar* column_name, const gchar* column_constraints, const gchar* upgrade_msg) { + gboolean result = FALSE; + gboolean _tmp0_ = FALSE; + const gchar* _tmp1_ = NULL; + gboolean _tmp2_ = FALSE; + const gchar* _tmp6_ = NULL; + const gchar* _tmp7_ = NULL; + const gchar* _tmp8_ = NULL; + const gchar* _tmp9_ = NULL; + gboolean _tmp10_ = FALSE; +#line 353 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (table_name != NULL, FALSE); +#line 353 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (column_name != NULL, FALSE); +#line 353 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (column_constraints != NULL, FALSE); +#line 353 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (upgrade_msg != NULL, FALSE); +#line 355 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = table_name; +#line 355 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp2_ = database_table_has_table (_tmp1_); +#line 355 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (!_tmp2_) { +#line 355 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = TRUE; +#line 2153 "DatabaseTable.c" + } else { + const gchar* _tmp3_ = NULL; + const gchar* _tmp4_ = NULL; + gboolean _tmp5_ = FALSE; +#line 355 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = table_name; +#line 355 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp4_ = column_name; +#line 355 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp5_ = database_table_has_column (_tmp3_, _tmp4_); +#line 355 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = _tmp5_; +#line 2166 "DatabaseTable.c" + } +#line 355 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp0_) { +#line 356 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + result = TRUE; +#line 356 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return result; +#line 2174 "DatabaseTable.c" + } +#line 358 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp6_ = upgrade_msg; +#line 358 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_message ("DatabaseTable.vala:358: %s", _tmp6_); +#line 360 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp7_ = table_name; +#line 360 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp8_ = column_name; +#line 360 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp9_ = column_constraints; +#line 360 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp10_ = database_table_add_column (_tmp7_, _tmp8_, _tmp9_); +#line 360 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + result = _tmp10_; +#line 360 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return result; +#line 2192 "DatabaseTable.c" +} + + +gint database_table_get_row_count (DatabaseTable* self) { + gint result = 0; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + gchar* _tmp2_ = NULL; + gchar* _tmp3_ = NULL; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + gint _tmp7_ = 0; + sqlite3_stmt* _tmp8_ = NULL; + gint _tmp9_ = 0; + gint _tmp10_ = 0; + sqlite3_stmt* _tmp15_ = NULL; + gint _tmp16_ = 0; +#line 363 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (IS_DATABASE_TABLE (self), 0); +#line 365 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = database_table_db; +#line 365 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = self->table_name; +#line 365 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp2_ = g_strdup_printf ("SELECT COUNT(id) AS RowCount FROM %s", _tmp1_); +#line 365 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = _tmp2_; +#line 365 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp5_ = sqlite3_prepare_v2 (_tmp0_, _tmp3_, -1, &_tmp4_, NULL); +#line 365 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 365 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + stmt = _tmp4_; +#line 365 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp6_ = _tmp5_; +#line 365 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (_tmp3_); +#line 365 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp6_; +#line 366 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp7_ = res; +#line 366 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (_tmp7_ == SQLITE_OK, "res == Sqlite.OK"); +#line 368 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp8_ = stmt; +#line 368 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp9_ = sqlite3_step (_tmp8_); +#line 368 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp9_; +#line 369 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp10_ = res; +#line 369 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp10_ != SQLITE_ROW) { +#line 2249 "DatabaseTable.c" + const gchar* _tmp11_ = NULL; + gint _tmp12_ = 0; + sqlite3* _tmp13_ = NULL; + const gchar* _tmp14_ = NULL; +#line 370 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp11_ = self->table_name; +#line 370 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp12_ = res; +#line 370 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp13_ = database_table_db; +#line 370 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp14_ = sqlite3_errmsg (_tmp13_); +#line 370 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_critical ("DatabaseTable.vala:370: Unable to retrieve row count on %s: (%d) %s", _tmp11_, _tmp12_, _tmp14_); +#line 372 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + result = 0; +#line 372 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 372 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return result; +#line 2270 "DatabaseTable.c" + } +#line 375 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp15_ = stmt; +#line 375 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp16_ = sqlite3_column_int (_tmp15_, 0); +#line 375 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + result = _tmp16_; +#line 375 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _sqlite3_finalize0 (stmt); +#line 375 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return result; +#line 2282 "DatabaseTable.c" +} + + +void database_table_begin_transaction (void) { + gint _tmp0_ = 0; + gint res = 0; + sqlite3* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; +#line 380 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = database_table_in_transaction; +#line 380 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_in_transaction = _tmp0_ + 1; +#line 380 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp0_ != 0) { +#line 381 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 2300 "DatabaseTable.c" + } +#line 383 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = database_table_db; +#line 383 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp2_ = _sqlite3_exec (_tmp1_, "BEGIN TRANSACTION", NULL, NULL, NULL); +#line 383 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp2_; +#line 384 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = res; +#line 384 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 2312 "DatabaseTable.c" +} + + +void database_table_commit_transaction (GError** error) { + gint _tmp0_ = 0; + gint _tmp1_ = 0; + gint _tmp2_ = 0; + gint res = 0; + sqlite3* _tmp3_ = NULL; + gint _tmp4_ = 0; + gint _tmp5_ = 0; + GError * _inner_error_ = NULL; +#line 389 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp0_ = database_table_in_transaction; +#line 389 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _vala_assert (_tmp0_ > 0, "in_transaction > 0"); +#line 390 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp1_ = database_table_in_transaction; +#line 390 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_in_transaction = _tmp1_ - 1; +#line 390 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp2_ = database_table_in_transaction; +#line 390 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp2_ != 0) { +#line 391 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 2339 "DatabaseTable.c" + } +#line 393 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp3_ = database_table_db; +#line 393 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp4_ = _sqlite3_exec (_tmp3_, "COMMIT TRANSACTION", NULL, NULL, NULL); +#line 393 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + res = _tmp4_; +#line 394 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp5_ = res; +#line 394 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_tmp5_ != SQLITE_DONE) { +#line 2351 "DatabaseTable.c" + gint _tmp6_ = 0; +#line 395 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _tmp6_ = res; +#line 395 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_throw_error ("commit_transaction", _tmp6_, &_inner_error_); +#line 395 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 395 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 395 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_propagate_error (error, _inner_error_); +#line 395 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 2365 "DatabaseTable.c" + } else { +#line 395 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 395 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_clear_error (&_inner_error_); +#line 395 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return; +#line 2373 "DatabaseTable.c" + } + } + } +} + + +DatabaseTable* database_table_construct (GType object_type) { + DatabaseTable* self = NULL; +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + self = (DatabaseTable*) g_type_create_instance (object_type); +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return self; +#line 2386 "DatabaseTable.c" +} + + +static void value_database_table_init (GValue* value) { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + value->data[0].v_pointer = NULL; +#line 2393 "DatabaseTable.c" +} + + +static void value_database_table_free_value (GValue* value) { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (value->data[0].v_pointer) { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_unref (value->data[0].v_pointer); +#line 2402 "DatabaseTable.c" + } +} + + +static void value_database_table_copy_value (const GValue* src_value, GValue* dest_value) { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (src_value->data[0].v_pointer) { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + dest_value->data[0].v_pointer = database_table_ref (src_value->data[0].v_pointer); +#line 2412 "DatabaseTable.c" + } else { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + dest_value->data[0].v_pointer = NULL; +#line 2416 "DatabaseTable.c" + } +} + + +static gpointer value_database_table_peek_pointer (const GValue* value) { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return value->data[0].v_pointer; +#line 2424 "DatabaseTable.c" +} + + +static gchar* value_database_table_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (collect_values[0].v_pointer) { +#line 2431 "DatabaseTable.c" + DatabaseTable* object; + object = collect_values[0].v_pointer; +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (object->parent_instance.g_class == NULL) { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); +#line 2438 "DatabaseTable.c" + } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); +#line 2442 "DatabaseTable.c" + } +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + value->data[0].v_pointer = database_table_ref (object); +#line 2446 "DatabaseTable.c" + } else { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + value->data[0].v_pointer = NULL; +#line 2450 "DatabaseTable.c" + } +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return NULL; +#line 2454 "DatabaseTable.c" +} + + +static gchar* value_database_table_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + DatabaseTable** object_p; + object_p = collect_values[0].v_pointer; +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (!object_p) { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); +#line 2465 "DatabaseTable.c" + } +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (!value->data[0].v_pointer) { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + *object_p = NULL; +#line 2471 "DatabaseTable.c" + } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + *object_p = value->data[0].v_pointer; +#line 2475 "DatabaseTable.c" + } else { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + *object_p = database_table_ref (value->data[0].v_pointer); +#line 2479 "DatabaseTable.c" + } +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return NULL; +#line 2483 "DatabaseTable.c" +} + + +GParamSpec* param_spec_database_table (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { + ParamSpecDatabaseTable* spec; +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (g_type_is_a (object_type, TYPE_DATABASE_TABLE), NULL); +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + G_PARAM_SPEC (spec)->value_type = object_type; +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return G_PARAM_SPEC (spec); +#line 2497 "DatabaseTable.c" +} + + +gpointer value_get_database_table (const GValue* value) { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_DATABASE_TABLE), NULL); +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return value->data[0].v_pointer; +#line 2506 "DatabaseTable.c" +} + + +void value_set_database_table (GValue* value, gpointer v_object) { + DatabaseTable* old; +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_DATABASE_TABLE)); +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + old = value->data[0].v_pointer; +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (v_object) { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_DATABASE_TABLE)); +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + value->data[0].v_pointer = v_object; +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_ref (value->data[0].v_pointer); +#line 2526 "DatabaseTable.c" + } else { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + value->data[0].v_pointer = NULL; +#line 2530 "DatabaseTable.c" + } +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (old) { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_unref (old); +#line 2536 "DatabaseTable.c" + } +} + + +void value_take_database_table (GValue* value, gpointer v_object) { + DatabaseTable* old; +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_DATABASE_TABLE)); +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + old = value->data[0].v_pointer; +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (v_object) { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_DATABASE_TABLE)); +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + value->data[0].v_pointer = v_object; +#line 2555 "DatabaseTable.c" + } else { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + value->data[0].v_pointer = NULL; +#line 2559 "DatabaseTable.c" + } +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (old) { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_unref (old); +#line 2565 "DatabaseTable.c" + } +} + + +static void database_table_class_init (DatabaseTableClass * klass) { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + database_table_parent_class = g_type_class_peek_parent (klass); +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + ((DatabaseTableClass *) klass)->finalize = database_table_finalize; +#line 2575 "DatabaseTable.c" +} + + +static void database_table_instance_init (DatabaseTable * self) { +#line 30 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + self->table_name = NULL; +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + self->ref_count = 1; +#line 2584 "DatabaseTable.c" +} + + +static void database_table_finalize (DatabaseTable* obj) { + DatabaseTable * self; +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_DATABASE_TABLE, DatabaseTable); +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_signal_handlers_destroy (self); +#line 30 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + _g_free0 (self->table_name); +#line 2596 "DatabaseTable.c" +} + + +GType database_table_get_type (void) { + static volatile gsize database_table_type_id__volatile = 0; + if (g_once_init_enter (&database_table_type_id__volatile)) { + static const GTypeValueTable g_define_type_value_table = { value_database_table_init, value_database_table_free_value, value_database_table_copy_value, value_database_table_peek_pointer, "p", value_database_table_collect_value, "p", value_database_table_lcopy_value }; + static const GTypeInfo g_define_type_info = { sizeof (DatabaseTableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) database_table_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DatabaseTable), 0, (GInstanceInitFunc) database_table_instance_init, &g_define_type_value_table }; + static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; + GType database_table_type_id; + database_table_type_id = g_type_register_fundamental (g_type_fundamental_next (), "DatabaseTable", &g_define_type_info, &g_define_type_fundamental_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&database_table_type_id__volatile, database_table_type_id); + } + return database_table_type_id__volatile; +} + + +gpointer database_table_ref (gpointer instance) { + DatabaseTable* self; + self = instance; +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_atomic_int_inc (&self->ref_count); +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + return instance; +#line 2621 "DatabaseTable.c" +} + + +void database_table_unref (gpointer instance) { + DatabaseTable* self; + self = instance; +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + if (g_atomic_int_dec_and_test (&self->ref_count)) { +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + DATABASE_TABLE_GET_CLASS (self)->finalize (self); +#line 16 "/home/jens/Source/shotwell/src/db/DatabaseTable.vala" + g_type_free_instance ((GTypeInstance *) self); +#line 2634 "DatabaseTable.c" + } +} + + + diff --git a/src/db/DatabaseTable.vala b/src/db/DatabaseTable.vala index 42eac69..09c026f 100644 --- a/src/db/DatabaseTable.vala +++ b/src/db/DatabaseTable.vala @@ -49,6 +49,13 @@ public abstract class DatabaseTable { e.message)); } } +#if SQLITE_DEBUG + db.trace (on_trace); +#endif + } + + public static void on_trace (string message) { + debug ("SQLITE: %s", message); } public static void init(string filename) { diff --git a/src/db/Db.c b/src/db/Db.c new file mode 100644 index 0000000..9c7e328 --- /dev/null +++ b/src/db/Db.c @@ -0,0 +1,852 @@ +/* Db.c generated by valac 0.32.1, the Vala compiler + * generated from Db.vala, do not modify */ + +/* 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. + */ + +#include +#include +#include +#include +#include + +#define _g_free0(var) (var = (g_free (var), NULL)) + +#define DB_TYPE_VERIFY_RESULT (db_verify_result_get_type ()) + +#define TYPE_DATABASE_TABLE (database_table_get_type ()) +#define DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATABASE_TABLE, DatabaseTable)) +#define DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATABASE_TABLE, DatabaseTableClass)) +#define IS_DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATABASE_TABLE)) +#define IS_DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATABASE_TABLE)) +#define DATABASE_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATABASE_TABLE, DatabaseTableClass)) + +typedef struct _DatabaseTable DatabaseTable; +typedef struct _DatabaseTableClass DatabaseTableClass; + +#define TYPE_VERSION_TABLE (version_table_get_type ()) +#define VERSION_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_VERSION_TABLE, VersionTable)) +#define VERSION_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_VERSION_TABLE, VersionTableClass)) +#define IS_VERSION_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_VERSION_TABLE)) +#define IS_VERSION_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_VERSION_TABLE)) +#define VERSION_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_VERSION_TABLE, VersionTableClass)) + +typedef struct _VersionTable VersionTable; +typedef struct _VersionTableClass VersionTableClass; +#define _database_table_unref0(var) ((var == NULL) ? NULL : (var = (database_table_unref (var), NULL))) + +#define TYPE_APPLICATION (application_get_type ()) +#define APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_APPLICATION, Application)) +#define APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_APPLICATION, ApplicationClass)) +#define IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_APPLICATION)) +#define IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_APPLICATION)) +#define APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_APPLICATION, ApplicationClass)) + +typedef struct _Application Application; +typedef struct _ApplicationClass ApplicationClass; +#define _application_unref0(var) ((var == NULL) ? NULL : (var = (application_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); +#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } +#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } +#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +typedef enum { + DB_VERIFY_RESULT_OK, + DB_VERIFY_RESULT_FUTURE_VERSION, + DB_VERIFY_RESULT_UPGRADE_ERROR, + DB_VERIFY_RESULT_NO_UPGRADE_AVAILABLE +} DbVerifyResult; + + +extern gchar* db_filename; +gchar* db_filename = NULL; + +#define DB_IN_MEMORY_NAME ":memory:" +void db_preconfigure (GFile* db_file); +void db_init (GError** error); +void database_table_init (const gchar* filename); +void db_terminate (void); +void database_table_terminate (void); +GType db_verify_result_get_type (void) G_GNUC_CONST; +DbVerifyResult db_verify_database (gchar** app_version, gint* schema_version); +gpointer database_table_ref (gpointer instance); +void database_table_unref (gpointer instance); +GParamSpec* param_spec_database_table (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_database_table (GValue* value, gpointer v_object); +void value_take_database_table (GValue* value, gpointer v_object); +gpointer value_get_database_table (const GValue* value); +GType database_table_get_type (void) G_GNUC_CONST; +GType version_table_get_type (void) G_GNUC_CONST; +VersionTable* version_table_get_instance (void); +gint version_table_get_version (VersionTable* self, gchar** app_version); +#define DATABASE_TABLE_SCHEMA_VERSION 20 +#define RESOURCES_APP_VERSION _VERSION +void version_table_set_version (VersionTable* self, gint version, const gchar* app_version, const gchar* user_data); +DbVerifyResult db_upgrade_database (gint input_version); +gboolean database_table_has_column (const gchar* table_name, const gchar* column_name); +gboolean database_table_add_column (const gchar* table_name, const gchar* column_name, const gchar* column_constraints); +gboolean database_table_has_table (const gchar* table_name); +gboolean database_table_ensure_column (const gchar* table_name, const gchar* column_name, const gchar* column_constraints, const gchar* upgrade_msg); +void tag_table_upgrade_for_htags (void); +void gsettings_configuration_engine_run_gsettings_migrator (void); +gpointer application_ref (gpointer instance); +void application_unref (gpointer instance); +GParamSpec* param_spec_application (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_application (GValue* value, gpointer v_object); +void value_take_application (GValue* value, gpointer v_object); +gpointer value_get_application (const GValue* value); +GType application_get_type (void) G_GNUC_CONST; +Application* application_get_instance (void); +void application_set_raw_thumbs_fix_required (Application* self, gboolean should_fixup); +void version_table_update_version (VersionTable* self, gint version, const gchar* app_version); + + +void db_preconfigure (GFile* db_file) { + gchar* _tmp0_ = NULL; + GFile* _tmp1_ = NULL; + gchar* _tmp5_ = NULL; +#line 14 "/home/jens/Source/shotwell/src/db/Db.vala" + g_return_if_fail ((db_file == NULL) || G_IS_FILE (db_file)); +#line 15 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp1_ = db_file; +#line 15 "/home/jens/Source/shotwell/src/db/Db.vala" + if (_tmp1_ != NULL) { +#line 118 "Db.c" + GFile* _tmp2_ = NULL; + gchar* _tmp3_ = NULL; +#line 15 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp2_ = db_file; +#line 15 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp3_ = g_file_get_path (_tmp2_); +#line 15 "/home/jens/Source/shotwell/src/db/Db.vala" + _g_free0 (_tmp0_); +#line 15 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp0_ = _tmp3_; +#line 129 "Db.c" + } else { + gchar* _tmp4_ = NULL; +#line 15 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp4_ = g_strdup (DB_IN_MEMORY_NAME); +#line 15 "/home/jens/Source/shotwell/src/db/Db.vala" + _g_free0 (_tmp0_); +#line 15 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp0_ = _tmp4_; +#line 138 "Db.c" + } +#line 15 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp5_ = g_strdup (_tmp0_); +#line 15 "/home/jens/Source/shotwell/src/db/Db.vala" + _g_free0 (db_filename); +#line 15 "/home/jens/Source/shotwell/src/db/Db.vala" + db_filename = _tmp5_; +#line 14 "/home/jens/Source/shotwell/src/db/Db.vala" + _g_free0 (_tmp0_); +#line 148 "Db.c" +} + + +void db_init (GError** error) { + const gchar* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; +#line 19 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp0_ = db_filename; +#line 19 "/home/jens/Source/shotwell/src/db/Db.vala" + _vala_assert (_tmp0_ != NULL, "filename != null"); +#line 21 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp1_ = db_filename; +#line 21 "/home/jens/Source/shotwell/src/db/Db.vala" + database_table_init (_tmp1_); +#line 163 "Db.c" +} + + +void db_terminate (void) { +#line 25 "/home/jens/Source/shotwell/src/db/Db.vala" + database_table_terminate (); +#line 170 "Db.c" +} + + +GType db_verify_result_get_type (void) { + static volatile gsize db_verify_result_type_id__volatile = 0; + if (g_once_init_enter (&db_verify_result_type_id__volatile)) { + static const GEnumValue values[] = {{DB_VERIFY_RESULT_OK, "DB_VERIFY_RESULT_OK", "ok"}, {DB_VERIFY_RESULT_FUTURE_VERSION, "DB_VERIFY_RESULT_FUTURE_VERSION", "future-version"}, {DB_VERIFY_RESULT_UPGRADE_ERROR, "DB_VERIFY_RESULT_UPGRADE_ERROR", "upgrade-error"}, {DB_VERIFY_RESULT_NO_UPGRADE_AVAILABLE, "DB_VERIFY_RESULT_NO_UPGRADE_AVAILABLE", "no-upgrade-available"}, {0, NULL, NULL}}; + GType db_verify_result_type_id; + db_verify_result_type_id = g_enum_register_static ("DbVerifyResult", values); + g_once_init_leave (&db_verify_result_type_id__volatile, db_verify_result_type_id); + } + return db_verify_result_type_id__volatile; +} + + +DbVerifyResult db_verify_database (gchar** app_version, gint* schema_version) { + gchar* _vala_app_version = NULL; + gint _vala_schema_version = 0; + DbVerifyResult result = 0; + VersionTable* version_table = NULL; + VersionTable* _tmp0_ = NULL; + VersionTable* _tmp1_ = NULL; + gchar* _tmp2_ = NULL; + gint _tmp3_ = 0; + gint _tmp4_ = 0; + gint _tmp7_ = 0; +#line 36 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp0_ = version_table_get_instance (); +#line 36 "/home/jens/Source/shotwell/src/db/Db.vala" + version_table = _tmp0_; +#line 37 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp1_ = version_table; +#line 37 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp3_ = version_table_get_version (_tmp1_, &_tmp2_); +#line 37 "/home/jens/Source/shotwell/src/db/Db.vala" + _g_free0 (_vala_app_version); +#line 37 "/home/jens/Source/shotwell/src/db/Db.vala" + _vala_app_version = _tmp2_; +#line 37 "/home/jens/Source/shotwell/src/db/Db.vala" + _vala_schema_version = _tmp3_; +#line 39 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp4_ = _vala_schema_version; +#line 39 "/home/jens/Source/shotwell/src/db/Db.vala" + if (_tmp4_ >= 0) { +#line 215 "Db.c" + gint _tmp5_ = 0; + const gchar* _tmp6_ = NULL; +#line 40 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp5_ = _vala_schema_version; +#line 40 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp6_ = _vala_app_version; +#line 40 "/home/jens/Source/shotwell/src/db/Db.vala" + g_debug ("Db.vala:40: Database schema version %d created by app version %s", _tmp5_, _tmp6_); +#line 224 "Db.c" + } +#line 42 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp7_ = _vala_schema_version; +#line 42 "/home/jens/Source/shotwell/src/db/Db.vala" + if (_tmp7_ == -1) { +#line 230 "Db.c" + VersionTable* _tmp8_ = NULL; + gchar* _tmp9_ = NULL; +#line 44 "/home/jens/Source/shotwell/src/db/Db.vala" + g_debug ("Db.vala:44: Creating database schema version %d for app version %s", DATABASE_TABLE_SCHEMA_VERSION, RESOURCES_APP_VERSION); +#line 46 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp8_ = version_table; +#line 46 "/home/jens/Source/shotwell/src/db/Db.vala" + version_table_set_version (_tmp8_, DATABASE_TABLE_SCHEMA_VERSION, RESOURCES_APP_VERSION, NULL); +#line 47 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp9_ = g_strdup (RESOURCES_APP_VERSION); +#line 47 "/home/jens/Source/shotwell/src/db/Db.vala" + _g_free0 (_vala_app_version); +#line 47 "/home/jens/Source/shotwell/src/db/Db.vala" + _vala_app_version = _tmp9_; +#line 48 "/home/jens/Source/shotwell/src/db/Db.vala" + _vala_schema_version = DATABASE_TABLE_SCHEMA_VERSION; +#line 247 "Db.c" + } else { + gint _tmp10_ = 0; +#line 49 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp10_ = _vala_schema_version; +#line 49 "/home/jens/Source/shotwell/src/db/Db.vala" + if (_tmp10_ > DATABASE_TABLE_SCHEMA_VERSION) { +#line 51 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_FUTURE_VERSION; +#line 51 "/home/jens/Source/shotwell/src/db/Db.vala" + _database_table_unref0 (version_table); +#line 51 "/home/jens/Source/shotwell/src/db/Db.vala" + if (app_version) { +#line 51 "/home/jens/Source/shotwell/src/db/Db.vala" + *app_version = _vala_app_version; +#line 262 "Db.c" + } else { +#line 51 "/home/jens/Source/shotwell/src/db/Db.vala" + _g_free0 (_vala_app_version); +#line 266 "Db.c" + } +#line 51 "/home/jens/Source/shotwell/src/db/Db.vala" + if (schema_version) { +#line 51 "/home/jens/Source/shotwell/src/db/Db.vala" + *schema_version = _vala_schema_version; +#line 272 "Db.c" + } +#line 51 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 276 "Db.c" + } else { + gint _tmp11_ = 0; +#line 52 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp11_ = _vala_schema_version; +#line 52 "/home/jens/Source/shotwell/src/db/Db.vala" + if (_tmp11_ < DATABASE_TABLE_SCHEMA_VERSION) { +#line 283 "Db.c" + DbVerifyResult _result_ = 0; + gint _tmp12_ = 0; + DbVerifyResult _tmp13_ = 0; + DbVerifyResult _tmp14_ = 0; +#line 54 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp12_ = _vala_schema_version; +#line 54 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp13_ = db_upgrade_database (_tmp12_); +#line 54 "/home/jens/Source/shotwell/src/db/Db.vala" + _result_ = _tmp13_; +#line 55 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp14_ = _result_; +#line 55 "/home/jens/Source/shotwell/src/db/Db.vala" + if (_tmp14_ != DB_VERIFY_RESULT_OK) { +#line 56 "/home/jens/Source/shotwell/src/db/Db.vala" + result = _result_; +#line 56 "/home/jens/Source/shotwell/src/db/Db.vala" + _database_table_unref0 (version_table); +#line 56 "/home/jens/Source/shotwell/src/db/Db.vala" + if (app_version) { +#line 56 "/home/jens/Source/shotwell/src/db/Db.vala" + *app_version = _vala_app_version; +#line 306 "Db.c" + } else { +#line 56 "/home/jens/Source/shotwell/src/db/Db.vala" + _g_free0 (_vala_app_version); +#line 310 "Db.c" + } +#line 56 "/home/jens/Source/shotwell/src/db/Db.vala" + if (schema_version) { +#line 56 "/home/jens/Source/shotwell/src/db/Db.vala" + *schema_version = _vala_schema_version; +#line 316 "Db.c" + } +#line 56 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 320 "Db.c" + } + } + } + } +#line 59 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_OK; +#line 59 "/home/jens/Source/shotwell/src/db/Db.vala" + _database_table_unref0 (version_table); +#line 59 "/home/jens/Source/shotwell/src/db/Db.vala" + if (app_version) { +#line 59 "/home/jens/Source/shotwell/src/db/Db.vala" + *app_version = _vala_app_version; +#line 333 "Db.c" + } else { +#line 59 "/home/jens/Source/shotwell/src/db/Db.vala" + _g_free0 (_vala_app_version); +#line 337 "Db.c" + } +#line 59 "/home/jens/Source/shotwell/src/db/Db.vala" + if (schema_version) { +#line 59 "/home/jens/Source/shotwell/src/db/Db.vala" + *schema_version = _vala_schema_version; +#line 343 "Db.c" + } +#line 59 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 347 "Db.c" +} + + +DbVerifyResult db_upgrade_database (gint input_version) { + DbVerifyResult result = 0; + gint _tmp0_ = 0; + gint version = 0; + gint _tmp1_ = 0; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + gboolean _tmp4_ = FALSE; + gboolean _tmp6_ = FALSE; + gboolean _tmp8_ = FALSE; + gboolean _tmp10_ = FALSE; + gboolean _tmp12_ = FALSE; + gboolean _tmp14_ = FALSE; + gboolean _tmp16_ = FALSE; + gboolean _tmp18_ = FALSE; + gboolean _tmp20_ = FALSE; + gboolean _tmp21_ = FALSE; + gboolean _tmp24_ = FALSE; + gboolean _tmp26_ = FALSE; + gboolean _tmp27_ = FALSE; + gboolean _tmp29_ = FALSE; + gboolean _tmp31_ = FALSE; + gboolean _tmp33_ = FALSE; + gint _tmp35_ = 0; + gint _tmp36_ = 0; + gboolean _tmp37_ = FALSE; + gboolean _tmp39_ = FALSE; + gboolean _tmp41_ = FALSE; + gint _tmp43_ = 0; + gint _tmp46_ = 0; + VersionTable* _tmp47_ = NULL; + VersionTable* _tmp48_ = NULL; + gint _tmp49_ = 0; + gint _tmp50_ = 0; +#line 63 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp0_ = input_version; +#line 63 "/home/jens/Source/shotwell/src/db/Db.vala" + _vala_assert (_tmp0_ < DATABASE_TABLE_SCHEMA_VERSION, "input_version < DatabaseTable.SCHEMA_VERSION"); +#line 65 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp1_ = input_version; +#line 65 "/home/jens/Source/shotwell/src/db/Db.vala" + version = _tmp1_; +#line 68 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp2_ = version; +#line 68 "/home/jens/Source/shotwell/src/db/Db.vala" + if (_tmp2_ == 1) { +#line 69 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_NO_UPGRADE_AVAILABLE; +#line 69 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 401 "Db.c" + } +#line 71 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp3_ = version; +#line 71 "/home/jens/Source/shotwell/src/db/Db.vala" + g_message ("Db.vala:71: Upgrading database from schema version %d to %d", _tmp3_, DATABASE_TABLE_SCHEMA_VERSION); +#line 83 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp4_ = database_table_has_column ("PhotoTable", "flags"); +#line 83 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp4_) { +#line 411 "Db.c" + gboolean _tmp5_ = FALSE; +#line 84 "/home/jens/Source/shotwell/src/db/Db.vala" + g_message ("Db.vala:84: upgrade_database: adding flags column to PhotoTable"); +#line 85 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp5_ = database_table_add_column ("PhotoTable", "flags", "INTEGER DEFAULT 0"); +#line 85 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp5_) { +#line 86 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_UPGRADE_ERROR; +#line 86 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 423 "Db.c" + } + } +#line 89 "/home/jens/Source/shotwell/src/db/Db.vala" + version = 3; +#line 100 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp6_ = database_table_has_column ("PhotoTable", "file_format"); +#line 100 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp6_) { +#line 432 "Db.c" + gboolean _tmp7_ = FALSE; +#line 101 "/home/jens/Source/shotwell/src/db/Db.vala" + g_message ("Db.vala:101: upgrade_database: adding file_format column to PhotoTable"); +#line 102 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp7_ = database_table_add_column ("PhotoTable", "file_format", "INTEGER DEFAULT 0"); +#line 102 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp7_) { +#line 103 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_UPGRADE_ERROR; +#line 103 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 444 "Db.c" + } + } +#line 106 "/home/jens/Source/shotwell/src/db/Db.vala" + version = 4; +#line 113 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp8_ = database_table_has_column ("PhotoTable", "title"); +#line 113 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp8_) { +#line 453 "Db.c" + gboolean _tmp9_ = FALSE; +#line 114 "/home/jens/Source/shotwell/src/db/Db.vala" + g_message ("Db.vala:114: upgrade_database: adding title column to PhotoTable"); +#line 115 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp9_ = database_table_add_column ("PhotoTable", "title", "TEXT"); +#line 115 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp9_) { +#line 116 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_UPGRADE_ERROR; +#line 116 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 465 "Db.c" + } + } +#line 119 "/home/jens/Source/shotwell/src/db/Db.vala" + version = 5; +#line 126 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp10_ = database_table_has_column ("PhotoTable", "backlinks"); +#line 126 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp10_) { +#line 474 "Db.c" + gboolean _tmp11_ = FALSE; +#line 127 "/home/jens/Source/shotwell/src/db/Db.vala" + g_message ("Db.vala:127: upgrade_database: adding backlinks column to PhotoTable"); +#line 128 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp11_ = database_table_add_column ("PhotoTable", "backlinks", "TEXT"); +#line 128 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp11_) { +#line 129 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_UPGRADE_ERROR; +#line 129 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 486 "Db.c" + } + } +#line 132 "/home/jens/Source/shotwell/src/db/Db.vala" + version = 6; +#line 146 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp12_ = database_table_has_column ("PhotoTable", "time_reimported"); +#line 146 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp12_) { +#line 495 "Db.c" + gboolean _tmp13_ = FALSE; +#line 147 "/home/jens/Source/shotwell/src/db/Db.vala" + g_message ("Db.vala:147: upgrade_database: adding time_reimported column to PhotoT" \ +"able"); +#line 148 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp13_ = database_table_add_column ("PhotoTable", "time_reimported", "INTEGER"); +#line 148 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp13_) { +#line 149 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_UPGRADE_ERROR; +#line 149 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 507 "Db.c" + } + } +#line 152 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp14_ = database_table_has_column ("PhotoTable", "editable_id"); +#line 152 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp14_) { +#line 514 "Db.c" + gboolean _tmp15_ = FALSE; +#line 153 "/home/jens/Source/shotwell/src/db/Db.vala" + g_message ("Db.vala:153: upgrade_database: adding editable_id column to PhotoTable"); +#line 154 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp15_ = database_table_add_column ("PhotoTable", "editable_id", "INTEGER DEFAULT -1"); +#line 154 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp15_) { +#line 155 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_UPGRADE_ERROR; +#line 155 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 526 "Db.c" + } + } +#line 158 "/home/jens/Source/shotwell/src/db/Db.vala" + version = 7; +#line 170 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp16_ = database_table_has_column ("PhotoTable", "rating"); +#line 170 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp16_) { +#line 535 "Db.c" + gboolean _tmp17_ = FALSE; +#line 171 "/home/jens/Source/shotwell/src/db/Db.vala" + g_message ("Db.vala:171: upgrade_database: adding rating column to PhotoTable"); +#line 172 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp17_ = database_table_add_column ("PhotoTable", "rating", "INTEGER DEFAULT 0"); +#line 172 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp17_) { +#line 173 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_UPGRADE_ERROR; +#line 173 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 547 "Db.c" + } + } +#line 182 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp18_ = database_table_has_column ("PhotoTable", "metadata_dirty"); +#line 182 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp18_) { +#line 554 "Db.c" + gboolean _tmp19_ = FALSE; +#line 183 "/home/jens/Source/shotwell/src/db/Db.vala" + g_message ("Db.vala:183: upgrade_database: adding metadata_dirty column to PhotoTa" \ +"ble"); +#line 184 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp19_ = database_table_add_column ("PhotoTable", "metadata_dirty", "INTEGER DEFAULT 1"); +#line 184 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp19_) { +#line 185 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_UPGRADE_ERROR; +#line 185 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 566 "Db.c" + } + } +#line 188 "/home/jens/Source/shotwell/src/db/Db.vala" + version = 9; +#line 195 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp21_ = database_table_has_table ("VideoTable"); +#line 195 "/home/jens/Source/shotwell/src/db/Db.vala" + if (_tmp21_) { +#line 575 "Db.c" + gboolean _tmp22_ = FALSE; +#line 195 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp22_ = database_table_has_column ("VideoTable", "flags"); +#line 195 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp20_ = !_tmp22_; +#line 581 "Db.c" + } else { +#line 195 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp20_ = FALSE; +#line 585 "Db.c" + } +#line 195 "/home/jens/Source/shotwell/src/db/Db.vala" + if (_tmp20_) { +#line 589 "Db.c" + gboolean _tmp23_ = FALSE; +#line 196 "/home/jens/Source/shotwell/src/db/Db.vala" + g_message ("Db.vala:196: upgrade_database: adding flags column to VideoTable"); +#line 197 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp23_ = database_table_add_column ("VideoTable", "flags", "INTEGER DEFAULT 0"); +#line 197 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp23_) { +#line 198 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_UPGRADE_ERROR; +#line 198 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 601 "Db.c" + } + } +#line 201 "/home/jens/Source/shotwell/src/db/Db.vala" + version = 10; +#line 208 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp24_ = database_table_has_column ("EventTable", "primary_source_id"); +#line 208 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp24_) { +#line 610 "Db.c" + gboolean _tmp25_ = FALSE; +#line 209 "/home/jens/Source/shotwell/src/db/Db.vala" + g_message ("Db.vala:209: upgrade_database: adding primary_source_id column to Even" \ +"tTable"); +#line 210 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp25_ = database_table_add_column ("EventTable", "primary_source_id", "INTEGER DEFAULT 0"); +#line 210 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp25_) { +#line 211 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_UPGRADE_ERROR; +#line 211 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 622 "Db.c" + } + } +#line 214 "/home/jens/Source/shotwell/src/db/Db.vala" + version = 11; +#line 221 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp26_ = database_table_ensure_column ("TombstoneTable", "reason", "INTEGER DEFAULT 0", "upgrade_database: adding reason column to TombstoneTable"); +#line 221 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp26_) { +#line 223 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_UPGRADE_ERROR; +#line 223 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 635 "Db.c" + } +#line 226 "/home/jens/Source/shotwell/src/db/Db.vala" + version = 12; +#line 233 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp27_ = database_table_has_column ("PhotoTable", "developer"); +#line 233 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp27_) { +#line 643 "Db.c" + gboolean _tmp28_ = FALSE; +#line 234 "/home/jens/Source/shotwell/src/db/Db.vala" + g_message ("Db.vala:234: upgrade_database: adding developer column to PhotoTable"); +#line 235 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp28_ = database_table_add_column ("PhotoTable", "developer", "TEXT"); +#line 235 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp28_) { +#line 236 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_UPGRADE_ERROR; +#line 236 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 655 "Db.c" + } + } +#line 239 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp29_ = database_table_has_column ("PhotoTable", "develop_shotwell_id"); +#line 239 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp29_) { +#line 662 "Db.c" + gboolean _tmp30_ = FALSE; +#line 240 "/home/jens/Source/shotwell/src/db/Db.vala" + g_message ("Db.vala:240: upgrade_database: adding develop_shotwell_id column to Ph" \ +"otoTable"); +#line 241 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp30_ = database_table_add_column ("PhotoTable", "develop_shotwell_id", "INTEGER DEFAULT -1"); +#line 241 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp30_) { +#line 242 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_UPGRADE_ERROR; +#line 242 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 674 "Db.c" + } + } +#line 245 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp31_ = database_table_has_column ("PhotoTable", "develop_camera_id"); +#line 245 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp31_) { +#line 681 "Db.c" + gboolean _tmp32_ = FALSE; +#line 246 "/home/jens/Source/shotwell/src/db/Db.vala" + g_message ("Db.vala:246: upgrade_database: adding develop_camera_id column to Phot" \ +"oTable"); +#line 247 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp32_ = database_table_add_column ("PhotoTable", "develop_camera_id", "INTEGER DEFAULT -1"); +#line 247 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp32_) { +#line 248 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_UPGRADE_ERROR; +#line 248 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 693 "Db.c" + } + } +#line 251 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp33_ = database_table_has_column ("PhotoTable", "develop_embedded_id"); +#line 251 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp33_) { +#line 700 "Db.c" + gboolean _tmp34_ = FALSE; +#line 252 "/home/jens/Source/shotwell/src/db/Db.vala" + g_message ("Db.vala:252: upgrade_database: adding develop_embedded_id column to Ph" \ +"otoTable"); +#line 253 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp34_ = database_table_add_column ("PhotoTable", "develop_embedded_id", "INTEGER DEFAULT -1"); +#line 253 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp34_) { +#line 254 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_UPGRADE_ERROR; +#line 254 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 712 "Db.c" + } + } +#line 257 "/home/jens/Source/shotwell/src/db/Db.vala" + version = 13; +#line 264 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp35_ = input_version; +#line 264 "/home/jens/Source/shotwell/src/db/Db.vala" + if (_tmp35_ < 14) { +#line 265 "/home/jens/Source/shotwell/src/db/Db.vala" + tag_table_upgrade_for_htags (); +#line 723 "Db.c" + } +#line 267 "/home/jens/Source/shotwell/src/db/Db.vala" + version = 14; +#line 279 "/home/jens/Source/shotwell/src/db/Db.vala" + version = 15; +#line 289 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp36_ = input_version; +#line 289 "/home/jens/Source/shotwell/src/db/Db.vala" + if (_tmp36_ < 16) { +#line 292 "/home/jens/Source/shotwell/src/db/Db.vala" + gsettings_configuration_engine_run_gsettings_migrator (); +#line 735 "Db.c" + } +#line 295 "/home/jens/Source/shotwell/src/db/Db.vala" + version = 16; +#line 302 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp37_ = database_table_has_column ("PhotoTable", "comment"); +#line 302 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp37_) { +#line 743 "Db.c" + gboolean _tmp38_ = FALSE; +#line 303 "/home/jens/Source/shotwell/src/db/Db.vala" + g_message ("Db.vala:303: upgrade_database: adding comment column to PhotoTable"); +#line 304 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp38_ = database_table_add_column ("PhotoTable", "comment", "TEXT"); +#line 304 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp38_) { +#line 305 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_UPGRADE_ERROR; +#line 305 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 755 "Db.c" + } + } +#line 307 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp39_ = database_table_has_column ("VideoTable", "comment"); +#line 307 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp39_) { +#line 762 "Db.c" + gboolean _tmp40_ = FALSE; +#line 308 "/home/jens/Source/shotwell/src/db/Db.vala" + g_message ("Db.vala:308: upgrade_database: adding comment column to VideoTable"); +#line 309 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp40_ = database_table_add_column ("VideoTable", "comment", "TEXT"); +#line 309 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp40_) { +#line 310 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_UPGRADE_ERROR; +#line 310 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 774 "Db.c" + } + } +#line 313 "/home/jens/Source/shotwell/src/db/Db.vala" + version = 17; +#line 320 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp41_ = database_table_has_column ("EventTable", "comment"); +#line 320 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp41_) { +#line 783 "Db.c" + gboolean _tmp42_ = FALSE; +#line 321 "/home/jens/Source/shotwell/src/db/Db.vala" + g_message ("Db.vala:321: upgrade_database: adding comment column to EventTable"); +#line 322 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp42_ = database_table_add_column ("EventTable", "comment", "TEXT"); +#line 322 "/home/jens/Source/shotwell/src/db/Db.vala" + if (!_tmp42_) { +#line 323 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_UPGRADE_ERROR; +#line 323 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 795 "Db.c" + } + } +#line 326 "/home/jens/Source/shotwell/src/db/Db.vala" + version = 18; +#line 337 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp43_ = input_version; +#line 337 "/home/jens/Source/shotwell/src/db/Db.vala" + if (_tmp43_ < 19) { +#line 804 "Db.c" + Application* _tmp44_ = NULL; + Application* _tmp45_ = NULL; +#line 338 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp44_ = application_get_instance (); +#line 338 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp45_ = _tmp44_; +#line 338 "/home/jens/Source/shotwell/src/db/Db.vala" + application_set_raw_thumbs_fix_required (_tmp45_, TRUE); +#line 338 "/home/jens/Source/shotwell/src/db/Db.vala" + _application_unref0 (_tmp45_); +#line 815 "Db.c" + } +#line 341 "/home/jens/Source/shotwell/src/db/Db.vala" + version = 19; +#line 351 "/home/jens/Source/shotwell/src/db/Db.vala" + version = 20; +#line 357 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp46_ = version; +#line 357 "/home/jens/Source/shotwell/src/db/Db.vala" + _vala_assert (_tmp46_ == DATABASE_TABLE_SCHEMA_VERSION, "version == DatabaseTable.SCHEMA_VERSION"); +#line 358 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp47_ = version_table_get_instance (); +#line 358 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp48_ = _tmp47_; +#line 358 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp49_ = version; +#line 358 "/home/jens/Source/shotwell/src/db/Db.vala" + version_table_update_version (_tmp48_, _tmp49_, RESOURCES_APP_VERSION); +#line 358 "/home/jens/Source/shotwell/src/db/Db.vala" + _database_table_unref0 (_tmp48_); +#line 360 "/home/jens/Source/shotwell/src/db/Db.vala" + _tmp50_ = version; +#line 360 "/home/jens/Source/shotwell/src/db/Db.vala" + g_message ("Db.vala:360: Database upgrade to schema version %d successful", _tmp50_); +#line 362 "/home/jens/Source/shotwell/src/db/Db.vala" + result = DB_VERIFY_RESULT_OK; +#line 362 "/home/jens/Source/shotwell/src/db/Db.vala" + return result; +#line 843 "Db.c" +} + + + diff --git a/src/db/Db.vala b/src/db/Db.vala index d536b41..e4f83bf 100644 --- a/src/db/Db.vala +++ b/src/db/Db.vala @@ -6,7 +6,7 @@ namespace Db { -public static const string IN_MEMORY_NAME = ":memory:"; +public const string IN_MEMORY_NAME = ":memory:"; private string? filename = null; diff --git a/src/db/EventTable.c b/src/db/EventTable.c new file mode 100644 index 0000000..0e763e9 --- /dev/null +++ b/src/db/EventTable.c @@ -0,0 +1,1877 @@ +/* EventTable.c generated by valac 0.32.1, the Vala compiler + * generated from EventTable.vala, do not modify */ + +/* 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + + +#define TYPE_EVENT_ID (event_id_get_type ()) +typedef struct _EventID EventID; + +#define TYPE_EVENT_ROW (event_row_get_type ()) +#define EVENT_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_EVENT_ROW, EventRow)) +#define EVENT_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_EVENT_ROW, EventRowClass)) +#define IS_EVENT_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_EVENT_ROW)) +#define IS_EVENT_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_EVENT_ROW)) +#define EVENT_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_EVENT_ROW, EventRowClass)) + +typedef struct _EventRow EventRow; +typedef struct _EventRowClass EventRowClass; +typedef struct _EventRowPrivate EventRowPrivate; +#define _g_free0(var) (var = (g_free (var), NULL)) +typedef struct _ParamSpecEventRow ParamSpecEventRow; + +#define TYPE_DATABASE_TABLE (database_table_get_type ()) +#define DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATABASE_TABLE, DatabaseTable)) +#define DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATABASE_TABLE, DatabaseTableClass)) +#define IS_DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATABASE_TABLE)) +#define IS_DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATABASE_TABLE)) +#define DATABASE_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATABASE_TABLE, DatabaseTableClass)) + +typedef struct _DatabaseTable DatabaseTable; +typedef struct _DatabaseTableClass DatabaseTableClass; +typedef struct _DatabaseTablePrivate DatabaseTablePrivate; + +#define TYPE_EVENT_TABLE (event_table_get_type ()) +#define EVENT_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_EVENT_TABLE, EventTable)) +#define EVENT_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_EVENT_TABLE, EventTableClass)) +#define IS_EVENT_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_EVENT_TABLE)) +#define IS_EVENT_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_EVENT_TABLE)) +#define EVENT_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_EVENT_TABLE, EventTableClass)) + +typedef struct _EventTable EventTable; +typedef struct _EventTableClass EventTableClass; +typedef struct _EventTablePrivate EventTablePrivate; +#define _sqlite3_finalize0(var) ((var == NULL) ? NULL : (var = (sqlite3_finalize (var), NULL))) +#define _database_table_unref0(var) ((var == NULL) ? NULL : (var = (database_table_unref (var), NULL))) + +#define TYPE_MEDIA_COLLECTION_REGISTRY (media_collection_registry_get_type ()) +#define MEDIA_COLLECTION_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MEDIA_COLLECTION_REGISTRY, MediaCollectionRegistry)) +#define MEDIA_COLLECTION_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MEDIA_COLLECTION_REGISTRY, MediaCollectionRegistryClass)) +#define IS_MEDIA_COLLECTION_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MEDIA_COLLECTION_REGISTRY)) +#define IS_MEDIA_COLLECTION_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MEDIA_COLLECTION_REGISTRY)) +#define MEDIA_COLLECTION_REGISTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MEDIA_COLLECTION_REGISTRY, MediaCollectionRegistryClass)) + +typedef struct _MediaCollectionRegistry MediaCollectionRegistry; +typedef struct _MediaCollectionRegistryClass MediaCollectionRegistryClass; +#define _media_collection_registry_unref0(var) ((var == NULL) ? NULL : (var = (media_collection_registry_unref (var), NULL))) + +#define TYPE_PHOTO_ID (photo_id_get_type ()) +typedef struct _PhotoID PhotoID; +#define _event_row_unref0(var) ((var == NULL) ? NULL : (var = (event_row_unref (var), NULL))) +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); +#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } +#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } +#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _EventID { + gint64 id; +}; + +struct _EventRow { + GTypeInstance parent_instance; + volatile int ref_count; + EventRowPrivate * priv; + EventID event_id; + gchar* name; + time_t time_created; + gchar* primary_source_id; + gchar* comment; +}; + +struct _EventRowClass { + GTypeClass parent_class; + void (*finalize) (EventRow *self); +}; + +struct _ParamSpecEventRow { + GParamSpec parent_instance; +}; + +struct _DatabaseTable { + GTypeInstance parent_instance; + volatile int ref_count; + DatabaseTablePrivate * priv; + gchar* table_name; +}; + +struct _DatabaseTableClass { + GTypeClass parent_class; + void (*finalize) (DatabaseTable *self); +}; + +struct _EventTable { + DatabaseTable parent_instance; + EventTablePrivate * priv; +}; + +struct _EventTableClass { + DatabaseTableClass parent_class; +}; + +struct _PhotoID { + gint64 id; +}; + +typedef enum { + DATABASE_ERROR_ERROR, + DATABASE_ERROR_BACKING, + DATABASE_ERROR_MEMORY, + DATABASE_ERROR_ABORT, + DATABASE_ERROR_LIMITS, + DATABASE_ERROR_TYPESPEC +} DatabaseError; +#define DATABASE_ERROR database_error_quark () + +static gpointer event_row_parent_class = NULL; +static gpointer event_table_parent_class = NULL; +static EventTable* event_table_instance; +static EventTable* event_table_instance = NULL; +extern sqlite3* database_table_db; + +GType event_id_get_type (void) G_GNUC_CONST; +EventID* event_id_dup (const EventID* self); +void event_id_free (EventID* self); +#define EVENT_ID_INVALID ((gint64) -1) +void event_id_init (EventID *self, gint64 id); +gboolean event_id_is_invalid (EventID *self); +gboolean event_id_is_valid (EventID *self); +gpointer event_row_ref (gpointer instance); +void event_row_unref (gpointer instance); +GParamSpec* param_spec_event_row (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_event_row (GValue* value, gpointer v_object); +void value_take_event_row (GValue* value, gpointer v_object); +gpointer value_get_event_row (const GValue* value); +GType event_row_get_type (void) G_GNUC_CONST; +enum { + EVENT_ROW_DUMMY_PROPERTY +}; +EventRow* event_row_new (void); +EventRow* event_row_construct (GType object_type); +static void event_row_finalize (EventRow* obj); +gpointer database_table_ref (gpointer instance); +void database_table_unref (gpointer instance); +GParamSpec* param_spec_database_table (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_database_table (GValue* value, gpointer v_object); +void value_take_database_table (GValue* value, gpointer v_object); +gpointer value_get_database_table (const GValue* value); +GType database_table_get_type (void) G_GNUC_CONST; +GType event_table_get_type (void) G_GNUC_CONST; +enum { + EVENT_TABLE_DUMMY_PROPERTY +}; +static EventTable* event_table_new (void); +static EventTable* event_table_construct (GType object_type); +DatabaseTable* database_table_construct (GType object_type); +void database_table_fatal (const gchar* op, gint res); +void database_table_set_table_name (DatabaseTable* self, const gchar* table_name); +EventTable* event_table_get_instance (void); +static gchar* event_table_source_id_upgrade (EventTable* self, gint64 primary_photo_id, const gchar* primary_source_id); +gpointer media_collection_registry_ref (gpointer instance); +void media_collection_registry_unref (gpointer instance); +GParamSpec* param_spec_media_collection_registry (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_media_collection_registry (GValue* value, gpointer v_object); +void value_take_media_collection_registry (GValue* value, gpointer v_object); +gpointer value_get_media_collection_registry (const GValue* value); +GType media_collection_registry_get_type (void) G_GNUC_CONST; +MediaCollectionRegistry* media_collection_registry_get_instance (void); +gboolean media_collection_registry_is_valid_source_id (MediaCollectionRegistry* self, const gchar* source_id); +#define PHOTO_ID_INVALID ((gint64) -1) +GType photo_id_get_type (void) G_GNUC_CONST; +PhotoID* photo_id_dup (const PhotoID* self); +void photo_id_free (PhotoID* self); +gchar* photo_id_upgrade_photo_id_to_source_id (PhotoID* photo_id); +void photo_id_init (PhotoID *self, gint64 id); +GQuark database_error_quark (void); +EventRow* event_table_create (EventTable* self, const gchar* primary_source_id, const gchar* comment, GError** error); +gulong now_sec (void); +void database_table_throw_error (const gchar* method, gint res, GError** error); +void event_table_create_from_row (EventTable* self, EventRow* row, EventID* result); +EventRow* event_table_get_row (EventTable* self, EventID* event_id); +void event_table_remove (EventTable* self, EventID* event_id, GError** error); +void database_table_delete_by_id (DatabaseTable* self, gint64 id, GError** error); +GeeArrayList* event_table_get_events (EventTable* self); +gboolean event_table_rename (EventTable* self, EventID* event_id, const gchar* name); +gboolean database_table_update_text_by_id (DatabaseTable* self, gint64 id, const gchar* column, const gchar* text); +gchar* event_table_get_name (EventTable* self, EventID* event_id); +gboolean database_table_select_by_id (DatabaseTable* self, gint64 id, const gchar* columns, sqlite3_stmt** stmt); +gchar* event_table_get_primary_source_id (EventTable* self, EventID* event_id); +gboolean event_table_set_primary_source_id (EventTable* self, EventID* event_id, const gchar* primary_source_id); +time_t event_table_get_time_created (EventTable* self, EventID* event_id); +gboolean event_table_set_comment (EventTable* self, EventID* event_id, const gchar* new_comment); +static void event_table_finalize (DatabaseTable* obj); + + +void event_id_init (EventID *self, gint64 id) { + gint64 _tmp0_ = 0LL; +#line 12 "/home/jens/Source/shotwell/src/db/EventTable.vala" + memset (self, 0, sizeof (EventID)); +#line 13 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = id; +#line 13 "/home/jens/Source/shotwell/src/db/EventTable.vala" + (*self).id = _tmp0_; +#line 227 "EventTable.c" +} + + +gboolean event_id_is_invalid (EventID *self) { + gboolean result = FALSE; + gint64 _tmp0_ = 0LL; +#line 17 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = (*self).id; +#line 17 "/home/jens/Source/shotwell/src/db/EventTable.vala" + result = _tmp0_ == EVENT_ID_INVALID; +#line 17 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return result; +#line 240 "EventTable.c" +} + + +gboolean event_id_is_valid (EventID *self) { + gboolean result = FALSE; + gint64 _tmp0_ = 0LL; +#line 21 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = (*self).id; +#line 21 "/home/jens/Source/shotwell/src/db/EventTable.vala" + result = _tmp0_ != EVENT_ID_INVALID; +#line 21 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return result; +#line 253 "EventTable.c" +} + + +EventID* event_id_dup (const EventID* self) { + EventID* dup; +#line 7 "/home/jens/Source/shotwell/src/db/EventTable.vala" + dup = g_new0 (EventID, 1); +#line 7 "/home/jens/Source/shotwell/src/db/EventTable.vala" + memcpy (dup, self, sizeof (EventID)); +#line 7 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return dup; +#line 265 "EventTable.c" +} + + +void event_id_free (EventID* self) { +#line 7 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_free (self); +#line 272 "EventTable.c" +} + + +GType event_id_get_type (void) { + static volatile gsize event_id_type_id__volatile = 0; + if (g_once_init_enter (&event_id_type_id__volatile)) { + GType event_id_type_id; + event_id_type_id = g_boxed_type_register_static ("EventID", (GBoxedCopyFunc) event_id_dup, (GBoxedFreeFunc) event_id_free); + g_once_init_leave (&event_id_type_id__volatile, event_id_type_id); + } + return event_id_type_id__volatile; +} + + +EventRow* event_row_construct (GType object_type) { + EventRow* self = NULL; +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + self = (EventRow*) g_type_create_instance (object_type); +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return self; +#line 293 "EventTable.c" +} + + +EventRow* event_row_new (void) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return event_row_construct (TYPE_EVENT_ROW); +#line 300 "EventTable.c" +} + + +static void value_event_row_init (GValue* value) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + value->data[0].v_pointer = NULL; +#line 307 "EventTable.c" +} + + +static void value_event_row_free_value (GValue* value) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (value->data[0].v_pointer) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + event_row_unref (value->data[0].v_pointer); +#line 316 "EventTable.c" + } +} + + +static void value_event_row_copy_value (const GValue* src_value, GValue* dest_value) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (src_value->data[0].v_pointer) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + dest_value->data[0].v_pointer = event_row_ref (src_value->data[0].v_pointer); +#line 326 "EventTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + dest_value->data[0].v_pointer = NULL; +#line 330 "EventTable.c" + } +} + + +static gpointer value_event_row_peek_pointer (const GValue* value) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return value->data[0].v_pointer; +#line 338 "EventTable.c" +} + + +static gchar* value_event_row_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (collect_values[0].v_pointer) { +#line 345 "EventTable.c" + EventRow* object; + object = collect_values[0].v_pointer; +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (object->parent_instance.g_class == NULL) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); +#line 352 "EventTable.c" + } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); +#line 356 "EventTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + value->data[0].v_pointer = event_row_ref (object); +#line 360 "EventTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + value->data[0].v_pointer = NULL; +#line 364 "EventTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return NULL; +#line 368 "EventTable.c" +} + + +static gchar* value_event_row_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + EventRow** object_p; + object_p = collect_values[0].v_pointer; +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (!object_p) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); +#line 379 "EventTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (!value->data[0].v_pointer) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + *object_p = NULL; +#line 385 "EventTable.c" + } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + *object_p = value->data[0].v_pointer; +#line 389 "EventTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + *object_p = event_row_ref (value->data[0].v_pointer); +#line 393 "EventTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return NULL; +#line 397 "EventTable.c" +} + + +GParamSpec* param_spec_event_row (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { + ParamSpecEventRow* spec; +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (g_type_is_a (object_type, TYPE_EVENT_ROW), NULL); +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + G_PARAM_SPEC (spec)->value_type = object_type; +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return G_PARAM_SPEC (spec); +#line 411 "EventTable.c" +} + + +gpointer value_get_event_row (const GValue* value) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_EVENT_ROW), NULL); +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return value->data[0].v_pointer; +#line 420 "EventTable.c" +} + + +void value_set_event_row (GValue* value, gpointer v_object) { + EventRow* old; +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_EVENT_ROW)); +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + old = value->data[0].v_pointer; +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (v_object) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_EVENT_ROW)); +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + value->data[0].v_pointer = v_object; +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + event_row_ref (value->data[0].v_pointer); +#line 440 "EventTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + value->data[0].v_pointer = NULL; +#line 444 "EventTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (old) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + event_row_unref (old); +#line 450 "EventTable.c" + } +} + + +void value_take_event_row (GValue* value, gpointer v_object) { + EventRow* old; +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_EVENT_ROW)); +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + old = value->data[0].v_pointer; +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (v_object) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_EVENT_ROW)); +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + value->data[0].v_pointer = v_object; +#line 469 "EventTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + value->data[0].v_pointer = NULL; +#line 473 "EventTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (old) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + event_row_unref (old); +#line 479 "EventTable.c" + } +} + + +static void event_row_class_init (EventRowClass * klass) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + event_row_parent_class = g_type_class_peek_parent (klass); +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + ((EventRowClass *) klass)->finalize = event_row_finalize; +#line 489 "EventTable.c" +} + + +static void event_row_instance_init (EventRow * self) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + self->ref_count = 1; +#line 496 "EventTable.c" +} + + +static void event_row_finalize (EventRow* obj) { + EventRow * self; +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_EVENT_ROW, EventRow); +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_signal_handlers_destroy (self); +#line 27 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _g_free0 (self->name); +#line 29 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _g_free0 (self->primary_source_id); +#line 30 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _g_free0 (self->comment); +#line 512 "EventTable.c" +} + + +GType event_row_get_type (void) { + static volatile gsize event_row_type_id__volatile = 0; + if (g_once_init_enter (&event_row_type_id__volatile)) { + static const GTypeValueTable g_define_type_value_table = { value_event_row_init, value_event_row_free_value, value_event_row_copy_value, value_event_row_peek_pointer, "p", value_event_row_collect_value, "p", value_event_row_lcopy_value }; + static const GTypeInfo g_define_type_info = { sizeof (EventRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) event_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EventRow), 0, (GInstanceInitFunc) event_row_instance_init, &g_define_type_value_table }; + static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; + GType event_row_type_id; + event_row_type_id = g_type_register_fundamental (g_type_fundamental_next (), "EventRow", &g_define_type_info, &g_define_type_fundamental_info, 0); + g_once_init_leave (&event_row_type_id__volatile, event_row_type_id); + } + return event_row_type_id__volatile; +} + + +gpointer event_row_ref (gpointer instance) { + EventRow* self; + self = instance; +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_atomic_int_inc (&self->ref_count); +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return instance; +#line 537 "EventTable.c" +} + + +void event_row_unref (gpointer instance) { + EventRow* self; + self = instance; +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (g_atomic_int_dec_and_test (&self->ref_count)) { +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + EVENT_ROW_GET_CLASS (self)->finalize (self); +#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_type_free_instance ((GTypeInstance *) self); +#line 550 "EventTable.c" + } +} + + +static EventTable* event_table_construct (GType object_type) { + EventTable* self = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; +#line 36 "/home/jens/Source/shotwell/src/db/EventTable.vala" + self = (EventTable*) database_table_construct (object_type); +#line 38 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = database_table_db; +#line 38 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "CREATE TABLE IF NOT EXISTS EventTable (" "id INTEGER PRIMARY KEY, " "name TEXT, " "primary_photo_id INTEGER, " "time_created INTEGER," "primary_source_id TEXT," "comment TEXT" ")", -1, &_tmp1_, NULL); +#line 38 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 38 "/home/jens/Source/shotwell/src/db/EventTable.vala" + stmt = _tmp1_; +#line 38 "/home/jens/Source/shotwell/src/db/EventTable.vala" + res = _tmp2_; +#line 46 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp3_ = res; +#line 46 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 48 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp4_ = stmt; +#line 48 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp5_ = sqlite3_step (_tmp4_); +#line 48 "/home/jens/Source/shotwell/src/db/EventTable.vala" + res = _tmp5_; +#line 49 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp6_ = res; +#line 49 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (_tmp6_ != SQLITE_DONE) { +#line 592 "EventTable.c" + gint _tmp7_ = 0; +#line 50 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp7_ = res; +#line 50 "/home/jens/Source/shotwell/src/db/EventTable.vala" + database_table_fatal ("create photo table", _tmp7_); +#line 598 "EventTable.c" + } +#line 52 "/home/jens/Source/shotwell/src/db/EventTable.vala" + database_table_set_table_name (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), "EventTable"); +#line 36 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 36 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return self; +#line 606 "EventTable.c" +} + + +static EventTable* event_table_new (void) { +#line 36 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return event_table_construct (TYPE_EVENT_TABLE); +#line 613 "EventTable.c" +} + + +static gpointer _database_table_ref0 (gpointer self) { +#line 59 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return self ? database_table_ref (self) : NULL; +#line 620 "EventTable.c" +} + + +EventTable* event_table_get_instance (void) { + EventTable* result = NULL; + EventTable* _tmp0_ = NULL; + EventTable* _tmp2_ = NULL; + EventTable* _tmp3_ = NULL; +#line 56 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = event_table_instance; +#line 56 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (_tmp0_ == NULL) { +#line 633 "EventTable.c" + EventTable* _tmp1_ = NULL; +#line 57 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp1_ = event_table_new (); +#line 57 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _database_table_unref0 (event_table_instance); +#line 57 "/home/jens/Source/shotwell/src/db/EventTable.vala" + event_table_instance = _tmp1_; +#line 641 "EventTable.c" + } +#line 59 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp2_ = event_table_instance; +#line 59 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp3_ = _database_table_ref0 (_tmp2_); +#line 59 "/home/jens/Source/shotwell/src/db/EventTable.vala" + result = _tmp3_; +#line 59 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return result; +#line 651 "EventTable.c" +} + + +static gchar* event_table_source_id_upgrade (EventTable* self, gint64 primary_photo_id, const gchar* primary_source_id) { + gchar* result = NULL; + MediaCollectionRegistry* _tmp0_ = NULL; + MediaCollectionRegistry* _tmp1_ = NULL; + const gchar* _tmp2_ = NULL; + gboolean _tmp3_ = FALSE; + gboolean _tmp4_ = FALSE; + gint64 _tmp7_ = 0LL; +#line 63 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (IS_EVENT_TABLE (self), NULL); +#line 64 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = media_collection_registry_get_instance (); +#line 64 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp1_ = _tmp0_; +#line 64 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp2_ = primary_source_id; +#line 64 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp3_ = media_collection_registry_is_valid_source_id (_tmp1_, _tmp2_); +#line 64 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp4_ = _tmp3_; +#line 64 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _media_collection_registry_unref0 (_tmp1_); +#line 64 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (_tmp4_) { +#line 679 "EventTable.c" + const gchar* _tmp5_ = NULL; + gchar* _tmp6_ = NULL; +#line 65 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp5_ = primary_source_id; +#line 65 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp6_ = g_strdup (_tmp5_); +#line 65 "/home/jens/Source/shotwell/src/db/EventTable.vala" + result = _tmp6_; +#line 65 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return result; +#line 690 "EventTable.c" + } +#line 67 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp7_ = primary_photo_id; +#line 67 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (_tmp7_ != PHOTO_ID_INVALID) { +#line 696 "EventTable.c" + gint64 _tmp8_ = 0LL; + PhotoID _tmp9_ = {0}; + gchar* _tmp10_ = NULL; +#line 69 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp8_ = primary_photo_id; +#line 69 "/home/jens/Source/shotwell/src/db/EventTable.vala" + photo_id_init (&_tmp9_, _tmp8_); +#line 69 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp10_ = photo_id_upgrade_photo_id_to_source_id (&_tmp9_); +#line 69 "/home/jens/Source/shotwell/src/db/EventTable.vala" + result = _tmp10_; +#line 69 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return result; +#line 710 "EventTable.c" + } +#line 71 "/home/jens/Source/shotwell/src/db/EventTable.vala" + result = NULL; +#line 71 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return result; +#line 716 "EventTable.c" +} + + +EventRow* event_table_create (EventTable* self, const gchar* primary_source_id, const gchar* comment, GError** error) { + EventRow* result = NULL; + gboolean _tmp0_ = FALSE; + const gchar* _tmp1_ = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp3_ = NULL; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + time_t time_created = 0; + gulong _tmp7_ = 0UL; + sqlite3_stmt* _tmp8_ = NULL; + const gchar* _tmp9_ = NULL; + gchar* _tmp10_ = NULL; + GDestroyNotify _tmp11_ = NULL; + gint _tmp12_ = 0; + gint _tmp13_ = 0; + sqlite3_stmt* _tmp14_ = NULL; + time_t _tmp15_ = 0; + gint _tmp16_ = 0; + gint _tmp17_ = 0; + sqlite3_stmt* _tmp18_ = NULL; + const gchar* _tmp19_ = NULL; + gchar* _tmp20_ = NULL; + GDestroyNotify _tmp21_ = NULL; + gint _tmp22_ = 0; + gint _tmp23_ = 0; + sqlite3_stmt* _tmp24_ = NULL; + gint _tmp25_ = 0; + gint _tmp26_ = 0; + EventRow* row = NULL; + EventRow* _tmp28_ = NULL; + EventRow* _tmp29_ = NULL; + sqlite3* _tmp30_ = NULL; + gint64 _tmp31_ = 0LL; + EventRow* _tmp32_ = NULL; + EventRow* _tmp33_ = NULL; + const gchar* _tmp34_ = NULL; + gchar* _tmp35_ = NULL; + EventRow* _tmp36_ = NULL; + time_t _tmp37_ = 0; + EventRow* _tmp38_ = NULL; + const gchar* _tmp39_ = NULL; + gchar* _tmp40_ = NULL; + GError * _inner_error_ = NULL; +#line 74 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (IS_EVENT_TABLE (self), NULL); +#line 75 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp1_ = primary_source_id; +#line 75 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (_tmp1_ != NULL) { +#line 772 "EventTable.c" + const gchar* _tmp2_ = NULL; +#line 75 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp2_ = primary_source_id; +#line 75 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = g_strcmp0 (_tmp2_, "") != 0; +#line 778 "EventTable.c" + } else { +#line 75 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = FALSE; +#line 782 "EventTable.c" + } +#line 75 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _vala_assert (_tmp0_, "primary_source_id != null && primary_source_id != \"\""); +#line 78 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp3_ = database_table_db; +#line 78 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp5_ = sqlite3_prepare_v2 (_tmp3_, "INSERT INTO EventTable (primary_source_id, time_created, comment) VALU" \ +"ES (?, ?, ?)", -1, &_tmp4_, NULL); +#line 78 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 78 "/home/jens/Source/shotwell/src/db/EventTable.vala" + stmt = _tmp4_; +#line 78 "/home/jens/Source/shotwell/src/db/EventTable.vala" + res = _tmp5_; +#line 81 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp6_ = res; +#line 81 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _vala_assert (_tmp6_ == SQLITE_OK, "res == Sqlite.OK"); +#line 83 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp7_ = now_sec (); +#line 83 "/home/jens/Source/shotwell/src/db/EventTable.vala" + time_created = (time_t) _tmp7_; +#line 85 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp8_ = stmt; +#line 85 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp9_ = primary_source_id; +#line 85 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp10_ = g_strdup (_tmp9_); +#line 85 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp11_ = g_free; +#line 85 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp12_ = sqlite3_bind_text (_tmp8_, 1, _tmp10_, -1, _tmp11_); +#line 85 "/home/jens/Source/shotwell/src/db/EventTable.vala" + res = _tmp12_; +#line 86 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp13_ = res; +#line 86 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _vala_assert (_tmp13_ == SQLITE_OK, "res == Sqlite.OK"); +#line 87 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp14_ = stmt; +#line 87 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp15_ = time_created; +#line 87 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp16_ = sqlite3_bind_int64 (_tmp14_, 2, (gint64) _tmp15_); +#line 87 "/home/jens/Source/shotwell/src/db/EventTable.vala" + res = _tmp16_; +#line 88 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp17_ = res; +#line 88 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _vala_assert (_tmp17_ == SQLITE_OK, "res == Sqlite.OK"); +#line 89 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp18_ = stmt; +#line 89 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp19_ = comment; +#line 89 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp20_ = g_strdup (_tmp19_); +#line 89 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp21_ = g_free; +#line 89 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp22_ = sqlite3_bind_text (_tmp18_, 3, _tmp20_, -1, _tmp21_); +#line 89 "/home/jens/Source/shotwell/src/db/EventTable.vala" + res = _tmp22_; +#line 90 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp23_ = res; +#line 90 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _vala_assert (_tmp23_ == SQLITE_OK, "res == Sqlite.OK"); +#line 92 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp24_ = stmt; +#line 92 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp25_ = sqlite3_step (_tmp24_); +#line 92 "/home/jens/Source/shotwell/src/db/EventTable.vala" + res = _tmp25_; +#line 93 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp26_ = res; +#line 93 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (_tmp26_ != SQLITE_DONE) { +#line 858 "EventTable.c" + gint _tmp27_ = 0; +#line 94 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp27_ = res; +#line 94 "/home/jens/Source/shotwell/src/db/EventTable.vala" + database_table_throw_error ("EventTable.create", _tmp27_, &_inner_error_); +#line 94 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 94 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 94 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_propagate_error (error, _inner_error_); +#line 94 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 94 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return NULL; +#line 874 "EventTable.c" + } else { +#line 94 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 94 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 94 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_clear_error (&_inner_error_); +#line 94 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return NULL; +#line 884 "EventTable.c" + } + } + } +#line 96 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp28_ = event_row_new (); +#line 96 "/home/jens/Source/shotwell/src/db/EventTable.vala" + row = _tmp28_; +#line 97 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp29_ = row; +#line 97 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp30_ = database_table_db; +#line 97 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp31_ = sqlite3_last_insert_rowid (_tmp30_); +#line 97 "/home/jens/Source/shotwell/src/db/EventTable.vala" + event_id_init (&_tmp29_->event_id, _tmp31_); +#line 98 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp32_ = row; +#line 98 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _g_free0 (_tmp32_->name); +#line 98 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp32_->name = NULL; +#line 99 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp33_ = row; +#line 99 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp34_ = primary_source_id; +#line 99 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp35_ = g_strdup (_tmp34_); +#line 99 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _g_free0 (_tmp33_->primary_source_id); +#line 99 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp33_->primary_source_id = _tmp35_; +#line 100 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp36_ = row; +#line 100 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp37_ = time_created; +#line 100 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp36_->time_created = _tmp37_; +#line 101 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp38_ = row; +#line 101 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp39_ = comment; +#line 101 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp40_ = g_strdup (_tmp39_); +#line 101 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _g_free0 (_tmp38_->comment); +#line 101 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp38_->comment = _tmp40_; +#line 103 "/home/jens/Source/shotwell/src/db/EventTable.vala" + result = row; +#line 103 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 103 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return result; +#line 938 "EventTable.c" +} + + +void event_table_create_from_row (EventTable* self, EventRow* row, EventID* result) { + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + EventRow* _tmp5_ = NULL; + const gchar* _tmp6_ = NULL; + gchar* _tmp7_ = NULL; + GDestroyNotify _tmp8_ = NULL; + gint _tmp9_ = 0; + gint _tmp10_ = 0; + sqlite3_stmt* _tmp11_ = NULL; + gint _tmp12_ = 0; + gint _tmp13_ = 0; + sqlite3_stmt* _tmp14_ = NULL; + EventRow* _tmp15_ = NULL; + const gchar* _tmp16_ = NULL; + gchar* _tmp17_ = NULL; + GDestroyNotify _tmp18_ = NULL; + gint _tmp19_ = 0; + gint _tmp20_ = 0; + sqlite3_stmt* _tmp21_ = NULL; + EventRow* _tmp22_ = NULL; + time_t _tmp23_ = 0; + gint _tmp24_ = 0; + gint _tmp25_ = 0; + sqlite3_stmt* _tmp26_ = NULL; + EventRow* _tmp27_ = NULL; + const gchar* _tmp28_ = NULL; + gchar* _tmp29_ = NULL; + GDestroyNotify _tmp30_ = NULL; + gint _tmp31_ = 0; + gint _tmp32_ = 0; + sqlite3_stmt* _tmp33_ = NULL; + gint _tmp34_ = 0; + gint _tmp35_ = 0; + sqlite3* _tmp38_ = NULL; + gint64 _tmp39_ = 0LL; + EventID _tmp40_ = {0}; +#line 109 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_if_fail (IS_EVENT_TABLE (self)); +#line 109 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_if_fail (IS_EVENT_ROW (row)); +#line 111 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = database_table_db; +#line 111 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "INSERT INTO EventTable (name, primary_photo_id, primary_source_id, tim" \ +"e_created, comment) VALUES (?, ?, ?, ?, ?)", -1, &_tmp1_, NULL); +#line 111 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 111 "/home/jens/Source/shotwell/src/db/EventTable.vala" + stmt = _tmp1_; +#line 111 "/home/jens/Source/shotwell/src/db/EventTable.vala" + res = _tmp2_; +#line 113 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp3_ = res; +#line 113 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 115 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp4_ = stmt; +#line 115 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp5_ = row; +#line 115 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp6_ = _tmp5_->name; +#line 115 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp7_ = g_strdup (_tmp6_); +#line 115 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp8_ = g_free; +#line 115 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp9_ = sqlite3_bind_text (_tmp4_, 1, _tmp7_, -1, _tmp8_); +#line 115 "/home/jens/Source/shotwell/src/db/EventTable.vala" + res = _tmp9_; +#line 116 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp10_ = res; +#line 116 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _vala_assert (_tmp10_ == SQLITE_OK, "res == Sqlite.OK"); +#line 117 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp11_ = stmt; +#line 117 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp12_ = sqlite3_bind_int64 (_tmp11_, 2, PHOTO_ID_INVALID); +#line 117 "/home/jens/Source/shotwell/src/db/EventTable.vala" + res = _tmp12_; +#line 118 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp13_ = res; +#line 118 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _vala_assert (_tmp13_ == SQLITE_OK, "res == Sqlite.OK"); +#line 119 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp14_ = stmt; +#line 119 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp15_ = row; +#line 119 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp16_ = _tmp15_->primary_source_id; +#line 119 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp17_ = g_strdup (_tmp16_); +#line 119 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp18_ = g_free; +#line 119 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp19_ = sqlite3_bind_text (_tmp14_, 3, _tmp17_, -1, _tmp18_); +#line 119 "/home/jens/Source/shotwell/src/db/EventTable.vala" + res = _tmp19_; +#line 120 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp20_ = res; +#line 120 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _vala_assert (_tmp20_ == SQLITE_OK, "res == Sqlite.OK"); +#line 121 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp21_ = stmt; +#line 121 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp22_ = row; +#line 121 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp23_ = _tmp22_->time_created; +#line 121 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp24_ = sqlite3_bind_int64 (_tmp21_, 4, (gint64) _tmp23_); +#line 121 "/home/jens/Source/shotwell/src/db/EventTable.vala" + res = _tmp24_; +#line 122 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp25_ = res; +#line 122 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _vala_assert (_tmp25_ == SQLITE_OK, "res == Sqlite.OK"); +#line 123 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp26_ = stmt; +#line 123 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp27_ = row; +#line 123 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp28_ = _tmp27_->comment; +#line 123 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp29_ = g_strdup (_tmp28_); +#line 123 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp30_ = g_free; +#line 123 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp31_ = sqlite3_bind_text (_tmp26_, 5, _tmp29_, -1, _tmp30_); +#line 123 "/home/jens/Source/shotwell/src/db/EventTable.vala" + res = _tmp31_; +#line 124 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp32_ = res; +#line 124 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _vala_assert (_tmp32_ == SQLITE_OK, "res == Sqlite.OK"); +#line 126 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp33_ = stmt; +#line 126 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp34_ = sqlite3_step (_tmp33_); +#line 126 "/home/jens/Source/shotwell/src/db/EventTable.vala" + res = _tmp34_; +#line 127 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp35_ = res; +#line 127 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (_tmp35_ != SQLITE_DONE) { +#line 1090 "EventTable.c" + gint _tmp36_ = 0; + EventID _tmp37_ = {0}; +#line 128 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp36_ = res; +#line 128 "/home/jens/Source/shotwell/src/db/EventTable.vala" + database_table_fatal ("Event create_from_row", _tmp36_); +#line 130 "/home/jens/Source/shotwell/src/db/EventTable.vala" + event_id_init (&_tmp37_, EVENT_ID_INVALID); +#line 130 "/home/jens/Source/shotwell/src/db/EventTable.vala" + *result = _tmp37_; +#line 130 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 130 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return; +#line 1105 "EventTable.c" + } +#line 133 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp38_ = database_table_db; +#line 133 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp39_ = sqlite3_last_insert_rowid (_tmp38_); +#line 133 "/home/jens/Source/shotwell/src/db/EventTable.vala" + event_id_init (&_tmp40_, _tmp39_); +#line 133 "/home/jens/Source/shotwell/src/db/EventTable.vala" + *result = _tmp40_; +#line 133 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 133 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return; +#line 1119 "EventTable.c" +} + + +EventRow* event_table_get_row (EventTable* self, EventID* event_id) { + EventRow* result = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + EventID _tmp5_ = {0}; + gint64 _tmp6_ = 0LL; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + sqlite3_stmt* _tmp9_ = NULL; + gint _tmp10_ = 0; + EventRow* row = NULL; + EventRow* _tmp11_ = NULL; + EventRow* _tmp12_ = NULL; + EventID _tmp13_ = {0}; + EventRow* _tmp14_ = NULL; + sqlite3_stmt* _tmp15_ = NULL; + const gchar* _tmp16_ = NULL; + gchar* _tmp17_ = NULL; + gboolean _tmp18_ = FALSE; + EventRow* _tmp19_ = NULL; + const gchar* _tmp20_ = NULL; + EventRow* _tmp26_ = NULL; + sqlite3_stmt* _tmp27_ = NULL; + gint64 _tmp28_ = 0LL; + sqlite3_stmt* _tmp29_ = NULL; + const gchar* _tmp30_ = NULL; + gchar* _tmp31_ = NULL; + EventRow* _tmp32_ = NULL; + sqlite3_stmt* _tmp33_ = NULL; + gint64 _tmp34_ = 0LL; + EventRow* _tmp35_ = NULL; + sqlite3_stmt* _tmp36_ = NULL; + const gchar* _tmp37_ = NULL; + gchar* _tmp38_ = NULL; +#line 136 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (IS_EVENT_TABLE (self), NULL); +#line 136 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (event_id != NULL, NULL); +#line 138 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = database_table_db; +#line 138 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "SELECT name, primary_photo_id, primary_source_id, time_created, commen" \ +"t FROM EventTable WHERE id=?", -1, &_tmp1_, NULL); +#line 138 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 138 "/home/jens/Source/shotwell/src/db/EventTable.vala" + stmt = _tmp1_; +#line 138 "/home/jens/Source/shotwell/src/db/EventTable.vala" + res = _tmp2_; +#line 140 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp3_ = res; +#line 140 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 142 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp4_ = stmt; +#line 142 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp5_ = *event_id; +#line 142 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp6_ = _tmp5_.id; +#line 142 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp7_ = sqlite3_bind_int64 (_tmp4_, 1, _tmp6_); +#line 142 "/home/jens/Source/shotwell/src/db/EventTable.vala" + res = _tmp7_; +#line 143 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp8_ = res; +#line 143 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _vala_assert (_tmp8_ == SQLITE_OK, "res == Sqlite.OK"); +#line 145 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp9_ = stmt; +#line 145 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp10_ = sqlite3_step (_tmp9_); +#line 145 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (_tmp10_ != SQLITE_ROW) { +#line 146 "/home/jens/Source/shotwell/src/db/EventTable.vala" + result = NULL; +#line 146 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 146 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return result; +#line 1206 "EventTable.c" + } +#line 148 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp11_ = event_row_new (); +#line 148 "/home/jens/Source/shotwell/src/db/EventTable.vala" + row = _tmp11_; +#line 149 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp12_ = row; +#line 149 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp13_ = *event_id; +#line 149 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp12_->event_id = _tmp13_; +#line 150 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp14_ = row; +#line 150 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp15_ = stmt; +#line 150 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp16_ = sqlite3_column_text (_tmp15_, 0); +#line 150 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp17_ = g_strdup (_tmp16_); +#line 150 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _g_free0 (_tmp14_->name); +#line 150 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp14_->name = _tmp17_; +#line 151 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp19_ = row; +#line 151 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp20_ = _tmp19_->name; +#line 151 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (_tmp20_ != NULL) { +#line 1236 "EventTable.c" + EventRow* _tmp21_ = NULL; + const gchar* _tmp22_ = NULL; + gint _tmp23_ = 0; + gint _tmp24_ = 0; +#line 151 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp21_ = row; +#line 151 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp22_ = _tmp21_->name; +#line 151 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp23_ = strlen (_tmp22_); +#line 151 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp24_ = _tmp23_; +#line 151 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp18_ = _tmp24_ == 0; +#line 1251 "EventTable.c" + } else { +#line 151 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp18_ = FALSE; +#line 1255 "EventTable.c" + } +#line 151 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (_tmp18_) { +#line 1259 "EventTable.c" + EventRow* _tmp25_ = NULL; +#line 152 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp25_ = row; +#line 152 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _g_free0 (_tmp25_->name); +#line 152 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp25_->name = NULL; +#line 1267 "EventTable.c" + } +#line 153 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp26_ = row; +#line 153 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp27_ = stmt; +#line 153 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp28_ = sqlite3_column_int64 (_tmp27_, 1); +#line 153 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp29_ = stmt; +#line 153 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp30_ = sqlite3_column_text (_tmp29_, 2); +#line 153 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp31_ = event_table_source_id_upgrade (self, _tmp28_, _tmp30_); +#line 153 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _g_free0 (_tmp26_->primary_source_id); +#line 153 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp26_->primary_source_id = _tmp31_; +#line 154 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp32_ = row; +#line 154 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp33_ = stmt; +#line 154 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp34_ = sqlite3_column_int64 (_tmp33_, 3); +#line 154 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp32_->time_created = (time_t) _tmp34_; +#line 155 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp35_ = row; +#line 155 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp36_ = stmt; +#line 155 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp37_ = sqlite3_column_text (_tmp36_, 4); +#line 155 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp38_ = g_strdup (_tmp37_); +#line 155 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _g_free0 (_tmp35_->comment); +#line 155 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp35_->comment = _tmp38_; +#line 157 "/home/jens/Source/shotwell/src/db/EventTable.vala" + result = row; +#line 157 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 157 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return result; +#line 1311 "EventTable.c" +} + + +void event_table_remove (EventTable* self, EventID* event_id, GError** error) { + EventID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + GError * _inner_error_ = NULL; +#line 160 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_if_fail (IS_EVENT_TABLE (self)); +#line 160 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_if_fail (event_id != NULL); +#line 161 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = *event_id; +#line 161 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp1_ = _tmp0_.id; +#line 161 "/home/jens/Source/shotwell/src/db/EventTable.vala" + database_table_delete_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, &_inner_error_); +#line 161 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 161 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 161 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_propagate_error (error, _inner_error_); +#line 161 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return; +#line 1337 "EventTable.c" + } else { +#line 161 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 161 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_clear_error (&_inner_error_); +#line 161 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return; +#line 1345 "EventTable.c" + } + } +} + + +GeeArrayList* event_table_get_events (EventTable* self) { + GeeArrayList* result = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + GeeArrayList* event_rows = NULL; + GeeArrayList* _tmp4_ = NULL; +#line 164 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (IS_EVENT_TABLE (self), NULL); +#line 166 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = database_table_db; +#line 166 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "SELECT id, name, primary_photo_id, primary_source_id, time_created, co" \ +"mment FROM EventTable", -1, &_tmp1_, NULL); +#line 166 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 166 "/home/jens/Source/shotwell/src/db/EventTable.vala" + stmt = _tmp1_; +#line 166 "/home/jens/Source/shotwell/src/db/EventTable.vala" + res = _tmp2_; +#line 168 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp3_ = res; +#line 168 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 170 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp4_ = gee_array_list_new (TYPE_EVENT_ROW, (GBoxedCopyFunc) event_row_ref, event_row_unref, NULL, NULL, NULL); +#line 170 "/home/jens/Source/shotwell/src/db/EventTable.vala" + event_rows = _tmp4_; +#line 1381 "EventTable.c" + { + gboolean _tmp5_ = FALSE; +#line 171 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp5_ = TRUE; +#line 171 "/home/jens/Source/shotwell/src/db/EventTable.vala" + while (TRUE) { +#line 1388 "EventTable.c" + sqlite3_stmt* _tmp6_ = NULL; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + EventRow* row = NULL; + EventRow* _tmp11_ = NULL; + EventRow* _tmp12_ = NULL; + sqlite3_stmt* _tmp13_ = NULL; + gint64 _tmp14_ = 0LL; + EventRow* _tmp15_ = NULL; + sqlite3_stmt* _tmp16_ = NULL; + const gchar* _tmp17_ = NULL; + gchar* _tmp18_ = NULL; + EventRow* _tmp19_ = NULL; + sqlite3_stmt* _tmp20_ = NULL; + gint64 _tmp21_ = 0LL; + sqlite3_stmt* _tmp22_ = NULL; + const gchar* _tmp23_ = NULL; + gchar* _tmp24_ = NULL; + EventRow* _tmp25_ = NULL; + sqlite3_stmt* _tmp26_ = NULL; + gint64 _tmp27_ = 0LL; + EventRow* _tmp28_ = NULL; + sqlite3_stmt* _tmp29_ = NULL; + const gchar* _tmp30_ = NULL; + gchar* _tmp31_ = NULL; + GeeArrayList* _tmp32_ = NULL; + EventRow* _tmp33_ = NULL; +#line 171 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (!_tmp5_) { +#line 1418 "EventTable.c" + } +#line 171 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp5_ = FALSE; +#line 172 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp6_ = stmt; +#line 172 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp7_ = sqlite3_step (_tmp6_); +#line 172 "/home/jens/Source/shotwell/src/db/EventTable.vala" + res = _tmp7_; +#line 173 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp8_ = res; +#line 173 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (_tmp8_ == SQLITE_DONE) { +#line 174 "/home/jens/Source/shotwell/src/db/EventTable.vala" + break; +#line 1434 "EventTable.c" + } else { + gint _tmp9_ = 0; +#line 175 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp9_ = res; +#line 175 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (_tmp9_ != SQLITE_ROW) { +#line 1441 "EventTable.c" + gint _tmp10_ = 0; +#line 176 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp10_ = res; +#line 176 "/home/jens/Source/shotwell/src/db/EventTable.vala" + database_table_fatal ("get_events", _tmp10_); +#line 178 "/home/jens/Source/shotwell/src/db/EventTable.vala" + break; +#line 1449 "EventTable.c" + } + } +#line 181 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp11_ = event_row_new (); +#line 181 "/home/jens/Source/shotwell/src/db/EventTable.vala" + row = _tmp11_; +#line 183 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp12_ = row; +#line 183 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp13_ = stmt; +#line 183 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp14_ = sqlite3_column_int64 (_tmp13_, 0); +#line 183 "/home/jens/Source/shotwell/src/db/EventTable.vala" + event_id_init (&_tmp12_->event_id, _tmp14_); +#line 184 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp15_ = row; +#line 184 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp16_ = stmt; +#line 184 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp17_ = sqlite3_column_text (_tmp16_, 1); +#line 184 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp18_ = g_strdup (_tmp17_); +#line 184 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _g_free0 (_tmp15_->name); +#line 184 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp15_->name = _tmp18_; +#line 185 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp19_ = row; +#line 185 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp20_ = stmt; +#line 185 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp21_ = sqlite3_column_int64 (_tmp20_, 2); +#line 185 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp22_ = stmt; +#line 185 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp23_ = sqlite3_column_text (_tmp22_, 3); +#line 185 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp24_ = event_table_source_id_upgrade (self, _tmp21_, _tmp23_); +#line 185 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _g_free0 (_tmp19_->primary_source_id); +#line 185 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp19_->primary_source_id = _tmp24_; +#line 186 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp25_ = row; +#line 186 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp26_ = stmt; +#line 186 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp27_ = sqlite3_column_int64 (_tmp26_, 4); +#line 186 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp25_->time_created = (time_t) _tmp27_; +#line 187 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp28_ = row; +#line 187 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp29_ = stmt; +#line 187 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp30_ = sqlite3_column_text (_tmp29_, 5); +#line 187 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp31_ = g_strdup (_tmp30_); +#line 187 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _g_free0 (_tmp28_->comment); +#line 187 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp28_->comment = _tmp31_; +#line 189 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp32_ = event_rows; +#line 189 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp33_ = row; +#line 189 "/home/jens/Source/shotwell/src/db/EventTable.vala" + gee_abstract_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp32_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), _tmp33_); +#line 171 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _event_row_unref0 (row); +#line 1520 "EventTable.c" + } + } +#line 192 "/home/jens/Source/shotwell/src/db/EventTable.vala" + result = event_rows; +#line 192 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 192 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return result; +#line 1529 "EventTable.c" +} + + +gboolean event_table_rename (EventTable* self, EventID* event_id, const gchar* name) { + gboolean result = FALSE; + const gchar* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + EventID _tmp3_ = {0}; + gint64 _tmp4_ = 0LL; + gboolean _tmp5_ = FALSE; +#line 195 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (IS_EVENT_TABLE (self), FALSE); +#line 195 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (event_id != NULL, FALSE); +#line 196 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp1_ = name; +#line 196 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (_tmp1_ != NULL) { +#line 1548 "EventTable.c" + const gchar* _tmp2_ = NULL; +#line 196 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp2_ = name; +#line 196 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = _tmp2_; +#line 1554 "EventTable.c" + } else { +#line 196 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = ""; +#line 1558 "EventTable.c" + } +#line 196 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp3_ = *event_id; +#line 196 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp4_ = _tmp3_.id; +#line 196 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp5_ = database_table_update_text_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp4_, "name", _tmp0_); +#line 196 "/home/jens/Source/shotwell/src/db/EventTable.vala" + result = _tmp5_; +#line 196 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return result; +#line 1570 "EventTable.c" +} + + +gchar* event_table_get_name (EventTable* self, EventID* event_id) { + gchar* result = NULL; + sqlite3_stmt* stmt = NULL; + EventID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + sqlite3_stmt* _tmp2_ = NULL; + gboolean _tmp3_ = FALSE; + gchar* name = NULL; + sqlite3_stmt* _tmp4_ = NULL; + const gchar* _tmp5_ = NULL; + gchar* _tmp6_ = NULL; + const gchar* _tmp7_ = NULL; + gboolean _tmp8_ = FALSE; + const gchar* _tmp9_ = NULL; + gchar* _tmp14_ = NULL; +#line 199 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (IS_EVENT_TABLE (self), NULL); +#line 199 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (event_id != NULL, NULL); +#line 201 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = *event_id; +#line 201 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp1_ = _tmp0_.id; +#line 201 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp3_ = database_table_select_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "name", &_tmp2_); +#line 201 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 201 "/home/jens/Source/shotwell/src/db/EventTable.vala" + stmt = _tmp2_; +#line 201 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (!_tmp3_) { +#line 202 "/home/jens/Source/shotwell/src/db/EventTable.vala" + result = NULL; +#line 202 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 202 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return result; +#line 1611 "EventTable.c" + } +#line 204 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp4_ = stmt; +#line 204 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp5_ = sqlite3_column_text (_tmp4_, 0); +#line 204 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp6_ = g_strdup (_tmp5_); +#line 204 "/home/jens/Source/shotwell/src/db/EventTable.vala" + name = _tmp6_; +#line 206 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp9_ = name; +#line 206 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (_tmp9_ != NULL) { +#line 1625 "EventTable.c" + const gchar* _tmp10_ = NULL; + gint _tmp11_ = 0; + gint _tmp12_ = 0; +#line 206 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp10_ = name; +#line 206 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp11_ = strlen (_tmp10_); +#line 206 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp12_ = _tmp11_; +#line 206 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp8_ = _tmp12_ > 0; +#line 1637 "EventTable.c" + } else { +#line 206 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp8_ = FALSE; +#line 1641 "EventTable.c" + } +#line 206 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (_tmp8_) { +#line 1645 "EventTable.c" + const gchar* _tmp13_ = NULL; +#line 206 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp13_ = name; +#line 206 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp7_ = _tmp13_; +#line 1651 "EventTable.c" + } else { +#line 206 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp7_ = NULL; +#line 1655 "EventTable.c" + } +#line 206 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp14_ = g_strdup (_tmp7_); +#line 206 "/home/jens/Source/shotwell/src/db/EventTable.vala" + result = _tmp14_; +#line 206 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _g_free0 (name); +#line 206 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 206 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return result; +#line 1667 "EventTable.c" +} + + +gchar* event_table_get_primary_source_id (EventTable* self, EventID* event_id) { + gchar* result = NULL; + sqlite3_stmt* stmt = NULL; + EventID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + sqlite3_stmt* _tmp2_ = NULL; + gboolean _tmp3_ = FALSE; + sqlite3_stmt* _tmp4_ = NULL; + const gchar* _tmp5_ = NULL; + gchar* _tmp6_ = NULL; +#line 209 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (IS_EVENT_TABLE (self), NULL); +#line 209 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (event_id != NULL, NULL); +#line 211 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = *event_id; +#line 211 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp1_ = _tmp0_.id; +#line 211 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp3_ = database_table_select_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "primary_source_id", &_tmp2_); +#line 211 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 211 "/home/jens/Source/shotwell/src/db/EventTable.vala" + stmt = _tmp2_; +#line 211 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (!_tmp3_) { +#line 212 "/home/jens/Source/shotwell/src/db/EventTable.vala" + result = NULL; +#line 212 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 212 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return result; +#line 1703 "EventTable.c" + } +#line 214 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp4_ = stmt; +#line 214 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp5_ = sqlite3_column_text (_tmp4_, 0); +#line 214 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp6_ = g_strdup (_tmp5_); +#line 214 "/home/jens/Source/shotwell/src/db/EventTable.vala" + result = _tmp6_; +#line 214 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 214 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return result; +#line 1717 "EventTable.c" +} + + +gboolean event_table_set_primary_source_id (EventTable* self, EventID* event_id, const gchar* primary_source_id) { + gboolean result = FALSE; + EventID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + const gchar* _tmp2_ = NULL; + gboolean _tmp3_ = FALSE; +#line 217 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (IS_EVENT_TABLE (self), FALSE); +#line 217 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (event_id != NULL, FALSE); +#line 217 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (primary_source_id != NULL, FALSE); +#line 218 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = *event_id; +#line 218 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp1_ = _tmp0_.id; +#line 218 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp2_ = primary_source_id; +#line 218 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp3_ = database_table_update_text_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "primary_source_id", _tmp2_); +#line 218 "/home/jens/Source/shotwell/src/db/EventTable.vala" + result = _tmp3_; +#line 218 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return result; +#line 1745 "EventTable.c" +} + + +time_t event_table_get_time_created (EventTable* self, EventID* event_id) { + time_t result = 0; + sqlite3_stmt* stmt = NULL; + EventID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + sqlite3_stmt* _tmp2_ = NULL; + gboolean _tmp3_ = FALSE; + sqlite3_stmt* _tmp4_ = NULL; + gint64 _tmp5_ = 0LL; +#line 221 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (IS_EVENT_TABLE (self), 0); +#line 221 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (event_id != NULL, 0); +#line 223 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = *event_id; +#line 223 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp1_ = _tmp0_.id; +#line 223 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp3_ = database_table_select_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "time_created", &_tmp2_); +#line 223 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 223 "/home/jens/Source/shotwell/src/db/EventTable.vala" + stmt = _tmp2_; +#line 223 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (!_tmp3_) { +#line 224 "/home/jens/Source/shotwell/src/db/EventTable.vala" + result = (time_t) 0; +#line 224 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 224 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return result; +#line 1780 "EventTable.c" + } +#line 226 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp4_ = stmt; +#line 226 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp5_ = sqlite3_column_int64 (_tmp4_, 0); +#line 226 "/home/jens/Source/shotwell/src/db/EventTable.vala" + result = (time_t) _tmp5_; +#line 226 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _sqlite3_finalize0 (stmt); +#line 226 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return result; +#line 1792 "EventTable.c" +} + + +gboolean event_table_set_comment (EventTable* self, EventID* event_id, const gchar* new_comment) { + gboolean result = FALSE; + const gchar* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + EventID _tmp3_ = {0}; + gint64 _tmp4_ = 0LL; + gboolean _tmp5_ = FALSE; +#line 229 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (IS_EVENT_TABLE (self), FALSE); +#line 229 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (event_id != NULL, FALSE); +#line 229 "/home/jens/Source/shotwell/src/db/EventTable.vala" + g_return_val_if_fail (new_comment != NULL, FALSE); +#line 230 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp1_ = new_comment; +#line 230 "/home/jens/Source/shotwell/src/db/EventTable.vala" + if (_tmp1_ != NULL) { +#line 1813 "EventTable.c" + const gchar* _tmp2_ = NULL; +#line 230 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp2_ = new_comment; +#line 230 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = _tmp2_; +#line 1819 "EventTable.c" + } else { +#line 230 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp0_ = ""; +#line 1823 "EventTable.c" + } +#line 230 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp3_ = *event_id; +#line 230 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp4_ = _tmp3_.id; +#line 230 "/home/jens/Source/shotwell/src/db/EventTable.vala" + _tmp5_ = database_table_update_text_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp4_, "comment", _tmp0_); +#line 230 "/home/jens/Source/shotwell/src/db/EventTable.vala" + result = _tmp5_; +#line 230 "/home/jens/Source/shotwell/src/db/EventTable.vala" + return result; +#line 1835 "EventTable.c" +} + + +static void event_table_class_init (EventTableClass * klass) { +#line 33 "/home/jens/Source/shotwell/src/db/EventTable.vala" + event_table_parent_class = g_type_class_peek_parent (klass); +#line 33 "/home/jens/Source/shotwell/src/db/EventTable.vala" + ((DatabaseTableClass *) klass)->finalize = event_table_finalize; +#line 1844 "EventTable.c" +} + + +static void event_table_instance_init (EventTable * self) { +} + + +static void event_table_finalize (DatabaseTable* obj) { + EventTable * self; +#line 33 "/home/jens/Source/shotwell/src/db/EventTable.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_EVENT_TABLE, EventTable); +#line 33 "/home/jens/Source/shotwell/src/db/EventTable.vala" + DATABASE_TABLE_CLASS (event_table_parent_class)->finalize (obj); +#line 1858 "EventTable.c" +} + + +GType event_table_get_type (void) { + static volatile gsize event_table_type_id__volatile = 0; + if (g_once_init_enter (&event_table_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (EventTableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) event_table_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EventTable), 0, (GInstanceInitFunc) event_table_instance_init, NULL }; + GType event_table_type_id; + event_table_type_id = g_type_register_static (TYPE_DATABASE_TABLE, "EventTable", &g_define_type_info, 0); + g_once_init_leave (&event_table_type_id__volatile, event_table_type_id); + } + return event_table_type_id__volatile; +} + + + diff --git a/src/db/PhotoTable.c b/src/db/PhotoTable.c new file mode 100644 index 0000000..42ed64a --- /dev/null +++ b/src/db/PhotoTable.c @@ -0,0 +1,9397 @@ +/* PhotoTable.c generated by valac 0.32.1, the Vala compiler + * generated from PhotoTable.vala, do not modify */ + +/* 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define TYPE_PHOTO_ID (photo_id_get_type ()) +typedef struct _PhotoID PhotoID; + +#define TYPE_IMPORT_ID (import_id_get_type ()) +typedef struct _ImportID ImportID; + +#define TYPE_PHOTO_ROW (photo_row_get_type ()) +#define PHOTO_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO_ROW, PhotoRow)) +#define PHOTO_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO_ROW, PhotoRowClass)) +#define IS_PHOTO_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO_ROW)) +#define IS_PHOTO_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO_ROW)) +#define PHOTO_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO_ROW, PhotoRowClass)) + +typedef struct _PhotoRow PhotoRow; +typedef struct _PhotoRowClass PhotoRowClass; +typedef struct _PhotoRowPrivate PhotoRowPrivate; + +#define TYPE_BACKING_PHOTO_ROW (backing_photo_row_get_type ()) +#define BACKING_PHOTO_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BACKING_PHOTO_ROW, BackingPhotoRow)) +#define BACKING_PHOTO_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BACKING_PHOTO_ROW, BackingPhotoRowClass)) +#define IS_BACKING_PHOTO_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BACKING_PHOTO_ROW)) +#define IS_BACKING_PHOTO_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BACKING_PHOTO_ROW)) +#define BACKING_PHOTO_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BACKING_PHOTO_ROW, BackingPhotoRowClass)) + +typedef struct _BackingPhotoRow BackingPhotoRow; +typedef struct _BackingPhotoRowClass BackingPhotoRowClass; + +#define TYPE_EVENT_ID (event_id_get_type ()) +typedef struct _EventID EventID; + +#define TYPE_ORIENTATION (orientation_get_type ()) + +#define TYPE_KEY_VALUE_MAP (key_value_map_get_type ()) +#define KEY_VALUE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_KEY_VALUE_MAP, KeyValueMap)) +#define KEY_VALUE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_KEY_VALUE_MAP, KeyValueMapClass)) +#define IS_KEY_VALUE_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_KEY_VALUE_MAP)) +#define IS_KEY_VALUE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_KEY_VALUE_MAP)) +#define KEY_VALUE_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_KEY_VALUE_MAP, KeyValueMapClass)) + +typedef struct _KeyValueMap KeyValueMap; +typedef struct _KeyValueMapClass KeyValueMapClass; + +#define TYPE_RATING (rating_get_type ()) + +#define TYPE_BACKING_PHOTO_ID (backing_photo_id_get_type ()) +typedef struct _BackingPhotoID BackingPhotoID; + +#define TYPE_RAW_DEVELOPER (raw_developer_get_type ()) +#define _backing_photo_row_unref0(var) ((var == NULL) ? NULL : (var = (backing_photo_row_unref (var), NULL))) +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +typedef struct _ParamSpecPhotoRow ParamSpecPhotoRow; + +#define TYPE_DATABASE_TABLE (database_table_get_type ()) +#define DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATABASE_TABLE, DatabaseTable)) +#define DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATABASE_TABLE, DatabaseTableClass)) +#define IS_DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATABASE_TABLE)) +#define IS_DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATABASE_TABLE)) +#define DATABASE_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATABASE_TABLE, DatabaseTableClass)) + +typedef struct _DatabaseTable DatabaseTable; +typedef struct _DatabaseTableClass DatabaseTableClass; +typedef struct _DatabaseTablePrivate DatabaseTablePrivate; + +#define TYPE_PHOTO_TABLE (photo_table_get_type ()) +#define PHOTO_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO_TABLE, PhotoTable)) +#define PHOTO_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO_TABLE, PhotoTableClass)) +#define IS_PHOTO_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO_TABLE)) +#define IS_PHOTO_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO_TABLE)) +#define PHOTO_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO_TABLE, PhotoTableClass)) + +typedef struct _PhotoTable PhotoTable; +typedef struct _PhotoTableClass PhotoTableClass; +typedef struct _PhotoTablePrivate PhotoTablePrivate; +#define _sqlite3_finalize0(var) ((var == NULL) ? NULL : (var = (sqlite3_finalize (var), NULL))) +#define _database_table_unref0(var) ((var == NULL) ? NULL : (var = (database_table_unref (var), NULL))) +typedef struct _BackingPhotoRowPrivate BackingPhotoRowPrivate; + +#define TYPE_PHOTO_FILE_FORMAT (photo_file_format_get_type ()) + +#define TYPE_DIMENSIONS (dimensions_get_type ()) +typedef struct _Dimensions Dimensions; +#define _photo_row_unref0(var) ((var == NULL) ? NULL : (var = (photo_row_unref (var), NULL))) +#define _g_key_file_unref0(var) ((var == NULL) ? NULL : (var = (g_key_file_unref (var), NULL))) +#define _key_value_map_unref0(var) ((var == NULL) ? NULL : (var = (key_value_map_unref (var), NULL))) +#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) +typedef struct _ParamSpecBackingPhotoRow ParamSpecBackingPhotoRow; + +#define TYPE_BACKING_PHOTO_TABLE (backing_photo_table_get_type ()) +#define BACKING_PHOTO_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BACKING_PHOTO_TABLE, BackingPhotoTable)) +#define BACKING_PHOTO_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BACKING_PHOTO_TABLE, BackingPhotoTableClass)) +#define IS_BACKING_PHOTO_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BACKING_PHOTO_TABLE)) +#define IS_BACKING_PHOTO_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BACKING_PHOTO_TABLE)) +#define BACKING_PHOTO_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BACKING_PHOTO_TABLE, BackingPhotoTableClass)) + +typedef struct _BackingPhotoTable BackingPhotoTable; +typedef struct _BackingPhotoTableClass BackingPhotoTableClass; +typedef struct _BackingPhotoTablePrivate BackingPhotoTablePrivate; +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); +#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } +#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } +#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _PhotoID { + gint64 id; +}; + +struct _ImportID { + gint64 id; +}; + +struct _EventID { + gint64 id; +}; + +typedef enum { + ORIENTATION_MIN = 1, + ORIENTATION_TOP_LEFT = 1, + ORIENTATION_TOP_RIGHT = 2, + ORIENTATION_BOTTOM_RIGHT = 3, + ORIENTATION_BOTTOM_LEFT = 4, + ORIENTATION_LEFT_TOP = 5, + ORIENTATION_RIGHT_TOP = 6, + ORIENTATION_RIGHT_BOTTOM = 7, + ORIENTATION_LEFT_BOTTOM = 8, + ORIENTATION_MAX = 8 +} Orientation; + +typedef enum { + RATING_REJECTED = -1, + RATING_UNRATED = 0, + RATING_ONE = 1, + RATING_TWO = 2, + RATING_THREE = 3, + RATING_FOUR = 4, + RATING_FIVE = 5 +} Rating; + +struct _BackingPhotoID { + gint64 id; +}; + +typedef enum { + RAW_DEVELOPER_SHOTWELL = 0, + RAW_DEVELOPER_CAMERA, + RAW_DEVELOPER_EMBEDDED +} RawDeveloper; + +struct _PhotoRow { + GTypeInstance parent_instance; + volatile int ref_count; + PhotoRowPrivate * priv; + PhotoID photo_id; + BackingPhotoRow* master; + time_t exposure_time; + ImportID import_id; + EventID event_id; + Orientation orientation; + GeeHashMap* transformations; + gchar* md5; + gchar* thumbnail_md5; + gchar* exif_md5; + time_t time_created; + guint64 flags; + Rating rating; + gchar* title; + gchar* comment; + gchar* backlinks; + time_t time_reimported; + BackingPhotoID editable_id; + gboolean metadata_dirty; + RawDeveloper developer; + BackingPhotoID* development_ids; + gint development_ids_length1; +}; + +struct _PhotoRowClass { + GTypeClass parent_class; + void (*finalize) (PhotoRow *self); +}; + +struct _ParamSpecPhotoRow { + GParamSpec parent_instance; +}; + +struct _DatabaseTable { + GTypeInstance parent_instance; + volatile int ref_count; + DatabaseTablePrivate * priv; + gchar* table_name; +}; + +struct _DatabaseTableClass { + GTypeClass parent_class; + void (*finalize) (DatabaseTable *self); +}; + +struct _PhotoTable { + DatabaseTable parent_instance; + PhotoTablePrivate * priv; +}; + +struct _PhotoTableClass { + DatabaseTableClass parent_class; +}; + +typedef enum { + PHOTO_FILE_FORMAT_JFIF, + PHOTO_FILE_FORMAT_RAW, + PHOTO_FILE_FORMAT_PNG, + PHOTO_FILE_FORMAT_TIFF, + PHOTO_FILE_FORMAT_BMP, + PHOTO_FILE_FORMAT_UNKNOWN +} PhotoFileFormat; + +struct _Dimensions { + gint width; + gint height; +}; + +struct _BackingPhotoRow { + GTypeInstance parent_instance; + volatile int ref_count; + BackingPhotoRowPrivate * priv; + BackingPhotoID id; + time_t time_created; + gchar* filepath; + gint64 filesize; + time_t timestamp; + PhotoFileFormat file_format; + Dimensions dim; + Orientation original_orientation; +}; + +struct _BackingPhotoRowClass { + GTypeClass parent_class; + void (*finalize) (BackingPhotoRow *self); +}; + +typedef enum { + DATABASE_ERROR_ERROR, + DATABASE_ERROR_BACKING, + DATABASE_ERROR_MEMORY, + DATABASE_ERROR_ABORT, + DATABASE_ERROR_LIMITS, + DATABASE_ERROR_TYPESPEC +} DatabaseError; +#define DATABASE_ERROR database_error_quark () +struct _ParamSpecBackingPhotoRow { + GParamSpec parent_instance; +}; + +struct _BackingPhotoTable { + DatabaseTable parent_instance; + BackingPhotoTablePrivate * priv; +}; + +struct _BackingPhotoTableClass { + DatabaseTableClass parent_class; +}; + + +static gpointer photo_row_parent_class = NULL; +static gpointer photo_table_parent_class = NULL; +static PhotoTable* photo_table_instance; +static PhotoTable* photo_table_instance = NULL; +extern sqlite3* database_table_db; +static gpointer backing_photo_row_parent_class = NULL; +static gpointer backing_photo_table_parent_class = NULL; +static BackingPhotoTable* backing_photo_table_instance; +static BackingPhotoTable* backing_photo_table_instance = NULL; + +GType photo_id_get_type (void) G_GNUC_CONST; +PhotoID* photo_id_dup (const PhotoID* self); +void photo_id_free (PhotoID* self); +#define PHOTO_ID_INVALID ((gint64) -1) +void photo_id_init (PhotoID *self, gint64 id); +gboolean photo_id_is_invalid (PhotoID *self); +gboolean photo_id_is_valid (PhotoID *self); +guint photo_id_hash (PhotoID *self); +guint int64_hash (gint64* n); +gboolean photo_id_equal (void* a, void* b); +gchar* photo_id_upgrade_photo_id_to_source_id (PhotoID* photo_id); +#define PHOTO_TYPENAME "thumb" +GType import_id_get_type (void) G_GNUC_CONST; +ImportID* import_id_dup (const ImportID* self); +void import_id_free (ImportID* self); +#define IMPORT_ID_INVALID ((gint64) 0) +void import_id_init (ImportID *self, gint64 id); +void import_id_generate (ImportID* result); +gboolean import_id_is_invalid (ImportID *self); +gboolean import_id_is_valid (ImportID *self); +gint import_id_compare_func (ImportID* a, ImportID* b); +gint64 import_id_comparator (void* a, void* b); +gpointer photo_row_ref (gpointer instance); +void photo_row_unref (gpointer instance); +GParamSpec* param_spec_photo_row (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_photo_row (GValue* value, gpointer v_object); +void value_take_photo_row (GValue* value, gpointer v_object); +gpointer value_get_photo_row (const GValue* value); +GType photo_row_get_type (void) G_GNUC_CONST; +gpointer backing_photo_row_ref (gpointer instance); +void backing_photo_row_unref (gpointer instance); +GParamSpec* param_spec_backing_photo_row (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_backing_photo_row (GValue* value, gpointer v_object); +void value_take_backing_photo_row (GValue* value, gpointer v_object); +gpointer value_get_backing_photo_row (const GValue* value); +GType backing_photo_row_get_type (void) G_GNUC_CONST; +GType event_id_get_type (void) G_GNUC_CONST; +EventID* event_id_dup (const EventID* self); +void event_id_free (EventID* self); +GType orientation_get_type (void) G_GNUC_CONST; +gpointer key_value_map_ref (gpointer instance); +void key_value_map_unref (gpointer instance); +GParamSpec* param_spec_key_value_map (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_key_value_map (GValue* value, gpointer v_object); +void value_take_key_value_map (GValue* value, gpointer v_object); +gpointer value_get_key_value_map (const GValue* value); +GType key_value_map_get_type (void) G_GNUC_CONST; +GType rating_get_type (void) G_GNUC_CONST; +GType backing_photo_id_get_type (void) G_GNUC_CONST; +BackingPhotoID* backing_photo_id_dup (const BackingPhotoID* self); +void backing_photo_id_free (BackingPhotoID* self); +GType raw_developer_get_type (void) G_GNUC_CONST; +enum { + PHOTO_ROW_DUMMY_PROPERTY +}; +PhotoRow* photo_row_new (void); +PhotoRow* photo_row_construct (GType object_type); +BackingPhotoRow* backing_photo_row_new (void); +BackingPhotoRow* backing_photo_row_construct (GType object_type); +#define BACKING_PHOTO_ID_INVALID ((gint64) -1) +void backing_photo_id_init (BackingPhotoID *self, gint64 id); +RawDeveloper* raw_developer_as_array (int* result_length1); +static void photo_row_finalize (PhotoRow* obj); +gpointer database_table_ref (gpointer instance); +void database_table_unref (gpointer instance); +GParamSpec* param_spec_database_table (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_database_table (GValue* value, gpointer v_object); +void value_take_database_table (GValue* value, gpointer v_object); +gpointer value_get_database_table (const GValue* value); +GType database_table_get_type (void) G_GNUC_CONST; +GType photo_table_get_type (void) G_GNUC_CONST; +enum { + PHOTO_TABLE_DUMMY_PROPERTY +}; +static PhotoTable* photo_table_new (void); +static PhotoTable* photo_table_construct (GType object_type); +DatabaseTable* database_table_construct (GType object_type); +void database_table_fatal (const gchar* op, gint res); +void database_table_warning (const gchar* op, gint res); +void database_table_set_table_name (DatabaseTable* self, const gchar* table_name); +PhotoTable* photo_table_get_instance (void); +void photo_table_add (PhotoTable* self, PhotoRow* photo_row, PhotoID* result); +gulong now_sec (void); +GType photo_file_format_get_type (void) G_GNUC_CONST; +GType dimensions_get_type (void) G_GNUC_CONST; +Dimensions* dimensions_dup (const Dimensions* self); +void dimensions_free (Dimensions* self); +#define EVENT_ID_INVALID ((gint64) -1) +gint photo_file_format_serialize (PhotoFileFormat self); +gint rating_serialize (Rating self); +gchar* raw_developer_to_string (RawDeveloper self); +void event_id_init (EventID *self, gint64 id); +GQuark database_error_quark (void); +void photo_table_reimport (PhotoTable* self, PhotoRow* row, GError** error); +void database_table_throw_error (const gchar* method, gint res, GError** error); +gboolean photo_table_master_exif_updated (PhotoTable* self, PhotoID* photoID, gint64 filesize, glong timestamp, const gchar* md5, const gchar* exif_md5, const gchar* thumbnail_md5, PhotoRow* row); +static void photo_table_validate_orientation (PhotoTable* self, PhotoRow* row); +gboolean photo_table_set_orientation (PhotoTable* self, PhotoID* photo_id, Orientation orientation); +PhotoRow* photo_table_get_row (PhotoTable* self, PhotoID* photo_id); +void dimensions_init (Dimensions *self, gint width, gint height); +GeeHashMap* photo_table_marshall_all_transformations (const gchar* trans); +Rating rating_unserialize (gint value); +PhotoFileFormat photo_file_format_unserialize (gint value); +RawDeveloper raw_developer_from_string (const gchar* value); +GeeArrayList* photo_table_get_all (PhotoTable* self); +void photo_table_duplicate (PhotoTable* self, PhotoID* photo_id, const gchar* new_filename, BackingPhotoID* editable_id, BackingPhotoID* develop_shotwell, BackingPhotoID* develop_camera_id, BackingPhotoID* develop_embedded_id, PhotoID* result); +gchar* photo_table_unmarshall_all_transformations (GeeHashMap* transformations); +gboolean photo_table_set_title (PhotoTable* self, PhotoID* photo_id, const gchar* new_title); +gboolean database_table_update_text_by_id (DatabaseTable* self, gint64 id, const gchar* column, const gchar* text); +gboolean photo_table_set_comment (PhotoTable* self, PhotoID* photo_id, const gchar* new_comment); +void photo_table_set_filepath (PhotoTable* self, PhotoID* photo_id, const gchar* filepath, GError** error); +void database_table_update_text_by_id_2 (DatabaseTable* self, gint64 id, const gchar* column, const gchar* text, GError** error); +void photo_table_update_timestamp (PhotoTable* self, PhotoID* photo_id, time_t timestamp, GError** error); +void database_table_update_int64_by_id_2 (DatabaseTable* self, gint64 id, const gchar* column, gint64 value, GError** error); +gboolean photo_table_set_exposure_time (PhotoTable* self, PhotoID* photo_id, time_t time); +gboolean database_table_update_int64_by_id (DatabaseTable* self, gint64 id, const gchar* column, gint64 value); +void photo_table_set_import_id (PhotoTable* self, PhotoID* photo_id, ImportID* import_id, GError** error); +gboolean photo_table_remove_by_file (PhotoTable* self, GFile* file); +void photo_table_remove (PhotoTable* self, PhotoID* photo_id, GError** error); +void database_table_delete_by_id (DatabaseTable* self, gint64 id, GError** error); +GeeArrayList* photo_table_get_photos (PhotoTable* self); +gboolean database_table_update_int_by_id (DatabaseTable* self, gint64 id, const gchar* column, gint value); +gboolean photo_table_replace_flags (PhotoTable* self, PhotoID* photo_id, guint64 flags); +gboolean photo_table_set_rating (PhotoTable* self, PhotoID* photo_id, Rating rating); +gint photo_table_get_event_photo_count (PhotoTable* self, EventID* event_id); +GeeArrayList* photo_table_get_event_source_ids (PhotoTable* self, EventID* event_id); +gboolean photo_table_event_has_photos (PhotoTable* self, EventID* event_id); +gboolean photo_table_drop_event (PhotoTable* self, EventID* event_id); +gboolean photo_table_set_event (PhotoTable* self, PhotoID* photo_id, EventID* event_id); +static gchar* photo_table_get_raw_transformations (PhotoTable* self, PhotoID* photo_id); +gboolean database_table_select_by_id (DatabaseTable* self, gint64 id, const gchar* columns, sqlite3_stmt** stmt); +static gboolean photo_table_set_raw_transformations (PhotoTable* self, PhotoID* photo_id, const gchar* trans); +gboolean photo_table_set_transformation_state (PhotoTable* self, PhotoID* photo_id, Orientation orientation, GeeHashMap* transformations); +KeyValueMap* key_value_map_new (const gchar* group); +KeyValueMap* key_value_map_construct (GType object_type, const gchar* group); +void key_value_map_set_string (KeyValueMap* self, const gchar* key, const gchar* value); +GeeSet* key_value_map_get_keys (KeyValueMap* self); +gchar* key_value_map_get_string (KeyValueMap* self, const gchar* key, const gchar* def); +gboolean photo_table_set_transformation (PhotoTable* self, PhotoID* photo_id, KeyValueMap* map); +gchar* key_value_map_get_group (KeyValueMap* self); +gboolean photo_table_remove_transformation (PhotoTable* self, PhotoID* photo_id, const gchar* object); +gboolean photo_table_remove_all_transformations (PhotoTable* self, PhotoID* photo_id); +static sqlite3_stmt* photo_table_get_duplicate_stmt (PhotoTable* self, GFile* file, const gchar* thumbnail_md5, const gchar* md5, PhotoFileFormat file_format); +gboolean photo_table_has_duplicate (PhotoTable* self, GFile* file, const gchar* thumbnail_md5, const gchar* md5, PhotoFileFormat file_format); +PhotoID* photo_table_get_duplicate_ids (PhotoTable* self, GFile* file, const gchar* thumbnail_md5, const gchar* md5, PhotoFileFormat file_format, int* result_length1); +static void _vala_array_add2 (PhotoID** array, int* length, int* size, const PhotoID* value); +void photo_table_update_backlinks (PhotoTable* self, PhotoID* photo_id, const gchar* backlinks, GError** error); +void photo_table_attach_editable (PhotoTable* self, PhotoRow* row, BackingPhotoID* editable_id, GError** error); +void photo_table_detach_editable (PhotoTable* self, PhotoRow* row, GError** error); +void photo_table_set_metadata_dirty (PhotoTable* self, PhotoID* photo_id, gboolean dirty, GError** error); +void database_table_update_int_by_id_2 (DatabaseTable* self, gint64 id, const gchar* column, gint value, GError** error); +void photo_table_update_raw_development (PhotoTable* self, PhotoRow* row, RawDeveloper rd, BackingPhotoID* backing_photo_id, GError** error); +void photo_table_remove_development (PhotoTable* self, PhotoRow* row, RawDeveloper rd, GError** error); +static void photo_table_finalize (DatabaseTable* obj); +gboolean backing_photo_id_is_invalid (BackingPhotoID *self); +gboolean backing_photo_id_is_valid (BackingPhotoID *self); +enum { + BACKING_PHOTO_ROW_DUMMY_PROPERTY +}; +gboolean backing_photo_row_matches_file_info (BackingPhotoRow* self, GFileInfo* info); +gboolean backing_photo_row_is_touched (BackingPhotoRow* self, GFileInfo* info); +void backing_photo_row_copy_from (BackingPhotoRow* self, BackingPhotoRow* from); +static void backing_photo_row_finalize (BackingPhotoRow* obj); +GType backing_photo_table_get_type (void) G_GNUC_CONST; +enum { + BACKING_PHOTO_TABLE_DUMMY_PROPERTY +}; +static BackingPhotoTable* backing_photo_table_new (void); +static BackingPhotoTable* backing_photo_table_construct (GType object_type); +BackingPhotoTable* backing_photo_table_get_instance (void); +void backing_photo_table_add (BackingPhotoTable* self, BackingPhotoRow* state, GError** error); +BackingPhotoRow* backing_photo_table_fetch (BackingPhotoTable* self, BackingPhotoID* id, GError** error); +void backing_photo_table_update (BackingPhotoTable* self, BackingPhotoRow* row, GError** error); +void backing_photo_table_update_attributes (BackingPhotoTable* self, BackingPhotoID* id, time_t timestamp, gint64 filesize, GError** error); +void backing_photo_table_remove (BackingPhotoTable* self, BackingPhotoID* backing_id, GError** error); +void backing_photo_table_set_filepath (BackingPhotoTable* self, BackingPhotoID* id, const gchar* filepath, GError** error); +void backing_photo_table_update_timestamp (BackingPhotoTable* self, BackingPhotoID* id, time_t timestamp, GError** error); +static void backing_photo_table_finalize (DatabaseTable* obj); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); + + +void photo_id_init (PhotoID *self, gint64 id) { + gint64 _tmp0_ = 0LL; +#line 12 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + memset (self, 0, sizeof (PhotoID)); +#line 13 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = id; +#line 13 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + (*self).id = _tmp0_; +#line 484 "PhotoTable.c" +} + + +gboolean photo_id_is_invalid (PhotoID *self) { + gboolean result = FALSE; + gint64 _tmp0_ = 0LL; +#line 17 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = (*self).id; +#line 17 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp0_ == PHOTO_ID_INVALID; +#line 17 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 497 "PhotoTable.c" +} + + +gboolean photo_id_is_valid (PhotoID *self) { + gboolean result = FALSE; + gint64 _tmp0_ = 0LL; +#line 21 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = (*self).id; +#line 21 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp0_ != PHOTO_ID_INVALID; +#line 21 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 510 "PhotoTable.c" +} + + +guint photo_id_hash (PhotoID *self) { + guint result = 0U; + gint64 _tmp0_ = 0LL; + guint _tmp1_ = 0U; +#line 25 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = (*self).id; +#line 25 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = int64_hash (&_tmp0_); +#line 25 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp1_; +#line 25 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 526 "PhotoTable.c" +} + + +gboolean photo_id_equal (void* a, void* b) { + gboolean result = FALSE; + void* _tmp0_ = NULL; + gint64 _tmp1_ = 0LL; + void* _tmp2_ = NULL; + gint64 _tmp3_ = 0LL; +#line 29 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = a; +#line 29 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = (*((PhotoID*) _tmp0_)).id; +#line 29 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = b; +#line 29 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = (*((PhotoID*) _tmp2_)).id; +#line 29 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp1_ == _tmp3_; +#line 29 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 548 "PhotoTable.c" +} + + +gchar* photo_id_upgrade_photo_id_to_source_id (PhotoID* photo_id) { + gchar* result = NULL; + PhotoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + gchar* _tmp2_ = NULL; +#line 32 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (photo_id != NULL, NULL); +#line 33 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = *photo_id; +#line 33 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp0_.id; +#line 33 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = g_strdup_printf ("%s%016" G_GINT64_MODIFIER "x", PHOTO_TYPENAME, _tmp1_); +#line 33 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp2_; +#line 33 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 569 "PhotoTable.c" +} + + +PhotoID* photo_id_dup (const PhotoID* self) { + PhotoID* dup; +#line 7 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + dup = g_new0 (PhotoID, 1); +#line 7 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + memcpy (dup, self, sizeof (PhotoID)); +#line 7 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return dup; +#line 581 "PhotoTable.c" +} + + +void photo_id_free (PhotoID* self) { +#line 7 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_free (self); +#line 588 "PhotoTable.c" +} + + +GType photo_id_get_type (void) { + static volatile gsize photo_id_type_id__volatile = 0; + if (g_once_init_enter (&photo_id_type_id__volatile)) { + GType photo_id_type_id; + photo_id_type_id = g_boxed_type_register_static ("PhotoID", (GBoxedCopyFunc) photo_id_dup, (GBoxedFreeFunc) photo_id_free); + g_once_init_leave (&photo_id_type_id__volatile, photo_id_type_id); + } + return photo_id_type_id__volatile; +} + + +void import_id_init (ImportID *self, gint64 id) { + gint64 _tmp0_ = 0LL; +#line 42 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + memset (self, 0, sizeof (ImportID)); +#line 43 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = id; +#line 43 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + (*self).id = _tmp0_; +#line 611 "PhotoTable.c" +} + + +void import_id_generate (ImportID* result) { + GTimeVal timestamp = {0}; + gint64 id = 0LL; + GTimeVal _tmp0_ = {0}; + glong _tmp1_ = 0L; + ImportID _tmp2_ = {0}; +#line 47 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_get_current_time (×tamp); +#line 48 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_get_current_time (×tamp); +#line 49 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = timestamp; +#line 49 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp0_.tv_sec; +#line 49 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + id = (gint64) _tmp1_; +#line 51 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + import_id_init (&_tmp2_, id); +#line 51 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + *result = _tmp2_; +#line 51 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 637 "PhotoTable.c" +} + + +gboolean import_id_is_invalid (ImportID *self) { + gboolean result = FALSE; + gint64 _tmp0_ = 0LL; +#line 55 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = (*self).id; +#line 55 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp0_ == IMPORT_ID_INVALID; +#line 55 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 650 "PhotoTable.c" +} + + +gboolean import_id_is_valid (ImportID *self) { + gboolean result = FALSE; + gint64 _tmp0_ = 0LL; +#line 59 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = (*self).id; +#line 59 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp0_ != IMPORT_ID_INVALID; +#line 59 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 663 "PhotoTable.c" +} + + +gint import_id_compare_func (ImportID* a, ImportID* b) { + gint result = 0; + gboolean _tmp0_ = FALSE; + ImportID* _tmp1_ = NULL; + ImportID* _tmp3_ = NULL; + gint64 _tmp4_ = 0LL; + ImportID* _tmp5_ = NULL; + gint64 _tmp6_ = 0LL; +#line 63 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = a; +#line 63 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp1_ != NULL) { +#line 679 "PhotoTable.c" + ImportID* _tmp2_ = NULL; +#line 63 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = b; +#line 63 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = _tmp2_ != NULL; +#line 685 "PhotoTable.c" + } else { +#line 63 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = FALSE; +#line 689 "PhotoTable.c" + } +#line 63 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp0_, "a != null && b != null"); +#line 64 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = a; +#line 64 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = (*_tmp3_).id; +#line 64 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = b; +#line 64 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = (*_tmp5_).id; +#line 64 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = (gint) (_tmp4_ - _tmp6_); +#line 64 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 705 "PhotoTable.c" +} + + +gint64 import_id_comparator (void* a, void* b) { + gint64 result = 0LL; + void* _tmp0_ = NULL; + gint64 _tmp1_ = 0LL; + void* _tmp2_ = NULL; + gint64 _tmp3_ = 0LL; +#line 68 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = a; +#line 68 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = (*((ImportID*) _tmp0_)).id; +#line 68 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = b; +#line 68 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = (*((ImportID*) _tmp2_)).id; +#line 68 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp1_ - _tmp3_; +#line 68 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 727 "PhotoTable.c" +} + + +ImportID* import_id_dup (const ImportID* self) { + ImportID* dup; +#line 37 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + dup = g_new0 (ImportID, 1); +#line 37 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + memcpy (dup, self, sizeof (ImportID)); +#line 37 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return dup; +#line 739 "PhotoTable.c" +} + + +void import_id_free (ImportID* self) { +#line 37 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_free (self); +#line 746 "PhotoTable.c" +} + + +GType import_id_get_type (void) { + static volatile gsize import_id_type_id__volatile = 0; + if (g_once_init_enter (&import_id_type_id__volatile)) { + GType import_id_type_id; + import_id_type_id = g_boxed_type_register_static ("ImportID", (GBoxedCopyFunc) import_id_dup, (GBoxedFreeFunc) import_id_free); + g_once_init_leave (&import_id_type_id__volatile, import_id_type_id); + } + return import_id_type_id__volatile; +} + + +PhotoRow* photo_row_construct (GType object_type) { + PhotoRow* self = NULL; + BackingPhotoRow* _tmp0_ = NULL; + gint _tmp1_ = 0; + RawDeveloper* _tmp2_ = NULL; + RawDeveloper* _tmp3_ = NULL; + gint _tmp3__length1 = 0; + BackingPhotoID* _tmp4_ = NULL; + gint _tmp5_ = 0; + RawDeveloper* _tmp6_ = NULL; +#line 100 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self = (PhotoRow*) g_type_create_instance (object_type); +#line 101 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = backing_photo_row_new (); +#line 101 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _backing_photo_row_unref0 (self->master); +#line 101 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self->master = _tmp0_; +#line 102 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_id_init (&self->editable_id, BACKING_PHOTO_ID_INVALID); +#line 103 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = raw_developer_as_array (&_tmp1_); +#line 103 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = _tmp2_; +#line 103 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3__length1 = _tmp1_; +#line 103 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = g_new0 (BackingPhotoID, _tmp1_); +#line 103 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self->development_ids = (g_free (self->development_ids), NULL); +#line 103 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self->development_ids = _tmp4_; +#line 103 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self->development_ids_length1 = _tmp1_; +#line 103 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = (g_free (_tmp3_), NULL); +#line 104 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = raw_developer_as_array (&_tmp5_); +#line 799 "PhotoTable.c" + { + RawDeveloper* d_collection = NULL; + gint d_collection_length1 = 0; + gint _d_collection_size_ = 0; + gint d_it = 0; +#line 104 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + d_collection = _tmp6_; +#line 104 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + d_collection_length1 = _tmp5_; +#line 104 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + for (d_it = 0; d_it < _tmp5_; d_it = d_it + 1) { +#line 811 "PhotoTable.c" + RawDeveloper d = 0; +#line 104 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + d = d_collection[d_it]; +#line 815 "PhotoTable.c" + { + BackingPhotoID* _tmp7_ = NULL; + gint _tmp7__length1 = 0; + RawDeveloper _tmp8_ = 0; + BackingPhotoID _tmp9_ = {0}; + BackingPhotoID _tmp10_ = {0}; +#line 105 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = self->development_ids; +#line 105 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7__length1 = self->development_ids_length1; +#line 105 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = d; +#line 105 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_id_init (&_tmp9_, BACKING_PHOTO_ID_INVALID); +#line 105 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_[_tmp8_] = _tmp9_; +#line 105 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = _tmp7_[_tmp8_]; +#line 834 "PhotoTable.c" + } + } +#line 104 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + d_collection = (g_free (d_collection), NULL); +#line 839 "PhotoTable.c" + } +#line 100 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return self; +#line 843 "PhotoTable.c" +} + + +PhotoRow* photo_row_new (void) { +#line 100 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return photo_row_construct (TYPE_PHOTO_ROW); +#line 850 "PhotoTable.c" +} + + +static void value_photo_row_init (GValue* value) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + value->data[0].v_pointer = NULL; +#line 857 "PhotoTable.c" +} + + +static void value_photo_row_free_value (GValue* value) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (value->data[0].v_pointer) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + photo_row_unref (value->data[0].v_pointer); +#line 866 "PhotoTable.c" + } +} + + +static void value_photo_row_copy_value (const GValue* src_value, GValue* dest_value) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (src_value->data[0].v_pointer) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + dest_value->data[0].v_pointer = photo_row_ref (src_value->data[0].v_pointer); +#line 876 "PhotoTable.c" + } else { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + dest_value->data[0].v_pointer = NULL; +#line 880 "PhotoTable.c" + } +} + + +static gpointer value_photo_row_peek_pointer (const GValue* value) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return value->data[0].v_pointer; +#line 888 "PhotoTable.c" +} + + +static gchar* value_photo_row_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (collect_values[0].v_pointer) { +#line 895 "PhotoTable.c" + PhotoRow* object; + object = collect_values[0].v_pointer; +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (object->parent_instance.g_class == NULL) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); +#line 902 "PhotoTable.c" + } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); +#line 906 "PhotoTable.c" + } +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + value->data[0].v_pointer = photo_row_ref (object); +#line 910 "PhotoTable.c" + } else { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + value->data[0].v_pointer = NULL; +#line 914 "PhotoTable.c" + } +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return NULL; +#line 918 "PhotoTable.c" +} + + +static gchar* value_photo_row_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + PhotoRow** object_p; + object_p = collect_values[0].v_pointer; +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (!object_p) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); +#line 929 "PhotoTable.c" + } +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (!value->data[0].v_pointer) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + *object_p = NULL; +#line 935 "PhotoTable.c" + } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + *object_p = value->data[0].v_pointer; +#line 939 "PhotoTable.c" + } else { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + *object_p = photo_row_ref (value->data[0].v_pointer); +#line 943 "PhotoTable.c" + } +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return NULL; +#line 947 "PhotoTable.c" +} + + +GParamSpec* param_spec_photo_row (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { + ParamSpecPhotoRow* spec; +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (g_type_is_a (object_type, TYPE_PHOTO_ROW), NULL); +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + G_PARAM_SPEC (spec)->value_type = object_type; +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return G_PARAM_SPEC (spec); +#line 961 "PhotoTable.c" +} + + +gpointer value_get_photo_row (const GValue* value) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_PHOTO_ROW), NULL); +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return value->data[0].v_pointer; +#line 970 "PhotoTable.c" +} + + +void value_set_photo_row (GValue* value, gpointer v_object) { + PhotoRow* old; +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_PHOTO_ROW)); +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + old = value->data[0].v_pointer; +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (v_object) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_PHOTO_ROW)); +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + value->data[0].v_pointer = v_object; +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + photo_row_ref (value->data[0].v_pointer); +#line 990 "PhotoTable.c" + } else { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + value->data[0].v_pointer = NULL; +#line 994 "PhotoTable.c" + } +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (old) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + photo_row_unref (old); +#line 1000 "PhotoTable.c" + } +} + + +void value_take_photo_row (GValue* value, gpointer v_object) { + PhotoRow* old; +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_PHOTO_ROW)); +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + old = value->data[0].v_pointer; +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (v_object) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_PHOTO_ROW)); +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + value->data[0].v_pointer = v_object; +#line 1019 "PhotoTable.c" + } else { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + value->data[0].v_pointer = NULL; +#line 1023 "PhotoTable.c" + } +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (old) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + photo_row_unref (old); +#line 1029 "PhotoTable.c" + } +} + + +static void photo_row_class_init (PhotoRowClass * klass) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + photo_row_parent_class = g_type_class_peek_parent (klass); +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + ((PhotoRowClass *) klass)->finalize = photo_row_finalize; +#line 1039 "PhotoTable.c" +} + + +static void photo_row_instance_init (PhotoRow * self) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self->ref_count = 1; +#line 1046 "PhotoTable.c" +} + + +static void photo_row_finalize (PhotoRow* obj) { + PhotoRow * self; +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_PHOTO_ROW, PhotoRow); +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_signal_handlers_destroy (self); +#line 74 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _backing_photo_row_unref0 (self->master); +#line 79 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_object_unref0 (self->transformations); +#line 80 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (self->md5); +#line 81 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (self->thumbnail_md5); +#line 82 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (self->exif_md5); +#line 86 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (self->title); +#line 87 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (self->comment); +#line 88 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (self->backlinks); +#line 97 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self->development_ids = (g_free (self->development_ids), NULL); +#line 1074 "PhotoTable.c" +} + + +GType photo_row_get_type (void) { + static volatile gsize photo_row_type_id__volatile = 0; + if (g_once_init_enter (&photo_row_type_id__volatile)) { + static const GTypeValueTable g_define_type_value_table = { value_photo_row_init, value_photo_row_free_value, value_photo_row_copy_value, value_photo_row_peek_pointer, "p", value_photo_row_collect_value, "p", value_photo_row_lcopy_value }; + static const GTypeInfo g_define_type_info = { sizeof (PhotoRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) photo_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PhotoRow), 0, (GInstanceInitFunc) photo_row_instance_init, &g_define_type_value_table }; + static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; + GType photo_row_type_id; + photo_row_type_id = g_type_register_fundamental (g_type_fundamental_next (), "PhotoRow", &g_define_type_info, &g_define_type_fundamental_info, 0); + g_once_init_leave (&photo_row_type_id__volatile, photo_row_type_id); + } + return photo_row_type_id__volatile; +} + + +gpointer photo_row_ref (gpointer instance) { + PhotoRow* self; + self = instance; +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_atomic_int_inc (&self->ref_count); +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return instance; +#line 1099 "PhotoTable.c" +} + + +void photo_row_unref (gpointer instance) { + PhotoRow* self; + self = instance; +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (g_atomic_int_dec_and_test (&self->ref_count)) { +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + PHOTO_ROW_GET_CLASS (self)->finalize (self); +#line 72 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_type_free_instance ((GTypeInstance *) self); +#line 1112 "PhotoTable.c" + } +} + + +static PhotoTable* photo_table_construct (GType object_type) { + PhotoTable* self = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + sqlite3_stmt* stmt2 = NULL; + gint res2 = 0; + sqlite3* _tmp8_ = NULL; + sqlite3_stmt* _tmp9_ = NULL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + sqlite3_stmt* _tmp12_ = NULL; + gint _tmp13_ = 0; + gint _tmp14_ = 0; + sqlite3* _tmp16_ = NULL; + sqlite3_stmt* _tmp17_ = NULL; + gint _tmp18_ = 0; + gint _tmp19_ = 0; + sqlite3_stmt* _tmp20_ = NULL; + gint _tmp21_ = 0; + gint _tmp22_ = 0; + sqlite3* _tmp24_ = NULL; + sqlite3_stmt* _tmp25_ = NULL; + gint _tmp26_ = 0; + gint _tmp27_ = 0; + sqlite3_stmt* _tmp28_ = NULL; + gint _tmp29_ = 0; + gint _tmp30_ = 0; + sqlite3* _tmp32_ = NULL; + sqlite3_stmt* _tmp33_ = NULL; + gint _tmp34_ = 0; + gint _tmp35_ = 0; + sqlite3_stmt* _tmp36_ = NULL; + gint _tmp37_ = 0; + gint _tmp38_ = 0; +#line 112 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self = (PhotoTable*) database_table_construct (object_type); +#line 114 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = database_table_db; +#line 114 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "CREATE TABLE IF NOT EXISTS PhotoTable (" "id INTEGER PRIMARY KEY, " "filename TEXT UNIQUE NOT NULL, " "width INTEGER, " "height INTEGER, " "filesize INTEGER, " "timestamp INTEGER, " "exposure_time INTEGER, " "orientation INTEGER, " "original_orientation INTEGER, " "import_id INTEGER, " "event_id INTEGER, " "transformations TEXT, " "md5 TEXT, " "thumbnail_md5 TEXT, " "exif_md5 TEXT, " "time_created INTEGER, " "flags INTEGER DEFAULT 0, " "rating INTEGER DEFAULT 0, " "file_format INTEGER DEFAULT 0, " "title TEXT, " "backlinks TEXT, " "time_reimported INTEGER, " "editable_id INTEGER DEFAULT -1, " "metadata_dirty INTEGER DEFAULT 0, " "developer TEXT, " "develop_shotwell_id INTEGER DEFAULT -1, " "develop_camera_id INTEGER DEFAULT -1, " "develop_embedded_id INTEGER DEFAULT -1, " "comment TEXT" ")", -1, &_tmp1_, NULL); +#line 114 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 114 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp1_; +#line 114 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp2_; +#line 145 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = res; +#line 145 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 147 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = stmt; +#line 147 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = sqlite3_step (_tmp4_); +#line 147 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp5_; +#line 148 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = res; +#line 148 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp6_ != SQLITE_DONE) { +#line 1184 "PhotoTable.c" + gint _tmp7_ = 0; +#line 149 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = res; +#line 149 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_fatal ("create photo table", _tmp7_); +#line 1190 "PhotoTable.c" + } +#line 153 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = database_table_db; +#line 153 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = sqlite3_prepare_v2 (_tmp8_, "CREATE INDEX IF NOT EXISTS PhotoEventIDIndex ON PhotoTable (event_id)", -1, &_tmp9_, NULL); +#line 153 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt2); +#line 153 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt2 = _tmp9_; +#line 153 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res2 = _tmp10_; +#line 155 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = res2; +#line 155 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp11_ == SQLITE_OK, "res2 == Sqlite.OK"); +#line 157 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = stmt2; +#line 157 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = sqlite3_step (_tmp12_); +#line 157 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res2 = _tmp13_; +#line 158 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = res2; +#line 158 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp14_ != SQLITE_DONE) { +#line 1216 "PhotoTable.c" + gint _tmp15_ = 0; +#line 159 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = res2; +#line 159 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_fatal ("create photo table", _tmp15_); +#line 1222 "PhotoTable.c" + } +#line 165 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = database_table_db; +#line 165 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp18_ = sqlite3_prepare_v2 (_tmp16_, "CREATE UNIQUE INDEX IF NOT EXISTS PhotoTableMD5Format on PhotoTable(md" \ +"5, file_format)", -1, &_tmp17_, NULL); +#line 165 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 165 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp17_; +#line 165 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp18_; +#line 166 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp19_ = res; +#line 166 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp19_ == SQLITE_OK, "res == Sqlite.OK"); +#line 167 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp20_ = stmt; +#line 167 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp21_ = sqlite3_step (_tmp20_); +#line 167 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp21_; +#line 168 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp22_ = res; +#line 168 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp22_ != SQLITE_DONE) { +#line 1248 "PhotoTable.c" + gint _tmp23_ = 0; +#line 169 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp23_ = res; +#line 169 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_warning ("Failed to create index on md5 and file_format", _tmp23_); +#line 1254 "PhotoTable.c" + } +#line 173 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp24_ = database_table_db; +#line 173 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp26_ = sqlite3_prepare_v2 (_tmp24_, "CREATE INDEX IF NOT EXISTS PhotoTableThumbnailMD5Format on PhotoTable(" \ +"thumbnail_md5, file_format)", -1, &_tmp25_, NULL); +#line 173 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 173 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp25_; +#line 173 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp26_; +#line 174 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp27_ = res; +#line 174 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp27_ == SQLITE_OK, "res == Sqlite.OK"); +#line 175 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp28_ = stmt; +#line 175 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp29_ = sqlite3_step (_tmp28_); +#line 175 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp29_; +#line 176 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp30_ = res; +#line 176 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp30_ != SQLITE_DONE) { +#line 1280 "PhotoTable.c" + gint _tmp31_ = 0; +#line 177 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp31_ = res; +#line 177 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_warning ("Failed to create index on md5 and file_format", _tmp31_); +#line 1286 "PhotoTable.c" + } +#line 181 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp32_ = database_table_db; +#line 181 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp34_ = sqlite3_prepare_v2 (_tmp32_, "CREATE INDEX IF NOT EXISTS PhotoTableThumbnailMD5MD5 on PhotoTable(thu" \ +"mbnail_md5, md5)", -1, &_tmp33_, NULL); +#line 181 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 181 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp33_; +#line 181 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp34_; +#line 182 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp35_ = res; +#line 182 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp35_ == SQLITE_OK, "res == Sqlite.OK"); +#line 183 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp36_ = stmt; +#line 183 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp37_ = sqlite3_step (_tmp36_); +#line 183 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp37_; +#line 184 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp38_ = res; +#line 184 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp38_ != SQLITE_DONE) { +#line 1312 "PhotoTable.c" + gint _tmp39_ = 0; +#line 185 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp39_ = res; +#line 185 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_warning ("Failed to create index on thumbnail_md5 and md5", _tmp39_); +#line 1318 "PhotoTable.c" + } +#line 188 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_set_table_name (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), "PhotoTable"); +#line 112 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt2); +#line 112 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 112 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return self; +#line 1328 "PhotoTable.c" +} + + +static PhotoTable* photo_table_new (void) { +#line 112 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return photo_table_construct (TYPE_PHOTO_TABLE); +#line 1335 "PhotoTable.c" +} + + +static gpointer _database_table_ref0 (gpointer self) { +#line 195 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return self ? database_table_ref (self) : NULL; +#line 1342 "PhotoTable.c" +} + + +PhotoTable* photo_table_get_instance (void) { + PhotoTable* result = NULL; + PhotoTable* _tmp0_ = NULL; + PhotoTable* _tmp2_ = NULL; + PhotoTable* _tmp3_ = NULL; +#line 192 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = photo_table_instance; +#line 192 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp0_ == NULL) { +#line 1355 "PhotoTable.c" + PhotoTable* _tmp1_ = NULL; +#line 193 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = photo_table_new (); +#line 193 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _database_table_unref0 (photo_table_instance); +#line 193 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + photo_table_instance = _tmp1_; +#line 1363 "PhotoTable.c" + } +#line 195 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = photo_table_instance; +#line 195 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = _database_table_ref0 (_tmp2_); +#line 195 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp3_; +#line 195 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 1373 "PhotoTable.c" +} + + +void photo_table_add (PhotoTable* self, PhotoRow* photo_row, PhotoID* result) { + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + gulong time_created = 0UL; + gulong _tmp4_ = 0UL; + sqlite3_stmt* _tmp5_ = NULL; + PhotoRow* _tmp6_ = NULL; + BackingPhotoRow* _tmp7_ = NULL; + const gchar* _tmp8_ = NULL; + gchar* _tmp9_ = NULL; + GDestroyNotify _tmp10_ = NULL; + gint _tmp11_ = 0; + gint _tmp12_ = 0; + sqlite3_stmt* _tmp13_ = NULL; + PhotoRow* _tmp14_ = NULL; + BackingPhotoRow* _tmp15_ = NULL; + Dimensions _tmp16_ = {0}; + gint _tmp17_ = 0; + gint _tmp18_ = 0; + gint _tmp19_ = 0; + sqlite3_stmt* _tmp20_ = NULL; + PhotoRow* _tmp21_ = NULL; + BackingPhotoRow* _tmp22_ = NULL; + Dimensions _tmp23_ = {0}; + gint _tmp24_ = 0; + gint _tmp25_ = 0; + gint _tmp26_ = 0; + sqlite3_stmt* _tmp27_ = NULL; + PhotoRow* _tmp28_ = NULL; + BackingPhotoRow* _tmp29_ = NULL; + gint64 _tmp30_ = 0LL; + gint _tmp31_ = 0; + gint _tmp32_ = 0; + sqlite3_stmt* _tmp33_ = NULL; + PhotoRow* _tmp34_ = NULL; + BackingPhotoRow* _tmp35_ = NULL; + time_t _tmp36_ = 0; + gint _tmp37_ = 0; + gint _tmp38_ = 0; + sqlite3_stmt* _tmp39_ = NULL; + PhotoRow* _tmp40_ = NULL; + time_t _tmp41_ = 0; + gint _tmp42_ = 0; + gint _tmp43_ = 0; + sqlite3_stmt* _tmp44_ = NULL; + PhotoRow* _tmp45_ = NULL; + BackingPhotoRow* _tmp46_ = NULL; + Orientation _tmp47_ = 0; + gint _tmp48_ = 0; + gint _tmp49_ = 0; + sqlite3_stmt* _tmp50_ = NULL; + PhotoRow* _tmp51_ = NULL; + BackingPhotoRow* _tmp52_ = NULL; + Orientation _tmp53_ = 0; + gint _tmp54_ = 0; + gint _tmp55_ = 0; + sqlite3_stmt* _tmp56_ = NULL; + PhotoRow* _tmp57_ = NULL; + ImportID _tmp58_ = {0}; + gint64 _tmp59_ = 0LL; + gint _tmp60_ = 0; + gint _tmp61_ = 0; + sqlite3_stmt* _tmp62_ = NULL; + gint _tmp63_ = 0; + gint _tmp64_ = 0; + sqlite3_stmt* _tmp65_ = NULL; + PhotoRow* _tmp66_ = NULL; + const gchar* _tmp67_ = NULL; + gchar* _tmp68_ = NULL; + GDestroyNotify _tmp69_ = NULL; + gint _tmp70_ = 0; + gint _tmp71_ = 0; + sqlite3_stmt* _tmp72_ = NULL; + PhotoRow* _tmp73_ = NULL; + const gchar* _tmp74_ = NULL; + gchar* _tmp75_ = NULL; + GDestroyNotify _tmp76_ = NULL; + gint _tmp77_ = 0; + gint _tmp78_ = 0; + sqlite3_stmt* _tmp79_ = NULL; + PhotoRow* _tmp80_ = NULL; + const gchar* _tmp81_ = NULL; + gchar* _tmp82_ = NULL; + GDestroyNotify _tmp83_ = NULL; + gint _tmp84_ = 0; + gint _tmp85_ = 0; + sqlite3_stmt* _tmp86_ = NULL; + gulong _tmp87_ = 0UL; + gint _tmp88_ = 0; + gint _tmp89_ = 0; + sqlite3_stmt* _tmp90_ = NULL; + PhotoRow* _tmp91_ = NULL; + BackingPhotoRow* _tmp92_ = NULL; + PhotoFileFormat _tmp93_ = 0; + gint _tmp94_ = 0; + gint _tmp95_ = 0; + gint _tmp96_ = 0; + sqlite3_stmt* _tmp97_ = NULL; + PhotoRow* _tmp98_ = NULL; + const gchar* _tmp99_ = NULL; + gchar* _tmp100_ = NULL; + GDestroyNotify _tmp101_ = NULL; + gint _tmp102_ = 0; + gint _tmp103_ = 0; + sqlite3_stmt* _tmp104_ = NULL; + PhotoRow* _tmp105_ = NULL; + Rating _tmp106_ = 0; + gint _tmp107_ = 0; + gint _tmp108_ = 0; + gint _tmp109_ = 0; + sqlite3_stmt* _tmp110_ = NULL; + gint _tmp111_ = 0; + gint _tmp112_ = 0; + sqlite3_stmt* _tmp113_ = NULL; + PhotoRow* _tmp114_ = NULL; + RawDeveloper _tmp115_ = 0; + gchar* _tmp116_ = NULL; + GDestroyNotify _tmp117_ = NULL; + gint _tmp118_ = 0; + gint _tmp119_ = 0; + sqlite3_stmt* _tmp120_ = NULL; + PhotoRow* _tmp121_ = NULL; + const gchar* _tmp122_ = NULL; + gchar* _tmp123_ = NULL; + GDestroyNotify _tmp124_ = NULL; + gint _tmp125_ = 0; + gint _tmp126_ = 0; + sqlite3_stmt* _tmp127_ = NULL; + gint _tmp128_ = 0; + gint _tmp129_ = 0; + PhotoRow* _tmp133_ = NULL; + sqlite3* _tmp134_ = NULL; + gint64 _tmp135_ = 0LL; + PhotoRow* _tmp136_ = NULL; + PhotoRow* _tmp137_ = NULL; + BackingPhotoRow* _tmp138_ = NULL; + Orientation _tmp139_ = 0; + PhotoRow* _tmp140_ = NULL; + PhotoRow* _tmp141_ = NULL; + gulong _tmp142_ = 0UL; + PhotoRow* _tmp143_ = NULL; + PhotoRow* _tmp144_ = NULL; + PhotoID _tmp145_ = {0}; +#line 200 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_TABLE (self)); +#line 200 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_ROW (photo_row)); +#line 202 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = database_table_db; +#line 202 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "INSERT INTO PhotoTable (filename, width, height, filesize, timestamp, " \ +"exposure_time, " "orientation, original_orientation, import_id, event_id, md5, thumbnail" \ +"_md5, " "exif_md5, time_created, file_format, title, rating, editable_id, devel" \ +"oper, comment) " "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", -1, &_tmp1_, NULL); +#line 202 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 202 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp1_; +#line 202 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp2_; +#line 208 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = res; +#line 208 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 210 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = now_sec (); +#line 210 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + time_created = _tmp4_; +#line 212 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = stmt; +#line 212 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = photo_row; +#line 212 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = _tmp6_->master; +#line 212 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = _tmp7_->filepath; +#line 212 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = g_strdup (_tmp8_); +#line 212 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = g_free; +#line 212 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = sqlite3_bind_text (_tmp5_, 1, _tmp9_, -1, _tmp10_); +#line 212 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp11_; +#line 213 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = res; +#line 213 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp12_ == SQLITE_OK, "res == Sqlite.OK"); +#line 214 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = stmt; +#line 214 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = photo_row; +#line 214 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = _tmp14_->master; +#line 214 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = _tmp15_->dim; +#line 214 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp17_ = _tmp16_.width; +#line 214 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp18_ = sqlite3_bind_int (_tmp13_, 2, _tmp17_); +#line 214 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp18_; +#line 215 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp19_ = res; +#line 215 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp19_ == SQLITE_OK, "res == Sqlite.OK"); +#line 216 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp20_ = stmt; +#line 216 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp21_ = photo_row; +#line 216 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp22_ = _tmp21_->master; +#line 216 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp23_ = _tmp22_->dim; +#line 216 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp24_ = _tmp23_.height; +#line 216 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp25_ = sqlite3_bind_int (_tmp20_, 3, _tmp24_); +#line 216 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp25_; +#line 217 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp26_ = res; +#line 217 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp26_ == SQLITE_OK, "res == Sqlite.OK"); +#line 218 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp27_ = stmt; +#line 218 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp28_ = photo_row; +#line 218 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp29_ = _tmp28_->master; +#line 218 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp30_ = _tmp29_->filesize; +#line 218 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp31_ = sqlite3_bind_int64 (_tmp27_, 4, _tmp30_); +#line 218 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp31_; +#line 219 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp32_ = res; +#line 219 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp32_ == SQLITE_OK, "res == Sqlite.OK"); +#line 220 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp33_ = stmt; +#line 220 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp34_ = photo_row; +#line 220 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp35_ = _tmp34_->master; +#line 220 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp36_ = _tmp35_->timestamp; +#line 220 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp37_ = sqlite3_bind_int64 (_tmp33_, 5, (gint64) _tmp36_); +#line 220 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp37_; +#line 221 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp38_ = res; +#line 221 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp38_ == SQLITE_OK, "res == Sqlite.OK"); +#line 222 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp39_ = stmt; +#line 222 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp40_ = photo_row; +#line 222 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp41_ = _tmp40_->exposure_time; +#line 222 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp42_ = sqlite3_bind_int64 (_tmp39_, 6, (gint64) _tmp41_); +#line 222 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp42_; +#line 223 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp43_ = res; +#line 223 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp43_ == SQLITE_OK, "res == Sqlite.OK"); +#line 224 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp44_ = stmt; +#line 224 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp45_ = photo_row; +#line 224 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp46_ = _tmp45_->master; +#line 224 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp47_ = _tmp46_->original_orientation; +#line 224 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp48_ = sqlite3_bind_int (_tmp44_, 7, (gint) _tmp47_); +#line 224 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp48_; +#line 225 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp49_ = res; +#line 225 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp49_ == SQLITE_OK, "res == Sqlite.OK"); +#line 226 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp50_ = stmt; +#line 226 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp51_ = photo_row; +#line 226 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp52_ = _tmp51_->master; +#line 226 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp53_ = _tmp52_->original_orientation; +#line 226 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp54_ = sqlite3_bind_int (_tmp50_, 8, (gint) _tmp53_); +#line 226 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp54_; +#line 227 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp55_ = res; +#line 227 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp55_ == SQLITE_OK, "res == Sqlite.OK"); +#line 228 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp56_ = stmt; +#line 228 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp57_ = photo_row; +#line 228 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp58_ = _tmp57_->import_id; +#line 228 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp59_ = _tmp58_.id; +#line 228 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp60_ = sqlite3_bind_int64 (_tmp56_, 9, _tmp59_); +#line 228 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp60_; +#line 229 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp61_ = res; +#line 229 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp61_ == SQLITE_OK, "res == Sqlite.OK"); +#line 230 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp62_ = stmt; +#line 230 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp63_ = sqlite3_bind_int64 (_tmp62_, 10, EVENT_ID_INVALID); +#line 230 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp63_; +#line 231 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp64_ = res; +#line 231 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp64_ == SQLITE_OK, "res == Sqlite.OK"); +#line 232 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp65_ = stmt; +#line 232 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp66_ = photo_row; +#line 232 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp67_ = _tmp66_->md5; +#line 232 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp68_ = g_strdup (_tmp67_); +#line 232 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp69_ = g_free; +#line 232 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp70_ = sqlite3_bind_text (_tmp65_, 11, _tmp68_, -1, _tmp69_); +#line 232 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp70_; +#line 233 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp71_ = res; +#line 233 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp71_ == SQLITE_OK, "res == Sqlite.OK"); +#line 234 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp72_ = stmt; +#line 234 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp73_ = photo_row; +#line 234 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp74_ = _tmp73_->thumbnail_md5; +#line 234 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp75_ = g_strdup (_tmp74_); +#line 234 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp76_ = g_free; +#line 234 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp77_ = sqlite3_bind_text (_tmp72_, 12, _tmp75_, -1, _tmp76_); +#line 234 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp77_; +#line 235 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp78_ = res; +#line 235 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp78_ == SQLITE_OK, "res == Sqlite.OK"); +#line 236 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp79_ = stmt; +#line 236 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp80_ = photo_row; +#line 236 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp81_ = _tmp80_->exif_md5; +#line 236 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp82_ = g_strdup (_tmp81_); +#line 236 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp83_ = g_free; +#line 236 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp84_ = sqlite3_bind_text (_tmp79_, 13, _tmp82_, -1, _tmp83_); +#line 236 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp84_; +#line 237 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp85_ = res; +#line 237 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp85_ == SQLITE_OK, "res == Sqlite.OK"); +#line 238 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp86_ = stmt; +#line 238 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp87_ = time_created; +#line 238 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp88_ = sqlite3_bind_int64 (_tmp86_, 14, (gint64) _tmp87_); +#line 238 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp88_; +#line 239 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp89_ = res; +#line 239 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp89_ == SQLITE_OK, "res == Sqlite.OK"); +#line 240 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp90_ = stmt; +#line 240 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp91_ = photo_row; +#line 240 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp92_ = _tmp91_->master; +#line 240 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp93_ = _tmp92_->file_format; +#line 240 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp94_ = photo_file_format_serialize (_tmp93_); +#line 240 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp95_ = sqlite3_bind_int (_tmp90_, 15, _tmp94_); +#line 240 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp95_; +#line 241 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp96_ = res; +#line 241 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp96_ == SQLITE_OK, "res == Sqlite.OK"); +#line 242 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp97_ = stmt; +#line 242 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp98_ = photo_row; +#line 242 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp99_ = _tmp98_->title; +#line 242 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp100_ = g_strdup (_tmp99_); +#line 242 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp101_ = g_free; +#line 242 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp102_ = sqlite3_bind_text (_tmp97_, 16, _tmp100_, -1, _tmp101_); +#line 242 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp102_; +#line 243 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp103_ = res; +#line 243 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp103_ == SQLITE_OK, "res == Sqlite.OK"); +#line 244 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp104_ = stmt; +#line 244 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp105_ = photo_row; +#line 244 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp106_ = _tmp105_->rating; +#line 244 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp107_ = rating_serialize (_tmp106_); +#line 244 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp108_ = sqlite3_bind_int64 (_tmp104_, 17, (gint64) _tmp107_); +#line 244 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp108_; +#line 245 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp109_ = res; +#line 245 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp109_ == SQLITE_OK, "res == Sqlite.OK"); +#line 246 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp110_ = stmt; +#line 246 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp111_ = sqlite3_bind_int64 (_tmp110_, 18, BACKING_PHOTO_ID_INVALID); +#line 246 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp111_; +#line 247 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp112_ = res; +#line 247 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp112_ == SQLITE_OK, "res == Sqlite.OK"); +#line 248 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp113_ = stmt; +#line 248 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp114_ = photo_row; +#line 248 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp115_ = _tmp114_->developer; +#line 248 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp116_ = raw_developer_to_string (_tmp115_); +#line 248 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp117_ = g_free; +#line 248 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp118_ = sqlite3_bind_text (_tmp113_, 19, _tmp116_, -1, _tmp117_); +#line 248 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp118_; +#line 249 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp119_ = res; +#line 249 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp119_ == SQLITE_OK, "res == Sqlite.OK"); +#line 250 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp120_ = stmt; +#line 250 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp121_ = photo_row; +#line 250 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp122_ = _tmp121_->comment; +#line 250 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp123_ = g_strdup (_tmp122_); +#line 250 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp124_ = g_free; +#line 250 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp125_ = sqlite3_bind_text (_tmp120_, 20, _tmp123_, -1, _tmp124_); +#line 250 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp125_; +#line 251 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp126_ = res; +#line 251 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp126_ == SQLITE_OK, "res == Sqlite.OK"); +#line 253 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp127_ = stmt; +#line 253 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp128_ = sqlite3_step (_tmp127_); +#line 253 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp128_; +#line 254 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp129_ = res; +#line 254 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp129_ != SQLITE_DONE) { +#line 1880 "PhotoTable.c" + gint _tmp130_ = 0; + PhotoID _tmp132_ = {0}; +#line 255 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp130_ = res; +#line 255 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp130_ != SQLITE_CONSTRAINT) { +#line 1887 "PhotoTable.c" + gint _tmp131_ = 0; +#line 256 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp131_ = res; +#line 256 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_fatal ("add_photo", _tmp131_); +#line 1893 "PhotoTable.c" + } +#line 258 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + photo_id_init (&_tmp132_, PHOTO_ID_INVALID); +#line 258 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + *result = _tmp132_; +#line 258 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 258 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 1903 "PhotoTable.c" + } +#line 262 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp133_ = photo_row; +#line 262 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp134_ = database_table_db; +#line 262 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp135_ = sqlite3_last_insert_rowid (_tmp134_); +#line 262 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + photo_id_init (&_tmp133_->photo_id, _tmp135_); +#line 263 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp136_ = photo_row; +#line 263 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp137_ = photo_row; +#line 263 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp138_ = _tmp137_->master; +#line 263 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp139_ = _tmp138_->original_orientation; +#line 263 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp136_->orientation = _tmp139_; +#line 264 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp140_ = photo_row; +#line 264 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + event_id_init (&_tmp140_->event_id, EVENT_ID_INVALID); +#line 265 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp141_ = photo_row; +#line 265 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp142_ = time_created; +#line 265 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp141_->time_created = (time_t) _tmp142_; +#line 266 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp143_ = photo_row; +#line 266 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp143_->flags = (guint64) 0; +#line 268 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp144_ = photo_row; +#line 268 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp145_ = _tmp144_->photo_id; +#line 268 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + *result = _tmp145_; +#line 268 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 268 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 1947 "PhotoTable.c" +} + + +void photo_table_reimport (PhotoTable* self, PhotoRow* row, GError** error) { + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + time_t time_reimported = 0; + gulong _tmp4_ = 0UL; + sqlite3_stmt* _tmp5_ = NULL; + PhotoRow* _tmp6_ = NULL; + BackingPhotoRow* _tmp7_ = NULL; + Dimensions _tmp8_ = {0}; + gint _tmp9_ = 0; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + sqlite3_stmt* _tmp12_ = NULL; + PhotoRow* _tmp13_ = NULL; + BackingPhotoRow* _tmp14_ = NULL; + Dimensions _tmp15_ = {0}; + gint _tmp16_ = 0; + gint _tmp17_ = 0; + gint _tmp18_ = 0; + sqlite3_stmt* _tmp19_ = NULL; + PhotoRow* _tmp20_ = NULL; + BackingPhotoRow* _tmp21_ = NULL; + gint64 _tmp22_ = 0LL; + gint _tmp23_ = 0; + gint _tmp24_ = 0; + sqlite3_stmt* _tmp25_ = NULL; + PhotoRow* _tmp26_ = NULL; + BackingPhotoRow* _tmp27_ = NULL; + time_t _tmp28_ = 0; + gint _tmp29_ = 0; + gint _tmp30_ = 0; + sqlite3_stmt* _tmp31_ = NULL; + PhotoRow* _tmp32_ = NULL; + time_t _tmp33_ = 0; + gint _tmp34_ = 0; + gint _tmp35_ = 0; + sqlite3_stmt* _tmp36_ = NULL; + PhotoRow* _tmp37_ = NULL; + BackingPhotoRow* _tmp38_ = NULL; + Orientation _tmp39_ = 0; + gint _tmp40_ = 0; + gint _tmp41_ = 0; + sqlite3_stmt* _tmp42_ = NULL; + PhotoRow* _tmp43_ = NULL; + BackingPhotoRow* _tmp44_ = NULL; + Orientation _tmp45_ = 0; + gint _tmp46_ = 0; + gint _tmp47_ = 0; + sqlite3_stmt* _tmp48_ = NULL; + PhotoRow* _tmp49_ = NULL; + const gchar* _tmp50_ = NULL; + gchar* _tmp51_ = NULL; + GDestroyNotify _tmp52_ = NULL; + gint _tmp53_ = 0; + gint _tmp54_ = 0; + sqlite3_stmt* _tmp55_ = NULL; + PhotoRow* _tmp56_ = NULL; + const gchar* _tmp57_ = NULL; + gchar* _tmp58_ = NULL; + GDestroyNotify _tmp59_ = NULL; + gint _tmp60_ = 0; + gint _tmp61_ = 0; + sqlite3_stmt* _tmp62_ = NULL; + PhotoRow* _tmp63_ = NULL; + const gchar* _tmp64_ = NULL; + gchar* _tmp65_ = NULL; + GDestroyNotify _tmp66_ = NULL; + gint _tmp67_ = 0; + gint _tmp68_ = 0; + sqlite3_stmt* _tmp69_ = NULL; + PhotoRow* _tmp70_ = NULL; + BackingPhotoRow* _tmp71_ = NULL; + PhotoFileFormat _tmp72_ = 0; + gint _tmp73_ = 0; + gint _tmp74_ = 0; + gint _tmp75_ = 0; + sqlite3_stmt* _tmp76_ = NULL; + PhotoRow* _tmp77_ = NULL; + const gchar* _tmp78_ = NULL; + gchar* _tmp79_ = NULL; + GDestroyNotify _tmp80_ = NULL; + gint _tmp81_ = 0; + gint _tmp82_ = 0; + sqlite3_stmt* _tmp83_ = NULL; + time_t _tmp84_ = 0; + gint _tmp85_ = 0; + gint _tmp86_ = 0; + sqlite3_stmt* _tmp87_ = NULL; + PhotoRow* _tmp88_ = NULL; + PhotoID _tmp89_ = {0}; + gint64 _tmp90_ = 0LL; + gint _tmp91_ = 0; + gint _tmp92_ = 0; + sqlite3_stmt* _tmp93_ = NULL; + gint _tmp94_ = 0; + gint _tmp95_ = 0; + PhotoRow* _tmp97_ = NULL; + time_t _tmp98_ = 0; + PhotoRow* _tmp99_ = NULL; + PhotoRow* _tmp100_ = NULL; + BackingPhotoRow* _tmp101_ = NULL; + Orientation _tmp102_ = 0; + GError * _inner_error_ = NULL; +#line 276 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_TABLE (self)); +#line 276 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_ROW (row)); +#line 278 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = database_table_db; +#line 278 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "UPDATE PhotoTable SET width = ?, height = ?, filesize = ?, timestamp =" \ +" ?, " "exposure_time = ?, orientation = ?, original_orientation = ?, md5 = ?," \ +" " "exif_md5 = ?, thumbnail_md5 = ?, file_format = ?, title = ?, time_reim" \ +"ported = ? " "WHERE id = ?", -1, &_tmp1_, NULL); +#line 278 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 278 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp1_; +#line 278 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp2_; +#line 283 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = res; +#line 283 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 285 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = now_sec (); +#line 285 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + time_reimported = (time_t) _tmp4_; +#line 287 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = stmt; +#line 287 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = row; +#line 287 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = _tmp6_->master; +#line 287 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = _tmp7_->dim; +#line 287 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = _tmp8_.width; +#line 287 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = sqlite3_bind_int (_tmp5_, 1, _tmp9_); +#line 287 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp10_; +#line 288 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = res; +#line 288 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp11_ == SQLITE_OK, "res == Sqlite.OK"); +#line 289 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = stmt; +#line 289 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = row; +#line 289 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = _tmp13_->master; +#line 289 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = _tmp14_->dim; +#line 289 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = _tmp15_.height; +#line 289 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp17_ = sqlite3_bind_int (_tmp12_, 2, _tmp16_); +#line 289 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp17_; +#line 290 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp18_ = res; +#line 290 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp18_ == SQLITE_OK, "res == Sqlite.OK"); +#line 291 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp19_ = stmt; +#line 291 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp20_ = row; +#line 291 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp21_ = _tmp20_->master; +#line 291 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp22_ = _tmp21_->filesize; +#line 291 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp23_ = sqlite3_bind_int64 (_tmp19_, 3, _tmp22_); +#line 291 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp23_; +#line 292 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp24_ = res; +#line 292 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp24_ == SQLITE_OK, "res == Sqlite.OK"); +#line 293 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp25_ = stmt; +#line 293 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp26_ = row; +#line 293 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp27_ = _tmp26_->master; +#line 293 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp28_ = _tmp27_->timestamp; +#line 293 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp29_ = sqlite3_bind_int64 (_tmp25_, 4, (gint64) _tmp28_); +#line 293 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp29_; +#line 294 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp30_ = res; +#line 294 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp30_ == SQLITE_OK, "res == Sqlite.OK"); +#line 295 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp31_ = stmt; +#line 295 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp32_ = row; +#line 295 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp33_ = _tmp32_->exposure_time; +#line 295 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp34_ = sqlite3_bind_int64 (_tmp31_, 5, (gint64) _tmp33_); +#line 295 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp34_; +#line 296 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp35_ = res; +#line 296 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp35_ == SQLITE_OK, "res == Sqlite.OK"); +#line 297 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp36_ = stmt; +#line 297 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp37_ = row; +#line 297 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp38_ = _tmp37_->master; +#line 297 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp39_ = _tmp38_->original_orientation; +#line 297 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp40_ = sqlite3_bind_int (_tmp36_, 6, (gint) _tmp39_); +#line 297 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp40_; +#line 298 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp41_ = res; +#line 298 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp41_ == SQLITE_OK, "res == Sqlite.OK"); +#line 299 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp42_ = stmt; +#line 299 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp43_ = row; +#line 299 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp44_ = _tmp43_->master; +#line 299 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp45_ = _tmp44_->original_orientation; +#line 299 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp46_ = sqlite3_bind_int (_tmp42_, 7, (gint) _tmp45_); +#line 299 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp46_; +#line 300 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp47_ = res; +#line 300 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp47_ == SQLITE_OK, "res == Sqlite.OK"); +#line 301 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp48_ = stmt; +#line 301 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp49_ = row; +#line 301 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp50_ = _tmp49_->md5; +#line 301 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp51_ = g_strdup (_tmp50_); +#line 301 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp52_ = g_free; +#line 301 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp53_ = sqlite3_bind_text (_tmp48_, 8, _tmp51_, -1, _tmp52_); +#line 301 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp53_; +#line 302 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp54_ = res; +#line 302 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp54_ == SQLITE_OK, "res == Sqlite.OK"); +#line 303 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp55_ = stmt; +#line 303 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp56_ = row; +#line 303 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp57_ = _tmp56_->exif_md5; +#line 303 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp58_ = g_strdup (_tmp57_); +#line 303 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp59_ = g_free; +#line 303 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp60_ = sqlite3_bind_text (_tmp55_, 9, _tmp58_, -1, _tmp59_); +#line 303 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp60_; +#line 304 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp61_ = res; +#line 304 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp61_ == SQLITE_OK, "res == Sqlite.OK"); +#line 305 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp62_ = stmt; +#line 305 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp63_ = row; +#line 305 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp64_ = _tmp63_->thumbnail_md5; +#line 305 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp65_ = g_strdup (_tmp64_); +#line 305 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp66_ = g_free; +#line 305 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp67_ = sqlite3_bind_text (_tmp62_, 10, _tmp65_, -1, _tmp66_); +#line 305 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp67_; +#line 306 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp68_ = res; +#line 306 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp68_ == SQLITE_OK, "res == Sqlite.OK"); +#line 307 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp69_ = stmt; +#line 307 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp70_ = row; +#line 307 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp71_ = _tmp70_->master; +#line 307 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp72_ = _tmp71_->file_format; +#line 307 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp73_ = photo_file_format_serialize (_tmp72_); +#line 307 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp74_ = sqlite3_bind_int (_tmp69_, 11, _tmp73_); +#line 307 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp74_; +#line 308 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp75_ = res; +#line 308 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp75_ == SQLITE_OK, "res == Sqlite.OK"); +#line 309 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp76_ = stmt; +#line 309 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp77_ = row; +#line 309 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp78_ = _tmp77_->title; +#line 309 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp79_ = g_strdup (_tmp78_); +#line 309 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp80_ = g_free; +#line 309 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp81_ = sqlite3_bind_text (_tmp76_, 12, _tmp79_, -1, _tmp80_); +#line 309 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp81_; +#line 310 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp82_ = res; +#line 310 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp82_ == SQLITE_OK, "res == Sqlite.OK"); +#line 311 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp83_ = stmt; +#line 311 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp84_ = time_reimported; +#line 311 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp85_ = sqlite3_bind_int64 (_tmp83_, 13, (gint64) _tmp84_); +#line 311 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp85_; +#line 312 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp86_ = res; +#line 312 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp86_ == SQLITE_OK, "res == Sqlite.OK"); +#line 313 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp87_ = stmt; +#line 313 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp88_ = row; +#line 313 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp89_ = _tmp88_->photo_id; +#line 313 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp90_ = _tmp89_.id; +#line 313 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp91_ = sqlite3_bind_int64 (_tmp87_, 14, _tmp90_); +#line 313 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp91_; +#line 314 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp92_ = res; +#line 314 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp92_ == SQLITE_OK, "res == Sqlite.OK"); +#line 316 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp93_ = stmt; +#line 316 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp94_ = sqlite3_step (_tmp93_); +#line 316 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp94_; +#line 317 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp95_ = res; +#line 317 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp95_ != SQLITE_DONE) { +#line 2322 "PhotoTable.c" + gint _tmp96_ = 0; +#line 318 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp96_ = res; +#line 318 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_throw_error ("PhotoTable.reimport_master", _tmp96_, &_inner_error_); +#line 318 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 318 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 318 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_propagate_error (error, _inner_error_); +#line 318 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 318 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 2338 "PhotoTable.c" + } else { +#line 318 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 318 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 318 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 318 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 2348 "PhotoTable.c" + } + } + } +#line 320 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp97_ = row; +#line 320 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp98_ = time_reimported; +#line 320 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp97_->time_reimported = _tmp98_; +#line 321 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp99_ = row; +#line 321 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp100_ = row; +#line 321 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp101_ = _tmp100_->master; +#line 321 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp102_ = _tmp101_->original_orientation; +#line 321 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp99_->orientation = _tmp102_; +#line 276 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 2370 "PhotoTable.c" +} + + +gboolean photo_table_master_exif_updated (PhotoTable* self, PhotoID* photoID, gint64 filesize, glong timestamp, const gchar* md5, const gchar* exif_md5, const gchar* thumbnail_md5, PhotoRow* row) { + gboolean result = FALSE; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + gint64 _tmp5_ = 0LL; + gint _tmp6_ = 0; + gint _tmp7_ = 0; + sqlite3_stmt* _tmp8_ = NULL; + glong _tmp9_ = 0L; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + sqlite3_stmt* _tmp12_ = NULL; + const gchar* _tmp13_ = NULL; + gchar* _tmp14_ = NULL; + GDestroyNotify _tmp15_ = NULL; + gint _tmp16_ = 0; + gint _tmp17_ = 0; + sqlite3_stmt* _tmp18_ = NULL; + const gchar* _tmp19_ = NULL; + gchar* _tmp20_ = NULL; + GDestroyNotify _tmp21_ = NULL; + gint _tmp22_ = 0; + gint _tmp23_ = 0; + sqlite3_stmt* _tmp24_ = NULL; + const gchar* _tmp25_ = NULL; + gchar* _tmp26_ = NULL; + GDestroyNotify _tmp27_ = NULL; + gint _tmp28_ = 0; + gint _tmp29_ = 0; + sqlite3_stmt* _tmp30_ = NULL; + PhotoID _tmp31_ = {0}; + gint64 _tmp32_ = 0LL; + gint _tmp33_ = 0; + gint _tmp34_ = 0; + sqlite3_stmt* _tmp35_ = NULL; + gint _tmp36_ = 0; + gint _tmp37_ = 0; + PhotoRow* _tmp40_ = NULL; + BackingPhotoRow* _tmp41_ = NULL; + gint64 _tmp42_ = 0LL; + PhotoRow* _tmp43_ = NULL; + BackingPhotoRow* _tmp44_ = NULL; + glong _tmp45_ = 0L; + PhotoRow* _tmp46_ = NULL; + const gchar* _tmp47_ = NULL; + gchar* _tmp48_ = NULL; + PhotoRow* _tmp49_ = NULL; + const gchar* _tmp50_ = NULL; + gchar* _tmp51_ = NULL; + PhotoRow* _tmp52_ = NULL; + const gchar* _tmp53_ = NULL; + gchar* _tmp54_ = NULL; +#line 324 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), FALSE); +#line 324 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (photoID != NULL, FALSE); +#line 324 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (md5 != NULL, FALSE); +#line 324 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_ROW (row), FALSE); +#line 327 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = database_table_db; +#line 327 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "UPDATE PhotoTable SET filesize = ?, timestamp = ?, md5 = ?, exif_md5 =" \ +" ?," "thumbnail_md5 =? WHERE id = ?", -1, &_tmp1_, NULL); +#line 327 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 327 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp1_; +#line 327 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp2_; +#line 330 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = res; +#line 330 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 332 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = stmt; +#line 332 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = filesize; +#line 332 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = sqlite3_bind_int64 (_tmp4_, 1, _tmp5_); +#line 332 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp6_; +#line 333 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = res; +#line 333 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp7_ == SQLITE_OK, "res == Sqlite.OK"); +#line 334 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = stmt; +#line 334 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = timestamp; +#line 334 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = sqlite3_bind_int64 (_tmp8_, 2, (gint64) _tmp9_); +#line 334 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp10_; +#line 335 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = res; +#line 335 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp11_ == SQLITE_OK, "res == Sqlite.OK"); +#line 336 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = stmt; +#line 336 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = md5; +#line 336 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = g_strdup (_tmp13_); +#line 336 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = g_free; +#line 336 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = sqlite3_bind_text (_tmp12_, 3, _tmp14_, -1, _tmp15_); +#line 336 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp16_; +#line 337 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp17_ = res; +#line 337 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp17_ == SQLITE_OK, "res == Sqlite.OK"); +#line 338 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp18_ = stmt; +#line 338 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp19_ = exif_md5; +#line 338 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp20_ = g_strdup (_tmp19_); +#line 338 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp21_ = g_free; +#line 338 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp22_ = sqlite3_bind_text (_tmp18_, 4, _tmp20_, -1, _tmp21_); +#line 338 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp22_; +#line 339 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp23_ = res; +#line 339 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp23_ == SQLITE_OK, "res == Sqlite.OK"); +#line 340 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp24_ = stmt; +#line 340 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp25_ = thumbnail_md5; +#line 340 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp26_ = g_strdup (_tmp25_); +#line 340 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp27_ = g_free; +#line 340 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp28_ = sqlite3_bind_text (_tmp24_, 5, _tmp26_, -1, _tmp27_); +#line 340 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp28_; +#line 341 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp29_ = res; +#line 341 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp29_ == SQLITE_OK, "res == Sqlite.OK"); +#line 342 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp30_ = stmt; +#line 342 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp31_ = *photoID; +#line 342 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp32_ = _tmp31_.id; +#line 342 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp33_ = sqlite3_bind_int64 (_tmp30_, 6, _tmp32_); +#line 342 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp33_; +#line 343 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp34_ = res; +#line 343 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp34_ == SQLITE_OK, "res == Sqlite.OK"); +#line 345 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp35_ = stmt; +#line 345 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp36_ = sqlite3_step (_tmp35_); +#line 345 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp36_; +#line 346 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp37_ = res; +#line 346 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp37_ != SQLITE_DONE) { +#line 2549 "PhotoTable.c" + gint _tmp38_ = 0; +#line 347 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp38_ = res; +#line 347 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp38_ != SQLITE_CONSTRAINT) { +#line 2555 "PhotoTable.c" + gint _tmp39_ = 0; +#line 348 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp39_ = res; +#line 348 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_fatal ("write_update_photo", _tmp39_); +#line 2561 "PhotoTable.c" + } +#line 350 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = FALSE; +#line 350 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 350 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 2569 "PhotoTable.c" + } +#line 353 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp40_ = row; +#line 353 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp41_ = _tmp40_->master; +#line 353 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp42_ = filesize; +#line 353 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp41_->filesize = _tmp42_; +#line 354 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp43_ = row; +#line 354 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp44_ = _tmp43_->master; +#line 354 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp45_ = timestamp; +#line 354 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp44_->timestamp = (time_t) _tmp45_; +#line 355 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp46_ = row; +#line 355 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp47_ = md5; +#line 355 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp48_ = g_strdup (_tmp47_); +#line 355 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp46_->md5); +#line 355 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp46_->md5 = _tmp48_; +#line 356 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp49_ = row; +#line 356 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp50_ = exif_md5; +#line 356 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp51_ = g_strdup (_tmp50_); +#line 356 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp49_->exif_md5); +#line 356 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp49_->exif_md5 = _tmp51_; +#line 357 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp52_ = row; +#line 357 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp53_ = thumbnail_md5; +#line 357 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp54_ = g_strdup (_tmp53_); +#line 357 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp52_->thumbnail_md5); +#line 357 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp52_->thumbnail_md5 = _tmp54_; +#line 359 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = TRUE; +#line 359 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 359 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 2623 "PhotoTable.c" +} + + +static void photo_table_validate_orientation (PhotoTable* self, PhotoRow* row) { + gboolean _tmp0_ = FALSE; + PhotoRow* _tmp1_ = NULL; + Orientation _tmp2_ = 0; +#line 370 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_TABLE (self)); +#line 370 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_ROW (row)); +#line 371 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = row; +#line 371 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = _tmp1_->orientation; +#line 371 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp2_ < ORIENTATION_MIN) { +#line 371 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = TRUE; +#line 2643 "PhotoTable.c" + } else { + PhotoRow* _tmp3_ = NULL; + Orientation _tmp4_ = 0; +#line 372 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = row; +#line 372 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = _tmp3_->orientation; +#line 372 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = _tmp4_ > ORIENTATION_MAX; +#line 2653 "PhotoTable.c" + } +#line 371 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp0_) { +#line 2657 "PhotoTable.c" + PhotoRow* _tmp5_ = NULL; + PhotoID _tmp6_ = {0}; + PhotoRow* _tmp7_ = NULL; +#line 374 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = row; +#line 374 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = _tmp5_->photo_id; +#line 374 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + photo_table_set_orientation (self, &_tmp6_, ORIENTATION_MIN); +#line 375 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = row; +#line 375 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_->orientation = ORIENTATION_MIN; +#line 2671 "PhotoTable.c" + } +} + + +PhotoRow* photo_table_get_row (PhotoTable* self, PhotoID* photo_id) { + PhotoRow* result = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + PhotoID _tmp5_ = {0}; + gint64 _tmp6_ = 0LL; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + sqlite3_stmt* _tmp9_ = NULL; + gint _tmp10_ = 0; + PhotoRow* row = NULL; + PhotoRow* _tmp11_ = NULL; + PhotoRow* _tmp12_ = NULL; + PhotoID _tmp13_ = {0}; + PhotoRow* _tmp14_ = NULL; + BackingPhotoRow* _tmp15_ = NULL; + sqlite3_stmt* _tmp16_ = NULL; + const gchar* _tmp17_ = NULL; + gchar* _tmp18_ = NULL; + PhotoRow* _tmp19_ = NULL; + BackingPhotoRow* _tmp20_ = NULL; + sqlite3_stmt* _tmp21_ = NULL; + gint _tmp22_ = 0; + sqlite3_stmt* _tmp23_ = NULL; + gint _tmp24_ = 0; + PhotoRow* _tmp25_ = NULL; + BackingPhotoRow* _tmp26_ = NULL; + sqlite3_stmt* _tmp27_ = NULL; + gint64 _tmp28_ = 0LL; + PhotoRow* _tmp29_ = NULL; + BackingPhotoRow* _tmp30_ = NULL; + sqlite3_stmt* _tmp31_ = NULL; + gint64 _tmp32_ = 0LL; + PhotoRow* _tmp33_ = NULL; + sqlite3_stmt* _tmp34_ = NULL; + gint64 _tmp35_ = 0LL; + PhotoRow* _tmp36_ = NULL; + sqlite3_stmt* _tmp37_ = NULL; + gint _tmp38_ = 0; + PhotoRow* _tmp39_ = NULL; + BackingPhotoRow* _tmp40_ = NULL; + sqlite3_stmt* _tmp41_ = NULL; + gint _tmp42_ = 0; + PhotoRow* _tmp43_ = NULL; + sqlite3_stmt* _tmp44_ = NULL; + gint64 _tmp45_ = 0LL; + PhotoRow* _tmp46_ = NULL; + sqlite3_stmt* _tmp47_ = NULL; + gint64 _tmp48_ = 0LL; + PhotoRow* _tmp49_ = NULL; + sqlite3_stmt* _tmp50_ = NULL; + const gchar* _tmp51_ = NULL; + GeeHashMap* _tmp52_ = NULL; + PhotoRow* _tmp53_ = NULL; + sqlite3_stmt* _tmp54_ = NULL; + const gchar* _tmp55_ = NULL; + gchar* _tmp56_ = NULL; + PhotoRow* _tmp57_ = NULL; + sqlite3_stmt* _tmp58_ = NULL; + const gchar* _tmp59_ = NULL; + gchar* _tmp60_ = NULL; + PhotoRow* _tmp61_ = NULL; + sqlite3_stmt* _tmp62_ = NULL; + const gchar* _tmp63_ = NULL; + gchar* _tmp64_ = NULL; + PhotoRow* _tmp65_ = NULL; + sqlite3_stmt* _tmp66_ = NULL; + gint64 _tmp67_ = 0LL; + PhotoRow* _tmp68_ = NULL; + sqlite3_stmt* _tmp69_ = NULL; + gint64 _tmp70_ = 0LL; + PhotoRow* _tmp71_ = NULL; + sqlite3_stmt* _tmp72_ = NULL; + gint _tmp73_ = 0; + Rating _tmp74_ = 0; + PhotoRow* _tmp75_ = NULL; + BackingPhotoRow* _tmp76_ = NULL; + sqlite3_stmt* _tmp77_ = NULL; + gint _tmp78_ = 0; + PhotoFileFormat _tmp79_ = 0; + PhotoRow* _tmp80_ = NULL; + sqlite3_stmt* _tmp81_ = NULL; + const gchar* _tmp82_ = NULL; + gchar* _tmp83_ = NULL; + PhotoRow* _tmp84_ = NULL; + sqlite3_stmt* _tmp85_ = NULL; + const gchar* _tmp86_ = NULL; + gchar* _tmp87_ = NULL; + PhotoRow* _tmp88_ = NULL; + sqlite3_stmt* _tmp89_ = NULL; + gint64 _tmp90_ = 0LL; + PhotoRow* _tmp91_ = NULL; + sqlite3_stmt* _tmp92_ = NULL; + gint64 _tmp93_ = 0LL; + PhotoRow* _tmp94_ = NULL; + sqlite3_stmt* _tmp95_ = NULL; + gint _tmp96_ = 0; + RawDeveloper _tmp97_ = 0; + sqlite3_stmt* _tmp98_ = NULL; + const gchar* _tmp99_ = NULL; + PhotoRow* _tmp103_ = NULL; + PhotoRow* _tmp104_ = NULL; + BackingPhotoID* _tmp105_ = NULL; + gint _tmp105__length1 = 0; + sqlite3_stmt* _tmp106_ = NULL; + gint64 _tmp107_ = 0LL; + BackingPhotoID _tmp108_ = {0}; + BackingPhotoID _tmp109_ = {0}; + PhotoRow* _tmp110_ = NULL; + BackingPhotoID* _tmp111_ = NULL; + gint _tmp111__length1 = 0; + sqlite3_stmt* _tmp112_ = NULL; + gint64 _tmp113_ = 0LL; + BackingPhotoID _tmp114_ = {0}; + BackingPhotoID _tmp115_ = {0}; + PhotoRow* _tmp116_ = NULL; + BackingPhotoID* _tmp117_ = NULL; + gint _tmp117__length1 = 0; + sqlite3_stmt* _tmp118_ = NULL; + gint64 _tmp119_ = 0LL; + BackingPhotoID _tmp120_ = {0}; + BackingPhotoID _tmp121_ = {0}; + PhotoRow* _tmp122_ = NULL; + sqlite3_stmt* _tmp123_ = NULL; + const gchar* _tmp124_ = NULL; + gchar* _tmp125_ = NULL; +#line 379 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), NULL); +#line 379 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (photo_id != NULL, NULL); +#line 381 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = database_table_db; +#line 381 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "SELECT filename, width, height, filesize, timestamp, exposure_time, or" \ +"ientation, " "original_orientation, import_id, event_id, transformations, md5, thumb" \ +"nail_md5, " "exif_md5, time_created, flags, rating, file_format, title, backlinks, " "time_reimported, editable_id, metadata_dirty, developer, develop_shotw" \ +"ell_id, " "develop_camera_id, develop_embedded_id, comment " "FROM PhotoTable WHERE id=?", -1, &_tmp1_, NULL); +#line 381 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 381 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp1_; +#line 381 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp2_; +#line 389 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = res; +#line 389 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 391 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = stmt; +#line 391 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = *photo_id; +#line 391 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = _tmp5_.id; +#line 391 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = sqlite3_bind_int64 (_tmp4_, 1, _tmp6_); +#line 391 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp7_; +#line 392 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = res; +#line 392 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp8_ == SQLITE_OK, "res == Sqlite.OK"); +#line 394 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = stmt; +#line 394 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = sqlite3_step (_tmp9_); +#line 394 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp10_ != SQLITE_ROW) { +#line 395 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = NULL; +#line 395 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 395 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 2851 "PhotoTable.c" + } +#line 397 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = photo_row_new (); +#line 397 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + row = _tmp11_; +#line 398 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = row; +#line 398 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = *photo_id; +#line 398 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_->photo_id = _tmp13_; +#line 399 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = row; +#line 399 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = _tmp14_->master; +#line 399 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = stmt; +#line 399 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp17_ = sqlite3_column_text (_tmp16_, 0); +#line 399 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp18_ = g_strdup (_tmp17_); +#line 399 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp15_->filepath); +#line 399 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_->filepath = _tmp18_; +#line 400 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp19_ = row; +#line 400 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp20_ = _tmp19_->master; +#line 400 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp21_ = stmt; +#line 400 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp22_ = sqlite3_column_int (_tmp21_, 1); +#line 400 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp23_ = stmt; +#line 400 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp24_ = sqlite3_column_int (_tmp23_, 2); +#line 400 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + dimensions_init (&_tmp20_->dim, _tmp22_, _tmp24_); +#line 401 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp25_ = row; +#line 401 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp26_ = _tmp25_->master; +#line 401 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp27_ = stmt; +#line 401 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp28_ = sqlite3_column_int64 (_tmp27_, 3); +#line 401 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp26_->filesize = _tmp28_; +#line 402 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp29_ = row; +#line 402 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp30_ = _tmp29_->master; +#line 402 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp31_ = stmt; +#line 402 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp32_ = sqlite3_column_int64 (_tmp31_, 4); +#line 402 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp30_->timestamp = (time_t) _tmp32_; +#line 403 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp33_ = row; +#line 403 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp34_ = stmt; +#line 403 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp35_ = sqlite3_column_int64 (_tmp34_, 5); +#line 403 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp33_->exposure_time = (time_t) _tmp35_; +#line 404 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp36_ = row; +#line 404 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp37_ = stmt; +#line 404 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp38_ = sqlite3_column_int (_tmp37_, 6); +#line 404 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp36_->orientation = (Orientation) _tmp38_; +#line 405 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp39_ = row; +#line 405 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp40_ = _tmp39_->master; +#line 405 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp41_ = stmt; +#line 405 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp42_ = sqlite3_column_int (_tmp41_, 7); +#line 405 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp40_->original_orientation = (Orientation) _tmp42_; +#line 406 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp43_ = row; +#line 406 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp44_ = stmt; +#line 406 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp45_ = sqlite3_column_int64 (_tmp44_, 8); +#line 406 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp43_->import_id.id = _tmp45_; +#line 407 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp46_ = row; +#line 407 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp47_ = stmt; +#line 407 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp48_ = sqlite3_column_int64 (_tmp47_, 9); +#line 407 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp46_->event_id.id = _tmp48_; +#line 408 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp49_ = row; +#line 408 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp50_ = stmt; +#line 408 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp51_ = sqlite3_column_text (_tmp50_, 10); +#line 408 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp52_ = photo_table_marshall_all_transformations (_tmp51_); +#line 408 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_object_unref0 (_tmp49_->transformations); +#line 408 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp49_->transformations = _tmp52_; +#line 409 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp53_ = row; +#line 409 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp54_ = stmt; +#line 409 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp55_ = sqlite3_column_text (_tmp54_, 11); +#line 409 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp56_ = g_strdup (_tmp55_); +#line 409 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp53_->md5); +#line 409 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp53_->md5 = _tmp56_; +#line 410 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp57_ = row; +#line 410 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp58_ = stmt; +#line 410 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp59_ = sqlite3_column_text (_tmp58_, 12); +#line 410 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp60_ = g_strdup (_tmp59_); +#line 410 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp57_->thumbnail_md5); +#line 410 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp57_->thumbnail_md5 = _tmp60_; +#line 411 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp61_ = row; +#line 411 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp62_ = stmt; +#line 411 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp63_ = sqlite3_column_text (_tmp62_, 13); +#line 411 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp64_ = g_strdup (_tmp63_); +#line 411 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp61_->exif_md5); +#line 411 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp61_->exif_md5 = _tmp64_; +#line 412 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp65_ = row; +#line 412 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp66_ = stmt; +#line 412 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp67_ = sqlite3_column_int64 (_tmp66_, 14); +#line 412 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp65_->time_created = (time_t) _tmp67_; +#line 413 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp68_ = row; +#line 413 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp69_ = stmt; +#line 413 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp70_ = sqlite3_column_int64 (_tmp69_, 15); +#line 413 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp68_->flags = (guint64) _tmp70_; +#line 414 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp71_ = row; +#line 414 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp72_ = stmt; +#line 414 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp73_ = sqlite3_column_int (_tmp72_, 16); +#line 414 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp74_ = rating_unserialize (_tmp73_); +#line 414 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp71_->rating = _tmp74_; +#line 415 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp75_ = row; +#line 415 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp76_ = _tmp75_->master; +#line 415 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp77_ = stmt; +#line 415 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp78_ = sqlite3_column_int (_tmp77_, 17); +#line 415 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp79_ = photo_file_format_unserialize (_tmp78_); +#line 415 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp76_->file_format = _tmp79_; +#line 416 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp80_ = row; +#line 416 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp81_ = stmt; +#line 416 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp82_ = sqlite3_column_text (_tmp81_, 18); +#line 416 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp83_ = g_strdup (_tmp82_); +#line 416 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp80_->title); +#line 416 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp80_->title = _tmp83_; +#line 417 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp84_ = row; +#line 417 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp85_ = stmt; +#line 417 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp86_ = sqlite3_column_text (_tmp85_, 19); +#line 417 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp87_ = g_strdup (_tmp86_); +#line 417 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp84_->backlinks); +#line 417 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp84_->backlinks = _tmp87_; +#line 418 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp88_ = row; +#line 418 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp89_ = stmt; +#line 418 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp90_ = sqlite3_column_int64 (_tmp89_, 20); +#line 418 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp88_->time_reimported = (time_t) _tmp90_; +#line 419 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp91_ = row; +#line 419 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp92_ = stmt; +#line 419 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp93_ = sqlite3_column_int64 (_tmp92_, 21); +#line 419 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_id_init (&_tmp91_->editable_id, _tmp93_); +#line 420 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp94_ = row; +#line 420 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp95_ = stmt; +#line 420 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp96_ = sqlite3_column_int (_tmp95_, 22); +#line 420 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp94_->metadata_dirty = _tmp96_ != 0; +#line 421 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp98_ = stmt; +#line 421 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp99_ = sqlite3_column_text (_tmp98_, 23); +#line 421 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp99_ != NULL) { +#line 3093 "PhotoTable.c" + sqlite3_stmt* _tmp100_ = NULL; + const gchar* _tmp101_ = NULL; + RawDeveloper _tmp102_ = 0; +#line 421 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp100_ = stmt; +#line 421 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp101_ = sqlite3_column_text (_tmp100_, 23); +#line 421 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp102_ = raw_developer_from_string (_tmp101_); +#line 421 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp97_ = _tmp102_; +#line 3105 "PhotoTable.c" + } else { +#line 422 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp97_ = RAW_DEVELOPER_CAMERA; +#line 3109 "PhotoTable.c" + } +#line 421 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp103_ = row; +#line 421 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp103_->developer = _tmp97_; +#line 423 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp104_ = row; +#line 423 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp105_ = _tmp104_->development_ids; +#line 423 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp105__length1 = _tmp104_->development_ids_length1; +#line 423 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp106_ = stmt; +#line 423 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp107_ = sqlite3_column_int64 (_tmp106_, 24); +#line 423 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_id_init (&_tmp108_, _tmp107_); +#line 423 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp105_[RAW_DEVELOPER_SHOTWELL] = _tmp108_; +#line 423 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp109_ = _tmp105_[RAW_DEVELOPER_SHOTWELL]; +#line 424 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp110_ = row; +#line 424 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp111_ = _tmp110_->development_ids; +#line 424 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp111__length1 = _tmp110_->development_ids_length1; +#line 424 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp112_ = stmt; +#line 424 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp113_ = sqlite3_column_int64 (_tmp112_, 25); +#line 424 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_id_init (&_tmp114_, _tmp113_); +#line 424 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp111_[RAW_DEVELOPER_CAMERA] = _tmp114_; +#line 424 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp115_ = _tmp111_[RAW_DEVELOPER_CAMERA]; +#line 425 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp116_ = row; +#line 425 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp117_ = _tmp116_->development_ids; +#line 425 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp117__length1 = _tmp116_->development_ids_length1; +#line 425 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp118_ = stmt; +#line 425 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp119_ = sqlite3_column_int64 (_tmp118_, 26); +#line 425 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_id_init (&_tmp120_, _tmp119_); +#line 425 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp117_[RAW_DEVELOPER_EMBEDDED] = _tmp120_; +#line 425 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp121_ = _tmp117_[RAW_DEVELOPER_EMBEDDED]; +#line 426 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp122_ = row; +#line 426 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp123_ = stmt; +#line 426 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp124_ = sqlite3_column_text (_tmp123_, 27); +#line 426 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp125_ = g_strdup (_tmp124_); +#line 426 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp122_->comment); +#line 426 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp122_->comment = _tmp125_; +#line 428 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = row; +#line 428 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 428 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 3181 "PhotoTable.c" +} + + +GeeArrayList* photo_table_get_all (PhotoTable* self) { + GeeArrayList* result = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + GeeArrayList* all = NULL; + GeeArrayList* _tmp4_ = NULL; +#line 431 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), NULL); +#line 433 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = database_table_db; +#line 433 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "SELECT id, filename, width, height, filesize, timestamp, exposure_time" \ +", orientation, " "original_orientation, import_id, event_id, transformations, md5, thumb" \ +"nail_md5, " "exif_md5, time_created, flags, rating, file_format, title, backlinks, " \ +"time_reimported, " "editable_id, metadata_dirty, developer, develop_shotwell_id, develop_c" \ +"amera_id, " "develop_embedded_id, comment FROM PhotoTable", -1, &_tmp1_, NULL); +#line 433 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 433 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp1_; +#line 433 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp2_; +#line 440 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = res; +#line 440 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 442 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = gee_array_list_new (TYPE_PHOTO_ROW, (GBoxedCopyFunc) photo_row_ref, photo_row_unref, NULL, NULL, NULL); +#line 442 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + all = _tmp4_; +#line 444 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + while (TRUE) { +#line 3217 "PhotoTable.c" + sqlite3_stmt* _tmp5_ = NULL; + gint _tmp6_ = 0; + gint _tmp7_ = 0; + PhotoRow* row = NULL; + PhotoRow* _tmp8_ = NULL; + PhotoRow* _tmp9_ = NULL; + sqlite3_stmt* _tmp10_ = NULL; + gint64 _tmp11_ = 0LL; + PhotoRow* _tmp12_ = NULL; + BackingPhotoRow* _tmp13_ = NULL; + sqlite3_stmt* _tmp14_ = NULL; + const gchar* _tmp15_ = NULL; + gchar* _tmp16_ = NULL; + PhotoRow* _tmp17_ = NULL; + BackingPhotoRow* _tmp18_ = NULL; + sqlite3_stmt* _tmp19_ = NULL; + gint _tmp20_ = 0; + sqlite3_stmt* _tmp21_ = NULL; + gint _tmp22_ = 0; + PhotoRow* _tmp23_ = NULL; + BackingPhotoRow* _tmp24_ = NULL; + sqlite3_stmt* _tmp25_ = NULL; + gint64 _tmp26_ = 0LL; + PhotoRow* _tmp27_ = NULL; + BackingPhotoRow* _tmp28_ = NULL; + sqlite3_stmt* _tmp29_ = NULL; + gint64 _tmp30_ = 0LL; + PhotoRow* _tmp31_ = NULL; + sqlite3_stmt* _tmp32_ = NULL; + gint64 _tmp33_ = 0LL; + PhotoRow* _tmp34_ = NULL; + sqlite3_stmt* _tmp35_ = NULL; + gint _tmp36_ = 0; + PhotoRow* _tmp37_ = NULL; + BackingPhotoRow* _tmp38_ = NULL; + sqlite3_stmt* _tmp39_ = NULL; + gint _tmp40_ = 0; + PhotoRow* _tmp41_ = NULL; + sqlite3_stmt* _tmp42_ = NULL; + gint64 _tmp43_ = 0LL; + PhotoRow* _tmp44_ = NULL; + sqlite3_stmt* _tmp45_ = NULL; + gint64 _tmp46_ = 0LL; + PhotoRow* _tmp47_ = NULL; + sqlite3_stmt* _tmp48_ = NULL; + const gchar* _tmp49_ = NULL; + GeeHashMap* _tmp50_ = NULL; + PhotoRow* _tmp51_ = NULL; + sqlite3_stmt* _tmp52_ = NULL; + const gchar* _tmp53_ = NULL; + gchar* _tmp54_ = NULL; + PhotoRow* _tmp55_ = NULL; + sqlite3_stmt* _tmp56_ = NULL; + const gchar* _tmp57_ = NULL; + gchar* _tmp58_ = NULL; + PhotoRow* _tmp59_ = NULL; + sqlite3_stmt* _tmp60_ = NULL; + const gchar* _tmp61_ = NULL; + gchar* _tmp62_ = NULL; + PhotoRow* _tmp63_ = NULL; + sqlite3_stmt* _tmp64_ = NULL; + gint64 _tmp65_ = 0LL; + PhotoRow* _tmp66_ = NULL; + sqlite3_stmt* _tmp67_ = NULL; + gint64 _tmp68_ = 0LL; + PhotoRow* _tmp69_ = NULL; + sqlite3_stmt* _tmp70_ = NULL; + gint _tmp71_ = 0; + Rating _tmp72_ = 0; + PhotoRow* _tmp73_ = NULL; + BackingPhotoRow* _tmp74_ = NULL; + sqlite3_stmt* _tmp75_ = NULL; + gint _tmp76_ = 0; + PhotoFileFormat _tmp77_ = 0; + PhotoRow* _tmp78_ = NULL; + sqlite3_stmt* _tmp79_ = NULL; + const gchar* _tmp80_ = NULL; + gchar* _tmp81_ = NULL; + PhotoRow* _tmp82_ = NULL; + sqlite3_stmt* _tmp83_ = NULL; + const gchar* _tmp84_ = NULL; + gchar* _tmp85_ = NULL; + PhotoRow* _tmp86_ = NULL; + sqlite3_stmt* _tmp87_ = NULL; + gint64 _tmp88_ = 0LL; + PhotoRow* _tmp89_ = NULL; + sqlite3_stmt* _tmp90_ = NULL; + gint64 _tmp91_ = 0LL; + PhotoRow* _tmp92_ = NULL; + sqlite3_stmt* _tmp93_ = NULL; + gint _tmp94_ = 0; + RawDeveloper _tmp95_ = 0; + sqlite3_stmt* _tmp96_ = NULL; + const gchar* _tmp97_ = NULL; + PhotoRow* _tmp101_ = NULL; + PhotoRow* _tmp102_ = NULL; + BackingPhotoID* _tmp103_ = NULL; + gint _tmp103__length1 = 0; + sqlite3_stmt* _tmp104_ = NULL; + gint64 _tmp105_ = 0LL; + BackingPhotoID _tmp106_ = {0}; + BackingPhotoID _tmp107_ = {0}; + PhotoRow* _tmp108_ = NULL; + BackingPhotoID* _tmp109_ = NULL; + gint _tmp109__length1 = 0; + sqlite3_stmt* _tmp110_ = NULL; + gint64 _tmp111_ = 0LL; + BackingPhotoID _tmp112_ = {0}; + BackingPhotoID _tmp113_ = {0}; + PhotoRow* _tmp114_ = NULL; + BackingPhotoID* _tmp115_ = NULL; + gint _tmp115__length1 = 0; + sqlite3_stmt* _tmp116_ = NULL; + gint64 _tmp117_ = 0LL; + BackingPhotoID _tmp118_ = {0}; + BackingPhotoID _tmp119_ = {0}; + PhotoRow* _tmp120_ = NULL; + sqlite3_stmt* _tmp121_ = NULL; + const gchar* _tmp122_ = NULL; + gchar* _tmp123_ = NULL; + PhotoRow* _tmp124_ = NULL; + GeeArrayList* _tmp125_ = NULL; + PhotoRow* _tmp126_ = NULL; +#line 444 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = stmt; +#line 444 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = sqlite3_step (_tmp5_); +#line 444 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp6_; +#line 444 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = res; +#line 444 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (!(_tmp7_ == SQLITE_ROW)) { +#line 444 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + break; +#line 3353 "PhotoTable.c" + } +#line 445 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = photo_row_new (); +#line 445 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + row = _tmp8_; +#line 446 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = row; +#line 446 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = stmt; +#line 446 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = sqlite3_column_int64 (_tmp10_, 0); +#line 446 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_->photo_id.id = _tmp11_; +#line 447 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = row; +#line 447 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = _tmp12_->master; +#line 447 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = stmt; +#line 447 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = sqlite3_column_text (_tmp14_, 1); +#line 447 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = g_strdup (_tmp15_); +#line 447 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp13_->filepath); +#line 447 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_->filepath = _tmp16_; +#line 448 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp17_ = row; +#line 448 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp18_ = _tmp17_->master; +#line 448 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp19_ = stmt; +#line 448 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp20_ = sqlite3_column_int (_tmp19_, 2); +#line 448 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp21_ = stmt; +#line 448 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp22_ = sqlite3_column_int (_tmp21_, 3); +#line 448 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + dimensions_init (&_tmp18_->dim, _tmp20_, _tmp22_); +#line 449 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp23_ = row; +#line 449 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp24_ = _tmp23_->master; +#line 449 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp25_ = stmt; +#line 449 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp26_ = sqlite3_column_int64 (_tmp25_, 4); +#line 449 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp24_->filesize = _tmp26_; +#line 450 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp27_ = row; +#line 450 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp28_ = _tmp27_->master; +#line 450 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp29_ = stmt; +#line 450 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp30_ = sqlite3_column_int64 (_tmp29_, 5); +#line 450 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp28_->timestamp = (time_t) _tmp30_; +#line 451 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp31_ = row; +#line 451 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp32_ = stmt; +#line 451 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp33_ = sqlite3_column_int64 (_tmp32_, 6); +#line 451 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp31_->exposure_time = (time_t) _tmp33_; +#line 452 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp34_ = row; +#line 452 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp35_ = stmt; +#line 452 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp36_ = sqlite3_column_int (_tmp35_, 7); +#line 452 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp34_->orientation = (Orientation) _tmp36_; +#line 453 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp37_ = row; +#line 453 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp38_ = _tmp37_->master; +#line 453 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp39_ = stmt; +#line 453 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp40_ = sqlite3_column_int (_tmp39_, 8); +#line 453 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp38_->original_orientation = (Orientation) _tmp40_; +#line 454 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp41_ = row; +#line 454 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp42_ = stmt; +#line 454 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp43_ = sqlite3_column_int64 (_tmp42_, 9); +#line 454 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp41_->import_id.id = _tmp43_; +#line 455 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp44_ = row; +#line 455 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp45_ = stmt; +#line 455 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp46_ = sqlite3_column_int64 (_tmp45_, 10); +#line 455 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp44_->event_id.id = _tmp46_; +#line 456 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp47_ = row; +#line 456 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp48_ = stmt; +#line 456 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp49_ = sqlite3_column_text (_tmp48_, 11); +#line 456 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp50_ = photo_table_marshall_all_transformations (_tmp49_); +#line 456 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_object_unref0 (_tmp47_->transformations); +#line 456 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp47_->transformations = _tmp50_; +#line 457 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp51_ = row; +#line 457 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp52_ = stmt; +#line 457 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp53_ = sqlite3_column_text (_tmp52_, 12); +#line 457 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp54_ = g_strdup (_tmp53_); +#line 457 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp51_->md5); +#line 457 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp51_->md5 = _tmp54_; +#line 458 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp55_ = row; +#line 458 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp56_ = stmt; +#line 458 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp57_ = sqlite3_column_text (_tmp56_, 13); +#line 458 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp58_ = g_strdup (_tmp57_); +#line 458 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp55_->thumbnail_md5); +#line 458 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp55_->thumbnail_md5 = _tmp58_; +#line 459 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp59_ = row; +#line 459 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp60_ = stmt; +#line 459 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp61_ = sqlite3_column_text (_tmp60_, 14); +#line 459 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp62_ = g_strdup (_tmp61_); +#line 459 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp59_->exif_md5); +#line 459 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp59_->exif_md5 = _tmp62_; +#line 460 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp63_ = row; +#line 460 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp64_ = stmt; +#line 460 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp65_ = sqlite3_column_int64 (_tmp64_, 15); +#line 460 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp63_->time_created = (time_t) _tmp65_; +#line 461 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp66_ = row; +#line 461 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp67_ = stmt; +#line 461 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp68_ = sqlite3_column_int64 (_tmp67_, 16); +#line 461 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp66_->flags = (guint64) _tmp68_; +#line 462 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp69_ = row; +#line 462 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp70_ = stmt; +#line 462 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp71_ = sqlite3_column_int (_tmp70_, 17); +#line 462 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp72_ = rating_unserialize (_tmp71_); +#line 462 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp69_->rating = _tmp72_; +#line 463 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp73_ = row; +#line 463 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp74_ = _tmp73_->master; +#line 463 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp75_ = stmt; +#line 463 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp76_ = sqlite3_column_int (_tmp75_, 18); +#line 463 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp77_ = photo_file_format_unserialize (_tmp76_); +#line 463 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp74_->file_format = _tmp77_; +#line 464 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp78_ = row; +#line 464 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp79_ = stmt; +#line 464 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp80_ = sqlite3_column_text (_tmp79_, 19); +#line 464 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp81_ = g_strdup (_tmp80_); +#line 464 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp78_->title); +#line 464 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp78_->title = _tmp81_; +#line 465 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp82_ = row; +#line 465 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp83_ = stmt; +#line 465 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp84_ = sqlite3_column_text (_tmp83_, 20); +#line 465 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp85_ = g_strdup (_tmp84_); +#line 465 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp82_->backlinks); +#line 465 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp82_->backlinks = _tmp85_; +#line 466 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp86_ = row; +#line 466 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp87_ = stmt; +#line 466 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp88_ = sqlite3_column_int64 (_tmp87_, 21); +#line 466 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp86_->time_reimported = (time_t) _tmp88_; +#line 467 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp89_ = row; +#line 467 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp90_ = stmt; +#line 467 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp91_ = sqlite3_column_int64 (_tmp90_, 22); +#line 467 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_id_init (&_tmp89_->editable_id, _tmp91_); +#line 468 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp92_ = row; +#line 468 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp93_ = stmt; +#line 468 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp94_ = sqlite3_column_int (_tmp93_, 23); +#line 468 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp92_->metadata_dirty = _tmp94_ != 0; +#line 469 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp96_ = stmt; +#line 469 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp97_ = sqlite3_column_text (_tmp96_, 24); +#line 469 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp97_ != NULL) { +#line 3597 "PhotoTable.c" + sqlite3_stmt* _tmp98_ = NULL; + const gchar* _tmp99_ = NULL; + RawDeveloper _tmp100_ = 0; +#line 469 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp98_ = stmt; +#line 469 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp99_ = sqlite3_column_text (_tmp98_, 24); +#line 469 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp100_ = raw_developer_from_string (_tmp99_); +#line 469 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp95_ = _tmp100_; +#line 3609 "PhotoTable.c" + } else { +#line 470 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp95_ = RAW_DEVELOPER_CAMERA; +#line 3613 "PhotoTable.c" + } +#line 469 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp101_ = row; +#line 469 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp101_->developer = _tmp95_; +#line 471 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp102_ = row; +#line 471 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp103_ = _tmp102_->development_ids; +#line 471 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp103__length1 = _tmp102_->development_ids_length1; +#line 471 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp104_ = stmt; +#line 471 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp105_ = sqlite3_column_int64 (_tmp104_, 25); +#line 471 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_id_init (&_tmp106_, _tmp105_); +#line 471 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp103_[RAW_DEVELOPER_SHOTWELL] = _tmp106_; +#line 471 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp107_ = _tmp103_[RAW_DEVELOPER_SHOTWELL]; +#line 472 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp108_ = row; +#line 472 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp109_ = _tmp108_->development_ids; +#line 472 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp109__length1 = _tmp108_->development_ids_length1; +#line 472 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp110_ = stmt; +#line 472 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp111_ = sqlite3_column_int64 (_tmp110_, 26); +#line 472 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_id_init (&_tmp112_, _tmp111_); +#line 472 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp109_[RAW_DEVELOPER_CAMERA] = _tmp112_; +#line 472 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp113_ = _tmp109_[RAW_DEVELOPER_CAMERA]; +#line 473 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp114_ = row; +#line 473 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp115_ = _tmp114_->development_ids; +#line 473 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp115__length1 = _tmp114_->development_ids_length1; +#line 473 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp116_ = stmt; +#line 473 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp117_ = sqlite3_column_int64 (_tmp116_, 27); +#line 473 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_id_init (&_tmp118_, _tmp117_); +#line 473 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp115_[RAW_DEVELOPER_EMBEDDED] = _tmp118_; +#line 473 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp119_ = _tmp115_[RAW_DEVELOPER_EMBEDDED]; +#line 474 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp120_ = row; +#line 474 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp121_ = stmt; +#line 474 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp122_ = sqlite3_column_text (_tmp121_, 28); +#line 474 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp123_ = g_strdup (_tmp122_); +#line 474 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp120_->comment); +#line 474 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp120_->comment = _tmp123_; +#line 476 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp124_ = row; +#line 476 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + photo_table_validate_orientation (self, _tmp124_); +#line 478 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp125_ = all; +#line 478 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp126_ = row; +#line 478 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + gee_abstract_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp125_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), _tmp126_); +#line 444 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _photo_row_unref0 (row); +#line 3691 "PhotoTable.c" + } +#line 481 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = all; +#line 481 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 481 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 3699 "PhotoTable.c" +} + + +void photo_table_duplicate (PhotoTable* self, PhotoID* photo_id, const gchar* new_filename, BackingPhotoID* editable_id, BackingPhotoID* develop_shotwell, BackingPhotoID* develop_camera_id, BackingPhotoID* develop_embedded_id, PhotoID* result) { + PhotoRow* original = NULL; + PhotoID _tmp0_ = {0}; + PhotoRow* _tmp1_ = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp2_ = NULL; + sqlite3_stmt* _tmp3_ = NULL; + gint _tmp4_ = 0; + gint _tmp5_ = 0; + sqlite3_stmt* _tmp6_ = NULL; + const gchar* _tmp7_ = NULL; + gchar* _tmp8_ = NULL; + GDestroyNotify _tmp9_ = NULL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + sqlite3_stmt* _tmp12_ = NULL; + PhotoRow* _tmp13_ = NULL; + BackingPhotoRow* _tmp14_ = NULL; + Dimensions _tmp15_ = {0}; + gint _tmp16_ = 0; + gint _tmp17_ = 0; + gint _tmp18_ = 0; + sqlite3_stmt* _tmp19_ = NULL; + PhotoRow* _tmp20_ = NULL; + BackingPhotoRow* _tmp21_ = NULL; + Dimensions _tmp22_ = {0}; + gint _tmp23_ = 0; + gint _tmp24_ = 0; + gint _tmp25_ = 0; + sqlite3_stmt* _tmp26_ = NULL; + PhotoRow* _tmp27_ = NULL; + BackingPhotoRow* _tmp28_ = NULL; + gint64 _tmp29_ = 0LL; + gint _tmp30_ = 0; + gint _tmp31_ = 0; + sqlite3_stmt* _tmp32_ = NULL; + PhotoRow* _tmp33_ = NULL; + BackingPhotoRow* _tmp34_ = NULL; + time_t _tmp35_ = 0; + gint _tmp36_ = 0; + gint _tmp37_ = 0; + sqlite3_stmt* _tmp38_ = NULL; + PhotoRow* _tmp39_ = NULL; + time_t _tmp40_ = 0; + gint _tmp41_ = 0; + gint _tmp42_ = 0; + sqlite3_stmt* _tmp43_ = NULL; + PhotoRow* _tmp44_ = NULL; + Orientation _tmp45_ = 0; + gint _tmp46_ = 0; + gint _tmp47_ = 0; + sqlite3_stmt* _tmp48_ = NULL; + PhotoRow* _tmp49_ = NULL; + BackingPhotoRow* _tmp50_ = NULL; + Orientation _tmp51_ = 0; + gint _tmp52_ = 0; + gint _tmp53_ = 0; + sqlite3_stmt* _tmp54_ = NULL; + PhotoRow* _tmp55_ = NULL; + ImportID _tmp56_ = {0}; + gint64 _tmp57_ = 0LL; + gint _tmp58_ = 0; + gint _tmp59_ = 0; + sqlite3_stmt* _tmp60_ = NULL; + PhotoRow* _tmp61_ = NULL; + EventID _tmp62_ = {0}; + gint64 _tmp63_ = 0LL; + gint _tmp64_ = 0; + gint _tmp65_ = 0; + sqlite3_stmt* _tmp66_ = NULL; + PhotoRow* _tmp67_ = NULL; + GeeHashMap* _tmp68_ = NULL; + gchar* _tmp69_ = NULL; + GDestroyNotify _tmp70_ = NULL; + gint _tmp71_ = 0; + gint _tmp72_ = 0; + sqlite3_stmt* _tmp73_ = NULL; + PhotoRow* _tmp74_ = NULL; + const gchar* _tmp75_ = NULL; + gchar* _tmp76_ = NULL; + GDestroyNotify _tmp77_ = NULL; + gint _tmp78_ = 0; + gint _tmp79_ = 0; + sqlite3_stmt* _tmp80_ = NULL; + PhotoRow* _tmp81_ = NULL; + const gchar* _tmp82_ = NULL; + gchar* _tmp83_ = NULL; + GDestroyNotify _tmp84_ = NULL; + gint _tmp85_ = 0; + gint _tmp86_ = 0; + sqlite3_stmt* _tmp87_ = NULL; + PhotoRow* _tmp88_ = NULL; + const gchar* _tmp89_ = NULL; + gchar* _tmp90_ = NULL; + GDestroyNotify _tmp91_ = NULL; + gint _tmp92_ = 0; + gint _tmp93_ = 0; + sqlite3_stmt* _tmp94_ = NULL; + gulong _tmp95_ = 0UL; + gint _tmp96_ = 0; + gint _tmp97_ = 0; + sqlite3_stmt* _tmp98_ = NULL; + PhotoRow* _tmp99_ = NULL; + guint64 _tmp100_ = 0ULL; + gint _tmp101_ = 0; + gint _tmp102_ = 0; + sqlite3_stmt* _tmp103_ = NULL; + PhotoRow* _tmp104_ = NULL; + Rating _tmp105_ = 0; + gint _tmp106_ = 0; + gint _tmp107_ = 0; + gint _tmp108_ = 0; + sqlite3_stmt* _tmp109_ = NULL; + PhotoRow* _tmp110_ = NULL; + BackingPhotoRow* _tmp111_ = NULL; + PhotoFileFormat _tmp112_ = 0; + gint _tmp113_ = 0; + gint _tmp114_ = 0; + gint _tmp115_ = 0; + sqlite3_stmt* _tmp116_ = NULL; + PhotoRow* _tmp117_ = NULL; + const gchar* _tmp118_ = NULL; + gchar* _tmp119_ = NULL; + GDestroyNotify _tmp120_ = NULL; + gint _tmp121_ = 0; + gint _tmp122_ = 0; + sqlite3_stmt* _tmp123_ = NULL; + BackingPhotoID _tmp124_ = {0}; + gint64 _tmp125_ = 0LL; + gint _tmp126_ = 0; + gint _tmp127_ = 0; + sqlite3_stmt* _tmp128_ = NULL; + PhotoRow* _tmp129_ = NULL; + RawDeveloper _tmp130_ = 0; + gchar* _tmp131_ = NULL; + GDestroyNotify _tmp132_ = NULL; + gint _tmp133_ = 0; + gint _tmp134_ = 0; + sqlite3_stmt* _tmp135_ = NULL; + BackingPhotoID _tmp136_ = {0}; + gint64 _tmp137_ = 0LL; + gint _tmp138_ = 0; + gint _tmp139_ = 0; + sqlite3_stmt* _tmp140_ = NULL; + BackingPhotoID _tmp141_ = {0}; + gint64 _tmp142_ = 0LL; + gint _tmp143_ = 0; + gint _tmp144_ = 0; + sqlite3_stmt* _tmp145_ = NULL; + BackingPhotoID _tmp146_ = {0}; + gint64 _tmp147_ = 0LL; + gint _tmp148_ = 0; + gint _tmp149_ = 0; + sqlite3_stmt* _tmp150_ = NULL; + PhotoRow* _tmp151_ = NULL; + const gchar* _tmp152_ = NULL; + gchar* _tmp153_ = NULL; + GDestroyNotify _tmp154_ = NULL; + gint _tmp155_ = 0; + gint _tmp156_ = 0; + sqlite3_stmt* _tmp157_ = NULL; + gint _tmp158_ = 0; + gint _tmp159_ = 0; + sqlite3* _tmp163_ = NULL; + gint64 _tmp164_ = 0LL; + PhotoID _tmp165_ = {0}; +#line 486 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_TABLE (self)); +#line 486 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (photo_id != NULL); +#line 486 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (new_filename != NULL); +#line 486 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (editable_id != NULL); +#line 486 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (develop_shotwell != NULL); +#line 486 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (develop_camera_id != NULL); +#line 486 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (develop_embedded_id != NULL); +#line 490 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = *photo_id; +#line 490 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = photo_table_get_row (self, &_tmp0_); +#line 490 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + original = _tmp1_; +#line 493 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = database_table_db; +#line 493 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = sqlite3_prepare_v2 (_tmp2_, "INSERT INTO PhotoTable (filename, width, height, filesize, " "timestamp, exposure_time, orientation, original_orientation, import_id" \ +", event_id, " "transformations, md5, thumbnail_md5, exif_md5, time_created, flags, ra" \ +"ting, " "file_format, title, editable_id, developer, develop_shotwell_id, devel" \ +"op_camera_id, " "develop_embedded_id, comment) " "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?," \ +" ?, ?, ?, ?)", -1, &_tmp3_, NULL); +#line 493 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 493 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp3_; +#line 493 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp4_; +#line 500 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = res; +#line 500 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp5_ == SQLITE_OK, "res == Sqlite.OK"); +#line 502 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = stmt; +#line 502 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = new_filename; +#line 502 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = g_strdup (_tmp7_); +#line 502 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = g_free; +#line 502 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = sqlite3_bind_text (_tmp6_, 1, _tmp8_, -1, _tmp9_); +#line 502 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp10_; +#line 503 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = res; +#line 503 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp11_ == SQLITE_OK, "res == Sqlite.OK"); +#line 504 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = stmt; +#line 504 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = original; +#line 504 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = _tmp13_->master; +#line 504 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = _tmp14_->dim; +#line 504 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = _tmp15_.width; +#line 504 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp17_ = sqlite3_bind_int (_tmp12_, 2, _tmp16_); +#line 504 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp17_; +#line 505 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp18_ = res; +#line 505 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp18_ == SQLITE_OK, "res == Sqlite.OK"); +#line 506 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp19_ = stmt; +#line 506 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp20_ = original; +#line 506 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp21_ = _tmp20_->master; +#line 506 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp22_ = _tmp21_->dim; +#line 506 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp23_ = _tmp22_.height; +#line 506 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp24_ = sqlite3_bind_int (_tmp19_, 3, _tmp23_); +#line 506 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp24_; +#line 507 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp25_ = res; +#line 507 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp25_ == SQLITE_OK, "res == Sqlite.OK"); +#line 508 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp26_ = stmt; +#line 508 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp27_ = original; +#line 508 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp28_ = _tmp27_->master; +#line 508 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp29_ = _tmp28_->filesize; +#line 508 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp30_ = sqlite3_bind_int64 (_tmp26_, 4, _tmp29_); +#line 508 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp30_; +#line 509 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp31_ = res; +#line 509 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp31_ == SQLITE_OK, "res == Sqlite.OK"); +#line 510 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp32_ = stmt; +#line 510 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp33_ = original; +#line 510 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp34_ = _tmp33_->master; +#line 510 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp35_ = _tmp34_->timestamp; +#line 510 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp36_ = sqlite3_bind_int64 (_tmp32_, 5, (gint64) _tmp35_); +#line 510 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp36_; +#line 511 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp37_ = res; +#line 511 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp37_ == SQLITE_OK, "res == Sqlite.OK"); +#line 512 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp38_ = stmt; +#line 512 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp39_ = original; +#line 512 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp40_ = _tmp39_->exposure_time; +#line 512 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp41_ = sqlite3_bind_int64 (_tmp38_, 6, (gint64) _tmp40_); +#line 512 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp41_; +#line 513 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp42_ = res; +#line 513 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp42_ == SQLITE_OK, "res == Sqlite.OK"); +#line 514 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp43_ = stmt; +#line 514 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp44_ = original; +#line 514 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp45_ = _tmp44_->orientation; +#line 514 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp46_ = sqlite3_bind_int (_tmp43_, 7, (gint) _tmp45_); +#line 514 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp46_; +#line 515 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp47_ = res; +#line 515 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp47_ == SQLITE_OK, "res == Sqlite.OK"); +#line 516 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp48_ = stmt; +#line 516 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp49_ = original; +#line 516 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp50_ = _tmp49_->master; +#line 516 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp51_ = _tmp50_->original_orientation; +#line 516 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp52_ = sqlite3_bind_int (_tmp48_, 8, (gint) _tmp51_); +#line 516 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp52_; +#line 517 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp53_ = res; +#line 517 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp53_ == SQLITE_OK, "res == Sqlite.OK"); +#line 518 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp54_ = stmt; +#line 518 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp55_ = original; +#line 518 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp56_ = _tmp55_->import_id; +#line 518 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp57_ = _tmp56_.id; +#line 518 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp58_ = sqlite3_bind_int64 (_tmp54_, 9, _tmp57_); +#line 518 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp58_; +#line 519 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp59_ = res; +#line 519 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp59_ == SQLITE_OK, "res == Sqlite.OK"); +#line 520 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp60_ = stmt; +#line 520 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp61_ = original; +#line 520 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp62_ = _tmp61_->event_id; +#line 520 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp63_ = _tmp62_.id; +#line 520 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp64_ = sqlite3_bind_int64 (_tmp60_, 10, _tmp63_); +#line 520 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp64_; +#line 521 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp65_ = res; +#line 521 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp65_ == SQLITE_OK, "res == Sqlite.OK"); +#line 522 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp66_ = stmt; +#line 522 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp67_ = original; +#line 522 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp68_ = _tmp67_->transformations; +#line 522 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp69_ = photo_table_unmarshall_all_transformations (_tmp68_); +#line 522 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp70_ = g_free; +#line 522 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp71_ = sqlite3_bind_text (_tmp66_, 11, _tmp69_, -1, _tmp70_); +#line 522 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp71_; +#line 523 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp72_ = res; +#line 523 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp72_ == SQLITE_OK, "res == Sqlite.OK"); +#line 524 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp73_ = stmt; +#line 524 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp74_ = original; +#line 524 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp75_ = _tmp74_->md5; +#line 524 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp76_ = g_strdup (_tmp75_); +#line 524 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp77_ = g_free; +#line 524 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp78_ = sqlite3_bind_text (_tmp73_, 12, _tmp76_, -1, _tmp77_); +#line 524 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp78_; +#line 525 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp79_ = res; +#line 525 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp79_ == SQLITE_OK, "res == Sqlite.OK"); +#line 526 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp80_ = stmt; +#line 526 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp81_ = original; +#line 526 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp82_ = _tmp81_->thumbnail_md5; +#line 526 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp83_ = g_strdup (_tmp82_); +#line 526 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp84_ = g_free; +#line 526 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp85_ = sqlite3_bind_text (_tmp80_, 13, _tmp83_, -1, _tmp84_); +#line 526 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp85_; +#line 527 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp86_ = res; +#line 527 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp86_ == SQLITE_OK, "res == Sqlite.OK"); +#line 528 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp87_ = stmt; +#line 528 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp88_ = original; +#line 528 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp89_ = _tmp88_->exif_md5; +#line 528 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp90_ = g_strdup (_tmp89_); +#line 528 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp91_ = g_free; +#line 528 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp92_ = sqlite3_bind_text (_tmp87_, 14, _tmp90_, -1, _tmp91_); +#line 528 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp92_; +#line 529 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp93_ = res; +#line 529 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp93_ == SQLITE_OK, "res == Sqlite.OK"); +#line 530 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp94_ = stmt; +#line 530 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp95_ = now_sec (); +#line 530 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp96_ = sqlite3_bind_int64 (_tmp94_, 15, (gint64) _tmp95_); +#line 530 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp96_; +#line 531 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp97_ = res; +#line 531 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp97_ == SQLITE_OK, "res == Sqlite.OK"); +#line 532 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp98_ = stmt; +#line 532 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp99_ = original; +#line 532 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp100_ = _tmp99_->flags; +#line 532 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp101_ = sqlite3_bind_int64 (_tmp98_, 16, (gint64) _tmp100_); +#line 532 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp101_; +#line 533 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp102_ = res; +#line 533 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp102_ == SQLITE_OK, "res == Sqlite.OK"); +#line 534 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp103_ = stmt; +#line 534 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp104_ = original; +#line 534 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp105_ = _tmp104_->rating; +#line 534 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp106_ = rating_serialize (_tmp105_); +#line 534 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp107_ = sqlite3_bind_int64 (_tmp103_, 17, (gint64) _tmp106_); +#line 534 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp107_; +#line 535 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp108_ = res; +#line 535 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp108_ == SQLITE_OK, "res == Sqlite.OK"); +#line 536 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp109_ = stmt; +#line 536 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp110_ = original; +#line 536 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp111_ = _tmp110_->master; +#line 536 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp112_ = _tmp111_->file_format; +#line 536 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp113_ = photo_file_format_serialize (_tmp112_); +#line 536 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp114_ = sqlite3_bind_int (_tmp109_, 18, _tmp113_); +#line 536 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp114_; +#line 537 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp115_ = res; +#line 537 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp115_ == SQLITE_OK, "res == Sqlite.OK"); +#line 538 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp116_ = stmt; +#line 538 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp117_ = original; +#line 538 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp118_ = _tmp117_->title; +#line 538 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp119_ = g_strdup (_tmp118_); +#line 538 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp120_ = g_free; +#line 538 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp121_ = sqlite3_bind_text (_tmp116_, 19, _tmp119_, -1, _tmp120_); +#line 538 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp121_; +#line 539 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp122_ = res; +#line 539 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp122_ == SQLITE_OK, "res == Sqlite.OK"); +#line 540 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp123_ = stmt; +#line 540 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp124_ = *editable_id; +#line 540 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp125_ = _tmp124_.id; +#line 540 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp126_ = sqlite3_bind_int64 (_tmp123_, 20, _tmp125_); +#line 540 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp126_; +#line 541 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp127_ = res; +#line 541 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp127_ == SQLITE_OK, "res == Sqlite.OK"); +#line 543 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp128_ = stmt; +#line 543 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp129_ = original; +#line 543 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp130_ = _tmp129_->developer; +#line 543 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp131_ = raw_developer_to_string (_tmp130_); +#line 543 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp132_ = g_free; +#line 543 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp133_ = sqlite3_bind_text (_tmp128_, 21, _tmp131_, -1, _tmp132_); +#line 543 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp133_; +#line 544 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp134_ = res; +#line 544 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp134_ == SQLITE_OK, "res == Sqlite.OK"); +#line 545 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp135_ = stmt; +#line 545 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp136_ = *develop_shotwell; +#line 545 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp137_ = _tmp136_.id; +#line 545 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp138_ = sqlite3_bind_int64 (_tmp135_, 22, _tmp137_); +#line 545 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp138_; +#line 546 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp139_ = res; +#line 546 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp139_ == SQLITE_OK, "res == Sqlite.OK"); +#line 547 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp140_ = stmt; +#line 547 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp141_ = *develop_camera_id; +#line 547 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp142_ = _tmp141_.id; +#line 547 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp143_ = sqlite3_bind_int64 (_tmp140_, 23, _tmp142_); +#line 547 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp143_; +#line 548 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp144_ = res; +#line 548 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp144_ == SQLITE_OK, "res == Sqlite.OK"); +#line 549 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp145_ = stmt; +#line 549 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp146_ = *develop_embedded_id; +#line 549 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp147_ = _tmp146_.id; +#line 549 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp148_ = sqlite3_bind_int64 (_tmp145_, 24, _tmp147_); +#line 549 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp148_; +#line 550 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp149_ = res; +#line 550 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp149_ == SQLITE_OK, "res == Sqlite.OK"); +#line 551 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp150_ = stmt; +#line 551 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp151_ = original; +#line 551 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp152_ = _tmp151_->comment; +#line 551 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp153_ = g_strdup (_tmp152_); +#line 551 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp154_ = g_free; +#line 551 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp155_ = sqlite3_bind_text (_tmp150_, 25, _tmp153_, -1, _tmp154_); +#line 551 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp155_; +#line 552 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp156_ = res; +#line 552 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp156_ == SQLITE_OK, "res == Sqlite.OK"); +#line 554 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp157_ = stmt; +#line 554 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp158_ = sqlite3_step (_tmp157_); +#line 554 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp158_; +#line 555 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp159_ = res; +#line 555 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp159_ != SQLITE_DONE) { +#line 4316 "PhotoTable.c" + gint _tmp160_ = 0; + PhotoID _tmp162_ = {0}; +#line 556 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp160_ = res; +#line 556 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp160_ != SQLITE_CONSTRAINT) { +#line 4323 "PhotoTable.c" + gint _tmp161_ = 0; +#line 557 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp161_ = res; +#line 557 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_fatal ("duplicate", _tmp161_); +#line 4329 "PhotoTable.c" + } +#line 559 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + photo_id_init (&_tmp162_, PHOTO_ID_INVALID); +#line 559 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + *result = _tmp162_; +#line 559 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 559 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _photo_row_unref0 (original); +#line 559 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 4341 "PhotoTable.c" + } +#line 562 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp163_ = database_table_db; +#line 562 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp164_ = sqlite3_last_insert_rowid (_tmp163_); +#line 562 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + photo_id_init (&_tmp165_, _tmp164_); +#line 562 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + *result = _tmp165_; +#line 562 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 562 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _photo_row_unref0 (original); +#line 562 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 4357 "PhotoTable.c" +} + + +gboolean photo_table_set_title (PhotoTable* self, PhotoID* photo_id, const gchar* new_title) { + gboolean result = FALSE; + const gchar* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + PhotoID _tmp3_ = {0}; + gint64 _tmp4_ = 0LL; + gboolean _tmp5_ = FALSE; +#line 565 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), FALSE); +#line 565 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (photo_id != NULL, FALSE); +#line 566 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = new_title; +#line 566 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp1_ != NULL) { +#line 4376 "PhotoTable.c" + const gchar* _tmp2_ = NULL; +#line 566 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = new_title; +#line 566 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = _tmp2_; +#line 4382 "PhotoTable.c" + } else { +#line 566 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = ""; +#line 4386 "PhotoTable.c" + } +#line 566 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = *photo_id; +#line 566 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = _tmp3_.id; +#line 566 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = database_table_update_text_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp4_, "title", _tmp0_); +#line 566 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp5_; +#line 566 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 4398 "PhotoTable.c" +} + + +gboolean photo_table_set_comment (PhotoTable* self, PhotoID* photo_id, const gchar* new_comment) { + gboolean result = FALSE; + const gchar* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + PhotoID _tmp3_ = {0}; + gint64 _tmp4_ = 0LL; + gboolean _tmp5_ = FALSE; +#line 569 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), FALSE); +#line 569 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (photo_id != NULL, FALSE); +#line 570 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = new_comment; +#line 570 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp1_ != NULL) { +#line 4417 "PhotoTable.c" + const gchar* _tmp2_ = NULL; +#line 570 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = new_comment; +#line 570 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = _tmp2_; +#line 4423 "PhotoTable.c" + } else { +#line 570 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = ""; +#line 4427 "PhotoTable.c" + } +#line 570 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = *photo_id; +#line 570 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = _tmp3_.id; +#line 570 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = database_table_update_text_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp4_, "comment", _tmp0_); +#line 570 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp5_; +#line 570 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 4439 "PhotoTable.c" +} + + +void photo_table_set_filepath (PhotoTable* self, PhotoID* photo_id, const gchar* filepath, GError** error) { + PhotoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + const gchar* _tmp2_ = NULL; + GError * _inner_error_ = NULL; +#line 573 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_TABLE (self)); +#line 573 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (photo_id != NULL); +#line 573 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (filepath != NULL); +#line 574 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = *photo_id; +#line 574 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp0_.id; +#line 574 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = filepath; +#line 574 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_update_text_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "filename", _tmp2_, &_inner_error_); +#line 574 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 574 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 574 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_propagate_error (error, _inner_error_); +#line 574 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 4470 "PhotoTable.c" + } else { +#line 574 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 574 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 574 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 4478 "PhotoTable.c" + } + } +} + + +void photo_table_update_timestamp (PhotoTable* self, PhotoID* photo_id, time_t timestamp, GError** error) { + PhotoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + time_t _tmp2_ = 0; + GError * _inner_error_ = NULL; +#line 577 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_TABLE (self)); +#line 577 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (photo_id != NULL); +#line 578 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = *photo_id; +#line 578 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp0_.id; +#line 578 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = timestamp; +#line 578 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_update_int64_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "timestamp", (gint64) _tmp2_, &_inner_error_); +#line 578 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 578 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 578 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_propagate_error (error, _inner_error_); +#line 578 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 4509 "PhotoTable.c" + } else { +#line 578 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 578 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 578 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 4517 "PhotoTable.c" + } + } +} + + +gboolean photo_table_set_exposure_time (PhotoTable* self, PhotoID* photo_id, time_t time) { + gboolean result = FALSE; + PhotoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + time_t _tmp2_ = 0; + gboolean _tmp3_ = FALSE; +#line 581 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), FALSE); +#line 581 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (photo_id != NULL, FALSE); +#line 582 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = *photo_id; +#line 582 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp0_.id; +#line 582 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = time; +#line 582 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = database_table_update_int64_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "exposure_time", (gint64) _tmp2_); +#line 582 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp3_; +#line 582 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 4545 "PhotoTable.c" +} + + +void photo_table_set_import_id (PhotoTable* self, PhotoID* photo_id, ImportID* import_id, GError** error) { + PhotoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + ImportID _tmp2_ = {0}; + gint64 _tmp3_ = 0LL; + GError * _inner_error_ = NULL; +#line 585 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_TABLE (self)); +#line 585 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (photo_id != NULL); +#line 585 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (import_id != NULL); +#line 586 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = *photo_id; +#line 586 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp0_.id; +#line 586 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = *import_id; +#line 586 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = _tmp2_.id; +#line 586 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_update_int64_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "import_id", _tmp3_, &_inner_error_); +#line 586 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 586 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 586 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_propagate_error (error, _inner_error_); +#line 586 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 4579 "PhotoTable.c" + } else { +#line 586 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 586 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 586 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 4587 "PhotoTable.c" + } + } +} + + +gboolean photo_table_remove_by_file (PhotoTable* self, GFile* file) { + gboolean result = FALSE; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + GFile* _tmp5_ = NULL; + gchar* _tmp6_ = NULL; + GDestroyNotify _tmp7_ = NULL; + gint _tmp8_ = 0; + gint _tmp9_ = 0; + sqlite3_stmt* _tmp10_ = NULL; + gint _tmp11_ = 0; + gint _tmp12_ = 0; +#line 589 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), FALSE); +#line 589 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (G_IS_FILE (file), FALSE); +#line 591 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = database_table_db; +#line 591 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "DELETE FROM PhotoTable WHERE filename=?", -1, &_tmp1_, NULL); +#line 591 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 591 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp1_; +#line 591 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp2_; +#line 592 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = res; +#line 592 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 594 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = stmt; +#line 594 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = file; +#line 594 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = g_file_get_path (_tmp5_); +#line 594 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = g_free; +#line 594 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = sqlite3_bind_text (_tmp4_, 1, _tmp6_, -1, _tmp7_); +#line 594 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp8_; +#line 595 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = res; +#line 595 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp9_ == SQLITE_OK, "res == Sqlite.OK"); +#line 597 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = stmt; +#line 597 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = sqlite3_step (_tmp10_); +#line 597 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp11_; +#line 598 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = res; +#line 598 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp12_ != SQLITE_DONE) { +#line 4654 "PhotoTable.c" + gint _tmp13_ = 0; +#line 599 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = res; +#line 599 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_warning ("remove", _tmp13_); +#line 601 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = FALSE; +#line 601 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 601 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 4666 "PhotoTable.c" + } +#line 604 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = TRUE; +#line 604 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 604 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 4674 "PhotoTable.c" +} + + +void photo_table_remove (PhotoTable* self, PhotoID* photo_id, GError** error) { + PhotoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + GError * _inner_error_ = NULL; +#line 607 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_TABLE (self)); +#line 607 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (photo_id != NULL); +#line 608 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = *photo_id; +#line 608 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp0_.id; +#line 608 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_delete_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, &_inner_error_); +#line 608 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 608 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 608 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_propagate_error (error, _inner_error_); +#line 608 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 4700 "PhotoTable.c" + } else { +#line 608 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 608 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 608 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 4708 "PhotoTable.c" + } + } +} + + +GeeArrayList* photo_table_get_photos (PhotoTable* self) { + GeeArrayList* result = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + GeeArrayList* photo_ids = NULL; + GeeArrayList* _tmp4_ = NULL; +#line 611 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), NULL); +#line 613 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = database_table_db; +#line 613 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "SELECT id FROM PhotoTable", -1, &_tmp1_, NULL); +#line 613 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 613 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp1_; +#line 613 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp2_; +#line 614 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = res; +#line 614 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 616 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = gee_array_list_new (TYPE_PHOTO_ID, (GBoxedCopyFunc) photo_id_dup, photo_id_free, NULL, NULL, NULL); +#line 616 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + photo_ids = _tmp4_; +#line 4744 "PhotoTable.c" + { + gboolean _tmp5_ = FALSE; +#line 617 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = TRUE; +#line 617 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + while (TRUE) { +#line 4751 "PhotoTable.c" + sqlite3_stmt* _tmp6_ = NULL; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + GeeArrayList* _tmp11_ = NULL; + sqlite3_stmt* _tmp12_ = NULL; + gint64 _tmp13_ = 0LL; + PhotoID _tmp14_ = {0}; +#line 617 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (!_tmp5_) { +#line 4761 "PhotoTable.c" + } +#line 617 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = FALSE; +#line 618 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = stmt; +#line 618 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = sqlite3_step (_tmp6_); +#line 618 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp7_; +#line 619 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = res; +#line 619 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp8_ == SQLITE_DONE) { +#line 620 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + break; +#line 4777 "PhotoTable.c" + } else { + gint _tmp9_ = 0; +#line 621 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = res; +#line 621 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp9_ != SQLITE_ROW) { +#line 4784 "PhotoTable.c" + gint _tmp10_ = 0; +#line 622 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = res; +#line 622 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_fatal ("get_photos", _tmp10_); +#line 624 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + break; +#line 4792 "PhotoTable.c" + } + } +#line 627 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = photo_ids; +#line 627 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = stmt; +#line 627 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = sqlite3_column_int64 (_tmp12_, 0); +#line 627 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + photo_id_init (&_tmp14_, _tmp13_); +#line 627 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + gee_abstract_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), &_tmp14_); +#line 4805 "PhotoTable.c" + } + } +#line 630 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = photo_ids; +#line 630 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 630 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 4814 "PhotoTable.c" +} + + +gboolean photo_table_set_orientation (PhotoTable* self, PhotoID* photo_id, Orientation orientation) { + gboolean result = FALSE; + PhotoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + Orientation _tmp2_ = 0; + gboolean _tmp3_ = FALSE; +#line 633 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), FALSE); +#line 633 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (photo_id != NULL, FALSE); +#line 634 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = *photo_id; +#line 634 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp0_.id; +#line 634 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = orientation; +#line 634 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = database_table_update_int_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "orientation", (gint) _tmp2_); +#line 634 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp3_; +#line 634 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 4840 "PhotoTable.c" +} + + +gboolean photo_table_replace_flags (PhotoTable* self, PhotoID* photo_id, guint64 flags) { + gboolean result = FALSE; + PhotoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + guint64 _tmp2_ = 0ULL; + gboolean _tmp3_ = FALSE; +#line 637 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), FALSE); +#line 637 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (photo_id != NULL, FALSE); +#line 638 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = *photo_id; +#line 638 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp0_.id; +#line 638 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = flags; +#line 638 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = database_table_update_int64_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "flags", (gint64) _tmp2_); +#line 638 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp3_; +#line 638 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 4866 "PhotoTable.c" +} + + +gboolean photo_table_set_rating (PhotoTable* self, PhotoID* photo_id, Rating rating) { + gboolean result = FALSE; + PhotoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + Rating _tmp2_ = 0; + gint _tmp3_ = 0; + gboolean _tmp4_ = FALSE; +#line 641 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), FALSE); +#line 641 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (photo_id != NULL, FALSE); +#line 642 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = *photo_id; +#line 642 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp0_.id; +#line 642 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = rating; +#line 642 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = rating_serialize (_tmp2_); +#line 642 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = database_table_update_int_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "rating", _tmp3_); +#line 642 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp4_; +#line 642 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 4895 "PhotoTable.c" +} + + +gint photo_table_get_event_photo_count (PhotoTable* self, EventID* event_id) { + gint result = 0; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + EventID _tmp5_ = {0}; + gint64 _tmp6_ = 0LL; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + gint count = 0; +#line 645 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), 0); +#line 645 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (event_id != NULL, 0); +#line 647 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = database_table_db; +#line 647 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "SELECT id FROM PhotoTable WHERE event_id = ?", -1, &_tmp1_, NULL); +#line 647 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 647 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp1_; +#line 647 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp2_; +#line 648 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = res; +#line 648 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 650 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = stmt; +#line 650 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = *event_id; +#line 650 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = _tmp5_.id; +#line 650 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = sqlite3_bind_int64 (_tmp4_, 1, _tmp6_); +#line 650 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp7_; +#line 651 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = res; +#line 651 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp8_ == SQLITE_OK, "res == Sqlite.OK"); +#line 653 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + count = 0; +#line 4947 "PhotoTable.c" + { + gboolean _tmp9_ = FALSE; +#line 654 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = TRUE; +#line 654 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + while (TRUE) { +#line 4954 "PhotoTable.c" + sqlite3_stmt* _tmp10_ = NULL; + gint _tmp11_ = 0; + gint _tmp12_ = 0; + gint _tmp15_ = 0; +#line 654 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (!_tmp9_) { +#line 4961 "PhotoTable.c" + } +#line 654 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = FALSE; +#line 655 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = stmt; +#line 655 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = sqlite3_step (_tmp10_); +#line 655 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp11_; +#line 656 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = res; +#line 656 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp12_ == SQLITE_DONE) { +#line 657 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + break; +#line 4977 "PhotoTable.c" + } else { + gint _tmp13_ = 0; +#line 658 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = res; +#line 658 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp13_ != SQLITE_ROW) { +#line 4984 "PhotoTable.c" + gint _tmp14_ = 0; +#line 659 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = res; +#line 659 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_fatal ("get_event_photo_count", _tmp14_); +#line 661 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + break; +#line 4992 "PhotoTable.c" + } + } +#line 664 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = count; +#line 664 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + count = _tmp15_ + 1; +#line 4999 "PhotoTable.c" + } + } +#line 667 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = count; +#line 667 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 667 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 5008 "PhotoTable.c" +} + + +GeeArrayList* photo_table_get_event_source_ids (PhotoTable* self, EventID* event_id) { + GeeArrayList* result = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + EventID _tmp5_ = {0}; + gint64 _tmp6_ = 0LL; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + GeeArrayList* _result_ = NULL; + GeeArrayList* _tmp9_ = NULL; +#line 670 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), NULL); +#line 670 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (event_id != NULL, NULL); +#line 672 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = database_table_db; +#line 672 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "SELECT id FROM PhotoTable WHERE event_id = ?", -1, &_tmp1_, NULL); +#line 672 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 672 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp1_; +#line 672 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp2_; +#line 673 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = res; +#line 673 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 675 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = stmt; +#line 675 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = *event_id; +#line 675 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = _tmp5_.id; +#line 675 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = sqlite3_bind_int64 (_tmp4_, 1, _tmp6_); +#line 675 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp7_; +#line 676 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = res; +#line 676 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp8_ == SQLITE_OK, "res == Sqlite.OK"); +#line 678 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL); +#line 678 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _result_ = _tmp9_; +#line 5063 "PhotoTable.c" + { + gboolean _tmp10_ = FALSE; +#line 679 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = TRUE; +#line 679 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + while (TRUE) { +#line 5070 "PhotoTable.c" + sqlite3_stmt* _tmp11_ = NULL; + gint _tmp12_ = 0; + gint _tmp13_ = 0; + GeeArrayList* _tmp16_ = NULL; + sqlite3_stmt* _tmp17_ = NULL; + gint64 _tmp18_ = 0LL; + PhotoID _tmp19_ = {0}; + gchar* _tmp20_ = NULL; + gchar* _tmp21_ = NULL; +#line 679 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (!_tmp10_) { +#line 5082 "PhotoTable.c" + } +#line 679 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = FALSE; +#line 680 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = stmt; +#line 680 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = sqlite3_step (_tmp11_); +#line 680 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp12_; +#line 681 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = res; +#line 681 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp13_ == SQLITE_DONE) { +#line 682 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + break; +#line 5098 "PhotoTable.c" + } else { + gint _tmp14_ = 0; +#line 683 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = res; +#line 683 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp14_ != SQLITE_ROW) { +#line 5105 "PhotoTable.c" + gint _tmp15_ = 0; +#line 684 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = res; +#line 684 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_fatal ("get_event_source_ids", _tmp15_); +#line 686 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + break; +#line 5113 "PhotoTable.c" + } + } +#line 689 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = _result_; +#line 689 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp17_ = stmt; +#line 689 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp18_ = sqlite3_column_int64 (_tmp17_, 0); +#line 689 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + photo_id_init (&_tmp19_, _tmp18_); +#line 689 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp20_ = photo_id_upgrade_photo_id_to_source_id (&_tmp19_); +#line 689 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp21_ = _tmp20_; +#line 689 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + gee_abstract_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), _tmp21_); +#line 689 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp21_); +#line 5132 "PhotoTable.c" + } + } +#line 692 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _result_; +#line 692 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 692 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 5141 "PhotoTable.c" +} + + +gboolean photo_table_event_has_photos (PhotoTable* self, EventID* event_id) { + gboolean result = FALSE; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + EventID _tmp5_ = {0}; + gint64 _tmp6_ = 0LL; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + sqlite3_stmt* _tmp9_ = NULL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; +#line 695 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), FALSE); +#line 695 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (event_id != NULL, FALSE); +#line 697 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = database_table_db; +#line 697 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "SELECT id FROM PhotoTable WHERE event_id = ? LIMIT 1", -1, &_tmp1_, NULL); +#line 697 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 697 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp1_; +#line 697 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp2_; +#line 698 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = res; +#line 698 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 700 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = stmt; +#line 700 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = *event_id; +#line 700 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = _tmp5_.id; +#line 700 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = sqlite3_bind_int64 (_tmp4_, 1, _tmp6_); +#line 700 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp7_; +#line 701 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = res; +#line 701 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp8_ == SQLITE_OK, "res == Sqlite.OK"); +#line 703 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = stmt; +#line 703 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = sqlite3_step (_tmp9_); +#line 703 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp10_; +#line 704 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = res; +#line 704 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp11_ == SQLITE_DONE) { +#line 705 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = FALSE; +#line 705 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 705 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 5209 "PhotoTable.c" + } else { + gint _tmp12_ = 0; +#line 706 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = res; +#line 706 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp12_ != SQLITE_ROW) { +#line 5216 "PhotoTable.c" + gint _tmp13_ = 0; +#line 707 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = res; +#line 707 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_fatal ("event_has_photos", _tmp13_); +#line 709 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = FALSE; +#line 709 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 709 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 5228 "PhotoTable.c" + } + } +#line 712 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = TRUE; +#line 712 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 712 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 5237 "PhotoTable.c" +} + + +gboolean photo_table_drop_event (PhotoTable* self, EventID* event_id) { + gboolean result = FALSE; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + sqlite3_stmt* _tmp7_ = NULL; + EventID _tmp8_ = {0}; + gint64 _tmp9_ = 0LL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + sqlite3_stmt* _tmp12_ = NULL; + gint _tmp13_ = 0; + gint _tmp14_ = 0; +#line 715 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), FALSE); +#line 715 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (event_id != NULL, FALSE); +#line 717 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = database_table_db; +#line 717 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "UPDATE PhotoTable SET event_id = ? WHERE event_id = ?", -1, &_tmp1_, NULL); +#line 717 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 717 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp1_; +#line 717 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp2_; +#line 718 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = res; +#line 718 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 720 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = stmt; +#line 720 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = sqlite3_bind_int64 (_tmp4_, 1, EVENT_ID_INVALID); +#line 720 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp5_; +#line 721 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = res; +#line 721 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp6_ == SQLITE_OK, "res == Sqlite.OK"); +#line 722 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = stmt; +#line 722 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = *event_id; +#line 722 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = _tmp8_.id; +#line 722 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = sqlite3_bind_int64 (_tmp7_, 2, _tmp9_); +#line 722 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp10_; +#line 723 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = res; +#line 723 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp11_ == SQLITE_OK, "res == Sqlite.OK"); +#line 725 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = stmt; +#line 725 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = sqlite3_step (_tmp12_); +#line 725 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp13_; +#line 726 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = res; +#line 726 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp14_ != SQLITE_DONE) { +#line 5312 "PhotoTable.c" + gint _tmp15_ = 0; +#line 727 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = res; +#line 727 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_fatal ("drop_event", _tmp15_); +#line 729 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = FALSE; +#line 729 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 729 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 5324 "PhotoTable.c" + } +#line 732 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = TRUE; +#line 732 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 732 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 5332 "PhotoTable.c" +} + + +gboolean photo_table_set_event (PhotoTable* self, PhotoID* photo_id, EventID* event_id) { + gboolean result = FALSE; + PhotoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + EventID _tmp2_ = {0}; + gint64 _tmp3_ = 0LL; + gboolean _tmp4_ = FALSE; +#line 735 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), FALSE); +#line 735 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (photo_id != NULL, FALSE); +#line 735 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (event_id != NULL, FALSE); +#line 736 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = *photo_id; +#line 736 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp0_.id; +#line 736 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = *event_id; +#line 736 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = _tmp2_.id; +#line 736 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = database_table_update_int64_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "event_id", _tmp3_); +#line 736 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp4_; +#line 736 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 5363 "PhotoTable.c" +} + + +static gchar* photo_table_get_raw_transformations (PhotoTable* self, PhotoID* photo_id) { + gchar* result = NULL; + sqlite3_stmt* stmt = NULL; + PhotoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + sqlite3_stmt* _tmp2_ = NULL; + gboolean _tmp3_ = FALSE; + gchar* trans = NULL; + sqlite3_stmt* _tmp4_ = NULL; + const gchar* _tmp5_ = NULL; + gchar* _tmp6_ = NULL; + gboolean _tmp7_ = FALSE; + const gchar* _tmp8_ = NULL; +#line 739 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), NULL); +#line 739 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (photo_id != NULL, NULL); +#line 741 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = *photo_id; +#line 741 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp0_.id; +#line 741 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = database_table_select_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "transformations", &_tmp2_); +#line 741 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 741 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp2_; +#line 741 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (!_tmp3_) { +#line 742 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = NULL; +#line 742 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 742 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 5402 "PhotoTable.c" + } +#line 744 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = stmt; +#line 744 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = sqlite3_column_text (_tmp4_, 0); +#line 744 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = g_strdup (_tmp5_); +#line 744 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + trans = _tmp6_; +#line 745 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = trans; +#line 745 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp8_ == NULL) { +#line 745 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = TRUE; +#line 5418 "PhotoTable.c" + } else { + const gchar* _tmp9_ = NULL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; +#line 745 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = trans; +#line 745 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = strlen (_tmp9_); +#line 745 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = _tmp10_; +#line 745 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = _tmp11_ == 0; +#line 5431 "PhotoTable.c" + } +#line 745 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp7_) { +#line 746 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = NULL; +#line 746 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (trans); +#line 746 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 746 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 5443 "PhotoTable.c" + } +#line 748 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = trans; +#line 748 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 748 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 5451 "PhotoTable.c" +} + + +static gboolean photo_table_set_raw_transformations (PhotoTable* self, PhotoID* photo_id, const gchar* trans) { + gboolean result = FALSE; + PhotoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + const gchar* _tmp2_ = NULL; + gboolean _tmp3_ = FALSE; +#line 751 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), FALSE); +#line 751 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (photo_id != NULL, FALSE); +#line 751 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (trans != NULL, FALSE); +#line 752 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = *photo_id; +#line 752 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp0_.id; +#line 752 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = trans; +#line 752 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = database_table_update_text_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "transformations", _tmp2_); +#line 752 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp3_; +#line 752 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 5479 "PhotoTable.c" +} + + +gboolean photo_table_set_transformation_state (PhotoTable* self, PhotoID* photo_id, Orientation orientation, GeeHashMap* transformations) { + gboolean result = FALSE; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + Orientation _tmp5_ = 0; + gint _tmp6_ = 0; + gint _tmp7_ = 0; + sqlite3_stmt* _tmp8_ = NULL; + GeeHashMap* _tmp9_ = NULL; + gchar* _tmp10_ = NULL; + GDestroyNotify _tmp11_ = NULL; + gint _tmp12_ = 0; + gint _tmp13_ = 0; + sqlite3_stmt* _tmp14_ = NULL; + PhotoID _tmp15_ = {0}; + gint64 _tmp16_ = 0LL; + gint _tmp17_ = 0; + gint _tmp18_ = 0; + sqlite3_stmt* _tmp19_ = NULL; + gint _tmp20_ = 0; + gint _tmp21_ = 0; +#line 755 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), FALSE); +#line 755 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (photo_id != NULL, FALSE); +#line 755 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail ((transformations == NULL) || GEE_IS_HASH_MAP (transformations), FALSE); +#line 758 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = database_table_db; +#line 758 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "UPDATE PhotoTable SET orientation = ?, transformations = ? WHERE id = " \ +"?", -1, &_tmp1_, NULL); +#line 758 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 758 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp1_; +#line 758 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp2_; +#line 760 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = res; +#line 760 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 762 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = stmt; +#line 762 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = orientation; +#line 762 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = sqlite3_bind_int (_tmp4_, 1, (gint) _tmp5_); +#line 762 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp6_; +#line 763 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = res; +#line 763 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp7_ == SQLITE_OK, "res == Sqlite.OK"); +#line 764 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = stmt; +#line 764 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = transformations; +#line 764 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = photo_table_unmarshall_all_transformations (_tmp9_); +#line 764 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = g_free; +#line 764 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = sqlite3_bind_text (_tmp8_, 2, _tmp10_, -1, _tmp11_); +#line 764 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp12_; +#line 765 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = res; +#line 765 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp13_ == SQLITE_OK, "res == Sqlite.OK"); +#line 766 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = stmt; +#line 766 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = *photo_id; +#line 766 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = _tmp15_.id; +#line 766 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp17_ = sqlite3_bind_int64 (_tmp14_, 3, _tmp16_); +#line 766 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp17_; +#line 767 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp18_ = res; +#line 767 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp18_ == SQLITE_OK, "res == Sqlite.OK"); +#line 769 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp19_ = stmt; +#line 769 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp20_ = sqlite3_step (_tmp19_); +#line 769 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp20_; +#line 770 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp21_ = res; +#line 770 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp21_ != SQLITE_DONE) { +#line 5581 "PhotoTable.c" + gint _tmp22_ = 0; +#line 771 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp22_ = res; +#line 771 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_fatal ("set_transformation_state", _tmp22_); +#line 773 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = FALSE; +#line 773 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 773 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 5593 "PhotoTable.c" + } +#line 776 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = TRUE; +#line 776 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 776 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 5601 "PhotoTable.c" +} + + +GeeHashMap* photo_table_marshall_all_transformations (const gchar* trans) { + GeeHashMap* result = NULL; + gboolean _tmp0_ = FALSE; + const gchar* _tmp1_ = NULL; + GError * _inner_error_ = NULL; +#line 780 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = trans; +#line 780 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp1_ == NULL) { +#line 780 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = TRUE; +#line 5616 "PhotoTable.c" + } else { + const gchar* _tmp2_ = NULL; + gint _tmp3_ = 0; + gint _tmp4_ = 0; +#line 780 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = trans; +#line 780 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = strlen (_tmp2_); +#line 780 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = _tmp3_; +#line 780 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = _tmp4_ == 0; +#line 5629 "PhotoTable.c" + } +#line 780 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp0_) { +#line 781 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = NULL; +#line 781 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 5637 "PhotoTable.c" + } + { + GKeyFile* keyfile = NULL; + GKeyFile* _tmp5_ = NULL; + gboolean _tmp6_ = FALSE; + GKeyFile* _tmp7_ = NULL; + const gchar* _tmp8_ = NULL; + const gchar* _tmp9_ = NULL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + gboolean _tmp12_ = FALSE; + GeeHashMap* map = NULL; + GeeHashMap* _tmp13_ = NULL; + gchar** objects = NULL; + GKeyFile* _tmp14_ = NULL; + gsize _tmp15_; + gchar** _tmp16_ = NULL; + gint objects_length1 = 0; + gint _objects_size_ = 0; + gchar** _tmp17_ = NULL; + gint _tmp17__length1 = 0; +#line 784 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = g_key_file_new (); +#line 784 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + keyfile = _tmp5_; +#line 785 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = keyfile; +#line 785 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = trans; +#line 785 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = trans; +#line 785 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = strlen (_tmp9_); +#line 785 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = _tmp10_; +#line 785 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = g_key_file_load_from_data (_tmp7_, _tmp8_, (gsize) _tmp11_, G_KEY_FILE_NONE, &_inner_error_); +#line 785 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = _tmp12_; +#line 785 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 785 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_key_file_unref0 (keyfile); +#line 5681 "PhotoTable.c" + goto __catch15_g_error; + } +#line 785 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (!_tmp6_) { +#line 786 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = NULL; +#line 786 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_key_file_unref0 (keyfile); +#line 786 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 5692 "PhotoTable.c" + } +#line 788 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, TYPE_KEY_VALUE_MAP, (GBoxedCopyFunc) key_value_map_ref, key_value_map_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +#line 788 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + map = _tmp13_; +#line 790 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = keyfile; +#line 790 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = g_key_file_get_groups (_tmp14_, &_tmp15_); +#line 790 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + objects = _tmp16_; +#line 790 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + objects_length1 = _tmp15_; +#line 790 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _objects_size_ = objects_length1; +#line 791 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp17_ = objects; +#line 791 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp17__length1 = objects_length1; +#line 5712 "PhotoTable.c" + { + gchar** object_collection = NULL; + gint object_collection_length1 = 0; + gint _object_collection_size_ = 0; + gint object_it = 0; +#line 791 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + object_collection = _tmp17_; +#line 791 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + object_collection_length1 = _tmp17__length1; +#line 791 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + for (object_it = 0; object_it < _tmp17__length1; object_it = object_it + 1) { +#line 5724 "PhotoTable.c" + gchar* _tmp18_ = NULL; + gchar* object = NULL; +#line 791 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp18_ = g_strdup (object_collection[object_it]); +#line 791 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + object = _tmp18_; +#line 5731 "PhotoTable.c" + { + gchar** keys = NULL; + GKeyFile* _tmp19_ = NULL; + const gchar* _tmp20_ = NULL; + gsize _tmp21_; + gchar** _tmp22_ = NULL; + gint keys_length1 = 0; + gint _keys_size_ = 0; + gboolean _tmp23_ = FALSE; + gchar** _tmp24_ = NULL; + gint _tmp24__length1 = 0; + KeyValueMap* key_map = NULL; + const gchar* _tmp26_ = NULL; + KeyValueMap* _tmp27_ = NULL; + GeeHashMap* _tmp43_ = NULL; + const gchar* _tmp44_ = NULL; + KeyValueMap* _tmp45_ = NULL; +#line 792 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp19_ = keyfile; +#line 792 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp20_ = object; +#line 792 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp22_ = g_key_file_get_keys (_tmp19_, _tmp20_, &_tmp21_, &_inner_error_); +#line 792 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + keys = _tmp22_; +#line 792 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + keys_length1 = _tmp21_; +#line 792 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _keys_size_ = keys_length1; +#line 792 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 792 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (object); +#line 792 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + objects = (_vala_array_free (objects, objects_length1, (GDestroyNotify) g_free), NULL); +#line 792 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_object_unref0 (map); +#line 792 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_key_file_unref0 (keyfile); +#line 5771 "PhotoTable.c" + goto __catch15_g_error; + } +#line 793 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp24_ = keys; +#line 793 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp24__length1 = keys_length1; +#line 793 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp24_ == NULL) { +#line 793 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp23_ = TRUE; +#line 5782 "PhotoTable.c" + } else { + gchar** _tmp25_ = NULL; + gint _tmp25__length1 = 0; +#line 793 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp25_ = keys; +#line 793 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp25__length1 = keys_length1; +#line 793 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp23_ = _tmp25__length1 == 0; +#line 5792 "PhotoTable.c" + } +#line 793 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp23_) { +#line 794 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL); +#line 794 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (object); +#line 794 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + continue; +#line 5802 "PhotoTable.c" + } +#line 796 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp26_ = object; +#line 796 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp27_ = key_value_map_new (_tmp26_); +#line 796 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + key_map = _tmp27_; +#line 5810 "PhotoTable.c" + { + gint ctr = 0; +#line 797 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + ctr = 0; +#line 5815 "PhotoTable.c" + { + gboolean _tmp28_ = FALSE; +#line 797 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp28_ = TRUE; +#line 797 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + while (TRUE) { +#line 5822 "PhotoTable.c" + gint _tmp30_ = 0; + gchar** _tmp31_ = NULL; + gint _tmp31__length1 = 0; + gchar* _tmp32_ = NULL; + GKeyFile* _tmp33_ = NULL; + const gchar* _tmp34_ = NULL; + gchar** _tmp35_ = NULL; + gint _tmp35__length1 = 0; + gint _tmp36_ = 0; + const gchar* _tmp37_ = NULL; + gchar* _tmp38_ = NULL; + KeyValueMap* _tmp39_ = NULL; + gchar** _tmp40_ = NULL; + gint _tmp40__length1 = 0; + gint _tmp41_ = 0; + const gchar* _tmp42_ = NULL; +#line 797 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (!_tmp28_) { +#line 5841 "PhotoTable.c" + gint _tmp29_ = 0; +#line 797 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp29_ = ctr; +#line 797 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + ctr = _tmp29_ + 1; +#line 5847 "PhotoTable.c" + } +#line 797 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp28_ = FALSE; +#line 797 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp30_ = ctr; +#line 797 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp31_ = keys; +#line 797 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp31__length1 = keys_length1; +#line 797 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (!(_tmp30_ < _tmp31__length1)) { +#line 797 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + break; +#line 5861 "PhotoTable.c" + } +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp33_ = keyfile; +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp34_ = object; +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp35_ = keys; +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp35__length1 = keys_length1; +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp36_ = ctr; +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp37_ = _tmp35_[_tmp36_]; +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp38_ = g_key_file_get_string (_tmp33_, _tmp34_, _tmp37_, &_inner_error_); +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp32_ = _tmp38_; +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _key_value_map_unref0 (key_map); +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL); +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (object); +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + objects = (_vala_array_free (objects, objects_length1, (GDestroyNotify) g_free), NULL); +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_object_unref0 (map); +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_key_file_unref0 (keyfile); +#line 5893 "PhotoTable.c" + goto __catch15_g_error; + } +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp39_ = key_map; +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp40_ = keys; +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp40__length1 = keys_length1; +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp41_ = ctr; +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp42_ = _tmp40_[_tmp41_]; +#line 798 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + key_value_map_set_string (_tmp39_, _tmp42_, _tmp32_); +#line 797 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp32_); +#line 5910 "PhotoTable.c" + } + } + } +#line 800 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp43_ = map; +#line 800 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp44_ = object; +#line 800 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp45_ = key_map; +#line 800 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + gee_abstract_map_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp43_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _tmp44_, _tmp45_); +#line 791 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _key_value_map_unref0 (key_map); +#line 791 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL); +#line 791 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (object); +#line 5928 "PhotoTable.c" + } + } + } +#line 803 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = map; +#line 803 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + objects = (_vala_array_free (objects, objects_length1, (GDestroyNotify) g_free), NULL); +#line 803 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_key_file_unref0 (keyfile); +#line 803 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 5940 "PhotoTable.c" + } + goto __finally15; + __catch15_g_error: + { + GError* err = NULL; + const gchar* _tmp46_ = NULL; +#line 783 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + err = _inner_error_; +#line 783 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _inner_error_ = NULL; +#line 805 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp46_ = err->message; +#line 805 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_error ("PhotoTable.vala:805: %s", _tmp46_); +#line 783 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_error_free0 (err); +#line 5957 "PhotoTable.c" + } + __finally15: +#line 783 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 783 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 783 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return NULL; +#line 5966 "PhotoTable.c" +} + + +gchar* photo_table_unmarshall_all_transformations (GeeHashMap* transformations) { + gchar* result = NULL; + gboolean _tmp0_ = FALSE; + GeeHashMap* _tmp1_ = NULL; + GKeyFile* keyfile = NULL; + GKeyFile* _tmp8_ = NULL; + gsize length = 0UL; + gchar* unmarshalled = NULL; + GKeyFile* _tmp39_ = NULL; + gsize _tmp40_ = 0UL; + gchar* _tmp41_ = NULL; + const gchar* _tmp42_ = NULL; + const gchar* _tmp43_ = NULL; + gint _tmp44_ = 0; + gint _tmp45_ = 0; +#line 809 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail ((transformations == NULL) || GEE_IS_HASH_MAP (transformations), NULL); +#line 810 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = transformations; +#line 810 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp1_ == NULL) { +#line 810 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = TRUE; +#line 5993 "PhotoTable.c" + } else { + GeeHashMap* _tmp2_ = NULL; + GeeSet* _tmp3_ = NULL; + GeeSet* _tmp4_ = NULL; + GeeSet* _tmp5_ = NULL; + gint _tmp6_ = 0; + gint _tmp7_ = 0; +#line 810 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = transformations; +#line 810 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = gee_abstract_map_get_keys (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, GEE_TYPE_MAP, GeeMap)); +#line 810 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = _tmp3_; +#line 810 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = _tmp4_; +#line 810 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = gee_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, GEE_TYPE_COLLECTION, GeeCollection)); +#line 810 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = _tmp6_; +#line 810 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = _tmp7_ == 0; +#line 810 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_object_unref0 (_tmp5_); +#line 6017 "PhotoTable.c" + } +#line 810 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp0_) { +#line 811 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = NULL; +#line 811 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 6025 "PhotoTable.c" + } +#line 813 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = g_key_file_new (); +#line 813 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + keyfile = _tmp8_; +#line 6031 "PhotoTable.c" + { + GeeIterator* _object_it = NULL; + GeeHashMap* _tmp9_ = NULL; + GeeSet* _tmp10_ = NULL; + GeeSet* _tmp11_ = NULL; + GeeSet* _tmp12_ = NULL; + GeeIterator* _tmp13_ = NULL; + GeeIterator* _tmp14_ = NULL; +#line 815 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = transformations; +#line 815 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = gee_abstract_map_get_keys (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, GEE_TYPE_MAP, GeeMap)); +#line 815 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = _tmp10_; +#line 815 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = _tmp11_; +#line 815 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, GEE_TYPE_ITERABLE, GeeIterable)); +#line 815 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = _tmp13_; +#line 815 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_object_unref0 (_tmp12_); +#line 815 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _object_it = _tmp14_; +#line 815 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + while (TRUE) { +#line 6058 "PhotoTable.c" + GeeIterator* _tmp15_ = NULL; + gboolean _tmp16_ = FALSE; + gchar* object = NULL; + GeeIterator* _tmp17_ = NULL; + gpointer _tmp18_ = NULL; + KeyValueMap* map = NULL; + GeeHashMap* _tmp19_ = NULL; + const gchar* _tmp20_ = NULL; + gpointer _tmp21_ = NULL; +#line 815 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = _object_it; +#line 815 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = gee_iterator_next (_tmp15_); +#line 815 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (!_tmp16_) { +#line 815 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + break; +#line 6076 "PhotoTable.c" + } +#line 815 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp17_ = _object_it; +#line 815 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp18_ = gee_iterator_get (_tmp17_); +#line 815 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + object = (gchar*) _tmp18_; +#line 816 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp19_ = transformations; +#line 816 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp20_ = object; +#line 816 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp21_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp19_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _tmp20_); +#line 816 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + map = (KeyValueMap*) _tmp21_; +#line 6092 "PhotoTable.c" + { + GeeIterator* _key_it = NULL; + KeyValueMap* _tmp22_ = NULL; + GeeSet* _tmp23_ = NULL; + GeeSet* _tmp24_ = NULL; + GeeIterator* _tmp25_ = NULL; + GeeIterator* _tmp26_ = NULL; +#line 818 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp22_ = map; +#line 818 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp23_ = key_value_map_get_keys (_tmp22_); +#line 818 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp24_ = _tmp23_; +#line 818 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp25_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp24_, GEE_TYPE_ITERABLE, GeeIterable)); +#line 818 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp26_ = _tmp25_; +#line 818 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_object_unref0 (_tmp24_); +#line 818 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _key_it = _tmp26_; +#line 818 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + while (TRUE) { +#line 6116 "PhotoTable.c" + GeeIterator* _tmp27_ = NULL; + gboolean _tmp28_ = FALSE; + gchar* key = NULL; + GeeIterator* _tmp29_ = NULL; + gpointer _tmp30_ = NULL; + gchar* value = NULL; + KeyValueMap* _tmp31_ = NULL; + const gchar* _tmp32_ = NULL; + gchar* _tmp33_ = NULL; + const gchar* _tmp34_ = NULL; + GKeyFile* _tmp35_ = NULL; + const gchar* _tmp36_ = NULL; + const gchar* _tmp37_ = NULL; + const gchar* _tmp38_ = NULL; +#line 818 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp27_ = _key_it; +#line 818 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp28_ = gee_iterator_next (_tmp27_); +#line 818 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (!_tmp28_) { +#line 818 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + break; +#line 6139 "PhotoTable.c" + } +#line 818 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp29_ = _key_it; +#line 818 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp30_ = gee_iterator_get (_tmp29_); +#line 818 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + key = (gchar*) _tmp30_; +#line 819 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp31_ = map; +#line 819 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp32_ = key; +#line 819 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp33_ = key_value_map_get_string (_tmp31_, _tmp32_, NULL); +#line 819 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + value = _tmp33_; +#line 820 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp34_ = value; +#line 820 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp34_ != NULL, "value != null"); +#line 822 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp35_ = keyfile; +#line 822 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp36_ = object; +#line 822 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp37_ = key; +#line 822 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp38_ = value; +#line 822 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_key_file_set_string (_tmp35_, _tmp36_, _tmp37_, _tmp38_); +#line 818 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (value); +#line 818 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (key); +#line 6173 "PhotoTable.c" + } +#line 818 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_object_unref0 (_key_it); +#line 6177 "PhotoTable.c" + } +#line 815 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _key_value_map_unref0 (map); +#line 815 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (object); +#line 6183 "PhotoTable.c" + } +#line 815 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_object_unref0 (_object_it); +#line 6187 "PhotoTable.c" + } +#line 827 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp39_ = keyfile; +#line 827 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp41_ = g_key_file_to_data (_tmp39_, &_tmp40_, NULL); +#line 827 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + length = _tmp40_; +#line 827 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + unmarshalled = _tmp41_; +#line 828 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp42_ = unmarshalled; +#line 828 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp42_ != NULL, "unmarshalled != null"); +#line 829 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp43_ = unmarshalled; +#line 829 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp44_ = strlen (_tmp43_); +#line 829 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp45_ = _tmp44_; +#line 829 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp45_ > 0, "unmarshalled.length > 0"); +#line 831 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = unmarshalled; +#line 831 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_key_file_unref0 (keyfile); +#line 831 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 6215 "PhotoTable.c" +} + + +gboolean photo_table_set_transformation (PhotoTable* self, PhotoID* photo_id, KeyValueMap* map) { + gboolean result = FALSE; + gchar* trans = NULL; + PhotoID _tmp0_ = {0}; + gchar* _tmp1_ = NULL; + PhotoID _tmp37_ = {0}; + const gchar* _tmp38_ = NULL; + gboolean _tmp39_ = FALSE; + GError * _inner_error_ = NULL; +#line 834 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), FALSE); +#line 834 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (photo_id != NULL, FALSE); +#line 834 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_KEY_VALUE_MAP (map), FALSE); +#line 835 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = *photo_id; +#line 835 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = photo_table_get_raw_transformations (self, &_tmp0_); +#line 835 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + trans = _tmp1_; +#line 6240 "PhotoTable.c" + { + GKeyFile* keyfile = NULL; + GKeyFile* _tmp2_ = NULL; + const gchar* _tmp3_ = NULL; + GeeSet* keys = NULL; + KeyValueMap* _tmp11_ = NULL; + GeeSet* _tmp12_ = NULL; + gsize length = 0UL; + GKeyFile* _tmp29_ = NULL; + gsize _tmp30_ = 0UL; + gchar* _tmp31_ = NULL; + const gchar* _tmp32_ = NULL; + const gchar* _tmp33_ = NULL; + gint _tmp34_ = 0; + gint _tmp35_ = 0; +#line 838 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = g_key_file_new (); +#line 838 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + keyfile = _tmp2_; +#line 839 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = trans; +#line 839 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp3_ != NULL) { +#line 6264 "PhotoTable.c" + gboolean _tmp4_ = FALSE; + GKeyFile* _tmp5_ = NULL; + const gchar* _tmp6_ = NULL; + const gchar* _tmp7_ = NULL; + gint _tmp8_ = 0; + gint _tmp9_ = 0; + gboolean _tmp10_ = FALSE; +#line 840 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = keyfile; +#line 840 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = trans; +#line 840 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = trans; +#line 840 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = strlen (_tmp7_); +#line 840 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = _tmp8_; +#line 840 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = g_key_file_load_from_data (_tmp5_, _tmp6_, (gsize) _tmp9_, G_KEY_FILE_NONE, &_inner_error_); +#line 840 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = _tmp10_; +#line 840 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 840 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_key_file_unref0 (keyfile); +#line 6290 "PhotoTable.c" + goto __catch16_g_error; + } +#line 840 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (!_tmp4_) { +#line 841 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = FALSE; +#line 841 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_key_file_unref0 (keyfile); +#line 841 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (trans); +#line 841 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 6303 "PhotoTable.c" + } + } +#line 844 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = map; +#line 844 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = key_value_map_get_keys (_tmp11_); +#line 844 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + keys = _tmp12_; +#line 6312 "PhotoTable.c" + { + GeeIterator* _key_it = NULL; + GeeSet* _tmp13_ = NULL; + GeeIterator* _tmp14_ = NULL; +#line 845 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = keys; +#line 845 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, GEE_TYPE_ITERABLE, GeeIterable)); +#line 845 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _key_it = _tmp14_; +#line 845 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + while (TRUE) { +#line 6325 "PhotoTable.c" + GeeIterator* _tmp15_ = NULL; + gboolean _tmp16_ = FALSE; + gchar* key = NULL; + GeeIterator* _tmp17_ = NULL; + gpointer _tmp18_ = NULL; + gchar* value = NULL; + KeyValueMap* _tmp19_ = NULL; + const gchar* _tmp20_ = NULL; + gchar* _tmp21_ = NULL; + const gchar* _tmp22_ = NULL; + GKeyFile* _tmp23_ = NULL; + KeyValueMap* _tmp24_ = NULL; + gchar* _tmp25_ = NULL; + gchar* _tmp26_ = NULL; + const gchar* _tmp27_ = NULL; + const gchar* _tmp28_ = NULL; +#line 845 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = _key_it; +#line 845 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = gee_iterator_next (_tmp15_); +#line 845 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (!_tmp16_) { +#line 845 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + break; +#line 6350 "PhotoTable.c" + } +#line 845 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp17_ = _key_it; +#line 845 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp18_ = gee_iterator_get (_tmp17_); +#line 845 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + key = (gchar*) _tmp18_; +#line 846 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp19_ = map; +#line 846 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp20_ = key; +#line 846 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp21_ = key_value_map_get_string (_tmp19_, _tmp20_, NULL); +#line 846 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + value = _tmp21_; +#line 847 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp22_ = value; +#line 847 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp22_ != NULL, "value != null"); +#line 849 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp23_ = keyfile; +#line 849 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp24_ = map; +#line 849 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp25_ = key_value_map_get_group (_tmp24_); +#line 849 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp26_ = _tmp25_; +#line 849 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp27_ = key; +#line 849 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp28_ = value; +#line 849 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_key_file_set_string (_tmp23_, _tmp26_, _tmp27_, _tmp28_); +#line 849 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp26_); +#line 845 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (value); +#line 845 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (key); +#line 6390 "PhotoTable.c" + } +#line 845 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_object_unref0 (_key_it); +#line 6394 "PhotoTable.c" + } +#line 853 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp29_ = keyfile; +#line 853 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp31_ = g_key_file_to_data (_tmp29_, &_tmp30_, NULL); +#line 853 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + length = _tmp30_; +#line 853 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (trans); +#line 853 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + trans = _tmp31_; +#line 854 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp32_ = trans; +#line 854 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp32_ != NULL, "trans != null"); +#line 855 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp33_ = trans; +#line 855 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp34_ = strlen (_tmp33_); +#line 855 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp35_ = _tmp34_; +#line 855 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp35_ > 0, "trans.length > 0"); +#line 837 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_object_unref0 (keys); +#line 837 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_key_file_unref0 (keyfile); +#line 6422 "PhotoTable.c" + } + goto __finally16; + __catch16_g_error: + { + GError* err = NULL; + const gchar* _tmp36_ = NULL; +#line 837 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + err = _inner_error_; +#line 837 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _inner_error_ = NULL; +#line 857 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp36_ = err->message; +#line 857 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_error ("PhotoTable.vala:857: %s", _tmp36_); +#line 837 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_error_free0 (err); +#line 6439 "PhotoTable.c" + } + __finally16: +#line 837 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 837 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (trans); +#line 837 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 837 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 837 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return FALSE; +#line 6452 "PhotoTable.c" + } +#line 860 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp37_ = *photo_id; +#line 860 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp38_ = trans; +#line 860 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp39_ = photo_table_set_raw_transformations (self, &_tmp37_, _tmp38_); +#line 860 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp39_; +#line 860 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (trans); +#line 860 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 6466 "PhotoTable.c" +} + + +gboolean photo_table_remove_transformation (PhotoTable* self, PhotoID* photo_id, const gchar* object) { + gboolean result = FALSE; + gchar* trans = NULL; + PhotoID _tmp0_ = {0}; + gchar* _tmp1_ = NULL; + const gchar* _tmp2_ = NULL; + PhotoID _tmp21_ = {0}; + const gchar* _tmp22_ = NULL; + gboolean _tmp23_ = FALSE; + GError * _inner_error_ = NULL; +#line 863 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), FALSE); +#line 863 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (photo_id != NULL, FALSE); +#line 863 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (object != NULL, FALSE); +#line 864 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = *photo_id; +#line 864 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = photo_table_get_raw_transformations (self, &_tmp0_); +#line 864 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + trans = _tmp1_; +#line 865 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = trans; +#line 865 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp2_ == NULL) { +#line 866 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = TRUE; +#line 866 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (trans); +#line 866 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 6502 "PhotoTable.c" + } + { + GKeyFile* keyfile = NULL; + GKeyFile* _tmp3_ = NULL; + gboolean _tmp4_ = FALSE; + GKeyFile* _tmp5_ = NULL; + const gchar* _tmp6_ = NULL; + const gchar* _tmp7_ = NULL; + gint _tmp8_ = 0; + gint _tmp9_ = 0; + gboolean _tmp10_ = FALSE; + GKeyFile* _tmp11_ = NULL; + const gchar* _tmp12_ = NULL; + gboolean _tmp13_ = FALSE; + GKeyFile* _tmp14_ = NULL; + const gchar* _tmp15_ = NULL; + gsize length = 0UL; + GKeyFile* _tmp16_ = NULL; + gsize _tmp17_ = 0UL; + gchar* _tmp18_ = NULL; + const gchar* _tmp19_ = NULL; +#line 869 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = g_key_file_new (); +#line 869 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + keyfile = _tmp3_; +#line 870 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = keyfile; +#line 870 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = trans; +#line 870 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = trans; +#line 870 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = strlen (_tmp7_); +#line 870 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = _tmp8_; +#line 870 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = g_key_file_load_from_data (_tmp5_, _tmp6_, (gsize) _tmp9_, G_KEY_FILE_NONE, &_inner_error_); +#line 870 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = _tmp10_; +#line 870 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 870 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_key_file_unref0 (keyfile); +#line 6546 "PhotoTable.c" + goto __catch17_g_error; + } +#line 870 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (!_tmp4_) { +#line 871 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = FALSE; +#line 871 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_key_file_unref0 (keyfile); +#line 871 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (trans); +#line 871 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 6559 "PhotoTable.c" + } +#line 873 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = keyfile; +#line 873 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = object; +#line 873 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = g_key_file_has_group (_tmp11_, _tmp12_); +#line 873 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (!_tmp13_) { +#line 874 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = TRUE; +#line 874 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_key_file_unref0 (keyfile); +#line 874 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (trans); +#line 874 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 6577 "PhotoTable.c" + } +#line 876 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = keyfile; +#line 876 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = object; +#line 876 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_key_file_remove_group (_tmp14_, _tmp15_, &_inner_error_); +#line 876 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 876 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_key_file_unref0 (keyfile); +#line 6589 "PhotoTable.c" + goto __catch17_g_error; + } +#line 879 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = keyfile; +#line 879 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp18_ = g_key_file_to_data (_tmp16_, &_tmp17_, NULL); +#line 879 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + length = _tmp17_; +#line 879 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (trans); +#line 879 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + trans = _tmp18_; +#line 880 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp19_ = trans; +#line 880 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp19_ != NULL, "trans != null"); +#line 868 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_key_file_unref0 (keyfile); +#line 6608 "PhotoTable.c" + } + goto __finally17; + __catch17_g_error: + { + GError* err = NULL; + const gchar* _tmp20_ = NULL; +#line 868 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + err = _inner_error_; +#line 868 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _inner_error_ = NULL; +#line 882 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp20_ = err->message; +#line 882 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_error ("PhotoTable.vala:882: %s", _tmp20_); +#line 868 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_error_free0 (err); +#line 6625 "PhotoTable.c" + } + __finally17: +#line 868 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 868 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (trans); +#line 868 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 868 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 868 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return FALSE; +#line 6638 "PhotoTable.c" + } +#line 885 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp21_ = *photo_id; +#line 885 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp22_ = trans; +#line 885 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp23_ = photo_table_set_raw_transformations (self, &_tmp21_, _tmp22_); +#line 885 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp23_; +#line 885 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (trans); +#line 885 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 6652 "PhotoTable.c" +} + + +gboolean photo_table_remove_all_transformations (PhotoTable* self, PhotoID* photo_id) { + gboolean result = FALSE; + PhotoID _tmp0_ = {0}; + gchar* _tmp1_ = NULL; + gchar* _tmp2_ = NULL; + gboolean _tmp3_ = FALSE; + PhotoID _tmp4_ = {0}; + gint64 _tmp5_ = 0LL; + gboolean _tmp6_ = FALSE; +#line 888 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), FALSE); +#line 888 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (photo_id != NULL, FALSE); +#line 889 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = *photo_id; +#line 889 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = photo_table_get_raw_transformations (self, &_tmp0_); +#line 889 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = _tmp1_; +#line 889 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = _tmp2_ == NULL; +#line 889 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp2_); +#line 889 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp3_) { +#line 890 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = FALSE; +#line 890 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 6685 "PhotoTable.c" + } +#line 892 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = *photo_id; +#line 892 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = _tmp4_.id; +#line 892 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = database_table_update_text_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp5_, "transformations", ""); +#line 892 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp6_; +#line 892 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 6697 "PhotoTable.c" +} + + +static sqlite3_stmt* photo_table_get_duplicate_stmt (PhotoTable* self, GFile* file, const gchar* thumbnail_md5, const gchar* md5, PhotoFileFormat file_format) { + sqlite3_stmt* result = NULL; + gboolean _tmp0_ = FALSE; + gboolean _tmp1_ = FALSE; + GFile* _tmp2_ = NULL; + gchar* sql = NULL; + gchar* _tmp5_ = NULL; + gboolean first = FALSE; + GFile* _tmp6_ = NULL; + gboolean _tmp9_ = FALSE; + const gchar* _tmp10_ = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp33_ = NULL; + const gchar* _tmp34_ = NULL; + sqlite3_stmt* _tmp35_ = NULL; + gint _tmp36_ = 0; + gint _tmp37_ = 0; + gint col = 0; + GFile* _tmp38_ = NULL; + const gchar* _tmp46_ = NULL; + const gchar* _tmp54_ = NULL; + gboolean _tmp62_ = FALSE; + gboolean _tmp63_ = FALSE; + const gchar* _tmp64_ = NULL; +#line 897 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), NULL); +#line 897 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail ((file == NULL) || G_IS_FILE (file), NULL); +#line 899 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = file; +#line 899 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp2_ != NULL) { +#line 899 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = TRUE; +#line 6736 "PhotoTable.c" + } else { + const gchar* _tmp3_ = NULL; +#line 899 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = thumbnail_md5; +#line 899 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp3_ != NULL; +#line 6743 "PhotoTable.c" + } +#line 899 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp1_) { +#line 899 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = TRUE; +#line 6749 "PhotoTable.c" + } else { + const gchar* _tmp4_ = NULL; +#line 899 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = md5; +#line 899 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = _tmp4_ != NULL; +#line 6756 "PhotoTable.c" + } +#line 899 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp0_, "file != null || thumbnail_md5 != null || md5 != null"); +#line 901 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = g_strdup ("SELECT id FROM PhotoTable WHERE"); +#line 901 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + sql = _tmp5_; +#line 902 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + first = TRUE; +#line 904 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = file; +#line 904 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp6_ != NULL) { +#line 6770 "PhotoTable.c" + const gchar* _tmp7_ = NULL; + gchar* _tmp8_ = NULL; +#line 905 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = sql; +#line 905 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = g_strconcat (_tmp7_, " filename=?", NULL); +#line 905 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (sql); +#line 905 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + sql = _tmp8_; +#line 906 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + first = FALSE; +#line 6783 "PhotoTable.c" + } +#line 909 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = thumbnail_md5; +#line 909 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp10_ != NULL) { +#line 909 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = TRUE; +#line 6791 "PhotoTable.c" + } else { + const gchar* _tmp11_ = NULL; +#line 909 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = md5; +#line 909 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = _tmp11_ != NULL; +#line 6798 "PhotoTable.c" + } +#line 909 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp9_) { +#line 6802 "PhotoTable.c" + gboolean _tmp12_ = FALSE; + const gchar* _tmp17_ = NULL; + const gchar* _tmp20_ = NULL; + const gchar* _tmp26_ = NULL; + gchar* _tmp27_ = NULL; + PhotoFileFormat _tmp28_ = 0; + const gchar* _tmp31_ = NULL; + gchar* _tmp32_ = NULL; +#line 910 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = first; +#line 910 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp12_) { +#line 6815 "PhotoTable.c" + const gchar* _tmp13_ = NULL; + gchar* _tmp14_ = NULL; +#line 911 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = sql; +#line 911 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = g_strconcat (_tmp13_, " ((", NULL); +#line 911 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (sql); +#line 911 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + sql = _tmp14_; +#line 6826 "PhotoTable.c" + } else { + const gchar* _tmp15_ = NULL; + gchar* _tmp16_ = NULL; +#line 913 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = sql; +#line 913 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = g_strconcat (_tmp15_, " OR ((", NULL); +#line 913 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (sql); +#line 913 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + sql = _tmp16_; +#line 6838 "PhotoTable.c" + } +#line 914 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + first = FALSE; +#line 916 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp17_ = thumbnail_md5; +#line 916 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp17_ != NULL) { +#line 6846 "PhotoTable.c" + const gchar* _tmp18_ = NULL; + gchar* _tmp19_ = NULL; +#line 917 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp18_ = sql; +#line 917 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp19_ = g_strconcat (_tmp18_, " thumbnail_md5=?", NULL); +#line 917 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (sql); +#line 917 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + sql = _tmp19_; +#line 6857 "PhotoTable.c" + } +#line 919 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp20_ = md5; +#line 919 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp20_ != NULL) { +#line 6863 "PhotoTable.c" + const gchar* _tmp21_ = NULL; +#line 920 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp21_ = thumbnail_md5; +#line 920 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp21_ == NULL) { +#line 6869 "PhotoTable.c" + const gchar* _tmp22_ = NULL; + gchar* _tmp23_ = NULL; +#line 921 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp22_ = sql; +#line 921 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp23_ = g_strconcat (_tmp22_, " md5=?", NULL); +#line 921 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (sql); +#line 921 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + sql = _tmp23_; +#line 6880 "PhotoTable.c" + } else { + const gchar* _tmp24_ = NULL; + gchar* _tmp25_ = NULL; +#line 923 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp24_ = sql; +#line 923 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp25_ = g_strconcat (_tmp24_, " OR md5=?", NULL); +#line 923 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (sql); +#line 923 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + sql = _tmp25_; +#line 6892 "PhotoTable.c" + } + } +#line 926 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp26_ = sql; +#line 926 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp27_ = g_strconcat (_tmp26_, ")", NULL); +#line 926 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (sql); +#line 926 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + sql = _tmp27_; +#line 928 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp28_ = file_format; +#line 928 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp28_ != PHOTO_FILE_FORMAT_UNKNOWN) { +#line 6907 "PhotoTable.c" + const gchar* _tmp29_ = NULL; + gchar* _tmp30_ = NULL; +#line 929 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp29_ = sql; +#line 929 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp30_ = g_strconcat (_tmp29_, " AND file_format=?", NULL); +#line 929 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (sql); +#line 929 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + sql = _tmp30_; +#line 6918 "PhotoTable.c" + } +#line 931 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp31_ = sql; +#line 931 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp32_ = g_strconcat (_tmp31_, ")", NULL); +#line 931 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (sql); +#line 931 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + sql = _tmp32_; +#line 6928 "PhotoTable.c" + } +#line 935 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp33_ = database_table_db; +#line 935 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp34_ = sql; +#line 935 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp36_ = sqlite3_prepare_v2 (_tmp33_, _tmp34_, -1, &_tmp35_, NULL); +#line 935 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 935 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp35_; +#line 935 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp36_; +#line 936 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp37_ = res; +#line 936 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp37_ == SQLITE_OK, "res == Sqlite.OK"); +#line 938 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + col = 1; +#line 940 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp38_ = file; +#line 940 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp38_ != NULL) { +#line 6952 "PhotoTable.c" + sqlite3_stmt* _tmp39_ = NULL; + gint _tmp40_ = 0; + GFile* _tmp41_ = NULL; + gchar* _tmp42_ = NULL; + GDestroyNotify _tmp43_ = NULL; + gint _tmp44_ = 0; + gint _tmp45_ = 0; +#line 941 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp39_ = stmt; +#line 941 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp40_ = col; +#line 941 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + col = _tmp40_ + 1; +#line 941 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp41_ = file; +#line 941 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp42_ = g_file_get_path (_tmp41_); +#line 941 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp43_ = g_free; +#line 941 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp44_ = sqlite3_bind_text (_tmp39_, _tmp40_, _tmp42_, -1, _tmp43_); +#line 941 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp44_; +#line 942 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp45_ = res; +#line 942 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp45_ == SQLITE_OK, "res == Sqlite.OK"); +#line 6980 "PhotoTable.c" + } +#line 945 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp46_ = thumbnail_md5; +#line 945 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp46_ != NULL) { +#line 6986 "PhotoTable.c" + sqlite3_stmt* _tmp47_ = NULL; + gint _tmp48_ = 0; + const gchar* _tmp49_ = NULL; + gchar* _tmp50_ = NULL; + GDestroyNotify _tmp51_ = NULL; + gint _tmp52_ = 0; + gint _tmp53_ = 0; +#line 946 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp47_ = stmt; +#line 946 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp48_ = col; +#line 946 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + col = _tmp48_ + 1; +#line 946 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp49_ = thumbnail_md5; +#line 946 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp50_ = g_strdup (_tmp49_); +#line 946 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp51_ = g_free; +#line 946 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp52_ = sqlite3_bind_text (_tmp47_, _tmp48_, _tmp50_, -1, _tmp51_); +#line 946 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp52_; +#line 947 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp53_ = res; +#line 947 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp53_ == SQLITE_OK, "res == Sqlite.OK"); +#line 7014 "PhotoTable.c" + } +#line 950 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp54_ = md5; +#line 950 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp54_ != NULL) { +#line 7020 "PhotoTable.c" + sqlite3_stmt* _tmp55_ = NULL; + gint _tmp56_ = 0; + const gchar* _tmp57_ = NULL; + gchar* _tmp58_ = NULL; + GDestroyNotify _tmp59_ = NULL; + gint _tmp60_ = 0; + gint _tmp61_ = 0; +#line 951 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp55_ = stmt; +#line 951 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp56_ = col; +#line 951 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + col = _tmp56_ + 1; +#line 951 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp57_ = md5; +#line 951 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp58_ = g_strdup (_tmp57_); +#line 951 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp59_ = g_free; +#line 951 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp60_ = sqlite3_bind_text (_tmp55_, _tmp56_, _tmp58_, -1, _tmp59_); +#line 951 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp60_; +#line 952 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp61_ = res; +#line 952 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp61_ == SQLITE_OK, "res == Sqlite.OK"); +#line 7048 "PhotoTable.c" + } +#line 955 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp64_ = thumbnail_md5; +#line 955 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp64_ != NULL) { +#line 955 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp63_ = TRUE; +#line 7056 "PhotoTable.c" + } else { + const gchar* _tmp65_ = NULL; +#line 955 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp65_ = md5; +#line 955 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp63_ = _tmp65_ != NULL; +#line 7063 "PhotoTable.c" + } +#line 955 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp63_) { +#line 7067 "PhotoTable.c" + PhotoFileFormat _tmp66_ = 0; +#line 955 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp66_ = file_format; +#line 955 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp62_ = _tmp66_ != PHOTO_FILE_FORMAT_UNKNOWN; +#line 7073 "PhotoTable.c" + } else { +#line 955 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp62_ = FALSE; +#line 7077 "PhotoTable.c" + } +#line 955 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp62_) { +#line 7081 "PhotoTable.c" + sqlite3_stmt* _tmp67_ = NULL; + gint _tmp68_ = 0; + PhotoFileFormat _tmp69_ = 0; + gint _tmp70_ = 0; + gint _tmp71_ = 0; + gint _tmp72_ = 0; +#line 956 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp67_ = stmt; +#line 956 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp68_ = col; +#line 956 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + col = _tmp68_ + 1; +#line 956 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp69_ = file_format; +#line 956 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp70_ = photo_file_format_serialize (_tmp69_); +#line 956 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp71_ = sqlite3_bind_int (_tmp67_, _tmp68_, _tmp70_); +#line 956 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp71_; +#line 957 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp72_ = res; +#line 957 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp72_ == SQLITE_OK, "res == Sqlite.OK"); +#line 7106 "PhotoTable.c" + } +#line 960 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = stmt; +#line 960 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (sql); +#line 960 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 7114 "PhotoTable.c" +} + + +gboolean photo_table_has_duplicate (PhotoTable* self, GFile* file, const gchar* thumbnail_md5, const gchar* md5, PhotoFileFormat file_format) { + gboolean result = FALSE; + sqlite3_stmt* stmt = NULL; + GFile* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + const gchar* _tmp2_ = NULL; + PhotoFileFormat _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + gint res = 0; + sqlite3_stmt* _tmp5_ = NULL; + gint _tmp6_ = 0; + gint _tmp7_ = 0; +#line 963 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), FALSE); +#line 963 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail ((file == NULL) || G_IS_FILE (file), FALSE); +#line 964 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = file; +#line 964 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = thumbnail_md5; +#line 964 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = md5; +#line 964 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = file_format; +#line 964 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = photo_table_get_duplicate_stmt (self, _tmp0_, _tmp1_, _tmp2_, _tmp3_); +#line 964 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp4_; +#line 965 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = stmt; +#line 965 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = sqlite3_step (_tmp5_); +#line 965 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp6_; +#line 967 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = res; +#line 967 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp7_ == SQLITE_DONE) { +#line 969 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = FALSE; +#line 969 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 969 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 7162 "PhotoTable.c" + } else { + gint _tmp8_ = 0; +#line 970 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = res; +#line 970 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp8_ == SQLITE_ROW) { +#line 972 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = TRUE; +#line 972 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 972 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 7175 "PhotoTable.c" + } else { + gint _tmp9_ = 0; +#line 974 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = res; +#line 974 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_fatal ("has_duplicate", _tmp9_); +#line 976 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = FALSE; +#line 976 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 976 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 7188 "PhotoTable.c" + } + } +#line 963 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 7193 "PhotoTable.c" +} + + +static void _vala_array_add2 (PhotoID** array, int* length, int* size, const PhotoID* value) { +#line 988 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if ((*length) == (*size)) { +#line 988 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + *size = (*size) ? (2 * (*size)) : 4; +#line 988 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + *array = g_renew (PhotoID, *array, *size); +#line 7204 "PhotoTable.c" + } +#line 988 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + (*array)[(*length)++] = *value; +#line 7208 "PhotoTable.c" +} + + +PhotoID* photo_table_get_duplicate_ids (PhotoTable* self, GFile* file, const gchar* thumbnail_md5, const gchar* md5, PhotoFileFormat file_format, int* result_length1) { + PhotoID* result = NULL; + sqlite3_stmt* stmt = NULL; + GFile* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + const gchar* _tmp2_ = NULL; + PhotoFileFormat _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + PhotoID* ids = NULL; + PhotoID* _tmp5_ = NULL; + gint ids_length1 = 0; + gint _ids_size_ = 0; + gint res = 0; + sqlite3_stmt* _tmp6_ = NULL; + gint _tmp7_ = 0; + PhotoID* _tmp15_ = NULL; + gint _tmp15__length1 = 0; +#line 980 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_PHOTO_TABLE (self), NULL); +#line 980 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail ((file == NULL) || G_IS_FILE (file), NULL); +#line 982 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = file; +#line 982 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = thumbnail_md5; +#line 982 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = md5; +#line 982 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = file_format; +#line 982 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = photo_table_get_duplicate_stmt (self, _tmp0_, _tmp1_, _tmp2_, _tmp3_); +#line 982 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp4_; +#line 984 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = g_new0 (PhotoID, 0); +#line 984 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + ids = _tmp5_; +#line 984 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + ids_length1 = 0; +#line 984 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _ids_size_ = ids_length1; +#line 986 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = stmt; +#line 986 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = sqlite3_step (_tmp6_); +#line 986 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp7_; +#line 987 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + while (TRUE) { +#line 7261 "PhotoTable.c" + gint _tmp8_ = 0; + PhotoID* _tmp9_ = NULL; + gint _tmp9__length1 = 0; + sqlite3_stmt* _tmp10_ = NULL; + gint64 _tmp11_ = 0LL; + PhotoID _tmp12_ = {0}; + sqlite3_stmt* _tmp13_ = NULL; + gint _tmp14_ = 0; +#line 987 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = res; +#line 987 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (!(_tmp8_ == SQLITE_ROW)) { +#line 987 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + break; +#line 7276 "PhotoTable.c" + } +#line 988 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = ids; +#line 988 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9__length1 = ids_length1; +#line 988 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = stmt; +#line 988 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = sqlite3_column_int64 (_tmp10_, 0); +#line 988 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + photo_id_init (&_tmp12_, _tmp11_); +#line 988 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_array_add2 (&ids, &ids_length1, &_ids_size_, &_tmp12_); +#line 989 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = stmt; +#line 989 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = sqlite3_step (_tmp13_); +#line 989 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp14_; +#line 7296 "PhotoTable.c" + } +#line 992 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = ids; +#line 992 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15__length1 = ids_length1; +#line 992 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (result_length1) { +#line 992 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + *result_length1 = _tmp15__length1; +#line 7306 "PhotoTable.c" + } +#line 992 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp15_; +#line 992 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 992 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 7314 "PhotoTable.c" +} + + +void photo_table_update_backlinks (PhotoTable* self, PhotoID* photo_id, const gchar* backlinks, GError** error) { + const gchar* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + PhotoID _tmp3_ = {0}; + gint64 _tmp4_ = 0LL; + GError * _inner_error_ = NULL; +#line 995 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_TABLE (self)); +#line 995 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (photo_id != NULL); +#line 996 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = backlinks; +#line 996 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp1_ != NULL) { +#line 7332 "PhotoTable.c" + const gchar* _tmp2_ = NULL; +#line 996 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = backlinks; +#line 996 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = _tmp2_; +#line 7338 "PhotoTable.c" + } else { +#line 996 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = ""; +#line 7342 "PhotoTable.c" + } +#line 996 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = *photo_id; +#line 996 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = _tmp3_.id; +#line 996 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_update_text_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp4_, "backlinks", _tmp0_, &_inner_error_); +#line 996 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 996 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 996 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_propagate_error (error, _inner_error_); +#line 996 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 7358 "PhotoTable.c" + } else { +#line 996 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 996 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 996 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 7366 "PhotoTable.c" + } + } +} + + +void photo_table_attach_editable (PhotoTable* self, PhotoRow* row, BackingPhotoID* editable_id, GError** error) { + PhotoRow* _tmp0_ = NULL; + PhotoID _tmp1_ = {0}; + gint64 _tmp2_ = 0LL; + BackingPhotoID _tmp3_ = {0}; + gint64 _tmp4_ = 0LL; + PhotoRow* _tmp5_ = NULL; + BackingPhotoID _tmp6_ = {0}; + GError * _inner_error_ = NULL; +#line 999 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_TABLE (self)); +#line 999 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_ROW (row)); +#line 999 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (editable_id != NULL); +#line 1000 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = row; +#line 1000 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp0_->photo_id; +#line 1000 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = _tmp1_.id; +#line 1000 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = *editable_id; +#line 1000 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = _tmp3_.id; +#line 1000 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_update_int64_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp2_, "editable_id", _tmp4_, &_inner_error_); +#line 1000 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 1000 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 1000 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_propagate_error (error, _inner_error_); +#line 1000 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 7407 "PhotoTable.c" + } else { +#line 1000 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 1000 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 1000 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 7415 "PhotoTable.c" + } + } +#line 1002 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = row; +#line 1002 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = *editable_id; +#line 1002 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_->editable_id = _tmp6_; +#line 7424 "PhotoTable.c" +} + + +void photo_table_detach_editable (PhotoTable* self, PhotoRow* row, GError** error) { + PhotoRow* _tmp0_ = NULL; + PhotoID _tmp1_ = {0}; + gint64 _tmp2_ = 0LL; + PhotoRow* _tmp3_ = NULL; + GError * _inner_error_ = NULL; +#line 1005 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_TABLE (self)); +#line 1005 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_ROW (row)); +#line 1006 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = row; +#line 1006 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp0_->photo_id; +#line 1006 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = _tmp1_.id; +#line 1006 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_update_int64_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp2_, "editable_id", BACKING_PHOTO_ID_INVALID, &_inner_error_); +#line 1006 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 1006 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 1006 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_propagate_error (error, _inner_error_); +#line 1006 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 7454 "PhotoTable.c" + } else { +#line 1006 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 1006 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 1006 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 7462 "PhotoTable.c" + } + } +#line 1008 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = row; +#line 1008 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_id_init (&_tmp3_->editable_id, BACKING_PHOTO_ID_INVALID); +#line 7469 "PhotoTable.c" +} + + +void photo_table_set_metadata_dirty (PhotoTable* self, PhotoID* photo_id, gboolean dirty, GError** error) { + gint _tmp0_ = 0; + gboolean _tmp1_ = FALSE; + PhotoID _tmp2_ = {0}; + gint64 _tmp3_ = 0LL; + GError * _inner_error_ = NULL; +#line 1011 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_TABLE (self)); +#line 1011 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (photo_id != NULL); +#line 1012 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = dirty; +#line 1012 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp1_) { +#line 1012 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = 1; +#line 7489 "PhotoTable.c" + } else { +#line 1012 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = 0; +#line 7493 "PhotoTable.c" + } +#line 1012 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = *photo_id; +#line 1012 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = _tmp2_.id; +#line 1012 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_update_int_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp3_, "metadata_dirty", _tmp0_, &_inner_error_); +#line 1012 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 1012 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 1012 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_propagate_error (error, _inner_error_); +#line 1012 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 7509 "PhotoTable.c" + } else { +#line 1012 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 1012 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 1012 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 7517 "PhotoTable.c" + } + } +} + + +void photo_table_update_raw_development (PhotoTable* self, PhotoRow* row, RawDeveloper rd, BackingPhotoID* backing_photo_id, GError** error) { + gchar* col = NULL; + RawDeveloper _tmp0_ = 0; + PhotoRow* _tmp4_ = NULL; + BackingPhotoID* _tmp5_ = NULL; + gint _tmp5__length1 = 0; + RawDeveloper _tmp6_ = 0; + BackingPhotoID _tmp7_ = {0}; + BackingPhotoID _tmp8_ = {0}; + PhotoRow* _tmp9_ = NULL; + PhotoID _tmp10_ = {0}; + gint64 _tmp11_ = 0LL; + const gchar* _tmp12_ = NULL; + BackingPhotoID _tmp13_ = {0}; + gint64 _tmp14_ = 0LL; + BackingPhotoID _tmp15_ = {0}; + gint64 _tmp16_ = 0LL; + GError * _inner_error_ = NULL; +#line 1015 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_TABLE (self)); +#line 1015 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_ROW (row)); +#line 1015 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (backing_photo_id != NULL); +#line 1019 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = rd; +#line 1019 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + switch (_tmp0_) { +#line 1019 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + case RAW_DEVELOPER_SHOTWELL: +#line 7553 "PhotoTable.c" + { + gchar* _tmp1_ = NULL; +#line 1021 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = g_strdup ("develop_shotwell_id"); +#line 1021 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (col); +#line 1021 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + col = _tmp1_; +#line 1022 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + break; +#line 7564 "PhotoTable.c" + } +#line 1019 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + case RAW_DEVELOPER_CAMERA: +#line 7568 "PhotoTable.c" + { + gchar* _tmp2_ = NULL; +#line 1025 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = g_strdup ("develop_camera_id"); +#line 1025 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (col); +#line 1025 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + col = _tmp2_; +#line 1026 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + break; +#line 7579 "PhotoTable.c" + } +#line 1019 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + case RAW_DEVELOPER_EMBEDDED: +#line 7583 "PhotoTable.c" + { + gchar* _tmp3_ = NULL; +#line 1029 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = g_strdup ("develop_embedded_id"); +#line 1029 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (col); +#line 1029 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + col = _tmp3_; +#line 1030 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + break; +#line 7594 "PhotoTable.c" + } + default: + { +#line 1033 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_assert_not_reached (); +#line 7600 "PhotoTable.c" + } + } +#line 1036 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = row; +#line 1036 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = _tmp4_->development_ids; +#line 1036 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5__length1 = _tmp4_->development_ids_length1; +#line 1036 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = rd; +#line 1036 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = *backing_photo_id; +#line 1036 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_[_tmp6_] = _tmp7_; +#line 1036 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = _tmp5_[_tmp6_]; +#line 1037 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = row; +#line 1037 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = _tmp9_->photo_id; +#line 1037 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = _tmp10_.id; +#line 1037 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = col; +#line 1037 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = *backing_photo_id; +#line 1037 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = _tmp13_.id; +#line 1037 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_update_int64_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp11_, _tmp12_, _tmp14_, &_inner_error_); +#line 1037 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 1037 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 1037 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_propagate_error (error, _inner_error_); +#line 1037 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (col); +#line 1037 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 7641 "PhotoTable.c" + } else { +#line 1037 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (col); +#line 1037 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 1037 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 1037 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 7651 "PhotoTable.c" + } + } +#line 1039 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = *backing_photo_id; +#line 1039 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = _tmp15_.id; +#line 1039 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp16_ != BACKING_PHOTO_ID_INVALID) { +#line 7660 "PhotoTable.c" + PhotoRow* _tmp17_ = NULL; + PhotoID _tmp18_ = {0}; + gint64 _tmp19_ = 0LL; + RawDeveloper _tmp20_ = 0; + gchar* _tmp21_ = NULL; + gchar* _tmp22_ = NULL; +#line 1040 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp17_ = row; +#line 1040 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp18_ = _tmp17_->photo_id; +#line 1040 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp19_ = _tmp18_.id; +#line 1040 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp20_ = rd; +#line 1040 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp21_ = raw_developer_to_string (_tmp20_); +#line 1040 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp22_ = _tmp21_; +#line 1040 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_update_text_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp19_, "developer", _tmp22_, &_inner_error_); +#line 1040 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp22_); +#line 1040 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 1040 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 1040 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_propagate_error (error, _inner_error_); +#line 1040 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (col); +#line 1040 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 7693 "PhotoTable.c" + } else { +#line 1040 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (col); +#line 1040 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 1040 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 1040 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 7703 "PhotoTable.c" + } + } + } +#line 1015 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (col); +#line 7709 "PhotoTable.c" +} + + +void photo_table_remove_development (PhotoTable* self, PhotoRow* row, RawDeveloper rd, GError** error) { + PhotoRow* _tmp0_ = NULL; + RawDeveloper _tmp1_ = 0; + BackingPhotoID _tmp2_ = {0}; + GError * _inner_error_ = NULL; +#line 1043 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_TABLE (self)); +#line 1043 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_PHOTO_ROW (row)); +#line 1044 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = row; +#line 1044 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = rd; +#line 1044 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_id_init (&_tmp2_, BACKING_PHOTO_ID_INVALID); +#line 1044 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + photo_table_update_raw_development (self, _tmp0_, _tmp1_, &_tmp2_, &_inner_error_); +#line 1044 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 1044 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 1044 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_propagate_error (error, _inner_error_); +#line 1044 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 7738 "PhotoTable.c" + } else { +#line 1044 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 1044 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 1044 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 7746 "PhotoTable.c" + } + } +} + + +static void photo_table_class_init (PhotoTableClass * klass) { +#line 109 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + photo_table_parent_class = g_type_class_peek_parent (klass); +#line 109 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + ((DatabaseTableClass *) klass)->finalize = photo_table_finalize; +#line 7757 "PhotoTable.c" +} + + +static void photo_table_instance_init (PhotoTable * self) { +} + + +static void photo_table_finalize (DatabaseTable* obj) { + PhotoTable * self; +#line 109 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_PHOTO_TABLE, PhotoTable); +#line 109 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + DATABASE_TABLE_CLASS (photo_table_parent_class)->finalize (obj); +#line 7771 "PhotoTable.c" +} + + +GType photo_table_get_type (void) { + static volatile gsize photo_table_type_id__volatile = 0; + if (g_once_init_enter (&photo_table_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (PhotoTableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) photo_table_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PhotoTable), 0, (GInstanceInitFunc) photo_table_instance_init, NULL }; + GType photo_table_type_id; + photo_table_type_id = g_type_register_static (TYPE_DATABASE_TABLE, "PhotoTable", &g_define_type_info, 0); + g_once_init_leave (&photo_table_type_id__volatile, photo_table_type_id); + } + return photo_table_type_id__volatile; +} + + +void backing_photo_id_init (BackingPhotoID *self, gint64 id) { + gint64 _tmp0_ = 0LL; +#line 1064 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + memset (self, 0, sizeof (BackingPhotoID)); +#line 1065 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = id; +#line 1065 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + (*self).id = _tmp0_; +#line 7795 "PhotoTable.c" +} + + +gboolean backing_photo_id_is_invalid (BackingPhotoID *self) { + gboolean result = FALSE; + gint64 _tmp0_ = 0LL; +#line 1069 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = (*self).id; +#line 1069 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp0_ == BACKING_PHOTO_ID_INVALID; +#line 1069 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 7808 "PhotoTable.c" +} + + +gboolean backing_photo_id_is_valid (BackingPhotoID *self) { + gboolean result = FALSE; + gint64 _tmp0_ = 0LL; +#line 1073 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = (*self).id; +#line 1073 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp0_ != BACKING_PHOTO_ID_INVALID; +#line 1073 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 7821 "PhotoTable.c" +} + + +BackingPhotoID* backing_photo_id_dup (const BackingPhotoID* self) { + BackingPhotoID* dup; +#line 1059 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + dup = g_new0 (BackingPhotoID, 1); +#line 1059 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + memcpy (dup, self, sizeof (BackingPhotoID)); +#line 1059 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return dup; +#line 7833 "PhotoTable.c" +} + + +void backing_photo_id_free (BackingPhotoID* self) { +#line 1059 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_free (self); +#line 7840 "PhotoTable.c" +} + + +GType backing_photo_id_get_type (void) { + static volatile gsize backing_photo_id_type_id__volatile = 0; + if (g_once_init_enter (&backing_photo_id_type_id__volatile)) { + GType backing_photo_id_type_id; + backing_photo_id_type_id = g_boxed_type_register_static ("BackingPhotoID", (GBoxedCopyFunc) backing_photo_id_dup, (GBoxedFreeFunc) backing_photo_id_free); + g_once_init_leave (&backing_photo_id_type_id__volatile, backing_photo_id_type_id); + } + return backing_photo_id_type_id__volatile; +} + + +gboolean backing_photo_row_matches_file_info (BackingPhotoRow* self, GFileInfo* info) { + gboolean result = FALSE; + gint64 _tmp0_ = 0LL; + GFileInfo* _tmp1_ = NULL; + gint64 _tmp2_ = 0LL; + time_t _tmp3_ = 0; + GFileInfo* _tmp4_ = NULL; + GTimeVal _tmp5_ = {0}; + glong _tmp6_ = 0L; +#line 1087 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_BACKING_PHOTO_ROW (self), FALSE); +#line 1087 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (G_IS_FILE_INFO (info), FALSE); +#line 1088 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = self->filesize; +#line 1088 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = info; +#line 1088 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = g_file_info_get_size (_tmp1_); +#line 1088 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp0_ != _tmp2_) { +#line 1089 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = FALSE; +#line 1089 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 7880 "PhotoTable.c" + } +#line 1091 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = self->timestamp; +#line 1091 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = info; +#line 1091 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_file_info_get_modification_time (_tmp4_, &_tmp5_); +#line 1091 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = _tmp5_.tv_sec; +#line 1091 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp3_ == ((time_t) _tmp6_); +#line 1091 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 7894 "PhotoTable.c" +} + + +gboolean backing_photo_row_is_touched (BackingPhotoRow* self, GFileInfo* info) { + gboolean result = FALSE; + gint64 _tmp0_ = 0LL; + GFileInfo* _tmp1_ = NULL; + gint64 _tmp2_ = 0LL; + time_t _tmp3_ = 0; + GFileInfo* _tmp4_ = NULL; + GTimeVal _tmp5_ = {0}; + glong _tmp6_ = 0L; +#line 1094 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_BACKING_PHOTO_ROW (self), FALSE); +#line 1094 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (G_IS_FILE_INFO (info), FALSE); +#line 1095 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = self->filesize; +#line 1095 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = info; +#line 1095 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = g_file_info_get_size (_tmp1_); +#line 1095 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp0_ != _tmp2_) { +#line 1096 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = FALSE; +#line 1096 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 7923 "PhotoTable.c" + } +#line 1098 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = self->timestamp; +#line 1098 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = info; +#line 1098 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_file_info_get_modification_time (_tmp4_, &_tmp5_); +#line 1098 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = _tmp5_.tv_sec; +#line 1098 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp3_ != ((time_t) _tmp6_); +#line 1098 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 7937 "PhotoTable.c" +} + + +void backing_photo_row_copy_from (BackingPhotoRow* self, BackingPhotoRow* from) { + BackingPhotoRow* _tmp0_ = NULL; + BackingPhotoID _tmp1_ = {0}; + BackingPhotoRow* _tmp2_ = NULL; + time_t _tmp3_ = 0; + BackingPhotoRow* _tmp4_ = NULL; + const gchar* _tmp5_ = NULL; + gchar* _tmp6_ = NULL; + BackingPhotoRow* _tmp7_ = NULL; + gint64 _tmp8_ = 0LL; + BackingPhotoRow* _tmp9_ = NULL; + time_t _tmp10_ = 0; + BackingPhotoRow* _tmp11_ = NULL; + PhotoFileFormat _tmp12_ = 0; + BackingPhotoRow* _tmp13_ = NULL; + Dimensions _tmp14_ = {0}; + BackingPhotoRow* _tmp15_ = NULL; + Orientation _tmp16_ = 0; +#line 1102 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_BACKING_PHOTO_ROW (self)); +#line 1102 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_BACKING_PHOTO_ROW (from)); +#line 1103 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = from; +#line 1103 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp0_->id; +#line 1103 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self->id = _tmp1_; +#line 1104 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = from; +#line 1104 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = _tmp2_->time_created; +#line 1104 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self->time_created = _tmp3_; +#line 1105 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = from; +#line 1105 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = _tmp4_->filepath; +#line 1105 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = g_strdup (_tmp5_); +#line 1105 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (self->filepath); +#line 1105 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self->filepath = _tmp6_; +#line 1106 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = from; +#line 1106 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = _tmp7_->filesize; +#line 1106 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self->filesize = _tmp8_; +#line 1107 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = from; +#line 1107 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = _tmp9_->timestamp; +#line 1107 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self->timestamp = _tmp10_; +#line 1108 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = from; +#line 1108 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = _tmp11_->file_format; +#line 1108 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self->file_format = _tmp12_; +#line 1109 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = from; +#line 1109 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = _tmp13_->dim; +#line 1109 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self->dim = _tmp14_; +#line 1110 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = from; +#line 1110 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = _tmp15_->original_orientation; +#line 1110 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self->original_orientation = _tmp16_; +#line 8015 "PhotoTable.c" +} + + +BackingPhotoRow* backing_photo_row_construct (GType object_type) { + BackingPhotoRow* self = NULL; +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self = (BackingPhotoRow*) g_type_create_instance (object_type); +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return self; +#line 8025 "PhotoTable.c" +} + + +BackingPhotoRow* backing_photo_row_new (void) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return backing_photo_row_construct (TYPE_BACKING_PHOTO_ROW); +#line 8032 "PhotoTable.c" +} + + +static void value_backing_photo_row_init (GValue* value) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + value->data[0].v_pointer = NULL; +#line 8039 "PhotoTable.c" +} + + +static void value_backing_photo_row_free_value (GValue* value) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (value->data[0].v_pointer) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_row_unref (value->data[0].v_pointer); +#line 8048 "PhotoTable.c" + } +} + + +static void value_backing_photo_row_copy_value (const GValue* src_value, GValue* dest_value) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (src_value->data[0].v_pointer) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + dest_value->data[0].v_pointer = backing_photo_row_ref (src_value->data[0].v_pointer); +#line 8058 "PhotoTable.c" + } else { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + dest_value->data[0].v_pointer = NULL; +#line 8062 "PhotoTable.c" + } +} + + +static gpointer value_backing_photo_row_peek_pointer (const GValue* value) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return value->data[0].v_pointer; +#line 8070 "PhotoTable.c" +} + + +static gchar* value_backing_photo_row_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (collect_values[0].v_pointer) { +#line 8077 "PhotoTable.c" + BackingPhotoRow* object; + object = collect_values[0].v_pointer; +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (object->parent_instance.g_class == NULL) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); +#line 8084 "PhotoTable.c" + } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); +#line 8088 "PhotoTable.c" + } +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + value->data[0].v_pointer = backing_photo_row_ref (object); +#line 8092 "PhotoTable.c" + } else { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + value->data[0].v_pointer = NULL; +#line 8096 "PhotoTable.c" + } +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return NULL; +#line 8100 "PhotoTable.c" +} + + +static gchar* value_backing_photo_row_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + BackingPhotoRow** object_p; + object_p = collect_values[0].v_pointer; +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (!object_p) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); +#line 8111 "PhotoTable.c" + } +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (!value->data[0].v_pointer) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + *object_p = NULL; +#line 8117 "PhotoTable.c" + } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + *object_p = value->data[0].v_pointer; +#line 8121 "PhotoTable.c" + } else { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + *object_p = backing_photo_row_ref (value->data[0].v_pointer); +#line 8125 "PhotoTable.c" + } +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return NULL; +#line 8129 "PhotoTable.c" +} + + +GParamSpec* param_spec_backing_photo_row (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { + ParamSpecBackingPhotoRow* spec; +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (g_type_is_a (object_type, TYPE_BACKING_PHOTO_ROW), NULL); +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + G_PARAM_SPEC (spec)->value_type = object_type; +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return G_PARAM_SPEC (spec); +#line 8143 "PhotoTable.c" +} + + +gpointer value_get_backing_photo_row (const GValue* value) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BACKING_PHOTO_ROW), NULL); +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return value->data[0].v_pointer; +#line 8152 "PhotoTable.c" +} + + +void value_set_backing_photo_row (GValue* value, gpointer v_object) { + BackingPhotoRow* old; +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BACKING_PHOTO_ROW)); +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + old = value->data[0].v_pointer; +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (v_object) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BACKING_PHOTO_ROW)); +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + value->data[0].v_pointer = v_object; +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_row_ref (value->data[0].v_pointer); +#line 8172 "PhotoTable.c" + } else { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + value->data[0].v_pointer = NULL; +#line 8176 "PhotoTable.c" + } +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (old) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_row_unref (old); +#line 8182 "PhotoTable.c" + } +} + + +void value_take_backing_photo_row (GValue* value, gpointer v_object) { + BackingPhotoRow* old; +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BACKING_PHOTO_ROW)); +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + old = value->data[0].v_pointer; +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (v_object) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BACKING_PHOTO_ROW)); +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + value->data[0].v_pointer = v_object; +#line 8201 "PhotoTable.c" + } else { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + value->data[0].v_pointer = NULL; +#line 8205 "PhotoTable.c" + } +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (old) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_row_unref (old); +#line 8211 "PhotoTable.c" + } +} + + +static void backing_photo_row_class_init (BackingPhotoRowClass * klass) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_row_parent_class = g_type_class_peek_parent (klass); +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + ((BackingPhotoRowClass *) klass)->finalize = backing_photo_row_finalize; +#line 8221 "PhotoTable.c" +} + + +static void backing_photo_row_instance_init (BackingPhotoRow * self) { +#line 1080 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self->filepath = NULL; +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self->ref_count = 1; +#line 8230 "PhotoTable.c" +} + + +static void backing_photo_row_finalize (BackingPhotoRow* obj) { + BackingPhotoRow * self; +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BACKING_PHOTO_ROW, BackingPhotoRow); +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_signal_handlers_destroy (self); +#line 1080 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (self->filepath); +#line 8242 "PhotoTable.c" +} + + +GType backing_photo_row_get_type (void) { + static volatile gsize backing_photo_row_type_id__volatile = 0; + if (g_once_init_enter (&backing_photo_row_type_id__volatile)) { + static const GTypeValueTable g_define_type_value_table = { value_backing_photo_row_init, value_backing_photo_row_free_value, value_backing_photo_row_copy_value, value_backing_photo_row_peek_pointer, "p", value_backing_photo_row_collect_value, "p", value_backing_photo_row_lcopy_value }; + static const GTypeInfo g_define_type_info = { sizeof (BackingPhotoRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) backing_photo_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BackingPhotoRow), 0, (GInstanceInitFunc) backing_photo_row_instance_init, &g_define_type_value_table }; + static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; + GType backing_photo_row_type_id; + backing_photo_row_type_id = g_type_register_fundamental (g_type_fundamental_next (), "BackingPhotoRow", &g_define_type_info, &g_define_type_fundamental_info, 0); + g_once_init_leave (&backing_photo_row_type_id__volatile, backing_photo_row_type_id); + } + return backing_photo_row_type_id__volatile; +} + + +gpointer backing_photo_row_ref (gpointer instance) { + BackingPhotoRow* self; + self = instance; +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_atomic_int_inc (&self->ref_count); +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return instance; +#line 8267 "PhotoTable.c" +} + + +void backing_photo_row_unref (gpointer instance) { + BackingPhotoRow* self; + self = instance; +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (g_atomic_int_dec_and_test (&self->ref_count)) { +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + BACKING_PHOTO_ROW_GET_CLASS (self)->finalize (self); +#line 1077 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_type_free_instance ((GTypeInstance *) self); +#line 8280 "PhotoTable.c" + } +} + + +static BackingPhotoTable* backing_photo_table_construct (GType object_type) { + BackingPhotoTable* self = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; +#line 1117 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self = (BackingPhotoTable*) database_table_construct (object_type); +#line 1118 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_set_table_name (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), "BackingPhotoTable"); +#line 1121 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = database_table_db; +#line 1121 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "CREATE TABLE IF NOT EXISTS " "BackingPhotoTable " "(" "id INTEGER PRIMARY KEY, " "filepath TEXT UNIQUE NOT NULL, " "timestamp INTEGER, " "filesize INTEGER, " "width INTEGER, " "height INTEGER, " "original_orientation INTEGER, " "file_format INTEGER, " "time_created INTEGER " ")", -1, &_tmp1_, NULL); +#line 1121 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 1121 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp1_; +#line 1121 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp2_; +#line 1134 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = res; +#line 1134 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1136 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = stmt; +#line 1136 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = sqlite3_step (_tmp4_); +#line 1136 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp5_; +#line 1137 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = res; +#line 1137 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp6_ != SQLITE_DONE) { +#line 8324 "PhotoTable.c" + gint _tmp7_ = 0; +#line 1138 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = res; +#line 1138 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_fatal ("create PhotoBackingTable", _tmp7_); +#line 8330 "PhotoTable.c" + } +#line 1117 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 1117 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return self; +#line 8336 "PhotoTable.c" +} + + +static BackingPhotoTable* backing_photo_table_new (void) { +#line 1117 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return backing_photo_table_construct (TYPE_BACKING_PHOTO_TABLE); +#line 8343 "PhotoTable.c" +} + + +BackingPhotoTable* backing_photo_table_get_instance (void) { + BackingPhotoTable* result = NULL; + BackingPhotoTable* _tmp0_ = NULL; + BackingPhotoTable* _tmp2_ = NULL; + BackingPhotoTable* _tmp3_ = NULL; +#line 1142 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = backing_photo_table_instance; +#line 1142 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp0_ == NULL) { +#line 8356 "PhotoTable.c" + BackingPhotoTable* _tmp1_ = NULL; +#line 1143 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = backing_photo_table_new (); +#line 1143 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _database_table_unref0 (backing_photo_table_instance); +#line 1143 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_table_instance = _tmp1_; +#line 8364 "PhotoTable.c" + } +#line 1145 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = backing_photo_table_instance; +#line 1145 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = _database_table_ref0 (_tmp2_); +#line 1145 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = _tmp3_; +#line 1145 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 8374 "PhotoTable.c" +} + + +void backing_photo_table_add (BackingPhotoTable* self, BackingPhotoRow* state, GError** error) { + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + time_t time_created = 0; + gulong _tmp4_ = 0UL; + sqlite3_stmt* _tmp5_ = NULL; + BackingPhotoRow* _tmp6_ = NULL; + const gchar* _tmp7_ = NULL; + gchar* _tmp8_ = NULL; + GDestroyNotify _tmp9_ = NULL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + sqlite3_stmt* _tmp12_ = NULL; + BackingPhotoRow* _tmp13_ = NULL; + time_t _tmp14_ = 0; + gint _tmp15_ = 0; + gint _tmp16_ = 0; + sqlite3_stmt* _tmp17_ = NULL; + BackingPhotoRow* _tmp18_ = NULL; + gint64 _tmp19_ = 0LL; + gint _tmp20_ = 0; + gint _tmp21_ = 0; + sqlite3_stmt* _tmp22_ = NULL; + BackingPhotoRow* _tmp23_ = NULL; + Dimensions _tmp24_ = {0}; + gint _tmp25_ = 0; + gint _tmp26_ = 0; + gint _tmp27_ = 0; + sqlite3_stmt* _tmp28_ = NULL; + BackingPhotoRow* _tmp29_ = NULL; + Dimensions _tmp30_ = {0}; + gint _tmp31_ = 0; + gint _tmp32_ = 0; + gint _tmp33_ = 0; + sqlite3_stmt* _tmp34_ = NULL; + BackingPhotoRow* _tmp35_ = NULL; + Orientation _tmp36_ = 0; + gint _tmp37_ = 0; + gint _tmp38_ = 0; + sqlite3_stmt* _tmp39_ = NULL; + BackingPhotoRow* _tmp40_ = NULL; + PhotoFileFormat _tmp41_ = 0; + gint _tmp42_ = 0; + gint _tmp43_ = 0; + gint _tmp44_ = 0; + sqlite3_stmt* _tmp45_ = NULL; + time_t _tmp46_ = 0; + gint _tmp47_ = 0; + gint _tmp48_ = 0; + sqlite3_stmt* _tmp49_ = NULL; + gint _tmp50_ = 0; + gint _tmp51_ = 0; + BackingPhotoRow* _tmp53_ = NULL; + sqlite3* _tmp54_ = NULL; + gint64 _tmp55_ = 0LL; + BackingPhotoRow* _tmp56_ = NULL; + time_t _tmp57_ = 0; + GError * _inner_error_ = NULL; +#line 1148 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_BACKING_PHOTO_TABLE (self)); +#line 1148 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_BACKING_PHOTO_ROW (state)); +#line 1150 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = database_table_db; +#line 1150 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "INSERT INTO BackingPhotoTable " "(filepath, timestamp, filesize, width, height, original_orientation, " "file_format, time_created) " "VALUES (?, ?, ?, ?, ?, ?, ?, ?)", -1, &_tmp1_, NULL); +#line 1150 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 1150 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp1_; +#line 1150 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp2_; +#line 1155 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = res; +#line 1155 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1157 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = now_sec (); +#line 1157 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + time_created = (time_t) _tmp4_; +#line 1159 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = stmt; +#line 1159 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = state; +#line 1159 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = _tmp6_->filepath; +#line 1159 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = g_strdup (_tmp7_); +#line 1159 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = g_free; +#line 1159 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = sqlite3_bind_text (_tmp5_, 1, _tmp8_, -1, _tmp9_); +#line 1159 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp10_; +#line 1160 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = res; +#line 1160 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp11_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1161 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = stmt; +#line 1161 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = state; +#line 1161 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = _tmp13_->timestamp; +#line 1161 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = sqlite3_bind_int64 (_tmp12_, 2, (gint64) _tmp14_); +#line 1161 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp15_; +#line 1162 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = res; +#line 1162 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp16_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1163 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp17_ = stmt; +#line 1163 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp18_ = state; +#line 1163 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp19_ = _tmp18_->filesize; +#line 1163 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp20_ = sqlite3_bind_int64 (_tmp17_, 3, _tmp19_); +#line 1163 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp20_; +#line 1164 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp21_ = res; +#line 1164 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp21_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1165 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp22_ = stmt; +#line 1165 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp23_ = state; +#line 1165 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp24_ = _tmp23_->dim; +#line 1165 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp25_ = _tmp24_.width; +#line 1165 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp26_ = sqlite3_bind_int (_tmp22_, 4, _tmp25_); +#line 1165 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp26_; +#line 1166 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp27_ = res; +#line 1166 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp27_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1167 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp28_ = stmt; +#line 1167 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp29_ = state; +#line 1167 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp30_ = _tmp29_->dim; +#line 1167 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp31_ = _tmp30_.height; +#line 1167 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp32_ = sqlite3_bind_int (_tmp28_, 5, _tmp31_); +#line 1167 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp32_; +#line 1168 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp33_ = res; +#line 1168 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp33_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1169 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp34_ = stmt; +#line 1169 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp35_ = state; +#line 1169 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp36_ = _tmp35_->original_orientation; +#line 1169 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp37_ = sqlite3_bind_int (_tmp34_, 6, (gint) _tmp36_); +#line 1169 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp37_; +#line 1170 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp38_ = res; +#line 1170 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp38_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1171 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp39_ = stmt; +#line 1171 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp40_ = state; +#line 1171 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp41_ = _tmp40_->file_format; +#line 1171 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp42_ = photo_file_format_serialize (_tmp41_); +#line 1171 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp43_ = sqlite3_bind_int (_tmp39_, 7, _tmp42_); +#line 1171 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp43_; +#line 1172 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp44_ = res; +#line 1172 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp44_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1173 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp45_ = stmt; +#line 1173 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp46_ = time_created; +#line 1173 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp47_ = sqlite3_bind_int64 (_tmp45_, 8, (gint64) _tmp46_); +#line 1173 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp47_; +#line 1174 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp48_ = res; +#line 1174 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp48_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1176 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp49_ = stmt; +#line 1176 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp50_ = sqlite3_step (_tmp49_); +#line 1176 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp50_; +#line 1177 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp51_ = res; +#line 1177 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp51_ != SQLITE_DONE) { +#line 8592 "PhotoTable.c" + gint _tmp52_ = 0; +#line 1178 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp52_ = res; +#line 1178 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_throw_error ("PhotoBackingTable.add", _tmp52_, &_inner_error_); +#line 1178 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 1178 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 1178 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_propagate_error (error, _inner_error_); +#line 1178 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 1178 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 8608 "PhotoTable.c" + } else { +#line 1178 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 1178 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 1178 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 1178 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 8618 "PhotoTable.c" + } + } + } +#line 1180 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp53_ = state; +#line 1180 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp54_ = database_table_db; +#line 1180 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp55_ = sqlite3_last_insert_rowid (_tmp54_); +#line 1180 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_id_init (&_tmp53_->id, _tmp55_); +#line 1181 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp56_ = state; +#line 1181 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp57_ = time_created; +#line 1181 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp56_->time_created = _tmp57_; +#line 1148 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 8638 "PhotoTable.c" +} + + +BackingPhotoRow* backing_photo_table_fetch (BackingPhotoTable* self, BackingPhotoID* id, GError** error) { + BackingPhotoRow* result = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + BackingPhotoID _tmp5_ = {0}; + gint64 _tmp6_ = 0LL; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + sqlite3_stmt* _tmp9_ = NULL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + BackingPhotoRow* row = NULL; + BackingPhotoRow* _tmp14_ = NULL; + BackingPhotoRow* _tmp15_ = NULL; + BackingPhotoID _tmp16_ = {0}; + BackingPhotoRow* _tmp17_ = NULL; + sqlite3_stmt* _tmp18_ = NULL; + const gchar* _tmp19_ = NULL; + gchar* _tmp20_ = NULL; + BackingPhotoRow* _tmp21_ = NULL; + sqlite3_stmt* _tmp22_ = NULL; + gint64 _tmp23_ = 0LL; + BackingPhotoRow* _tmp24_ = NULL; + sqlite3_stmt* _tmp25_ = NULL; + gint64 _tmp26_ = 0LL; + BackingPhotoRow* _tmp27_ = NULL; + sqlite3_stmt* _tmp28_ = NULL; + gint _tmp29_ = 0; + sqlite3_stmt* _tmp30_ = NULL; + gint _tmp31_ = 0; + BackingPhotoRow* _tmp32_ = NULL; + sqlite3_stmt* _tmp33_ = NULL; + gint _tmp34_ = 0; + BackingPhotoRow* _tmp35_ = NULL; + sqlite3_stmt* _tmp36_ = NULL; + gint _tmp37_ = 0; + PhotoFileFormat _tmp38_ = 0; + BackingPhotoRow* _tmp39_ = NULL; + sqlite3_stmt* _tmp40_ = NULL; + gint64 _tmp41_ = 0LL; + GError * _inner_error_ = NULL; +#line 1184 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (IS_BACKING_PHOTO_TABLE (self), NULL); +#line 1184 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_val_if_fail (id != NULL, NULL); +#line 1186 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = database_table_db; +#line 1186 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "SELECT filepath, timestamp, filesize, width, height, " "original_orientation, file_format, time_created FROM BackingPhotoTable" \ +" WHERE id=?", -1, &_tmp1_, NULL); +#line 1186 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 1186 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp1_; +#line 1186 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp2_; +#line 1189 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = res; +#line 1189 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1191 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = stmt; +#line 1191 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = *id; +#line 1191 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = _tmp5_.id; +#line 1191 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = sqlite3_bind_int64 (_tmp4_, 1, _tmp6_); +#line 1191 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp7_; +#line 1192 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = res; +#line 1192 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp8_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1194 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = stmt; +#line 1194 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = sqlite3_step (_tmp9_); +#line 1194 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp10_; +#line 1195 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = res; +#line 1195 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp11_ == SQLITE_DONE) { +#line 1196 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = NULL; +#line 1196 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 1196 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 8736 "PhotoTable.c" + } else { + gint _tmp12_ = 0; +#line 1197 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = res; +#line 1197 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp12_ != SQLITE_ROW) { +#line 8743 "PhotoTable.c" + gint _tmp13_ = 0; +#line 1198 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = res; +#line 1198 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_throw_error ("BackingPhotoTable.fetch_for_photo", _tmp13_, &_inner_error_); +#line 1198 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 1198 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 1198 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_propagate_error (error, _inner_error_); +#line 1198 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 1198 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return NULL; +#line 8759 "PhotoTable.c" + } else { +#line 1198 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 1198 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 1198 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 1198 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return NULL; +#line 8769 "PhotoTable.c" + } + } + } + } +#line 1200 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = backing_photo_row_new (); +#line 1200 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + row = _tmp14_; +#line 1201 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = row; +#line 1201 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = *id; +#line 1201 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_->id = _tmp16_; +#line 1202 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp17_ = row; +#line 1202 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp18_ = stmt; +#line 1202 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp19_ = sqlite3_column_text (_tmp18_, 0); +#line 1202 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp20_ = g_strdup (_tmp19_); +#line 1202 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _g_free0 (_tmp17_->filepath); +#line 1202 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp17_->filepath = _tmp20_; +#line 1203 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp21_ = row; +#line 1203 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp22_ = stmt; +#line 1203 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp23_ = sqlite3_column_int64 (_tmp22_, 1); +#line 1203 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp21_->timestamp = (time_t) _tmp23_; +#line 1204 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp24_ = row; +#line 1204 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp25_ = stmt; +#line 1204 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp26_ = sqlite3_column_int64 (_tmp25_, 2); +#line 1204 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp24_->filesize = _tmp26_; +#line 1205 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp27_ = row; +#line 1205 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp28_ = stmt; +#line 1205 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp29_ = sqlite3_column_int (_tmp28_, 3); +#line 1205 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp30_ = stmt; +#line 1205 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp31_ = sqlite3_column_int (_tmp30_, 4); +#line 1205 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + dimensions_init (&_tmp27_->dim, _tmp29_, _tmp31_); +#line 1206 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp32_ = row; +#line 1206 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp33_ = stmt; +#line 1206 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp34_ = sqlite3_column_int (_tmp33_, 5); +#line 1206 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp32_->original_orientation = (Orientation) _tmp34_; +#line 1207 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp35_ = row; +#line 1207 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp36_ = stmt; +#line 1207 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp37_ = sqlite3_column_int (_tmp36_, 6); +#line 1207 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp38_ = photo_file_format_unserialize (_tmp37_); +#line 1207 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp35_->file_format = _tmp38_; +#line 1208 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp39_ = row; +#line 1208 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp40_ = stmt; +#line 1208 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp41_ = sqlite3_column_int64 (_tmp40_, 7); +#line 1208 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp39_->time_created = (time_t) _tmp41_; +#line 1210 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + result = row; +#line 1210 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 1210 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return result; +#line 8856 "PhotoTable.c" +} + + +void backing_photo_table_update (BackingPhotoTable* self, BackingPhotoRow* row, GError** error) { + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + BackingPhotoRow* _tmp5_ = NULL; + time_t _tmp6_ = 0; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + sqlite3_stmt* _tmp9_ = NULL; + BackingPhotoRow* _tmp10_ = NULL; + gint64 _tmp11_ = 0LL; + gint _tmp12_ = 0; + gint _tmp13_ = 0; + sqlite3_stmt* _tmp14_ = NULL; + BackingPhotoRow* _tmp15_ = NULL; + Dimensions _tmp16_ = {0}; + gint _tmp17_ = 0; + gint _tmp18_ = 0; + gint _tmp19_ = 0; + sqlite3_stmt* _tmp20_ = NULL; + BackingPhotoRow* _tmp21_ = NULL; + Dimensions _tmp22_ = {0}; + gint _tmp23_ = 0; + gint _tmp24_ = 0; + gint _tmp25_ = 0; + sqlite3_stmt* _tmp26_ = NULL; + BackingPhotoRow* _tmp27_ = NULL; + Orientation _tmp28_ = 0; + gint _tmp29_ = 0; + gint _tmp30_ = 0; + sqlite3_stmt* _tmp31_ = NULL; + BackingPhotoRow* _tmp32_ = NULL; + PhotoFileFormat _tmp33_ = 0; + gint _tmp34_ = 0; + gint _tmp35_ = 0; + gint _tmp36_ = 0; + sqlite3_stmt* _tmp37_ = NULL; + BackingPhotoRow* _tmp38_ = NULL; + BackingPhotoID _tmp39_ = {0}; + gint64 _tmp40_ = 0LL; + gint _tmp41_ = 0; + gint _tmp42_ = 0; + sqlite3_stmt* _tmp43_ = NULL; + gint _tmp44_ = 0; + gint _tmp45_ = 0; + GError * _inner_error_ = NULL; +#line 1214 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_BACKING_PHOTO_TABLE (self)); +#line 1214 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_BACKING_PHOTO_ROW (row)); +#line 1216 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = database_table_db; +#line 1216 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "UPDATE BackingPhotoTable SET timestamp=?, filesize=?, " "width=?, height=?, original_orientation=?, file_format=? " "WHERE id=?", -1, &_tmp1_, NULL); +#line 1216 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 1216 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp1_; +#line 1216 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp2_; +#line 1220 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = res; +#line 1220 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1222 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = stmt; +#line 1222 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = row; +#line 1222 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = _tmp5_->timestamp; +#line 1222 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = sqlite3_bind_int64 (_tmp4_, 1, (gint64) _tmp6_); +#line 1222 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp7_; +#line 1223 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = res; +#line 1223 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp8_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1224 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = stmt; +#line 1224 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = row; +#line 1224 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = _tmp10_->filesize; +#line 1224 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = sqlite3_bind_int64 (_tmp9_, 2, _tmp11_); +#line 1224 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp12_; +#line 1225 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = res; +#line 1225 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp13_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1226 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = stmt; +#line 1226 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = row; +#line 1226 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = _tmp15_->dim; +#line 1226 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp17_ = _tmp16_.width; +#line 1226 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp18_ = sqlite3_bind_int (_tmp14_, 3, _tmp17_); +#line 1226 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp18_; +#line 1227 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp19_ = res; +#line 1227 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp19_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1228 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp20_ = stmt; +#line 1228 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp21_ = row; +#line 1228 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp22_ = _tmp21_->dim; +#line 1228 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp23_ = _tmp22_.height; +#line 1228 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp24_ = sqlite3_bind_int (_tmp20_, 4, _tmp23_); +#line 1228 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp24_; +#line 1229 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp25_ = res; +#line 1229 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp25_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1230 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp26_ = stmt; +#line 1230 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp27_ = row; +#line 1230 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp28_ = _tmp27_->original_orientation; +#line 1230 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp29_ = sqlite3_bind_int (_tmp26_, 5, (gint) _tmp28_); +#line 1230 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp29_; +#line 1231 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp30_ = res; +#line 1231 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp30_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1232 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp31_ = stmt; +#line 1232 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp32_ = row; +#line 1232 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp33_ = _tmp32_->file_format; +#line 1232 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp34_ = photo_file_format_serialize (_tmp33_); +#line 1232 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp35_ = sqlite3_bind_int (_tmp31_, 6, _tmp34_); +#line 1232 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp35_; +#line 1233 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp36_ = res; +#line 1233 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp36_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1234 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp37_ = stmt; +#line 1234 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp38_ = row; +#line 1234 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp39_ = _tmp38_->id; +#line 1234 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp40_ = _tmp39_.id; +#line 1234 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp41_ = sqlite3_bind_int64 (_tmp37_, 7, _tmp40_); +#line 1234 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp41_; +#line 1235 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp42_ = res; +#line 1235 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp42_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1237 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp43_ = stmt; +#line 1237 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp44_ = sqlite3_step (_tmp43_); +#line 1237 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp44_; +#line 1238 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp45_ = res; +#line 1238 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp45_ != SQLITE_DONE) { +#line 9044 "PhotoTable.c" + gint _tmp46_ = 0; +#line 1239 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp46_ = res; +#line 1239 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_throw_error ("BackingPhotoTable.update", _tmp46_, &_inner_error_); +#line 1239 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 1239 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 1239 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_propagate_error (error, _inner_error_); +#line 1239 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 1239 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 9060 "PhotoTable.c" + } else { +#line 1239 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 1239 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 1239 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 1239 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 9070 "PhotoTable.c" + } + } + } +#line 1214 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 9076 "PhotoTable.c" +} + + +void backing_photo_table_update_attributes (BackingPhotoTable* self, BackingPhotoID* id, time_t timestamp, gint64 filesize, GError** error) { + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + time_t _tmp5_ = 0; + gint _tmp6_ = 0; + gint _tmp7_ = 0; + sqlite3_stmt* _tmp8_ = NULL; + gint64 _tmp9_ = 0LL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + sqlite3_stmt* _tmp12_ = NULL; + BackingPhotoID _tmp13_ = {0}; + gint64 _tmp14_ = 0LL; + gint _tmp15_ = 0; + gint _tmp16_ = 0; + sqlite3_stmt* _tmp17_ = NULL; + gint _tmp18_ = 0; + gint _tmp19_ = 0; + GError * _inner_error_ = NULL; +#line 1242 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_BACKING_PHOTO_TABLE (self)); +#line 1242 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (id != NULL); +#line 1244 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = database_table_db; +#line 1244 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "UPDATE BackingPhotoTable SET timestamp=?, filesize=? WHERE id=?", -1, &_tmp1_, NULL); +#line 1244 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 1244 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + stmt = _tmp1_; +#line 1244 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp2_; +#line 1246 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp3_ = res; +#line 1246 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1248 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp4_ = stmt; +#line 1248 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp5_ = timestamp; +#line 1248 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp6_ = sqlite3_bind_int64 (_tmp4_, 1, (gint64) _tmp5_); +#line 1248 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp6_; +#line 1249 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp7_ = res; +#line 1249 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp7_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1250 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp8_ = stmt; +#line 1250 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp9_ = filesize; +#line 1250 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp10_ = sqlite3_bind_int64 (_tmp8_, 2, _tmp9_); +#line 1250 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp10_; +#line 1251 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp11_ = res; +#line 1251 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp11_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1252 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp12_ = stmt; +#line 1252 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp13_ = *id; +#line 1252 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp14_ = _tmp13_.id; +#line 1252 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp15_ = sqlite3_bind_int64 (_tmp12_, 3, _tmp14_); +#line 1252 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp15_; +#line 1253 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp16_ = res; +#line 1253 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _vala_assert (_tmp16_ == SQLITE_OK, "res == Sqlite.OK"); +#line 1255 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp17_ = stmt; +#line 1255 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp18_ = sqlite3_step (_tmp17_); +#line 1255 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + res = _tmp18_; +#line 1256 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp19_ = res; +#line 1256 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_tmp19_ != SQLITE_DONE) { +#line 9170 "PhotoTable.c" + gint _tmp20_ = 0; +#line 1257 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp20_ = res; +#line 1257 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_throw_error ("BackingPhotoTable.update_attributes", _tmp20_, &_inner_error_); +#line 1257 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 1257 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 1257 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_propagate_error (error, _inner_error_); +#line 1257 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 1257 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 9186 "PhotoTable.c" + } else { +#line 1257 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 1257 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 1257 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 1257 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 9196 "PhotoTable.c" + } + } + } +#line 1242 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _sqlite3_finalize0 (stmt); +#line 9202 "PhotoTable.c" +} + + +void backing_photo_table_remove (BackingPhotoTable* self, BackingPhotoID* backing_id, GError** error) { + BackingPhotoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + GError * _inner_error_ = NULL; +#line 1260 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_BACKING_PHOTO_TABLE (self)); +#line 1260 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (backing_id != NULL); +#line 1261 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = *backing_id; +#line 1261 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp0_.id; +#line 1261 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_delete_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, &_inner_error_); +#line 1261 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 1261 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 1261 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_propagate_error (error, _inner_error_); +#line 1261 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 9228 "PhotoTable.c" + } else { +#line 1261 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 1261 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 1261 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 9236 "PhotoTable.c" + } + } +} + + +void backing_photo_table_set_filepath (BackingPhotoTable* self, BackingPhotoID* id, const gchar* filepath, GError** error) { + BackingPhotoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + const gchar* _tmp2_ = NULL; + GError * _inner_error_ = NULL; +#line 1264 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_BACKING_PHOTO_TABLE (self)); +#line 1264 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (id != NULL); +#line 1264 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (filepath != NULL); +#line 1265 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = *id; +#line 1265 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp0_.id; +#line 1265 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = filepath; +#line 1265 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_update_text_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "filepath", _tmp2_, &_inner_error_); +#line 1265 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 1265 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 1265 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_propagate_error (error, _inner_error_); +#line 1265 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 9269 "PhotoTable.c" + } else { +#line 1265 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 1265 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 1265 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 9277 "PhotoTable.c" + } + } +} + + +void backing_photo_table_update_timestamp (BackingPhotoTable* self, BackingPhotoID* id, time_t timestamp, GError** error) { + BackingPhotoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + time_t _tmp2_ = 0; + GError * _inner_error_ = NULL; +#line 1268 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (IS_BACKING_PHOTO_TABLE (self)); +#line 1268 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_return_if_fail (id != NULL); +#line 1269 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp0_ = *id; +#line 1269 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp1_ = _tmp0_.id; +#line 1269 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + _tmp2_ = timestamp; +#line 1269 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + database_table_update_int64_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "timestamp", (gint64) _tmp2_, &_inner_error_); +#line 1269 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 1269 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 1269 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_propagate_error (error, _inner_error_); +#line 1269 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 9308 "PhotoTable.c" + } else { +#line 1269 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 1269 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + g_clear_error (&_inner_error_); +#line 1269 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + return; +#line 9316 "PhotoTable.c" + } + } +} + + +static void backing_photo_table_class_init (BackingPhotoTableClass * klass) { +#line 1114 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + backing_photo_table_parent_class = g_type_class_peek_parent (klass); +#line 1114 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + ((DatabaseTableClass *) klass)->finalize = backing_photo_table_finalize; +#line 9327 "PhotoTable.c" +} + + +static void backing_photo_table_instance_init (BackingPhotoTable * self) { +} + + +static void backing_photo_table_finalize (DatabaseTable* obj) { + BackingPhotoTable * self; +#line 1114 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BACKING_PHOTO_TABLE, BackingPhotoTable); +#line 1114 "/home/jens/Source/shotwell/src/db/PhotoTable.vala" + DATABASE_TABLE_CLASS (backing_photo_table_parent_class)->finalize (obj); +#line 9341 "PhotoTable.c" +} + + +GType backing_photo_table_get_type (void) { + static volatile gsize backing_photo_table_type_id__volatile = 0; + if (g_once_init_enter (&backing_photo_table_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (BackingPhotoTableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) backing_photo_table_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BackingPhotoTable), 0, (GInstanceInitFunc) backing_photo_table_instance_init, NULL }; + GType backing_photo_table_type_id; + backing_photo_table_type_id = g_type_register_static (TYPE_DATABASE_TABLE, "BackingPhotoTable", &g_define_type_info, 0); + g_once_init_leave (&backing_photo_table_type_id__volatile, backing_photo_table_type_id); + } + return backing_photo_table_type_id__volatile; +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + + diff --git a/src/db/PhotoTable.vala b/src/db/PhotoTable.vala index 5be08e7..f774df5 100644 --- a/src/db/PhotoTable.vala +++ b/src/db/PhotoTable.vala @@ -158,6 +158,33 @@ public class PhotoTable : DatabaseTable { if (res2 != Sqlite.DONE) fatal("create photo table", res2); + // These are for duplicate searches + // https://bugzilla.gnome.org/show_bug.cgi?id=742670 + // + // 1) index on md5,file_format + res = db.prepare_v2 ("CREATE UNIQUE INDEX IF NOT EXISTS PhotoTableMD5Format on PhotoTable(md5, file_format)", -1, out stmt); + assert (res == Sqlite.OK); + res = stmt.step (); + if (res != Sqlite.DONE) { + DatabaseTable.warning ("Failed to create index on md5 and file_format", res); + } + + // 2) index on thumbnail_md5,file_format + res = db.prepare_v2 ("CREATE INDEX IF NOT EXISTS PhotoTableThumbnailMD5Format on PhotoTable(thumbnail_md5, file_format)", -1, out stmt); + assert (res == Sqlite.OK); + res = stmt.step (); + if (res != Sqlite.DONE) { + DatabaseTable.warning ("Failed to create index on md5 and file_format", res); + } + + // 3) index on thumbnail_md5,md5 + res = db.prepare_v2 ("CREATE INDEX IF NOT EXISTS PhotoTableThumbnailMD5MD5 on PhotoTable(thumbnail_md5, md5)", -1, out stmt); + assert (res == Sqlite.OK); + res = stmt.step (); + if (res != Sqlite.DONE) { + DatabaseTable.warning ("Failed to create index on thumbnail_md5 and md5", res); + } + set_table_name("PhotoTable"); } diff --git a/src/db/SavedSearchDBTable.c b/src/db/SavedSearchDBTable.c new file mode 100644 index 0000000..1747d47 --- /dev/null +++ b/src/db/SavedSearchDBTable.c @@ -0,0 +1,4793 @@ +/* SavedSearchDBTable.c generated by valac 0.32.1, the Vala compiler + * generated from SavedSearchDBTable.vala, do not modify */ + +/* 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. + */ + +#include +#include +#include +#include +#include +#include +#include + + +#define TYPE_SAVED_SEARCH_ID (saved_search_id_get_type ()) +typedef struct _SavedSearchID SavedSearchID; + +#define TYPE_SAVED_SEARCH_ROW (saved_search_row_get_type ()) +#define SAVED_SEARCH_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SAVED_SEARCH_ROW, SavedSearchRow)) +#define SAVED_SEARCH_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SAVED_SEARCH_ROW, SavedSearchRowClass)) +#define IS_SAVED_SEARCH_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SAVED_SEARCH_ROW)) +#define IS_SAVED_SEARCH_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SAVED_SEARCH_ROW)) +#define SAVED_SEARCH_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SAVED_SEARCH_ROW, SavedSearchRowClass)) + +typedef struct _SavedSearchRow SavedSearchRow; +typedef struct _SavedSearchRowClass SavedSearchRowClass; +typedef struct _SavedSearchRowPrivate SavedSearchRowPrivate; + +#define TYPE_SEARCH_OPERATOR (search_operator_get_type ()) + +#define TYPE_SEARCH_CONDITION (search_condition_get_type ()) +#define SEARCH_CONDITION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SEARCH_CONDITION, SearchCondition)) +#define SEARCH_CONDITION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SEARCH_CONDITION, SearchConditionClass)) +#define IS_SEARCH_CONDITION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SEARCH_CONDITION)) +#define IS_SEARCH_CONDITION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SEARCH_CONDITION)) +#define SEARCH_CONDITION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SEARCH_CONDITION, SearchConditionClass)) + +typedef struct _SearchCondition SearchCondition; +typedef struct _SearchConditionClass SearchConditionClass; +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +typedef struct _ParamSpecSavedSearchRow ParamSpecSavedSearchRow; + +#define TYPE_DATABASE_TABLE (database_table_get_type ()) +#define DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATABASE_TABLE, DatabaseTable)) +#define DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATABASE_TABLE, DatabaseTableClass)) +#define IS_DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATABASE_TABLE)) +#define IS_DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATABASE_TABLE)) +#define DATABASE_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATABASE_TABLE, DatabaseTableClass)) + +typedef struct _DatabaseTable DatabaseTable; +typedef struct _DatabaseTableClass DatabaseTableClass; +typedef struct _DatabaseTablePrivate DatabaseTablePrivate; + +#define TYPE_SAVED_SEARCH_DB_TABLE (saved_search_db_table_get_type ()) +#define SAVED_SEARCH_DB_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SAVED_SEARCH_DB_TABLE, SavedSearchDBTable)) +#define SAVED_SEARCH_DB_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SAVED_SEARCH_DB_TABLE, SavedSearchDBTableClass)) +#define IS_SAVED_SEARCH_DB_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SAVED_SEARCH_DB_TABLE)) +#define IS_SAVED_SEARCH_DB_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SAVED_SEARCH_DB_TABLE)) +#define SAVED_SEARCH_DB_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SAVED_SEARCH_DB_TABLE, SavedSearchDBTableClass)) + +typedef struct _SavedSearchDBTable SavedSearchDBTable; +typedef struct _SavedSearchDBTableClass SavedSearchDBTableClass; +typedef struct _SavedSearchDBTablePrivate SavedSearchDBTablePrivate; +#define _sqlite3_finalize0(var) ((var == NULL) ? NULL : (var = (sqlite3_finalize (var), NULL))) +#define _database_table_unref0(var) ((var == NULL) ? NULL : (var = (database_table_unref (var), NULL))) +#define _search_condition_unref0(var) ((var == NULL) ? NULL : (var = (search_condition_unref (var), NULL))) +#define _saved_search_row_unref0(var) ((var == NULL) ? NULL : (var = (saved_search_row_unref (var), NULL))) + +#define TYPE_SEARCH_CONDITION_TEXT (search_condition_text_get_type ()) +#define SEARCH_CONDITION_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SEARCH_CONDITION_TEXT, SearchConditionText)) +#define SEARCH_CONDITION_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SEARCH_CONDITION_TEXT, SearchConditionTextClass)) +#define IS_SEARCH_CONDITION_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SEARCH_CONDITION_TEXT)) +#define IS_SEARCH_CONDITION_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SEARCH_CONDITION_TEXT)) +#define SEARCH_CONDITION_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SEARCH_CONDITION_TEXT, SearchConditionTextClass)) + +typedef struct _SearchConditionText SearchConditionText; +typedef struct _SearchConditionTextClass SearchConditionTextClass; + +#define SEARCH_CONDITION_TYPE_SEARCH_TYPE (search_condition_search_type_get_type ()) + +#define SEARCH_CONDITION_TEXT_TYPE_CONTEXT (search_condition_text_context_get_type ()) + +#define TYPE_SEARCH_CONDITION_MEDIA_TYPE (search_condition_media_type_get_type ()) +#define SEARCH_CONDITION_MEDIA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SEARCH_CONDITION_MEDIA_TYPE, SearchConditionMediaType)) +#define SEARCH_CONDITION_MEDIA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SEARCH_CONDITION_MEDIA_TYPE, SearchConditionMediaTypeClass)) +#define IS_SEARCH_CONDITION_MEDIA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SEARCH_CONDITION_MEDIA_TYPE)) +#define IS_SEARCH_CONDITION_MEDIA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SEARCH_CONDITION_MEDIA_TYPE)) +#define SEARCH_CONDITION_MEDIA_TYPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SEARCH_CONDITION_MEDIA_TYPE, SearchConditionMediaTypeClass)) + +typedef struct _SearchConditionMediaType SearchConditionMediaType; +typedef struct _SearchConditionMediaTypeClass SearchConditionMediaTypeClass; + +#define SEARCH_CONDITION_MEDIA_TYPE_TYPE_CONTEXT (search_condition_media_type_context_get_type ()) + +#define SEARCH_CONDITION_MEDIA_TYPE_TYPE_MEDIA_TYPE (search_condition_media_type_media_type_get_type ()) + +#define TYPE_SEARCH_CONDITION_FLAGGED (search_condition_flagged_get_type ()) +#define SEARCH_CONDITION_FLAGGED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SEARCH_CONDITION_FLAGGED, SearchConditionFlagged)) +#define SEARCH_CONDITION_FLAGGED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SEARCH_CONDITION_FLAGGED, SearchConditionFlaggedClass)) +#define IS_SEARCH_CONDITION_FLAGGED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SEARCH_CONDITION_FLAGGED)) +#define IS_SEARCH_CONDITION_FLAGGED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SEARCH_CONDITION_FLAGGED)) +#define SEARCH_CONDITION_FLAGGED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SEARCH_CONDITION_FLAGGED, SearchConditionFlaggedClass)) + +typedef struct _SearchConditionFlagged SearchConditionFlagged; +typedef struct _SearchConditionFlaggedClass SearchConditionFlaggedClass; + +#define SEARCH_CONDITION_FLAGGED_TYPE_STATE (search_condition_flagged_state_get_type ()) + +#define TYPE_SEARCH_CONDITION_MODIFIED (search_condition_modified_get_type ()) +#define SEARCH_CONDITION_MODIFIED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SEARCH_CONDITION_MODIFIED, SearchConditionModified)) +#define SEARCH_CONDITION_MODIFIED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SEARCH_CONDITION_MODIFIED, SearchConditionModifiedClass)) +#define IS_SEARCH_CONDITION_MODIFIED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SEARCH_CONDITION_MODIFIED)) +#define IS_SEARCH_CONDITION_MODIFIED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SEARCH_CONDITION_MODIFIED)) +#define SEARCH_CONDITION_MODIFIED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SEARCH_CONDITION_MODIFIED, SearchConditionModifiedClass)) + +typedef struct _SearchConditionModified SearchConditionModified; +typedef struct _SearchConditionModifiedClass SearchConditionModifiedClass; + +#define SEARCH_CONDITION_MODIFIED_TYPE_CONTEXT (search_condition_modified_context_get_type ()) + +#define SEARCH_CONDITION_MODIFIED_TYPE_STATE (search_condition_modified_state_get_type ()) + +#define TYPE_SEARCH_CONDITION_RATING (search_condition_rating_get_type ()) +#define SEARCH_CONDITION_RATING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SEARCH_CONDITION_RATING, SearchConditionRating)) +#define SEARCH_CONDITION_RATING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SEARCH_CONDITION_RATING, SearchConditionRatingClass)) +#define IS_SEARCH_CONDITION_RATING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SEARCH_CONDITION_RATING)) +#define IS_SEARCH_CONDITION_RATING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SEARCH_CONDITION_RATING)) +#define SEARCH_CONDITION_RATING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SEARCH_CONDITION_RATING, SearchConditionRatingClass)) + +typedef struct _SearchConditionRating SearchConditionRating; +typedef struct _SearchConditionRatingClass SearchConditionRatingClass; + +#define TYPE_RATING (rating_get_type ()) + +#define SEARCH_CONDITION_RATING_TYPE_CONTEXT (search_condition_rating_context_get_type ()) + +#define TYPE_SEARCH_CONDITION_DATE (search_condition_date_get_type ()) +#define SEARCH_CONDITION_DATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SEARCH_CONDITION_DATE, SearchConditionDate)) +#define SEARCH_CONDITION_DATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SEARCH_CONDITION_DATE, SearchConditionDateClass)) +#define IS_SEARCH_CONDITION_DATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SEARCH_CONDITION_DATE)) +#define IS_SEARCH_CONDITION_DATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SEARCH_CONDITION_DATE)) +#define SEARCH_CONDITION_DATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SEARCH_CONDITION_DATE, SearchConditionDateClass)) + +typedef struct _SearchConditionDate SearchConditionDate; +typedef struct _SearchConditionDateClass SearchConditionDateClass; + +#define SEARCH_CONDITION_DATE_TYPE_CONTEXT (search_condition_date_context_get_type ()) +#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); +#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } +#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } +#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _SavedSearchID { + gint64 id; +}; + +typedef enum { + SEARCH_OPERATOR_ANY = 0, + SEARCH_OPERATOR_ALL, + SEARCH_OPERATOR_NONE +} SearchOperator; + +struct _SavedSearchRow { + GTypeInstance parent_instance; + volatile int ref_count; + SavedSearchRowPrivate * priv; + SavedSearchID search_id; + gchar* name; + SearchOperator operator; + GeeList* conditions; +}; + +struct _SavedSearchRowClass { + GTypeClass parent_class; + void (*finalize) (SavedSearchRow *self); +}; + +struct _ParamSpecSavedSearchRow { + GParamSpec parent_instance; +}; + +struct _DatabaseTable { + GTypeInstance parent_instance; + volatile int ref_count; + DatabaseTablePrivate * priv; + gchar* table_name; +}; + +struct _DatabaseTableClass { + GTypeClass parent_class; + void (*finalize) (DatabaseTable *self); +}; + +struct _SavedSearchDBTable { + DatabaseTable parent_instance; + SavedSearchDBTablePrivate * priv; +}; + +struct _SavedSearchDBTableClass { + DatabaseTableClass parent_class; +}; + +typedef enum { + DATABASE_ERROR_ERROR, + DATABASE_ERROR_BACKING, + DATABASE_ERROR_MEMORY, + DATABASE_ERROR_ABORT, + DATABASE_ERROR_LIMITS, + DATABASE_ERROR_TYPESPEC +} DatabaseError; +#define DATABASE_ERROR database_error_quark () +typedef enum { + SEARCH_CONDITION_SEARCH_TYPE_ANY_TEXT = 0, + SEARCH_CONDITION_SEARCH_TYPE_TITLE, + SEARCH_CONDITION_SEARCH_TYPE_TAG, + SEARCH_CONDITION_SEARCH_TYPE_EVENT_NAME, + SEARCH_CONDITION_SEARCH_TYPE_FILE_NAME, + SEARCH_CONDITION_SEARCH_TYPE_MEDIA_TYPE, + SEARCH_CONDITION_SEARCH_TYPE_FLAG_STATE, + SEARCH_CONDITION_SEARCH_TYPE_MODIFIED_STATE, + SEARCH_CONDITION_SEARCH_TYPE_RATING, + SEARCH_CONDITION_SEARCH_TYPE_COMMENT, + SEARCH_CONDITION_SEARCH_TYPE_DATE +} SearchConditionSearchType; + +typedef enum { + SEARCH_CONDITION_TEXT_CONTEXT_CONTAINS = 0, + SEARCH_CONDITION_TEXT_CONTEXT_IS_EXACTLY, + SEARCH_CONDITION_TEXT_CONTEXT_STARTS_WITH, + SEARCH_CONDITION_TEXT_CONTEXT_ENDS_WITH, + SEARCH_CONDITION_TEXT_CONTEXT_DOES_NOT_CONTAIN, + SEARCH_CONDITION_TEXT_CONTEXT_IS_NOT_SET, + SEARCH_CONDITION_TEXT_CONTEXT_IS_SET +} SearchConditionTextContext; + +typedef enum { + SEARCH_CONDITION_MEDIA_TYPE_CONTEXT_IS = 0, + SEARCH_CONDITION_MEDIA_TYPE_CONTEXT_IS_NOT +} SearchConditionMediaTypeContext; + +typedef enum { + SEARCH_CONDITION_MEDIA_TYPE_MEDIA_TYPE_PHOTO_ALL = 0, + SEARCH_CONDITION_MEDIA_TYPE_MEDIA_TYPE_PHOTO_RAW, + SEARCH_CONDITION_MEDIA_TYPE_MEDIA_TYPE_VIDEO +} SearchConditionMediaTypeMediaType; + +typedef enum { + SEARCH_CONDITION_FLAGGED_STATE_FLAGGED = 0, + SEARCH_CONDITION_FLAGGED_STATE_UNFLAGGED +} SearchConditionFlaggedState; + +typedef enum { + SEARCH_CONDITION_MODIFIED_CONTEXT_HAS = 0, + SEARCH_CONDITION_MODIFIED_CONTEXT_HAS_NO +} SearchConditionModifiedContext; + +typedef enum { + SEARCH_CONDITION_MODIFIED_STATE_MODIFIED = 0, + SEARCH_CONDITION_MODIFIED_STATE_INTERNAL_CHANGES, + SEARCH_CONDITION_MODIFIED_STATE_EXTERNAL_CHANGES +} SearchConditionModifiedState; + +typedef enum { + RATING_REJECTED = -1, + RATING_UNRATED = 0, + RATING_ONE = 1, + RATING_TWO = 2, + RATING_THREE = 3, + RATING_FOUR = 4, + RATING_FIVE = 5 +} Rating; + +typedef enum { + SEARCH_CONDITION_RATING_CONTEXT_AND_HIGHER = 0, + SEARCH_CONDITION_RATING_CONTEXT_ONLY, + SEARCH_CONDITION_RATING_CONTEXT_AND_LOWER +} SearchConditionRatingContext; + +typedef enum { + SEARCH_CONDITION_DATE_CONTEXT_EXACT = 0, + SEARCH_CONDITION_DATE_CONTEXT_AFTER, + SEARCH_CONDITION_DATE_CONTEXT_BEFORE, + SEARCH_CONDITION_DATE_CONTEXT_BETWEEN, + SEARCH_CONDITION_DATE_CONTEXT_IS_NOT_SET +} SearchConditionDateContext; + + +static gpointer saved_search_row_parent_class = NULL; +static gpointer saved_search_db_table_parent_class = NULL; +static SavedSearchDBTable* saved_search_db_table_instance; +static SavedSearchDBTable* saved_search_db_table_instance = NULL; +extern sqlite3* database_table_db; + +GType saved_search_id_get_type (void) G_GNUC_CONST; +SavedSearchID* saved_search_id_dup (const SavedSearchID* self); +void saved_search_id_free (SavedSearchID* self); +#define SAVED_SEARCH_ID_INVALID ((gint64) -1) +void saved_search_id_init (SavedSearchID *self, gint64 id); +gboolean saved_search_id_is_invalid (SavedSearchID *self); +gboolean saved_search_id_is_valid (SavedSearchID *self); +gpointer saved_search_row_ref (gpointer instance); +void saved_search_row_unref (gpointer instance); +GParamSpec* param_spec_saved_search_row (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_saved_search_row (GValue* value, gpointer v_object); +void value_take_saved_search_row (GValue* value, gpointer v_object); +gpointer value_get_saved_search_row (const GValue* value); +GType saved_search_row_get_type (void) G_GNUC_CONST; +GType search_operator_get_type (void) G_GNUC_CONST; +gpointer search_condition_ref (gpointer instance); +void search_condition_unref (gpointer instance); +GParamSpec* param_spec_search_condition (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_search_condition (GValue* value, gpointer v_object); +void value_take_search_condition (GValue* value, gpointer v_object); +gpointer value_get_search_condition (const GValue* value); +GType search_condition_get_type (void) G_GNUC_CONST; +enum { + SAVED_SEARCH_ROW_DUMMY_PROPERTY +}; +SavedSearchRow* saved_search_row_new (void); +SavedSearchRow* saved_search_row_construct (GType object_type); +static void saved_search_row_finalize (SavedSearchRow* obj); +gpointer database_table_ref (gpointer instance); +void database_table_unref (gpointer instance); +GParamSpec* param_spec_database_table (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_database_table (GValue* value, gpointer v_object); +void value_take_database_table (GValue* value, gpointer v_object); +gpointer value_get_database_table (const GValue* value); +GType database_table_get_type (void) G_GNUC_CONST; +GType saved_search_db_table_get_type (void) G_GNUC_CONST; +enum { + SAVED_SEARCH_DB_TABLE_DUMMY_PROPERTY +}; +static SavedSearchDBTable* saved_search_db_table_new (void); +static SavedSearchDBTable* saved_search_db_table_construct (GType object_type); +DatabaseTable* database_table_construct (GType object_type); +void database_table_set_table_name (DatabaseTable* self, const gchar* table_name); +void database_table_fatal (const gchar* op, gint res); +SavedSearchDBTable* saved_search_db_table_get_instance (void); +GQuark database_error_quark (void); +SavedSearchRow* saved_search_db_table_add (SavedSearchDBTable* self, const gchar* name, SearchOperator operator, GeeArrayList* conditions, GError** error); +gchar* search_operator_to_string (SearchOperator self); +void database_table_throw_error (const gchar* method, gint res, GError** error); +static void saved_search_db_table_add_condition (SavedSearchDBTable* self, SavedSearchID* id, SearchCondition* condition, GError** error); +GType search_condition_text_get_type (void) G_GNUC_CONST; +GType search_condition_search_type_get_type (void) G_GNUC_CONST; +SearchConditionSearchType search_condition_get_search_type (SearchCondition* self); +gchar* search_condition_search_type_to_string (SearchConditionSearchType self); +GType search_condition_text_context_get_type (void) G_GNUC_CONST; +SearchConditionTextContext search_condition_text_get_context (SearchConditionText* self); +gchar* search_condition_text_context_to_string (SearchConditionTextContext self); +const gchar* search_condition_text_get_text (SearchConditionText* self); +GType search_condition_media_type_get_type (void) G_GNUC_CONST; +GType search_condition_media_type_context_get_type (void) G_GNUC_CONST; +SearchConditionMediaTypeContext search_condition_media_type_get_context (SearchConditionMediaType* self); +gchar* search_condition_media_type_context_to_string (SearchConditionMediaTypeContext self); +GType search_condition_media_type_media_type_get_type (void) G_GNUC_CONST; +SearchConditionMediaTypeMediaType search_condition_media_type_get_media_type (SearchConditionMediaType* self); +gchar* search_condition_media_type_media_type_to_string (SearchConditionMediaTypeMediaType self); +GType search_condition_flagged_get_type (void) G_GNUC_CONST; +GType search_condition_flagged_state_get_type (void) G_GNUC_CONST; +SearchConditionFlaggedState search_condition_flagged_get_state (SearchConditionFlagged* self); +gchar* search_condition_flagged_state_to_string (SearchConditionFlaggedState self); +GType search_condition_modified_get_type (void) G_GNUC_CONST; +GType search_condition_modified_context_get_type (void) G_GNUC_CONST; +SearchConditionModifiedContext search_condition_modified_get_context (SearchConditionModified* self); +gchar* search_condition_modified_context_to_string (SearchConditionModifiedContext self); +GType search_condition_modified_state_get_type (void) G_GNUC_CONST; +SearchConditionModifiedState search_condition_modified_get_state (SearchConditionModified* self); +gchar* search_condition_modified_state_to_string (SearchConditionModifiedState self); +GType search_condition_rating_get_type (void) G_GNUC_CONST; +GType rating_get_type (void) G_GNUC_CONST; +Rating search_condition_rating_get_rating (SearchConditionRating* self); +gint rating_serialize (Rating self); +GType search_condition_rating_context_get_type (void) G_GNUC_CONST; +SearchConditionRatingContext search_condition_rating_get_context (SearchConditionRating* self); +gchar* search_condition_rating_context_to_string (SearchConditionRatingContext self); +GType search_condition_date_get_type (void) G_GNUC_CONST; +GType search_condition_date_context_get_type (void) G_GNUC_CONST; +SearchConditionDateContext search_condition_date_get_context (SearchConditionDate* self); +gchar* search_condition_date_context_to_string (SearchConditionDateContext self); +GDateTime* search_condition_date_get_date_one (SearchConditionDate* self); +GDateTime* search_condition_date_get_date_two (SearchConditionDate* self); +static void saved_search_db_table_remove_conditions_for_search_id (SavedSearchDBTable* self, SavedSearchID* search_id, GError** error); +static void saved_search_db_table_remove_conditions_for_table (SavedSearchDBTable* self, const gchar* table_name, SavedSearchID* search_id, GError** error); +static GeeList* saved_search_db_table_get_conditions_for_id (SavedSearchDBTable* self, SavedSearchID* search_id, GError** error); +SearchConditionSearchType search_condition_search_type_from_string (const gchar* str); +SearchConditionTextContext search_condition_text_context_from_string (const gchar* str); +SearchConditionText* search_condition_text_new (SearchConditionSearchType search_type, const gchar* text, SearchConditionTextContext context); +SearchConditionText* search_condition_text_construct (GType object_type, SearchConditionSearchType search_type, const gchar* text, SearchConditionTextContext context); +SearchConditionMediaTypeContext search_condition_media_type_context_from_string (const gchar* str); +SearchConditionMediaTypeMediaType search_condition_media_type_media_type_from_string (const gchar* str); +SearchConditionMediaType* search_condition_media_type_new (SearchConditionSearchType search_type, SearchConditionMediaTypeContext context, SearchConditionMediaTypeMediaType media_type); +SearchConditionMediaType* search_condition_media_type_construct (GType object_type, SearchConditionSearchType search_type, SearchConditionMediaTypeContext context, SearchConditionMediaTypeMediaType media_type); +SearchConditionFlaggedState search_condition_flagged_state_from_string (const gchar* str); +SearchConditionFlagged* search_condition_flagged_new (SearchConditionSearchType search_type, SearchConditionFlaggedState state); +SearchConditionFlagged* search_condition_flagged_construct (GType object_type, SearchConditionSearchType search_type, SearchConditionFlaggedState state); +SearchConditionModifiedContext search_condition_modified_context_from_string (const gchar* str); +SearchConditionModifiedState search_condition_modified_state_from_string (const gchar* str); +SearchConditionModified* search_condition_modified_new (SearchConditionSearchType search_type, SearchConditionModifiedContext context, SearchConditionModifiedState state); +SearchConditionModified* search_condition_modified_construct (GType object_type, SearchConditionSearchType search_type, SearchConditionModifiedContext context, SearchConditionModifiedState state); +Rating rating_unserialize (gint value); +SearchConditionRatingContext search_condition_rating_context_from_string (const gchar* str); +SearchConditionRating* search_condition_rating_new (SearchConditionSearchType search_type, Rating rating, SearchConditionRatingContext context); +SearchConditionRating* search_condition_rating_construct (GType object_type, SearchConditionSearchType search_type, Rating rating, SearchConditionRatingContext context); +SearchConditionDateContext search_condition_date_context_from_string (const gchar* str); +SearchConditionDate* search_condition_date_new (SearchConditionSearchType search_type, SearchConditionDateContext context, GDateTime* date_one, GDateTime* date_two); +SearchConditionDate* search_condition_date_construct (GType object_type, SearchConditionSearchType search_type, SearchConditionDateContext context, GDateTime* date_one, GDateTime* date_two); +void saved_search_db_table_create_from_row (SavedSearchDBTable* self, SavedSearchRow* row, SavedSearchID* result, GError** error); +void saved_search_db_table_remove (SavedSearchDBTable* self, SavedSearchID* search_id, GError** error); +void database_table_delete_by_id (DatabaseTable* self, gint64 id, GError** error); +SavedSearchRow* saved_search_db_table_get_row (SavedSearchDBTable* self, SavedSearchID* search_id, GError** error); +SearchOperator search_operator_from_string (const gchar* str); +GeeList* saved_search_db_table_get_all_rows (SavedSearchDBTable* self, GError** error); +void saved_search_db_table_rename (SavedSearchDBTable* self, SavedSearchID* search_id, const gchar* new_name, GError** error); +void database_table_update_text_by_id_2 (DatabaseTable* self, gint64 id, const gchar* column, const gchar* text, GError** error); +static void saved_search_db_table_finalize (DatabaseTable* obj); + + +void saved_search_id_init (SavedSearchID *self, gint64 id) { + gint64 _tmp0_ = 0LL; +#line 12 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + memset (self, 0, sizeof (SavedSearchID)); +#line 13 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp0_ = id; +#line 13 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + (*self).id = _tmp0_; +#line 434 "SavedSearchDBTable.c" +} + + +gboolean saved_search_id_is_invalid (SavedSearchID *self) { + gboolean result = FALSE; + gint64 _tmp0_ = 0LL; +#line 17 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp0_ = (*self).id; +#line 17 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + result = _tmp0_ == SAVED_SEARCH_ID_INVALID; +#line 17 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return result; +#line 447 "SavedSearchDBTable.c" +} + + +gboolean saved_search_id_is_valid (SavedSearchID *self) { + gboolean result = FALSE; + gint64 _tmp0_ = 0LL; +#line 21 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp0_ = (*self).id; +#line 21 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + result = _tmp0_ != SAVED_SEARCH_ID_INVALID; +#line 21 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return result; +#line 460 "SavedSearchDBTable.c" +} + + +SavedSearchID* saved_search_id_dup (const SavedSearchID* self) { + SavedSearchID* dup; +#line 7 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + dup = g_new0 (SavedSearchID, 1); +#line 7 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + memcpy (dup, self, sizeof (SavedSearchID)); +#line 7 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return dup; +#line 472 "SavedSearchDBTable.c" +} + + +void saved_search_id_free (SavedSearchID* self) { +#line 7 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_free (self); +#line 479 "SavedSearchDBTable.c" +} + + +GType saved_search_id_get_type (void) { + static volatile gsize saved_search_id_type_id__volatile = 0; + if (g_once_init_enter (&saved_search_id_type_id__volatile)) { + GType saved_search_id_type_id; + saved_search_id_type_id = g_boxed_type_register_static ("SavedSearchID", (GBoxedCopyFunc) saved_search_id_dup, (GBoxedFreeFunc) saved_search_id_free); + g_once_init_leave (&saved_search_id_type_id__volatile, saved_search_id_type_id); + } + return saved_search_id_type_id__volatile; +} + + +SavedSearchRow* saved_search_row_construct (GType object_type) { + SavedSearchRow* self = NULL; +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + self = (SavedSearchRow*) g_type_create_instance (object_type); +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return self; +#line 500 "SavedSearchDBTable.c" +} + + +SavedSearchRow* saved_search_row_new (void) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return saved_search_row_construct (TYPE_SAVED_SEARCH_ROW); +#line 507 "SavedSearchDBTable.c" +} + + +static void value_saved_search_row_init (GValue* value) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + value->data[0].v_pointer = NULL; +#line 514 "SavedSearchDBTable.c" +} + + +static void value_saved_search_row_free_value (GValue* value) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (value->data[0].v_pointer) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + saved_search_row_unref (value->data[0].v_pointer); +#line 523 "SavedSearchDBTable.c" + } +} + + +static void value_saved_search_row_copy_value (const GValue* src_value, GValue* dest_value) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (src_value->data[0].v_pointer) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + dest_value->data[0].v_pointer = saved_search_row_ref (src_value->data[0].v_pointer); +#line 533 "SavedSearchDBTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + dest_value->data[0].v_pointer = NULL; +#line 537 "SavedSearchDBTable.c" + } +} + + +static gpointer value_saved_search_row_peek_pointer (const GValue* value) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return value->data[0].v_pointer; +#line 545 "SavedSearchDBTable.c" +} + + +static gchar* value_saved_search_row_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (collect_values[0].v_pointer) { +#line 552 "SavedSearchDBTable.c" + SavedSearchRow* object; + object = collect_values[0].v_pointer; +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (object->parent_instance.g_class == NULL) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); +#line 559 "SavedSearchDBTable.c" + } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); +#line 563 "SavedSearchDBTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + value->data[0].v_pointer = saved_search_row_ref (object); +#line 567 "SavedSearchDBTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + value->data[0].v_pointer = NULL; +#line 571 "SavedSearchDBTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 575 "SavedSearchDBTable.c" +} + + +static gchar* value_saved_search_row_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + SavedSearchRow** object_p; + object_p = collect_values[0].v_pointer; +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (!object_p) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); +#line 586 "SavedSearchDBTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (!value->data[0].v_pointer) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + *object_p = NULL; +#line 592 "SavedSearchDBTable.c" + } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + *object_p = value->data[0].v_pointer; +#line 596 "SavedSearchDBTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + *object_p = saved_search_row_ref (value->data[0].v_pointer); +#line 600 "SavedSearchDBTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 604 "SavedSearchDBTable.c" +} + + +GParamSpec* param_spec_saved_search_row (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { + ParamSpecSavedSearchRow* spec; +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_val_if_fail (g_type_is_a (object_type, TYPE_SAVED_SEARCH_ROW), NULL); +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + G_PARAM_SPEC (spec)->value_type = object_type; +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return G_PARAM_SPEC (spec); +#line 618 "SavedSearchDBTable.c" +} + + +gpointer value_get_saved_search_row (const GValue* value) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SAVED_SEARCH_ROW), NULL); +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return value->data[0].v_pointer; +#line 627 "SavedSearchDBTable.c" +} + + +void value_set_saved_search_row (GValue* value, gpointer v_object) { + SavedSearchRow* old; +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SAVED_SEARCH_ROW)); +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + old = value->data[0].v_pointer; +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (v_object) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_SAVED_SEARCH_ROW)); +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + value->data[0].v_pointer = v_object; +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + saved_search_row_ref (value->data[0].v_pointer); +#line 647 "SavedSearchDBTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + value->data[0].v_pointer = NULL; +#line 651 "SavedSearchDBTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (old) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + saved_search_row_unref (old); +#line 657 "SavedSearchDBTable.c" + } +} + + +void value_take_saved_search_row (GValue* value, gpointer v_object) { + SavedSearchRow* old; +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SAVED_SEARCH_ROW)); +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + old = value->data[0].v_pointer; +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (v_object) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_SAVED_SEARCH_ROW)); +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + value->data[0].v_pointer = v_object; +#line 676 "SavedSearchDBTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + value->data[0].v_pointer = NULL; +#line 680 "SavedSearchDBTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (old) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + saved_search_row_unref (old); +#line 686 "SavedSearchDBTable.c" + } +} + + +static void saved_search_row_class_init (SavedSearchRowClass * klass) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + saved_search_row_parent_class = g_type_class_peek_parent (klass); +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + ((SavedSearchRowClass *) klass)->finalize = saved_search_row_finalize; +#line 696 "SavedSearchDBTable.c" +} + + +static void saved_search_row_instance_init (SavedSearchRow * self) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + self->ref_count = 1; +#line 703 "SavedSearchDBTable.c" +} + + +static void saved_search_row_finalize (SavedSearchRow* obj) { + SavedSearchRow * self; +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SAVED_SEARCH_ROW, SavedSearchRow); +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_signal_handlers_destroy (self); +#line 28 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_free0 (self->name); +#line 30 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (self->conditions); +#line 717 "SavedSearchDBTable.c" +} + + +GType saved_search_row_get_type (void) { + static volatile gsize saved_search_row_type_id__volatile = 0; + if (g_once_init_enter (&saved_search_row_type_id__volatile)) { + static const GTypeValueTable g_define_type_value_table = { value_saved_search_row_init, value_saved_search_row_free_value, value_saved_search_row_copy_value, value_saved_search_row_peek_pointer, "p", value_saved_search_row_collect_value, "p", value_saved_search_row_lcopy_value }; + static const GTypeInfo g_define_type_info = { sizeof (SavedSearchRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) saved_search_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SavedSearchRow), 0, (GInstanceInitFunc) saved_search_row_instance_init, &g_define_type_value_table }; + static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; + GType saved_search_row_type_id; + saved_search_row_type_id = g_type_register_fundamental (g_type_fundamental_next (), "SavedSearchRow", &g_define_type_info, &g_define_type_fundamental_info, 0); + g_once_init_leave (&saved_search_row_type_id__volatile, saved_search_row_type_id); + } + return saved_search_row_type_id__volatile; +} + + +gpointer saved_search_row_ref (gpointer instance) { + SavedSearchRow* self; + self = instance; +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_atomic_int_inc (&self->ref_count); +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return instance; +#line 742 "SavedSearchDBTable.c" +} + + +void saved_search_row_unref (gpointer instance) { + SavedSearchRow* self; + self = instance; +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (g_atomic_int_dec_and_test (&self->ref_count)) { +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + SAVED_SEARCH_ROW_GET_CLASS (self)->finalize (self); +#line 25 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_type_free_instance ((GTypeInstance *) self); +#line 755 "SavedSearchDBTable.c" + } +} + + +static SavedSearchDBTable* saved_search_db_table_construct (GType object_type) { + SavedSearchDBTable* self = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + sqlite3* _tmp8_ = NULL; + sqlite3_stmt* _tmp9_ = NULL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + sqlite3_stmt* _tmp12_ = NULL; + gint _tmp13_ = 0; + gint _tmp14_ = 0; + sqlite3* _tmp16_ = NULL; + sqlite3_stmt* _tmp17_ = NULL; + gint _tmp18_ = 0; + gint _tmp19_ = 0; + sqlite3_stmt* _tmp20_ = NULL; + gint _tmp21_ = 0; + gint _tmp22_ = 0; + sqlite3* _tmp24_ = NULL; + sqlite3_stmt* _tmp25_ = NULL; + gint _tmp26_ = 0; + gint _tmp27_ = 0; + sqlite3_stmt* _tmp28_ = NULL; + gint _tmp29_ = 0; + gint _tmp30_ = 0; + sqlite3* _tmp32_ = NULL; + sqlite3_stmt* _tmp33_ = NULL; + gint _tmp34_ = 0; + gint _tmp35_ = 0; + sqlite3_stmt* _tmp36_ = NULL; + gint _tmp37_ = 0; + gint _tmp38_ = 0; + sqlite3* _tmp40_ = NULL; + sqlite3_stmt* _tmp41_ = NULL; + gint _tmp42_ = 0; + gint _tmp43_ = 0; + sqlite3_stmt* _tmp44_ = NULL; + gint _tmp45_ = 0; + gint _tmp46_ = 0; + sqlite3* _tmp48_ = NULL; + sqlite3_stmt* _tmp49_ = NULL; + gint _tmp50_ = 0; + gint _tmp51_ = 0; + sqlite3_stmt* _tmp52_ = NULL; + gint _tmp53_ = 0; + gint _tmp54_ = 0; + sqlite3* _tmp56_ = NULL; + sqlite3_stmt* _tmp57_ = NULL; + gint _tmp58_ = 0; + gint _tmp59_ = 0; + sqlite3_stmt* _tmp60_ = NULL; + gint _tmp61_ = 0; + gint _tmp62_ = 0; + sqlite3* _tmp64_ = NULL; + sqlite3_stmt* _tmp65_ = NULL; + gint _tmp66_ = 0; + gint _tmp67_ = 0; + sqlite3_stmt* _tmp68_ = NULL; + gint _tmp69_ = 0; + gint _tmp70_ = 0; + sqlite3* _tmp72_ = NULL; + sqlite3_stmt* _tmp73_ = NULL; + gint _tmp74_ = 0; + gint _tmp75_ = 0; + sqlite3_stmt* _tmp76_ = NULL; + gint _tmp77_ = 0; + gint _tmp78_ = 0; + sqlite3* _tmp80_ = NULL; + sqlite3_stmt* _tmp81_ = NULL; + gint _tmp82_ = 0; + gint _tmp83_ = 0; + sqlite3_stmt* _tmp84_ = NULL; + gint _tmp85_ = 0; + gint _tmp86_ = 0; + sqlite3* _tmp88_ = NULL; + sqlite3_stmt* _tmp89_ = NULL; + gint _tmp90_ = 0; + gint _tmp91_ = 0; + sqlite3_stmt* _tmp92_ = NULL; + gint _tmp93_ = 0; + gint _tmp94_ = 0; + sqlite3* _tmp96_ = NULL; + sqlite3_stmt* _tmp97_ = NULL; + gint _tmp98_ = 0; + gint _tmp99_ = 0; + sqlite3_stmt* _tmp100_ = NULL; + gint _tmp101_ = 0; + gint _tmp102_ = 0; +#line 36 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + self = (SavedSearchDBTable*) database_table_construct (object_type); +#line 37 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_set_table_name (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), "SavedSearchDBTable"); +#line 41 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp0_ = database_table_db; +#line 41 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "CREATE TABLE IF NOT EXISTS " "SavedSearchDBTable " "(" "id INTEGER PRIMARY KEY, " "name TEXT UNIQUE NOT NULL, " "operator TEXT NOT NULL" ")", -1, &_tmp1_, NULL); +#line 41 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 41 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp1_; +#line 41 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp2_; +#line 48 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp3_ = res; +#line 48 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 50 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp4_ = stmt; +#line 50 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp5_ = sqlite3_step (_tmp4_); +#line 50 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp5_; +#line 51 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp6_ = res; +#line 51 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp6_ != SQLITE_DONE) { +#line 883 "SavedSearchDBTable.c" + gint _tmp7_ = 0; +#line 52 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp7_ = res; +#line 52 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_fatal ("create SavedSearchDBTable", _tmp7_); +#line 889 "SavedSearchDBTable.c" + } +#line 55 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp8_ = database_table_db; +#line 55 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp10_ = sqlite3_prepare_v2 (_tmp8_, "CREATE TABLE IF NOT EXISTS " "SavedSearchDBTable_Text " "(" "id INTEGER PRIMARY KEY, " "search_id INTEGER NOT NULL, " "search_type TEXT NOT NULL, " "context TEXT NOT NULL, " "text TEXT" ")", -1, &_tmp9_, NULL); +#line 55 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 55 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp9_; +#line 55 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp10_; +#line 64 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp11_ = res; +#line 64 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp11_ == SQLITE_OK, "res == Sqlite.OK"); +#line 66 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp12_ = stmt; +#line 66 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp13_ = sqlite3_step (_tmp12_); +#line 66 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp13_; +#line 67 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp14_ = res; +#line 67 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp14_ != SQLITE_DONE) { +#line 915 "SavedSearchDBTable.c" + gint _tmp15_ = 0; +#line 68 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp15_ = res; +#line 68 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_fatal ("create SavedSearchDBTable_Text", _tmp15_); +#line 921 "SavedSearchDBTable.c" + } +#line 71 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp16_ = database_table_db; +#line 71 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp18_ = sqlite3_prepare_v2 (_tmp16_, "CREATE TABLE IF NOT EXISTS " "SavedSearchDBTable_MediaType " "(" "id INTEGER PRIMARY KEY, " "search_id INTEGER NOT NULL, " "search_type TEXT NOT NULL, " "context TEXT NOT NULL, " "type TEXT NOT_NULL" ")", -1, &_tmp17_, NULL); +#line 71 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 71 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp17_; +#line 71 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp18_; +#line 80 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp19_ = res; +#line 80 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp19_ == SQLITE_OK, "res == Sqlite.OK"); +#line 82 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp20_ = stmt; +#line 82 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp21_ = sqlite3_step (_tmp20_); +#line 82 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp21_; +#line 83 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp22_ = res; +#line 83 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp22_ != SQLITE_DONE) { +#line 947 "SavedSearchDBTable.c" + gint _tmp23_ = 0; +#line 84 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp23_ = res; +#line 84 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_fatal ("create SavedSearchDBTable_MediaType", _tmp23_); +#line 953 "SavedSearchDBTable.c" + } +#line 87 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp24_ = database_table_db; +#line 87 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp26_ = sqlite3_prepare_v2 (_tmp24_, "CREATE TABLE IF NOT EXISTS " "SavedSearchDBTable_Flagged " "(" "id INTEGER PRIMARY KEY, " "search_id INTEGER NOT NULL, " "search_type TEXT NOT NULL, " "flag_state TEXT NOT NULL" ")", -1, &_tmp25_, NULL); +#line 87 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 87 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp25_; +#line 87 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp26_; +#line 95 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp27_ = res; +#line 95 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp27_ == SQLITE_OK, "res == Sqlite.OK"); +#line 97 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp28_ = stmt; +#line 97 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp29_ = sqlite3_step (_tmp28_); +#line 97 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp29_; +#line 98 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp30_ = res; +#line 98 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp30_ != SQLITE_DONE) { +#line 979 "SavedSearchDBTable.c" + gint _tmp31_ = 0; +#line 99 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp31_ = res; +#line 99 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_fatal ("create SavedSearchDBTable_Flagged", _tmp31_); +#line 985 "SavedSearchDBTable.c" + } +#line 102 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp32_ = database_table_db; +#line 102 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp34_ = sqlite3_prepare_v2 (_tmp32_, "CREATE TABLE IF NOT EXISTS " "SavedSearchDBTable_Modified " "(" "id INTEGER PRIMARY KEY, " "search_id INTEGER NOT NULL, " "search_type TEXT NOT NULL, " "context TEXT NOT NULL, " "modified_state TEXT NOT NULL" ")", -1, &_tmp33_, NULL); +#line 102 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 102 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp33_; +#line 102 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp34_; +#line 111 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp35_ = res; +#line 111 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp35_ == SQLITE_OK, "res == Sqlite.OK"); +#line 113 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp36_ = stmt; +#line 113 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp37_ = sqlite3_step (_tmp36_); +#line 113 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp37_; +#line 114 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp38_ = res; +#line 114 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp38_ != SQLITE_DONE) { +#line 1011 "SavedSearchDBTable.c" + gint _tmp39_ = 0; +#line 115 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp39_ = res; +#line 115 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_fatal ("create SavedSearchDBTable_Modified", _tmp39_); +#line 1017 "SavedSearchDBTable.c" + } +#line 118 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp40_ = database_table_db; +#line 118 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp42_ = sqlite3_prepare_v2 (_tmp40_, "CREATE TABLE IF NOT EXISTS " "SavedSearchDBTable_Rating " "(" "id INTEGER PRIMARY KEY, " "search_id INTEGER NOT NULL, " "search_type TEXT NOT NULL, " "rating INTEGER NOT_NULL, " "context TEXT NOT NULL" ")", -1, &_tmp41_, NULL); +#line 118 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 118 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp41_; +#line 118 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp42_; +#line 127 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp43_ = res; +#line 127 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp43_ == SQLITE_OK, "res == Sqlite.OK"); +#line 129 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp44_ = stmt; +#line 129 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp45_ = sqlite3_step (_tmp44_); +#line 129 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp45_; +#line 130 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp46_ = res; +#line 130 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp46_ != SQLITE_DONE) { +#line 1043 "SavedSearchDBTable.c" + gint _tmp47_ = 0; +#line 131 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp47_ = res; +#line 131 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_fatal ("create SavedSearchDBTable_Rating", _tmp47_); +#line 1049 "SavedSearchDBTable.c" + } +#line 134 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp48_ = database_table_db; +#line 134 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp50_ = sqlite3_prepare_v2 (_tmp48_, "CREATE TABLE IF NOT EXISTS " "SavedSearchDBTable_Date " "(" "id INTEGER PRIMARY KEY, " "search_id INTEGER NOT NULL, " "search_type TEXT NOT NULL, " "context TEXT NOT NULL, " "date_one INTEGER NOT_NULL, " "date_two INTEGER NOT_NULL" ")", -1, &_tmp49_, NULL); +#line 134 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 134 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp49_; +#line 134 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp50_; +#line 144 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp51_ = res; +#line 144 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp51_ == SQLITE_OK, "res == Sqlite.OK"); +#line 146 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp52_ = stmt; +#line 146 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp53_ = sqlite3_step (_tmp52_); +#line 146 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp53_; +#line 147 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp54_ = res; +#line 147 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp54_ != SQLITE_DONE) { +#line 1075 "SavedSearchDBTable.c" + gint _tmp55_ = 0; +#line 148 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp55_ = res; +#line 148 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_fatal ("create SavedSearchDBTable_Rating", _tmp55_); +#line 1081 "SavedSearchDBTable.c" + } +#line 151 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp56_ = database_table_db; +#line 151 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp58_ = sqlite3_prepare_v2 (_tmp56_, "CREATE INDEX IF NOT EXISTS " "SavedSearchDBTable_Text_Index " "ON SavedSearchDBTable_Text(search_id)", -1, &_tmp57_, NULL); +#line 151 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 151 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp57_; +#line 151 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp58_; +#line 154 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp59_ = res; +#line 154 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp59_ == SQLITE_OK, "res == Sqlite.OK"); +#line 155 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp60_ = stmt; +#line 155 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp61_ = sqlite3_step (_tmp60_); +#line 155 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp61_; +#line 156 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp62_ = res; +#line 156 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp62_ != SQLITE_DONE) { +#line 1107 "SavedSearchDBTable.c" + gint _tmp63_ = 0; +#line 157 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp63_ = res; +#line 157 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_fatal ("create SavedSearchDBTable_Text_Index", _tmp63_); +#line 1113 "SavedSearchDBTable.c" + } +#line 159 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp64_ = database_table_db; +#line 159 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp66_ = sqlite3_prepare_v2 (_tmp64_, "CREATE INDEX IF NOT EXISTS " "SavedSearchDBTable_MediaType_Index " "ON SavedSearchDBTable_MediaType(search_id)", -1, &_tmp65_, NULL); +#line 159 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 159 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp65_; +#line 159 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp66_; +#line 162 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp67_ = res; +#line 162 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp67_ == SQLITE_OK, "res == Sqlite.OK"); +#line 163 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp68_ = stmt; +#line 163 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp69_ = sqlite3_step (_tmp68_); +#line 163 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp69_; +#line 164 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp70_ = res; +#line 164 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp70_ != SQLITE_DONE) { +#line 1139 "SavedSearchDBTable.c" + gint _tmp71_ = 0; +#line 165 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp71_ = res; +#line 165 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_fatal ("create SavedSearchDBTable_MediaType_Index", _tmp71_); +#line 1145 "SavedSearchDBTable.c" + } +#line 167 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp72_ = database_table_db; +#line 167 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp74_ = sqlite3_prepare_v2 (_tmp72_, "CREATE INDEX IF NOT EXISTS " "SavedSearchDBTable_Flagged_Index " "ON SavedSearchDBTable_Flagged(search_id)", -1, &_tmp73_, NULL); +#line 167 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 167 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp73_; +#line 167 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp74_; +#line 170 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp75_ = res; +#line 170 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp75_ == SQLITE_OK, "res == Sqlite.OK"); +#line 171 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp76_ = stmt; +#line 171 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp77_ = sqlite3_step (_tmp76_); +#line 171 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp77_; +#line 172 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp78_ = res; +#line 172 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp78_ != SQLITE_DONE) { +#line 1171 "SavedSearchDBTable.c" + gint _tmp79_ = 0; +#line 173 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp79_ = res; +#line 173 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_fatal ("create SavedSearchDBTable_Flagged_Index", _tmp79_); +#line 1177 "SavedSearchDBTable.c" + } +#line 175 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp80_ = database_table_db; +#line 175 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp82_ = sqlite3_prepare_v2 (_tmp80_, "CREATE INDEX IF NOT EXISTS " "SavedSearchDBTable_Modified_Index " "ON SavedSearchDBTable_Modified(search_id)", -1, &_tmp81_, NULL); +#line 175 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 175 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp81_; +#line 175 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp82_; +#line 178 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp83_ = res; +#line 178 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp83_ == SQLITE_OK, "res == Sqlite.OK"); +#line 179 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp84_ = stmt; +#line 179 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp85_ = sqlite3_step (_tmp84_); +#line 179 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp85_; +#line 180 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp86_ = res; +#line 180 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp86_ != SQLITE_DONE) { +#line 1203 "SavedSearchDBTable.c" + gint _tmp87_ = 0; +#line 181 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp87_ = res; +#line 181 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_fatal ("create SavedSearchDBTable_Modified_Index", _tmp87_); +#line 1209 "SavedSearchDBTable.c" + } +#line 183 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp88_ = database_table_db; +#line 183 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp90_ = sqlite3_prepare_v2 (_tmp88_, "CREATE INDEX IF NOT EXISTS " "SavedSearchDBTable_Rating_Index " "ON SavedSearchDBTable_Rating(search_id)", -1, &_tmp89_, NULL); +#line 183 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 183 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp89_; +#line 183 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp90_; +#line 186 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp91_ = res; +#line 186 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp91_ == SQLITE_OK, "res == Sqlite.OK"); +#line 187 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp92_ = stmt; +#line 187 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp93_ = sqlite3_step (_tmp92_); +#line 187 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp93_; +#line 188 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp94_ = res; +#line 188 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp94_ != SQLITE_DONE) { +#line 1235 "SavedSearchDBTable.c" + gint _tmp95_ = 0; +#line 189 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp95_ = res; +#line 189 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_fatal ("create SavedSearchDBTable_Rating_Index", _tmp95_); +#line 1241 "SavedSearchDBTable.c" + } +#line 191 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp96_ = database_table_db; +#line 191 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp98_ = sqlite3_prepare_v2 (_tmp96_, "CREATE INDEX IF NOT EXISTS " "SavedSearchDBTable_Date_Index " "ON SavedSearchDBTable_Date(search_id)", -1, &_tmp97_, NULL); +#line 191 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 191 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp97_; +#line 191 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp98_; +#line 194 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp99_ = res; +#line 194 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp99_ == SQLITE_OK, "res == Sqlite.OK"); +#line 195 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp100_ = stmt; +#line 195 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp101_ = sqlite3_step (_tmp100_); +#line 195 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp101_; +#line 196 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp102_ = res; +#line 196 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp102_ != SQLITE_DONE) { +#line 1267 "SavedSearchDBTable.c" + gint _tmp103_ = 0; +#line 197 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp103_ = res; +#line 197 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_fatal ("create SavedSearchDBTable_Date_Index", _tmp103_); +#line 1273 "SavedSearchDBTable.c" + } +#line 36 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 36 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return self; +#line 1279 "SavedSearchDBTable.c" +} + + +static SavedSearchDBTable* saved_search_db_table_new (void) { +#line 36 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return saved_search_db_table_construct (TYPE_SAVED_SEARCH_DB_TABLE); +#line 1286 "SavedSearchDBTable.c" +} + + +static gpointer _database_table_ref0 (gpointer self) { +#line 204 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return self ? database_table_ref (self) : NULL; +#line 1293 "SavedSearchDBTable.c" +} + + +SavedSearchDBTable* saved_search_db_table_get_instance (void) { + SavedSearchDBTable* result = NULL; + SavedSearchDBTable* _tmp0_ = NULL; + SavedSearchDBTable* _tmp2_ = NULL; + SavedSearchDBTable* _tmp3_ = NULL; +#line 201 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp0_ = saved_search_db_table_instance; +#line 201 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp0_ == NULL) { +#line 1306 "SavedSearchDBTable.c" + SavedSearchDBTable* _tmp1_ = NULL; +#line 202 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp1_ = saved_search_db_table_new (); +#line 202 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _database_table_unref0 (saved_search_db_table_instance); +#line 202 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + saved_search_db_table_instance = _tmp1_; +#line 1314 "SavedSearchDBTable.c" + } +#line 204 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp2_ = saved_search_db_table_instance; +#line 204 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp3_ = _database_table_ref0 (_tmp2_); +#line 204 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + result = _tmp3_; +#line 204 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return result; +#line 1324 "SavedSearchDBTable.c" +} + + +static gpointer _g_object_ref0 (gpointer self) { +#line 227 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return self ? g_object_ref (self) : NULL; +#line 1331 "SavedSearchDBTable.c" +} + + +SavedSearchRow* saved_search_db_table_add (SavedSearchDBTable* self, const gchar* name, SearchOperator operator, GeeArrayList* conditions, GError** error) { + SavedSearchRow* result = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + const gchar* _tmp5_ = NULL; + gchar* _tmp6_ = NULL; + GDestroyNotify _tmp7_ = NULL; + gint _tmp8_ = 0; + gint _tmp9_ = 0; + sqlite3_stmt* _tmp10_ = NULL; + SearchOperator _tmp11_ = 0; + gchar* _tmp12_ = NULL; + GDestroyNotify _tmp13_ = NULL; + gint _tmp14_ = 0; + gint _tmp15_ = 0; + sqlite3_stmt* _tmp16_ = NULL; + gint _tmp17_ = 0; + gint _tmp18_ = 0; + SavedSearchRow* row = NULL; + SavedSearchRow* _tmp20_ = NULL; + SavedSearchRow* _tmp21_ = NULL; + sqlite3* _tmp22_ = NULL; + gint64 _tmp23_ = 0LL; + SavedSearchRow* _tmp24_ = NULL; + const gchar* _tmp25_ = NULL; + gchar* _tmp26_ = NULL; + SavedSearchRow* _tmp27_ = NULL; + SearchOperator _tmp28_ = 0; + SavedSearchRow* _tmp29_ = NULL; + GeeArrayList* _tmp30_ = NULL; + GeeList* _tmp31_ = NULL; + GError * _inner_error_ = NULL; +#line 207 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_val_if_fail (IS_SAVED_SEARCH_DB_TABLE (self), NULL); +#line 207 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_val_if_fail (name != NULL, NULL); +#line 207 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_val_if_fail (GEE_IS_ARRAY_LIST (conditions), NULL); +#line 210 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp0_ = database_table_db; +#line 210 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "INSERT INTO SavedSearchDBTable (name, operator) VALUES (?, ?)", -1, &_tmp1_, NULL); +#line 210 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 210 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp1_; +#line 210 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp2_; +#line 212 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp3_ = res; +#line 212 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 214 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp4_ = stmt; +#line 214 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp5_ = name; +#line 214 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp6_ = g_strdup (_tmp5_); +#line 214 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp7_ = g_free; +#line 214 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp8_ = sqlite3_bind_text (_tmp4_, 1, _tmp6_, -1, _tmp7_); +#line 214 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp8_; +#line 215 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp9_ = res; +#line 215 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp9_ == SQLITE_OK, "res == Sqlite.OK"); +#line 216 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp10_ = stmt; +#line 216 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp11_ = operator; +#line 216 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp12_ = search_operator_to_string (_tmp11_); +#line 216 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp13_ = g_free; +#line 216 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp14_ = sqlite3_bind_text (_tmp10_, 2, _tmp12_, -1, _tmp13_); +#line 216 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp14_; +#line 217 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp15_ = res; +#line 217 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp15_ == SQLITE_OK, "res == Sqlite.OK"); +#line 219 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp16_ = stmt; +#line 219 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp17_ = sqlite3_step (_tmp16_); +#line 219 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp17_; +#line 220 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp18_ = res; +#line 220 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp18_ != SQLITE_DONE) { +#line 1434 "SavedSearchDBTable.c" + gint _tmp19_ = 0; +#line 221 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp19_ = res; +#line 221 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_throw_error ("SavedSearchDBTable.add", _tmp19_, &_inner_error_); +#line 221 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 221 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 221 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 221 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 221 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 1450 "SavedSearchDBTable.c" + } else { +#line 221 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 221 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 221 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 221 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 1460 "SavedSearchDBTable.c" + } + } + } +#line 223 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp20_ = saved_search_row_new (); +#line 223 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + row = _tmp20_; +#line 224 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp21_ = row; +#line 224 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp22_ = database_table_db; +#line 224 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp23_ = sqlite3_last_insert_rowid (_tmp22_); +#line 224 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + saved_search_id_init (&_tmp21_->search_id, _tmp23_); +#line 225 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp24_ = row; +#line 225 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp25_ = name; +#line 225 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp26_ = g_strdup (_tmp25_); +#line 225 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_free0 (_tmp24_->name); +#line 225 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp24_->name = _tmp26_; +#line 226 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp27_ = row; +#line 226 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp28_ = operator; +#line 226 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp27_->operator = _tmp28_; +#line 227 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp29_ = row; +#line 227 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp30_ = conditions; +#line 227 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp31_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp30_, GEE_TYPE_LIST, GeeList)); +#line 227 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (_tmp29_->conditions); +#line 227 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp29_->conditions = _tmp31_; +#line 1502 "SavedSearchDBTable.c" + { + GeeArrayList* _sc_list = NULL; + GeeArrayList* _tmp32_ = NULL; + GeeArrayList* _tmp33_ = NULL; + gint _sc_size = 0; + GeeArrayList* _tmp34_ = NULL; + gint _tmp35_ = 0; + gint _tmp36_ = 0; + gint _sc_index = 0; +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp32_ = conditions; +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp33_ = _g_object_ref0 (_tmp32_); +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sc_list = _tmp33_; +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp34_ = _sc_list; +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp35_ = gee_abstract_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_tmp34_, GEE_TYPE_COLLECTION, GeeCollection)); +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp36_ = _tmp35_; +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sc_size = _tmp36_; +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sc_index = -1; +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + while (TRUE) { +#line 1530 "SavedSearchDBTable.c" + gint _tmp37_ = 0; + gint _tmp38_ = 0; + gint _tmp39_ = 0; + SearchCondition* sc = NULL; + GeeArrayList* _tmp40_ = NULL; + gint _tmp41_ = 0; + gpointer _tmp42_ = NULL; + SavedSearchRow* _tmp43_ = NULL; + SavedSearchID _tmp44_ = {0}; + SearchCondition* _tmp45_ = NULL; +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp37_ = _sc_index; +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sc_index = _tmp37_ + 1; +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp38_ = _sc_index; +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp39_ = _sc_size; +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (!(_tmp38_ < _tmp39_)) { +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + break; +#line 1553 "SavedSearchDBTable.c" + } +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp40_ = _sc_list; +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp41_ = _sc_index; +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp42_ = gee_abstract_list_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp40_, GEE_TYPE_ABSTRACT_LIST, GeeAbstractList), _tmp41_); +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + sc = (SearchCondition*) _tmp42_; +#line 230 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp43_ = row; +#line 230 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp44_ = _tmp43_->search_id; +#line 230 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp45_ = sc; +#line 230 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + saved_search_db_table_add_condition (self, &_tmp44_, _tmp45_, &_inner_error_); +#line 230 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 230 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 230 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 230 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (sc); +#line 230 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (_sc_list); +#line 230 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _saved_search_row_unref0 (row); +#line 230 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 230 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 1587 "SavedSearchDBTable.c" + } else { +#line 230 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (sc); +#line 230 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (_sc_list); +#line 230 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _saved_search_row_unref0 (row); +#line 230 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 230 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 230 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 230 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 1603 "SavedSearchDBTable.c" + } + } +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (sc); +#line 1608 "SavedSearchDBTable.c" + } +#line 229 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (_sc_list); +#line 1612 "SavedSearchDBTable.c" + } +#line 233 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + result = row; +#line 233 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 233 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return result; +#line 1620 "SavedSearchDBTable.c" +} + + +static gpointer _search_condition_ref0 (gpointer self) { +#line 238 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return self ? search_condition_ref (self) : NULL; +#line 1627 "SavedSearchDBTable.c" +} + + +static void saved_search_db_table_add_condition (SavedSearchDBTable* self, SavedSearchID* id, SearchCondition* condition, GError** error) { + SearchCondition* _tmp0_ = NULL; + GError * _inner_error_ = NULL; +#line 236 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (IS_SAVED_SEARCH_DB_TABLE (self)); +#line 236 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (id != NULL); +#line 236 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (IS_SEARCH_CONDITION (condition)); +#line 237 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp0_ = condition; +#line 237 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, TYPE_SEARCH_CONDITION_TEXT)) { +#line 1644 "SavedSearchDBTable.c" + SearchConditionText* text = NULL; + SearchCondition* _tmp1_ = NULL; + SearchConditionText* _tmp2_ = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp3_ = NULL; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + sqlite3_stmt* _tmp7_ = NULL; + SavedSearchID _tmp8_ = {0}; + gint64 _tmp9_ = 0LL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + sqlite3_stmt* _tmp12_ = NULL; + SearchConditionText* _tmp13_ = NULL; + SearchConditionSearchType _tmp14_ = 0; + SearchConditionSearchType _tmp15_ = 0; + gchar* _tmp16_ = NULL; + GDestroyNotify _tmp17_ = NULL; + gint _tmp18_ = 0; + gint _tmp19_ = 0; + sqlite3_stmt* _tmp20_ = NULL; + SearchConditionText* _tmp21_ = NULL; + SearchConditionTextContext _tmp22_ = 0; + SearchConditionTextContext _tmp23_ = 0; + gchar* _tmp24_ = NULL; + GDestroyNotify _tmp25_ = NULL; + gint _tmp26_ = 0; + gint _tmp27_ = 0; + sqlite3_stmt* _tmp28_ = NULL; + SearchConditionText* _tmp29_ = NULL; + const gchar* _tmp30_ = NULL; + const gchar* _tmp31_ = NULL; + gchar* _tmp32_ = NULL; + GDestroyNotify _tmp33_ = NULL; + gint _tmp34_ = 0; + gint _tmp35_ = 0; + sqlite3_stmt* _tmp36_ = NULL; + gint _tmp37_ = 0; + gint _tmp38_ = 0; +#line 238 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp1_ = condition; +#line 238 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp2_ = _search_condition_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, TYPE_SEARCH_CONDITION_TEXT) ? ((SearchConditionText*) _tmp1_) : NULL); +#line 238 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + text = _tmp2_; +#line 240 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp3_ = database_table_db; +#line 240 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp5_ = sqlite3_prepare_v2 (_tmp3_, "INSERT INTO SavedSearchDBTable_Text (search_id, search_type, context, " "text) VALUES (?, ?, ?, ?)", -1, &_tmp4_, NULL); +#line 240 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 240 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp4_; +#line 240 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp5_; +#line 243 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp6_ = res; +#line 243 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp6_ == SQLITE_OK, "res == Sqlite.OK"); +#line 245 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp7_ = stmt; +#line 245 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp8_ = *id; +#line 245 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp9_ = _tmp8_.id; +#line 245 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp10_ = sqlite3_bind_int64 (_tmp7_, 1, _tmp9_); +#line 245 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp10_; +#line 246 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp11_ = res; +#line 246 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp11_ == SQLITE_OK, "res == Sqlite.OK"); +#line 248 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp12_ = stmt; +#line 248 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp13_ = text; +#line 248 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp14_ = search_condition_get_search_type (G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, TYPE_SEARCH_CONDITION, SearchCondition)); +#line 248 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp15_ = _tmp14_; +#line 248 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp16_ = search_condition_search_type_to_string (_tmp15_); +#line 248 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp17_ = g_free; +#line 248 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp18_ = sqlite3_bind_text (_tmp12_, 2, _tmp16_, -1, _tmp17_); +#line 248 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp18_; +#line 249 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp19_ = res; +#line 249 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp19_ == SQLITE_OK, "res == Sqlite.OK"); +#line 251 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp20_ = stmt; +#line 251 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp21_ = text; +#line 251 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp22_ = search_condition_text_get_context (_tmp21_); +#line 251 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp23_ = _tmp22_; +#line 251 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp24_ = search_condition_text_context_to_string (_tmp23_); +#line 251 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp25_ = g_free; +#line 251 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp26_ = sqlite3_bind_text (_tmp20_, 3, _tmp24_, -1, _tmp25_); +#line 251 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp26_; +#line 252 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp27_ = res; +#line 252 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp27_ == SQLITE_OK, "res == Sqlite.OK"); +#line 254 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp28_ = stmt; +#line 254 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp29_ = text; +#line 254 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp30_ = search_condition_text_get_text (_tmp29_); +#line 254 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp31_ = _tmp30_; +#line 254 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp32_ = g_strdup (_tmp31_); +#line 254 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp33_ = g_free; +#line 254 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp34_ = sqlite3_bind_text (_tmp28_, 4, _tmp32_, -1, _tmp33_); +#line 254 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp34_; +#line 255 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp35_ = res; +#line 255 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp35_ == SQLITE_OK, "res == Sqlite.OK"); +#line 257 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp36_ = stmt; +#line 257 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp37_ = sqlite3_step (_tmp36_); +#line 257 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp37_; +#line 258 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp38_ = res; +#line 258 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp38_ != SQLITE_DONE) { +#line 1790 "SavedSearchDBTable.c" + gint _tmp39_ = 0; +#line 259 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp39_ = res; +#line 259 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_throw_error ("SavedSearchDBTable_Text.add", _tmp39_, &_inner_error_); +#line 259 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 259 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 259 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 259 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 259 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (text); +#line 259 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 1808 "SavedSearchDBTable.c" + } else { +#line 259 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 259 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (text); +#line 259 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 259 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 259 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 1820 "SavedSearchDBTable.c" + } + } + } +#line 237 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 237 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (text); +#line 1828 "SavedSearchDBTable.c" + } else { + SearchCondition* _tmp40_ = NULL; +#line 260 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp40_ = condition; +#line 260 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp40_, TYPE_SEARCH_CONDITION_MEDIA_TYPE)) { +#line 1835 "SavedSearchDBTable.c" + SearchConditionMediaType* media_type = NULL; + SearchCondition* _tmp41_ = NULL; + SearchConditionMediaType* _tmp42_ = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp43_ = NULL; + sqlite3_stmt* _tmp44_ = NULL; + gint _tmp45_ = 0; + gint _tmp46_ = 0; + sqlite3_stmt* _tmp47_ = NULL; + SavedSearchID _tmp48_ = {0}; + gint64 _tmp49_ = 0LL; + gint _tmp50_ = 0; + gint _tmp51_ = 0; + sqlite3_stmt* _tmp52_ = NULL; + SearchConditionMediaType* _tmp53_ = NULL; + SearchConditionSearchType _tmp54_ = 0; + SearchConditionSearchType _tmp55_ = 0; + gchar* _tmp56_ = NULL; + GDestroyNotify _tmp57_ = NULL; + gint _tmp58_ = 0; + gint _tmp59_ = 0; + sqlite3_stmt* _tmp60_ = NULL; + SearchConditionMediaType* _tmp61_ = NULL; + SearchConditionMediaTypeContext _tmp62_ = 0; + SearchConditionMediaTypeContext _tmp63_ = 0; + gchar* _tmp64_ = NULL; + GDestroyNotify _tmp65_ = NULL; + gint _tmp66_ = 0; + gint _tmp67_ = 0; + sqlite3_stmt* _tmp68_ = NULL; + SearchConditionMediaType* _tmp69_ = NULL; + SearchConditionMediaTypeMediaType _tmp70_ = 0; + SearchConditionMediaTypeMediaType _tmp71_ = 0; + gchar* _tmp72_ = NULL; + GDestroyNotify _tmp73_ = NULL; + gint _tmp74_ = 0; + gint _tmp75_ = 0; + sqlite3_stmt* _tmp76_ = NULL; + gint _tmp77_ = 0; + gint _tmp78_ = 0; +#line 261 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp41_ = condition; +#line 261 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp42_ = _search_condition_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp41_, TYPE_SEARCH_CONDITION_MEDIA_TYPE) ? ((SearchConditionMediaType*) _tmp41_) : NULL); +#line 261 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + media_type = _tmp42_; +#line 263 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp43_ = database_table_db; +#line 263 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp45_ = sqlite3_prepare_v2 (_tmp43_, "INSERT INTO SavedSearchDBTable_MediaType (search_id, search_type, cont" \ +"ext, " "type) VALUES (?, ?, ?, ?)", -1, &_tmp44_, NULL); +#line 263 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 263 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp44_; +#line 263 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp45_; +#line 266 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp46_ = res; +#line 266 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp46_ == SQLITE_OK, "res == Sqlite.OK"); +#line 268 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp47_ = stmt; +#line 268 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp48_ = *id; +#line 268 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp49_ = _tmp48_.id; +#line 268 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp50_ = sqlite3_bind_int64 (_tmp47_, 1, _tmp49_); +#line 268 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp50_; +#line 269 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp51_ = res; +#line 269 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp51_ == SQLITE_OK, "res == Sqlite.OK"); +#line 271 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp52_ = stmt; +#line 271 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp53_ = media_type; +#line 271 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp54_ = search_condition_get_search_type (G_TYPE_CHECK_INSTANCE_CAST (_tmp53_, TYPE_SEARCH_CONDITION, SearchCondition)); +#line 271 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp55_ = _tmp54_; +#line 271 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp56_ = search_condition_search_type_to_string (_tmp55_); +#line 271 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp57_ = g_free; +#line 271 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp58_ = sqlite3_bind_text (_tmp52_, 2, _tmp56_, -1, _tmp57_); +#line 271 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp58_; +#line 272 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp59_ = res; +#line 272 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp59_ == SQLITE_OK, "res == Sqlite.OK"); +#line 274 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp60_ = stmt; +#line 274 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp61_ = media_type; +#line 274 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp62_ = search_condition_media_type_get_context (_tmp61_); +#line 274 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp63_ = _tmp62_; +#line 274 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp64_ = search_condition_media_type_context_to_string (_tmp63_); +#line 274 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp65_ = g_free; +#line 274 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp66_ = sqlite3_bind_text (_tmp60_, 3, _tmp64_, -1, _tmp65_); +#line 274 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp66_; +#line 275 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp67_ = res; +#line 275 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp67_ == SQLITE_OK, "res == Sqlite.OK"); +#line 277 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp68_ = stmt; +#line 277 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp69_ = media_type; +#line 277 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp70_ = search_condition_media_type_get_media_type (_tmp69_); +#line 277 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp71_ = _tmp70_; +#line 277 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp72_ = search_condition_media_type_media_type_to_string (_tmp71_); +#line 277 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp73_ = g_free; +#line 277 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp74_ = sqlite3_bind_text (_tmp68_, 4, _tmp72_, -1, _tmp73_); +#line 277 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp74_; +#line 278 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp75_ = res; +#line 278 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp75_ == SQLITE_OK, "res == Sqlite.OK"); +#line 280 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp76_ = stmt; +#line 280 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp77_ = sqlite3_step (_tmp76_); +#line 280 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp77_; +#line 281 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp78_ = res; +#line 281 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp78_ != SQLITE_DONE) { +#line 1981 "SavedSearchDBTable.c" + gint _tmp79_ = 0; +#line 282 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp79_ = res; +#line 282 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_throw_error ("SavedSearchDBTable_MediaType.add", _tmp79_, &_inner_error_); +#line 282 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 282 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 282 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 282 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 282 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (media_type); +#line 282 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 1999 "SavedSearchDBTable.c" + } else { +#line 282 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 282 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (media_type); +#line 282 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 282 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 282 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2011 "SavedSearchDBTable.c" + } + } + } +#line 260 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 260 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (media_type); +#line 2019 "SavedSearchDBTable.c" + } else { + SearchCondition* _tmp80_ = NULL; +#line 283 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp80_ = condition; +#line 283 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp80_, TYPE_SEARCH_CONDITION_FLAGGED)) { +#line 2026 "SavedSearchDBTable.c" + SearchConditionFlagged* flag_state = NULL; + SearchCondition* _tmp81_ = NULL; + SearchConditionFlagged* _tmp82_ = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp83_ = NULL; + sqlite3_stmt* _tmp84_ = NULL; + gint _tmp85_ = 0; + gint _tmp86_ = 0; + sqlite3_stmt* _tmp87_ = NULL; + SavedSearchID _tmp88_ = {0}; + gint64 _tmp89_ = 0LL; + gint _tmp90_ = 0; + gint _tmp91_ = 0; + sqlite3_stmt* _tmp92_ = NULL; + SearchConditionFlagged* _tmp93_ = NULL; + SearchConditionSearchType _tmp94_ = 0; + SearchConditionSearchType _tmp95_ = 0; + gchar* _tmp96_ = NULL; + GDestroyNotify _tmp97_ = NULL; + gint _tmp98_ = 0; + gint _tmp99_ = 0; + sqlite3_stmt* _tmp100_ = NULL; + SearchConditionFlagged* _tmp101_ = NULL; + SearchConditionFlaggedState _tmp102_ = 0; + SearchConditionFlaggedState _tmp103_ = 0; + gchar* _tmp104_ = NULL; + GDestroyNotify _tmp105_ = NULL; + gint _tmp106_ = 0; + gint _tmp107_ = 0; + sqlite3_stmt* _tmp108_ = NULL; + gint _tmp109_ = 0; + gint _tmp110_ = 0; +#line 284 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp81_ = condition; +#line 284 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp82_ = _search_condition_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp81_, TYPE_SEARCH_CONDITION_FLAGGED) ? ((SearchConditionFlagged*) _tmp81_) : NULL); +#line 284 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + flag_state = _tmp82_; +#line 286 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp83_ = database_table_db; +#line 286 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp85_ = sqlite3_prepare_v2 (_tmp83_, "INSERT INTO SavedSearchDBTable_Flagged (search_id, search_type, " "flag_state) VALUES (?, ?, ?)", -1, &_tmp84_, NULL); +#line 286 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 286 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp84_; +#line 286 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp85_; +#line 289 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp86_ = res; +#line 289 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp86_ == SQLITE_OK, "res == Sqlite.OK"); +#line 291 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp87_ = stmt; +#line 291 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp88_ = *id; +#line 291 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp89_ = _tmp88_.id; +#line 291 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp90_ = sqlite3_bind_int64 (_tmp87_, 1, _tmp89_); +#line 291 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp90_; +#line 292 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp91_ = res; +#line 292 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp91_ == SQLITE_OK, "res == Sqlite.OK"); +#line 294 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp92_ = stmt; +#line 294 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp93_ = flag_state; +#line 294 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp94_ = search_condition_get_search_type (G_TYPE_CHECK_INSTANCE_CAST (_tmp93_, TYPE_SEARCH_CONDITION, SearchCondition)); +#line 294 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp95_ = _tmp94_; +#line 294 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp96_ = search_condition_search_type_to_string (_tmp95_); +#line 294 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp97_ = g_free; +#line 294 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp98_ = sqlite3_bind_text (_tmp92_, 2, _tmp96_, -1, _tmp97_); +#line 294 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp98_; +#line 295 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp99_ = res; +#line 295 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp99_ == SQLITE_OK, "res == Sqlite.OK"); +#line 297 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp100_ = stmt; +#line 297 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp101_ = flag_state; +#line 297 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp102_ = search_condition_flagged_get_state (_tmp101_); +#line 297 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp103_ = _tmp102_; +#line 297 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp104_ = search_condition_flagged_state_to_string (_tmp103_); +#line 297 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp105_ = g_free; +#line 297 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp106_ = sqlite3_bind_text (_tmp100_, 3, _tmp104_, -1, _tmp105_); +#line 297 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp106_; +#line 298 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp107_ = res; +#line 298 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp107_ == SQLITE_OK, "res == Sqlite.OK"); +#line 300 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp108_ = stmt; +#line 300 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp109_ = sqlite3_step (_tmp108_); +#line 300 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp109_; +#line 301 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp110_ = res; +#line 301 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp110_ != SQLITE_DONE) { +#line 2144 "SavedSearchDBTable.c" + gint _tmp111_ = 0; +#line 302 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp111_ = res; +#line 302 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_throw_error ("SavedSearchDBTable_Flagged.add", _tmp111_, &_inner_error_); +#line 302 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 302 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 302 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 302 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 302 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (flag_state); +#line 302 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2162 "SavedSearchDBTable.c" + } else { +#line 302 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 302 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (flag_state); +#line 302 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 302 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 302 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2174 "SavedSearchDBTable.c" + } + } + } +#line 283 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 283 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (flag_state); +#line 2182 "SavedSearchDBTable.c" + } else { + SearchCondition* _tmp112_ = NULL; +#line 303 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp112_ = condition; +#line 303 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp112_, TYPE_SEARCH_CONDITION_MODIFIED)) { +#line 2189 "SavedSearchDBTable.c" + SearchConditionModified* modified_state = NULL; + SearchCondition* _tmp113_ = NULL; + SearchConditionModified* _tmp114_ = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp115_ = NULL; + sqlite3_stmt* _tmp116_ = NULL; + gint _tmp117_ = 0; + gint _tmp118_ = 0; + sqlite3_stmt* _tmp119_ = NULL; + SavedSearchID _tmp120_ = {0}; + gint64 _tmp121_ = 0LL; + gint _tmp122_ = 0; + gint _tmp123_ = 0; + sqlite3_stmt* _tmp124_ = NULL; + SearchConditionModified* _tmp125_ = NULL; + SearchConditionSearchType _tmp126_ = 0; + SearchConditionSearchType _tmp127_ = 0; + gchar* _tmp128_ = NULL; + GDestroyNotify _tmp129_ = NULL; + gint _tmp130_ = 0; + gint _tmp131_ = 0; + sqlite3_stmt* _tmp132_ = NULL; + SearchConditionModified* _tmp133_ = NULL; + SearchConditionModifiedContext _tmp134_ = 0; + SearchConditionModifiedContext _tmp135_ = 0; + gchar* _tmp136_ = NULL; + GDestroyNotify _tmp137_ = NULL; + gint _tmp138_ = 0; + gint _tmp139_ = 0; + sqlite3_stmt* _tmp140_ = NULL; + SearchConditionModified* _tmp141_ = NULL; + SearchConditionModifiedState _tmp142_ = 0; + SearchConditionModifiedState _tmp143_ = 0; + gchar* _tmp144_ = NULL; + GDestroyNotify _tmp145_ = NULL; + gint _tmp146_ = 0; + gint _tmp147_ = 0; + sqlite3_stmt* _tmp148_ = NULL; + gint _tmp149_ = 0; + gint _tmp150_ = 0; +#line 304 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp113_ = condition; +#line 304 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp114_ = _search_condition_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp113_, TYPE_SEARCH_CONDITION_MODIFIED) ? ((SearchConditionModified*) _tmp113_) : NULL); +#line 304 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + modified_state = _tmp114_; +#line 306 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp115_ = database_table_db; +#line 306 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp117_ = sqlite3_prepare_v2 (_tmp115_, "INSERT INTO SavedSearchDBTable_Modified (search_id, search_type, conte" \ +"xt, " "modified_state) VALUES (?, ?, ?, ?)", -1, &_tmp116_, NULL); +#line 306 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 306 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp116_; +#line 306 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp117_; +#line 309 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp118_ = res; +#line 309 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp118_ == SQLITE_OK, "res == Sqlite.OK"); +#line 311 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp119_ = stmt; +#line 311 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp120_ = *id; +#line 311 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp121_ = _tmp120_.id; +#line 311 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp122_ = sqlite3_bind_int64 (_tmp119_, 1, _tmp121_); +#line 311 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp122_; +#line 312 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp123_ = res; +#line 312 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp123_ == SQLITE_OK, "res == Sqlite.OK"); +#line 314 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp124_ = stmt; +#line 314 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp125_ = modified_state; +#line 314 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp126_ = search_condition_get_search_type (G_TYPE_CHECK_INSTANCE_CAST (_tmp125_, TYPE_SEARCH_CONDITION, SearchCondition)); +#line 314 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp127_ = _tmp126_; +#line 314 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp128_ = search_condition_search_type_to_string (_tmp127_); +#line 314 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp129_ = g_free; +#line 314 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp130_ = sqlite3_bind_text (_tmp124_, 2, _tmp128_, -1, _tmp129_); +#line 314 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp130_; +#line 315 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp131_ = res; +#line 315 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp131_ == SQLITE_OK, "res == Sqlite.OK"); +#line 317 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp132_ = stmt; +#line 317 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp133_ = modified_state; +#line 317 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp134_ = search_condition_modified_get_context (_tmp133_); +#line 317 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp135_ = _tmp134_; +#line 317 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp136_ = search_condition_modified_context_to_string (_tmp135_); +#line 317 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp137_ = g_free; +#line 317 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp138_ = sqlite3_bind_text (_tmp132_, 3, _tmp136_, -1, _tmp137_); +#line 317 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp138_; +#line 318 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp139_ = res; +#line 318 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp139_ == SQLITE_OK, "res == Sqlite.OK"); +#line 320 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp140_ = stmt; +#line 320 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp141_ = modified_state; +#line 320 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp142_ = search_condition_modified_get_state (_tmp141_); +#line 320 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp143_ = _tmp142_; +#line 320 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp144_ = search_condition_modified_state_to_string (_tmp143_); +#line 320 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp145_ = g_free; +#line 320 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp146_ = sqlite3_bind_text (_tmp140_, 4, _tmp144_, -1, _tmp145_); +#line 320 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp146_; +#line 321 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp147_ = res; +#line 321 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp147_ == SQLITE_OK, "res == Sqlite.OK"); +#line 323 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp148_ = stmt; +#line 323 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp149_ = sqlite3_step (_tmp148_); +#line 323 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp149_; +#line 324 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp150_ = res; +#line 324 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp150_ != SQLITE_DONE) { +#line 2335 "SavedSearchDBTable.c" + gint _tmp151_ = 0; +#line 325 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp151_ = res; +#line 325 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_throw_error ("SavedSearchDBTable_Modified.add", _tmp151_, &_inner_error_); +#line 325 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 325 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 325 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 325 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 325 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (modified_state); +#line 325 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2353 "SavedSearchDBTable.c" + } else { +#line 325 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 325 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (modified_state); +#line 325 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 325 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 325 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2365 "SavedSearchDBTable.c" + } + } + } +#line 303 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 303 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (modified_state); +#line 2373 "SavedSearchDBTable.c" + } else { + SearchCondition* _tmp152_ = NULL; +#line 326 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp152_ = condition; +#line 326 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp152_, TYPE_SEARCH_CONDITION_RATING)) { +#line 2380 "SavedSearchDBTable.c" + SearchConditionRating* rating = NULL; + SearchCondition* _tmp153_ = NULL; + SearchConditionRating* _tmp154_ = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp155_ = NULL; + sqlite3_stmt* _tmp156_ = NULL; + gint _tmp157_ = 0; + gint _tmp158_ = 0; + sqlite3_stmt* _tmp159_ = NULL; + SavedSearchID _tmp160_ = {0}; + gint64 _tmp161_ = 0LL; + gint _tmp162_ = 0; + gint _tmp163_ = 0; + sqlite3_stmt* _tmp164_ = NULL; + SearchConditionRating* _tmp165_ = NULL; + SearchConditionSearchType _tmp166_ = 0; + SearchConditionSearchType _tmp167_ = 0; + gchar* _tmp168_ = NULL; + GDestroyNotify _tmp169_ = NULL; + gint _tmp170_ = 0; + gint _tmp171_ = 0; + sqlite3_stmt* _tmp172_ = NULL; + SearchConditionRating* _tmp173_ = NULL; + Rating _tmp174_ = 0; + Rating _tmp175_ = 0; + gint _tmp176_ = 0; + gint _tmp177_ = 0; + gint _tmp178_ = 0; + sqlite3_stmt* _tmp179_ = NULL; + SearchConditionRating* _tmp180_ = NULL; + SearchConditionRatingContext _tmp181_ = 0; + SearchConditionRatingContext _tmp182_ = 0; + gchar* _tmp183_ = NULL; + GDestroyNotify _tmp184_ = NULL; + gint _tmp185_ = 0; + gint _tmp186_ = 0; + sqlite3_stmt* _tmp187_ = NULL; + gint _tmp188_ = 0; + gint _tmp189_ = 0; +#line 327 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp153_ = condition; +#line 327 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp154_ = _search_condition_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp153_, TYPE_SEARCH_CONDITION_RATING) ? ((SearchConditionRating*) _tmp153_) : NULL); +#line 327 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + rating = _tmp154_; +#line 329 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp155_ = database_table_db; +#line 329 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp157_ = sqlite3_prepare_v2 (_tmp155_, "INSERT INTO SavedSearchDBTable_Rating (search_id, search_type, rating," \ +" " "context) VALUES (?, ?, ?, ?)", -1, &_tmp156_, NULL); +#line 329 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 329 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp156_; +#line 329 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp157_; +#line 332 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp158_ = res; +#line 332 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp158_ == SQLITE_OK, "res == Sqlite.OK"); +#line 334 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp159_ = stmt; +#line 334 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp160_ = *id; +#line 334 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp161_ = _tmp160_.id; +#line 334 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp162_ = sqlite3_bind_int64 (_tmp159_, 1, _tmp161_); +#line 334 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp162_; +#line 335 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp163_ = res; +#line 335 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp163_ == SQLITE_OK, "res == Sqlite.OK"); +#line 337 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp164_ = stmt; +#line 337 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp165_ = rating; +#line 337 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp166_ = search_condition_get_search_type (G_TYPE_CHECK_INSTANCE_CAST (_tmp165_, TYPE_SEARCH_CONDITION, SearchCondition)); +#line 337 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp167_ = _tmp166_; +#line 337 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp168_ = search_condition_search_type_to_string (_tmp167_); +#line 337 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp169_ = g_free; +#line 337 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp170_ = sqlite3_bind_text (_tmp164_, 2, _tmp168_, -1, _tmp169_); +#line 337 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp170_; +#line 338 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp171_ = res; +#line 338 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp171_ == SQLITE_OK, "res == Sqlite.OK"); +#line 340 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp172_ = stmt; +#line 340 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp173_ = rating; +#line 340 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp174_ = search_condition_rating_get_rating (_tmp173_); +#line 340 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp175_ = _tmp174_; +#line 340 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp176_ = rating_serialize (_tmp175_); +#line 340 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp177_ = sqlite3_bind_int (_tmp172_, 3, _tmp176_); +#line 340 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp177_; +#line 341 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp178_ = res; +#line 341 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp178_ == SQLITE_OK, "res == Sqlite.OK"); +#line 343 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp179_ = stmt; +#line 343 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp180_ = rating; +#line 343 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp181_ = search_condition_rating_get_context (_tmp180_); +#line 343 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp182_ = _tmp181_; +#line 343 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp183_ = search_condition_rating_context_to_string (_tmp182_); +#line 343 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp184_ = g_free; +#line 343 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp185_ = sqlite3_bind_text (_tmp179_, 4, _tmp183_, -1, _tmp184_); +#line 343 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp185_; +#line 344 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp186_ = res; +#line 344 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp186_ == SQLITE_OK, "res == Sqlite.OK"); +#line 346 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp187_ = stmt; +#line 346 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp188_ = sqlite3_step (_tmp187_); +#line 346 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp188_; +#line 347 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp189_ = res; +#line 347 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp189_ != SQLITE_DONE) { +#line 2523 "SavedSearchDBTable.c" + gint _tmp190_ = 0; +#line 348 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp190_ = res; +#line 348 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_throw_error ("SavedSearchDBTable_Rating.add", _tmp190_, &_inner_error_); +#line 348 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 348 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 348 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 348 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 348 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (rating); +#line 348 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2541 "SavedSearchDBTable.c" + } else { +#line 348 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 348 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (rating); +#line 348 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 348 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 348 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2553 "SavedSearchDBTable.c" + } + } + } +#line 326 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 326 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (rating); +#line 2561 "SavedSearchDBTable.c" + } else { + SearchCondition* _tmp191_ = NULL; +#line 349 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp191_ = condition; +#line 349 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp191_, TYPE_SEARCH_CONDITION_DATE)) { +#line 2568 "SavedSearchDBTable.c" + SearchConditionDate* date = NULL; + SearchCondition* _tmp192_ = NULL; + SearchConditionDate* _tmp193_ = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp194_ = NULL; + sqlite3_stmt* _tmp195_ = NULL; + gint _tmp196_ = 0; + gint _tmp197_ = 0; + sqlite3_stmt* _tmp198_ = NULL; + SavedSearchID _tmp199_ = {0}; + gint64 _tmp200_ = 0LL; + gint _tmp201_ = 0; + gint _tmp202_ = 0; + sqlite3_stmt* _tmp203_ = NULL; + SearchConditionDate* _tmp204_ = NULL; + SearchConditionSearchType _tmp205_ = 0; + SearchConditionSearchType _tmp206_ = 0; + gchar* _tmp207_ = NULL; + GDestroyNotify _tmp208_ = NULL; + gint _tmp209_ = 0; + gint _tmp210_ = 0; + sqlite3_stmt* _tmp211_ = NULL; + SearchConditionDate* _tmp212_ = NULL; + SearchConditionDateContext _tmp213_ = 0; + SearchConditionDateContext _tmp214_ = 0; + gchar* _tmp215_ = NULL; + GDestroyNotify _tmp216_ = NULL; + gint _tmp217_ = 0; + gint _tmp218_ = 0; + sqlite3_stmt* _tmp219_ = NULL; + SearchConditionDate* _tmp220_ = NULL; + GDateTime* _tmp221_ = NULL; + GDateTime* _tmp222_ = NULL; + gint64 _tmp223_ = 0LL; + gint _tmp224_ = 0; + gint _tmp225_ = 0; + sqlite3_stmt* _tmp226_ = NULL; + SearchConditionDate* _tmp227_ = NULL; + GDateTime* _tmp228_ = NULL; + GDateTime* _tmp229_ = NULL; + gint64 _tmp230_ = 0LL; + gint _tmp231_ = 0; + gint _tmp232_ = 0; + sqlite3_stmt* _tmp233_ = NULL; + gint _tmp234_ = 0; + gint _tmp235_ = 0; +#line 350 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp192_ = condition; +#line 350 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp193_ = _search_condition_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp192_, TYPE_SEARCH_CONDITION_DATE) ? ((SearchConditionDate*) _tmp192_) : NULL); +#line 350 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + date = _tmp193_; +#line 352 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp194_ = database_table_db; +#line 352 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp196_ = sqlite3_prepare_v2 (_tmp194_, "INSERT INTO SavedSearchDBTable_Date (search_id, search_type, " "context, date_one, date_two) VALUES (?, ?, ?, ?, ?)", -1, &_tmp195_, NULL); +#line 352 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 352 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp195_; +#line 352 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp196_; +#line 355 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp197_ = res; +#line 355 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp197_ == SQLITE_OK, "res == Sqlite.OK"); +#line 357 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp198_ = stmt; +#line 357 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp199_ = *id; +#line 357 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp200_ = _tmp199_.id; +#line 357 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp201_ = sqlite3_bind_int64 (_tmp198_, 1, _tmp200_); +#line 357 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp201_; +#line 358 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp202_ = res; +#line 358 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp202_ == SQLITE_OK, "res == Sqlite.OK"); +#line 360 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp203_ = stmt; +#line 360 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp204_ = date; +#line 360 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp205_ = search_condition_get_search_type (G_TYPE_CHECK_INSTANCE_CAST (_tmp204_, TYPE_SEARCH_CONDITION, SearchCondition)); +#line 360 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp206_ = _tmp205_; +#line 360 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp207_ = search_condition_search_type_to_string (_tmp206_); +#line 360 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp208_ = g_free; +#line 360 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp209_ = sqlite3_bind_text (_tmp203_, 2, _tmp207_, -1, _tmp208_); +#line 360 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp209_; +#line 361 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp210_ = res; +#line 361 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp210_ == SQLITE_OK, "res == Sqlite.OK"); +#line 363 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp211_ = stmt; +#line 363 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp212_ = date; +#line 363 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp213_ = search_condition_date_get_context (_tmp212_); +#line 363 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp214_ = _tmp213_; +#line 363 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp215_ = search_condition_date_context_to_string (_tmp214_); +#line 363 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp216_ = g_free; +#line 363 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp217_ = sqlite3_bind_text (_tmp211_, 3, _tmp215_, -1, _tmp216_); +#line 363 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp217_; +#line 364 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp218_ = res; +#line 364 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp218_ == SQLITE_OK, "res == Sqlite.OK"); +#line 366 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp219_ = stmt; +#line 366 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp220_ = date; +#line 366 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp221_ = search_condition_date_get_date_one (_tmp220_); +#line 366 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp222_ = _tmp221_; +#line 366 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp223_ = g_date_time_to_unix (_tmp222_); +#line 366 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp224_ = sqlite3_bind_int64 (_tmp219_, 4, _tmp223_); +#line 366 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp224_; +#line 367 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp225_ = res; +#line 367 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp225_ == SQLITE_OK, "res == Sqlite.OK"); +#line 369 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp226_ = stmt; +#line 369 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp227_ = date; +#line 369 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp228_ = search_condition_date_get_date_two (_tmp227_); +#line 369 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp229_ = _tmp228_; +#line 369 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp230_ = g_date_time_to_unix (_tmp229_); +#line 369 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp231_ = sqlite3_bind_int64 (_tmp226_, 5, _tmp230_); +#line 369 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp231_; +#line 370 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp232_ = res; +#line 370 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp232_ == SQLITE_OK, "res == Sqlite.OK"); +#line 372 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp233_ = stmt; +#line 372 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp234_ = sqlite3_step (_tmp233_); +#line 372 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp234_; +#line 373 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp235_ = res; +#line 373 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp235_ != SQLITE_DONE) { +#line 2736 "SavedSearchDBTable.c" + gint _tmp236_ = 0; +#line 374 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp236_ = res; +#line 374 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_throw_error ("SavedSearchDBTable_Date.add", _tmp236_, &_inner_error_); +#line 374 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 374 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 374 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 374 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 374 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (date); +#line 374 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2754 "SavedSearchDBTable.c" + } else { +#line 374 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 374 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (date); +#line 374 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 374 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 374 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2766 "SavedSearchDBTable.c" + } + } + } +#line 349 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 349 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (date); +#line 2774 "SavedSearchDBTable.c" + } else { +#line 376 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_assert_not_reached (); +#line 2778 "SavedSearchDBTable.c" + } + } + } + } + } + } +} + + +static void saved_search_db_table_remove_conditions_for_search_id (SavedSearchDBTable* self, SavedSearchID* search_id, GError** error) { + SavedSearchID _tmp0_ = {0}; + SavedSearchID _tmp1_ = {0}; + SavedSearchID _tmp2_ = {0}; + SavedSearchID _tmp3_ = {0}; + SavedSearchID _tmp4_ = {0}; + SavedSearchID _tmp5_ = {0}; + GError * _inner_error_ = NULL; +#line 381 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (IS_SAVED_SEARCH_DB_TABLE (self)); +#line 381 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (search_id != NULL); +#line 382 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp0_ = *search_id; +#line 382 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + saved_search_db_table_remove_conditions_for_table (self, "SavedSearchDBTable_Text", &_tmp0_, &_inner_error_); +#line 382 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 382 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 382 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 382 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2812 "SavedSearchDBTable.c" + } else { +#line 382 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 382 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 382 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2820 "SavedSearchDBTable.c" + } + } +#line 383 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp1_ = *search_id; +#line 383 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + saved_search_db_table_remove_conditions_for_table (self, "SavedSearchDBTable_MediaType", &_tmp1_, &_inner_error_); +#line 383 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 383 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 383 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 383 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2835 "SavedSearchDBTable.c" + } else { +#line 383 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 383 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 383 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2843 "SavedSearchDBTable.c" + } + } +#line 384 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp2_ = *search_id; +#line 384 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + saved_search_db_table_remove_conditions_for_table (self, "SavedSearchDBTable_Flagged", &_tmp2_, &_inner_error_); +#line 384 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 384 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 384 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 384 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2858 "SavedSearchDBTable.c" + } else { +#line 384 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 384 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 384 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2866 "SavedSearchDBTable.c" + } + } +#line 385 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp3_ = *search_id; +#line 385 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + saved_search_db_table_remove_conditions_for_table (self, "SavedSearchDBTable_Modified", &_tmp3_, &_inner_error_); +#line 385 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 385 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 385 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 385 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2881 "SavedSearchDBTable.c" + } else { +#line 385 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 385 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 385 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2889 "SavedSearchDBTable.c" + } + } +#line 386 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp4_ = *search_id; +#line 386 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + saved_search_db_table_remove_conditions_for_table (self, "SavedSearchDBTable_Rating", &_tmp4_, &_inner_error_); +#line 386 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 386 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 386 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 386 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2904 "SavedSearchDBTable.c" + } else { +#line 386 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 386 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 386 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2912 "SavedSearchDBTable.c" + } + } +#line 387 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp5_ = *search_id; +#line 387 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + saved_search_db_table_remove_conditions_for_table (self, "SavedSearchDBTable_Date", &_tmp5_, &_inner_error_); +#line 387 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 387 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 387 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 387 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2927 "SavedSearchDBTable.c" + } else { +#line 387 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 387 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 387 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 2935 "SavedSearchDBTable.c" + } + } +} + + +static void saved_search_db_table_remove_conditions_for_table (SavedSearchDBTable* self, const gchar* table_name, SavedSearchID* search_id, GError** error) { + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + gchar* _tmp2_ = NULL; + gchar* _tmp3_ = NULL; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + gint _tmp7_ = 0; + sqlite3_stmt* _tmp8_ = NULL; + SavedSearchID _tmp9_ = {0}; + gint64 _tmp10_ = 0LL; + gint _tmp11_ = 0; + gint _tmp12_ = 0; + sqlite3_stmt* _tmp13_ = NULL; + gint _tmp14_ = 0; + gint _tmp15_ = 0; + GError * _inner_error_ = NULL; +#line 390 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (IS_SAVED_SEARCH_DB_TABLE (self)); +#line 390 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (table_name != NULL); +#line 390 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (search_id != NULL); +#line 393 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp0_ = database_table_db; +#line 393 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp1_ = table_name; +#line 393 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp2_ = g_strdup_printf ("DELETE FROM %s WHERE search_id=?", _tmp1_); +#line 393 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp3_ = _tmp2_; +#line 393 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp5_ = sqlite3_prepare_v2 (_tmp0_, _tmp3_, -1, &_tmp4_, NULL); +#line 393 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 393 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp4_; +#line 393 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp6_ = _tmp5_; +#line 393 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_free0 (_tmp3_); +#line 393 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp6_; +#line 394 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp7_ = res; +#line 394 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp7_ == SQLITE_OK, "res == Sqlite.OK"); +#line 396 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp8_ = stmt; +#line 396 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp9_ = *search_id; +#line 396 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp10_ = _tmp9_.id; +#line 396 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp11_ = sqlite3_bind_int64 (_tmp8_, 1, _tmp10_); +#line 396 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp11_; +#line 397 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp12_ = res; +#line 397 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp12_ == SQLITE_OK, "res == Sqlite.OK"); +#line 399 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp13_ = stmt; +#line 399 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp14_ = sqlite3_step (_tmp13_); +#line 399 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp14_; +#line 400 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp15_ = res; +#line 400 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp15_ != SQLITE_DONE) { +#line 3015 "SavedSearchDBTable.c" + const gchar* _tmp16_ = NULL; + gchar* _tmp17_ = NULL; + gchar* _tmp18_ = NULL; + gint _tmp19_ = 0; +#line 401 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp16_ = table_name; +#line 401 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp17_ = g_strdup_printf ("%s.remove", _tmp16_); +#line 401 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp18_ = _tmp17_; +#line 401 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp19_ = res; +#line 401 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_throw_error (_tmp18_, _tmp19_, &_inner_error_); +#line 401 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_free0 (_tmp18_); +#line 401 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 401 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 401 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 401 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 401 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 3042 "SavedSearchDBTable.c" + } else { +#line 401 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 401 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 401 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 401 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 3052 "SavedSearchDBTable.c" + } + } + } +#line 390 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 3058 "SavedSearchDBTable.c" +} + + +static GeeList* saved_search_db_table_get_conditions_for_id (SavedSearchDBTable* self, SavedSearchID* search_id, GError** error) { + GeeList* result = NULL; + GeeList* list = NULL; + GeeArrayList* _tmp0_ = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp1_ = NULL; + sqlite3_stmt* _tmp2_ = NULL; + gint _tmp3_ = 0; + gint _tmp4_ = 0; + sqlite3_stmt* _tmp5_ = NULL; + SavedSearchID _tmp6_ = {0}; + gint64 _tmp7_ = 0LL; + gint _tmp8_ = 0; + gint _tmp9_ = 0; + sqlite3* _tmp27_ = NULL; + sqlite3_stmt* _tmp28_ = NULL; + gint _tmp29_ = 0; + gint _tmp30_ = 0; + sqlite3_stmt* _tmp31_ = NULL; + SavedSearchID _tmp32_ = {0}; + gint64 _tmp33_ = 0LL; + gint _tmp34_ = 0; + gint _tmp35_ = 0; + sqlite3* _tmp54_ = NULL; + sqlite3_stmt* _tmp55_ = NULL; + gint _tmp56_ = 0; + gint _tmp57_ = 0; + sqlite3_stmt* _tmp58_ = NULL; + SavedSearchID _tmp59_ = {0}; + gint64 _tmp60_ = 0LL; + gint _tmp61_ = 0; + gint _tmp62_ = 0; + sqlite3* _tmp78_ = NULL; + sqlite3_stmt* _tmp79_ = NULL; + gint _tmp80_ = 0; + gint _tmp81_ = 0; + sqlite3_stmt* _tmp82_ = NULL; + SavedSearchID _tmp83_ = {0}; + gint64 _tmp84_ = 0LL; + gint _tmp85_ = 0; + gint _tmp86_ = 0; + sqlite3* _tmp105_ = NULL; + sqlite3_stmt* _tmp106_ = NULL; + gint _tmp107_ = 0; + gint _tmp108_ = 0; + sqlite3_stmt* _tmp109_ = NULL; + SavedSearchID _tmp110_ = {0}; + gint64 _tmp111_ = 0LL; + gint _tmp112_ = 0; + gint _tmp113_ = 0; + sqlite3* _tmp132_ = NULL; + sqlite3_stmt* _tmp133_ = NULL; + gint _tmp134_ = 0; + gint _tmp135_ = 0; + sqlite3_stmt* _tmp136_ = NULL; + SavedSearchID _tmp137_ = {0}; + gint64 _tmp138_ = 0LL; + gint _tmp139_ = 0; + gint _tmp140_ = 0; + GError * _inner_error_ = NULL; +#line 405 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_val_if_fail (IS_SAVED_SEARCH_DB_TABLE (self), NULL); +#line 405 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_val_if_fail (search_id != NULL, NULL); +#line 407 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp0_ = gee_array_list_new (TYPE_SEARCH_CONDITION, (GBoxedCopyFunc) search_condition_ref, search_condition_unref, NULL, NULL, NULL); +#line 407 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + list = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST, GeeList); +#line 412 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp1_ = database_table_db; +#line 412 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp3_ = sqlite3_prepare_v2 (_tmp1_, "SELECT search_type, context, text FROM SavedSearchDBTable_Text " "WHERE search_id=?", -1, &_tmp2_, NULL); +#line 412 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 412 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp2_; +#line 412 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp3_; +#line 415 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp4_ = res; +#line 415 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp4_ == SQLITE_OK, "res == Sqlite.OK"); +#line 417 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp5_ = stmt; +#line 417 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp6_ = *search_id; +#line 417 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp7_ = _tmp6_.id; +#line 417 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp8_ = sqlite3_bind_int64 (_tmp5_, 1, _tmp7_); +#line 417 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp8_; +#line 418 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp9_ = res; +#line 418 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp9_ == SQLITE_OK, "res == Sqlite.OK"); +#line 3159 "SavedSearchDBTable.c" + { + gboolean _tmp10_ = FALSE; +#line 420 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp10_ = TRUE; +#line 420 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + while (TRUE) { +#line 3166 "SavedSearchDBTable.c" + sqlite3_stmt* _tmp11_ = NULL; + gint _tmp12_ = 0; + gint _tmp13_ = 0; + SearchConditionText* condition = NULL; + sqlite3_stmt* _tmp16_ = NULL; + const gchar* _tmp17_ = NULL; + SearchConditionSearchType _tmp18_ = 0; + sqlite3_stmt* _tmp19_ = NULL; + const gchar* _tmp20_ = NULL; + sqlite3_stmt* _tmp21_ = NULL; + const gchar* _tmp22_ = NULL; + SearchConditionTextContext _tmp23_ = 0; + SearchConditionText* _tmp24_ = NULL; + GeeList* _tmp25_ = NULL; + SearchConditionText* _tmp26_ = NULL; +#line 420 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (!_tmp10_) { +#line 3184 "SavedSearchDBTable.c" + } +#line 420 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp10_ = FALSE; +#line 421 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp11_ = stmt; +#line 421 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp12_ = sqlite3_step (_tmp11_); +#line 421 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp12_; +#line 422 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp13_ = res; +#line 422 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp13_ == SQLITE_DONE) { +#line 423 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + break; +#line 3200 "SavedSearchDBTable.c" + } else { + gint _tmp14_ = 0; +#line 424 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp14_ = res; +#line 424 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp14_ != SQLITE_ROW) { +#line 3207 "SavedSearchDBTable.c" + gint _tmp15_ = 0; +#line 425 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp15_ = res; +#line 425 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_throw_error ("SavedSearchDBTable_Text.get_all_rows", _tmp15_, &_inner_error_); +#line 425 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 425 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 425 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 425 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 425 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (list); +#line 425 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 3225 "SavedSearchDBTable.c" + } else { +#line 425 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 425 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (list); +#line 425 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 425 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 425 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 3237 "SavedSearchDBTable.c" + } + } + } + } +#line 427 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp16_ = stmt; +#line 427 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp17_ = sqlite3_column_text (_tmp16_, 0); +#line 427 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp18_ = search_condition_search_type_from_string (_tmp17_); +#line 427 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp19_ = stmt; +#line 427 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp20_ = sqlite3_column_text (_tmp19_, 2); +#line 427 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp21_ = stmt; +#line 427 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp22_ = sqlite3_column_text (_tmp21_, 1); +#line 427 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp23_ = search_condition_text_context_from_string (_tmp22_); +#line 427 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp24_ = search_condition_text_new (_tmp18_, _tmp20_, _tmp23_); +#line 427 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + condition = _tmp24_; +#line 432 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp25_ = list; +#line 432 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp26_ = condition; +#line 432 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp25_, GEE_TYPE_COLLECTION, GeeCollection), G_TYPE_CHECK_INSTANCE_CAST (_tmp26_, TYPE_SEARCH_CONDITION, SearchCondition)); +#line 420 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (condition); +#line 3270 "SavedSearchDBTable.c" + } + } +#line 436 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp27_ = database_table_db; +#line 436 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp29_ = sqlite3_prepare_v2 (_tmp27_, "SELECT search_type, context, type FROM SavedSearchDBTable_MediaType " "WHERE search_id=?", -1, &_tmp28_, NULL); +#line 436 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 436 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp28_; +#line 436 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp29_; +#line 439 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp30_ = res; +#line 439 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp30_ == SQLITE_OK, "res == Sqlite.OK"); +#line 441 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp31_ = stmt; +#line 441 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp32_ = *search_id; +#line 441 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp33_ = _tmp32_.id; +#line 441 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp34_ = sqlite3_bind_int64 (_tmp31_, 1, _tmp33_); +#line 441 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp34_; +#line 442 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp35_ = res; +#line 442 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp35_ == SQLITE_OK, "res == Sqlite.OK"); +#line 3301 "SavedSearchDBTable.c" + { + gboolean _tmp36_ = FALSE; +#line 444 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp36_ = TRUE; +#line 444 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + while (TRUE) { +#line 3308 "SavedSearchDBTable.c" + sqlite3_stmt* _tmp37_ = NULL; + gint _tmp38_ = 0; + gint _tmp39_ = 0; + SearchConditionMediaType* condition = NULL; + sqlite3_stmt* _tmp42_ = NULL; + const gchar* _tmp43_ = NULL; + SearchConditionSearchType _tmp44_ = 0; + sqlite3_stmt* _tmp45_ = NULL; + const gchar* _tmp46_ = NULL; + SearchConditionMediaTypeContext _tmp47_ = 0; + sqlite3_stmt* _tmp48_ = NULL; + const gchar* _tmp49_ = NULL; + SearchConditionMediaTypeMediaType _tmp50_ = 0; + SearchConditionMediaType* _tmp51_ = NULL; + GeeList* _tmp52_ = NULL; + SearchConditionMediaType* _tmp53_ = NULL; +#line 444 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (!_tmp36_) { +#line 3327 "SavedSearchDBTable.c" + } +#line 444 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp36_ = FALSE; +#line 445 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp37_ = stmt; +#line 445 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp38_ = sqlite3_step (_tmp37_); +#line 445 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp38_; +#line 446 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp39_ = res; +#line 446 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp39_ == SQLITE_DONE) { +#line 447 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + break; +#line 3343 "SavedSearchDBTable.c" + } else { + gint _tmp40_ = 0; +#line 448 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp40_ = res; +#line 448 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp40_ != SQLITE_ROW) { +#line 3350 "SavedSearchDBTable.c" + gint _tmp41_ = 0; +#line 449 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp41_ = res; +#line 449 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_throw_error ("SavedSearchDBTable_MediaType.get_all_rows", _tmp41_, &_inner_error_); +#line 449 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 449 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 449 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 449 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 449 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (list); +#line 449 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 3368 "SavedSearchDBTable.c" + } else { +#line 449 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 449 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (list); +#line 449 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 449 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 449 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 3380 "SavedSearchDBTable.c" + } + } + } + } +#line 451 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp42_ = stmt; +#line 451 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp43_ = sqlite3_column_text (_tmp42_, 0); +#line 451 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp44_ = search_condition_search_type_from_string (_tmp43_); +#line 451 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp45_ = stmt; +#line 451 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp46_ = sqlite3_column_text (_tmp45_, 1); +#line 451 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp47_ = search_condition_media_type_context_from_string (_tmp46_); +#line 451 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp48_ = stmt; +#line 451 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp49_ = sqlite3_column_text (_tmp48_, 2); +#line 451 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp50_ = search_condition_media_type_media_type_from_string (_tmp49_); +#line 451 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp51_ = search_condition_media_type_new (_tmp44_, _tmp47_, _tmp50_); +#line 451 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + condition = _tmp51_; +#line 456 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp52_ = list; +#line 456 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp53_ = condition; +#line 456 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp52_, GEE_TYPE_COLLECTION, GeeCollection), G_TYPE_CHECK_INSTANCE_CAST (_tmp53_, TYPE_SEARCH_CONDITION, SearchCondition)); +#line 444 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (condition); +#line 3415 "SavedSearchDBTable.c" + } + } +#line 460 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp54_ = database_table_db; +#line 460 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp56_ = sqlite3_prepare_v2 (_tmp54_, "SELECT search_type, flag_state FROM SavedSearchDBTable_Flagged " "WHERE search_id=?", -1, &_tmp55_, NULL); +#line 460 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 460 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp55_; +#line 460 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp56_; +#line 463 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp57_ = res; +#line 463 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp57_ == SQLITE_OK, "res == Sqlite.OK"); +#line 465 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp58_ = stmt; +#line 465 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp59_ = *search_id; +#line 465 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp60_ = _tmp59_.id; +#line 465 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp61_ = sqlite3_bind_int64 (_tmp58_, 1, _tmp60_); +#line 465 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp61_; +#line 466 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp62_ = res; +#line 466 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp62_ == SQLITE_OK, "res == Sqlite.OK"); +#line 3446 "SavedSearchDBTable.c" + { + gboolean _tmp63_ = FALSE; +#line 468 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp63_ = TRUE; +#line 468 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + while (TRUE) { +#line 3453 "SavedSearchDBTable.c" + sqlite3_stmt* _tmp64_ = NULL; + gint _tmp65_ = 0; + gint _tmp66_ = 0; + SearchConditionFlagged* condition = NULL; + sqlite3_stmt* _tmp69_ = NULL; + const gchar* _tmp70_ = NULL; + SearchConditionSearchType _tmp71_ = 0; + sqlite3_stmt* _tmp72_ = NULL; + const gchar* _tmp73_ = NULL; + SearchConditionFlaggedState _tmp74_ = 0; + SearchConditionFlagged* _tmp75_ = NULL; + GeeList* _tmp76_ = NULL; + SearchConditionFlagged* _tmp77_ = NULL; +#line 468 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (!_tmp63_) { +#line 3469 "SavedSearchDBTable.c" + } +#line 468 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp63_ = FALSE; +#line 469 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp64_ = stmt; +#line 469 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp65_ = sqlite3_step (_tmp64_); +#line 469 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp65_; +#line 470 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp66_ = res; +#line 470 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp66_ == SQLITE_DONE) { +#line 471 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + break; +#line 3485 "SavedSearchDBTable.c" + } else { + gint _tmp67_ = 0; +#line 472 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp67_ = res; +#line 472 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp67_ != SQLITE_ROW) { +#line 3492 "SavedSearchDBTable.c" + gint _tmp68_ = 0; +#line 473 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp68_ = res; +#line 473 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_throw_error ("SavedSearchDBTable_Flagged.get_all_rows", _tmp68_, &_inner_error_); +#line 473 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 473 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 473 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 473 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 473 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (list); +#line 473 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 3510 "SavedSearchDBTable.c" + } else { +#line 473 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 473 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (list); +#line 473 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 473 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 473 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 3522 "SavedSearchDBTable.c" + } + } + } + } +#line 475 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp69_ = stmt; +#line 475 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp70_ = sqlite3_column_text (_tmp69_, 0); +#line 475 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp71_ = search_condition_search_type_from_string (_tmp70_); +#line 475 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp72_ = stmt; +#line 475 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp73_ = sqlite3_column_text (_tmp72_, 1); +#line 475 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp74_ = search_condition_flagged_state_from_string (_tmp73_); +#line 475 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp75_ = search_condition_flagged_new (_tmp71_, _tmp74_); +#line 475 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + condition = _tmp75_; +#line 479 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp76_ = list; +#line 479 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp77_ = condition; +#line 479 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp76_, GEE_TYPE_COLLECTION, GeeCollection), G_TYPE_CHECK_INSTANCE_CAST (_tmp77_, TYPE_SEARCH_CONDITION, SearchCondition)); +#line 468 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (condition); +#line 3551 "SavedSearchDBTable.c" + } + } +#line 483 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp78_ = database_table_db; +#line 483 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp80_ = sqlite3_prepare_v2 (_tmp78_, "SELECT search_type, context, modified_state FROM SavedSearchDBTable_Mo" \ +"dified " "WHERE search_id=?", -1, &_tmp79_, NULL); +#line 483 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 483 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp79_; +#line 483 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp80_; +#line 486 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp81_ = res; +#line 486 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp81_ == SQLITE_OK, "res == Sqlite.OK"); +#line 488 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp82_ = stmt; +#line 488 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp83_ = *search_id; +#line 488 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp84_ = _tmp83_.id; +#line 488 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp85_ = sqlite3_bind_int64 (_tmp82_, 1, _tmp84_); +#line 488 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp85_; +#line 489 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp86_ = res; +#line 489 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp86_ == SQLITE_OK, "res == Sqlite.OK"); +#line 3582 "SavedSearchDBTable.c" + { + gboolean _tmp87_ = FALSE; +#line 491 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp87_ = TRUE; +#line 491 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + while (TRUE) { +#line 3589 "SavedSearchDBTable.c" + sqlite3_stmt* _tmp88_ = NULL; + gint _tmp89_ = 0; + gint _tmp90_ = 0; + SearchConditionModified* condition = NULL; + sqlite3_stmt* _tmp93_ = NULL; + const gchar* _tmp94_ = NULL; + SearchConditionSearchType _tmp95_ = 0; + sqlite3_stmt* _tmp96_ = NULL; + const gchar* _tmp97_ = NULL; + SearchConditionModifiedContext _tmp98_ = 0; + sqlite3_stmt* _tmp99_ = NULL; + const gchar* _tmp100_ = NULL; + SearchConditionModifiedState _tmp101_ = 0; + SearchConditionModified* _tmp102_ = NULL; + GeeList* _tmp103_ = NULL; + SearchConditionModified* _tmp104_ = NULL; +#line 491 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (!_tmp87_) { +#line 3608 "SavedSearchDBTable.c" + } +#line 491 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp87_ = FALSE; +#line 492 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp88_ = stmt; +#line 492 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp89_ = sqlite3_step (_tmp88_); +#line 492 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp89_; +#line 493 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp90_ = res; +#line 493 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp90_ == SQLITE_DONE) { +#line 494 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + break; +#line 3624 "SavedSearchDBTable.c" + } else { + gint _tmp91_ = 0; +#line 495 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp91_ = res; +#line 495 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp91_ != SQLITE_ROW) { +#line 3631 "SavedSearchDBTable.c" + gint _tmp92_ = 0; +#line 496 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp92_ = res; +#line 496 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_throw_error ("SavedSearchDBTable_Modified.get_all_rows", _tmp92_, &_inner_error_); +#line 496 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 496 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 496 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 496 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 496 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (list); +#line 496 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 3649 "SavedSearchDBTable.c" + } else { +#line 496 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 496 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (list); +#line 496 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 496 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 496 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 3661 "SavedSearchDBTable.c" + } + } + } + } +#line 498 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp93_ = stmt; +#line 498 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp94_ = sqlite3_column_text (_tmp93_, 0); +#line 498 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp95_ = search_condition_search_type_from_string (_tmp94_); +#line 498 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp96_ = stmt; +#line 498 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp97_ = sqlite3_column_text (_tmp96_, 1); +#line 498 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp98_ = search_condition_modified_context_from_string (_tmp97_); +#line 498 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp99_ = stmt; +#line 498 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp100_ = sqlite3_column_text (_tmp99_, 2); +#line 498 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp101_ = search_condition_modified_state_from_string (_tmp100_); +#line 498 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp102_ = search_condition_modified_new (_tmp95_, _tmp98_, _tmp101_); +#line 498 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + condition = _tmp102_; +#line 503 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp103_ = list; +#line 503 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp104_ = condition; +#line 503 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp103_, GEE_TYPE_COLLECTION, GeeCollection), G_TYPE_CHECK_INSTANCE_CAST (_tmp104_, TYPE_SEARCH_CONDITION, SearchCondition)); +#line 491 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (condition); +#line 3696 "SavedSearchDBTable.c" + } + } +#line 507 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp105_ = database_table_db; +#line 507 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp107_ = sqlite3_prepare_v2 (_tmp105_, "SELECT search_type, rating, context FROM SavedSearchDBTable_Rating " "WHERE search_id=?", -1, &_tmp106_, NULL); +#line 507 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 507 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp106_; +#line 507 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp107_; +#line 510 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp108_ = res; +#line 510 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp108_ == SQLITE_OK, "res == Sqlite.OK"); +#line 512 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp109_ = stmt; +#line 512 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp110_ = *search_id; +#line 512 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp111_ = _tmp110_.id; +#line 512 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp112_ = sqlite3_bind_int64 (_tmp109_, 1, _tmp111_); +#line 512 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp112_; +#line 513 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp113_ = res; +#line 513 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp113_ == SQLITE_OK, "res == Sqlite.OK"); +#line 3727 "SavedSearchDBTable.c" + { + gboolean _tmp114_ = FALSE; +#line 515 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp114_ = TRUE; +#line 515 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + while (TRUE) { +#line 3734 "SavedSearchDBTable.c" + sqlite3_stmt* _tmp115_ = NULL; + gint _tmp116_ = 0; + gint _tmp117_ = 0; + SearchConditionRating* condition = NULL; + sqlite3_stmt* _tmp120_ = NULL; + const gchar* _tmp121_ = NULL; + SearchConditionSearchType _tmp122_ = 0; + sqlite3_stmt* _tmp123_ = NULL; + gint _tmp124_ = 0; + Rating _tmp125_ = 0; + sqlite3_stmt* _tmp126_ = NULL; + const gchar* _tmp127_ = NULL; + SearchConditionRatingContext _tmp128_ = 0; + SearchConditionRating* _tmp129_ = NULL; + GeeList* _tmp130_ = NULL; + SearchConditionRating* _tmp131_ = NULL; +#line 515 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (!_tmp114_) { +#line 3753 "SavedSearchDBTable.c" + } +#line 515 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp114_ = FALSE; +#line 516 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp115_ = stmt; +#line 516 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp116_ = sqlite3_step (_tmp115_); +#line 516 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp116_; +#line 517 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp117_ = res; +#line 517 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp117_ == SQLITE_DONE) { +#line 518 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + break; +#line 3769 "SavedSearchDBTable.c" + } else { + gint _tmp118_ = 0; +#line 519 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp118_ = res; +#line 519 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp118_ != SQLITE_ROW) { +#line 3776 "SavedSearchDBTable.c" + gint _tmp119_ = 0; +#line 520 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp119_ = res; +#line 520 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_throw_error ("SavedSearchDBTable_Rating.get_all_rows", _tmp119_, &_inner_error_); +#line 520 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 520 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 520 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 520 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 520 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (list); +#line 520 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 3794 "SavedSearchDBTable.c" + } else { +#line 520 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 520 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (list); +#line 520 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 520 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 520 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 3806 "SavedSearchDBTable.c" + } + } + } + } +#line 522 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp120_ = stmt; +#line 522 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp121_ = sqlite3_column_text (_tmp120_, 0); +#line 522 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp122_ = search_condition_search_type_from_string (_tmp121_); +#line 522 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp123_ = stmt; +#line 522 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp124_ = sqlite3_column_int (_tmp123_, 1); +#line 522 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp125_ = rating_unserialize (_tmp124_); +#line 522 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp126_ = stmt; +#line 522 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp127_ = sqlite3_column_text (_tmp126_, 2); +#line 522 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp128_ = search_condition_rating_context_from_string (_tmp127_); +#line 522 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp129_ = search_condition_rating_new (_tmp122_, _tmp125_, _tmp128_); +#line 522 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + condition = _tmp129_; +#line 527 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp130_ = list; +#line 527 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp131_ = condition; +#line 527 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp130_, GEE_TYPE_COLLECTION, GeeCollection), G_TYPE_CHECK_INSTANCE_CAST (_tmp131_, TYPE_SEARCH_CONDITION, SearchCondition)); +#line 515 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (condition); +#line 3841 "SavedSearchDBTable.c" + } + } +#line 531 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp132_ = database_table_db; +#line 531 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp134_ = sqlite3_prepare_v2 (_tmp132_, "SELECT search_type, context, date_one, date_two FROM SavedSearchDBTabl" \ +"e_Date " "WHERE search_id=?", -1, &_tmp133_, NULL); +#line 531 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 531 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp133_; +#line 531 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp134_; +#line 534 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp135_ = res; +#line 534 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp135_ == SQLITE_OK, "res == Sqlite.OK"); +#line 536 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp136_ = stmt; +#line 536 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp137_ = *search_id; +#line 536 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp138_ = _tmp137_.id; +#line 536 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp139_ = sqlite3_bind_int64 (_tmp136_, 1, _tmp138_); +#line 536 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp139_; +#line 537 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp140_ = res; +#line 537 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp140_ == SQLITE_OK, "res == Sqlite.OK"); +#line 3872 "SavedSearchDBTable.c" + { + gboolean _tmp141_ = FALSE; +#line 539 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp141_ = TRUE; +#line 539 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + while (TRUE) { +#line 3879 "SavedSearchDBTable.c" + sqlite3_stmt* _tmp142_ = NULL; + gint _tmp143_ = 0; + gint _tmp144_ = 0; + SearchConditionDate* condition = NULL; + sqlite3_stmt* _tmp147_ = NULL; + const gchar* _tmp148_ = NULL; + SearchConditionSearchType _tmp149_ = 0; + sqlite3_stmt* _tmp150_ = NULL; + const gchar* _tmp151_ = NULL; + SearchConditionDateContext _tmp152_ = 0; + sqlite3_stmt* _tmp153_ = NULL; + gint64 _tmp154_ = 0LL; + GDateTime* _tmp155_ = NULL; + GDateTime* _tmp156_ = NULL; + sqlite3_stmt* _tmp157_ = NULL; + gint64 _tmp158_ = 0LL; + GDateTime* _tmp159_ = NULL; + GDateTime* _tmp160_ = NULL; + SearchConditionDate* _tmp161_ = NULL; + SearchConditionDate* _tmp162_ = NULL; + GeeList* _tmp163_ = NULL; + SearchConditionDate* _tmp164_ = NULL; +#line 539 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (!_tmp141_) { +#line 3904 "SavedSearchDBTable.c" + } +#line 539 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp141_ = FALSE; +#line 540 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp142_ = stmt; +#line 540 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp143_ = sqlite3_step (_tmp142_); +#line 540 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp143_; +#line 541 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp144_ = res; +#line 541 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp144_ == SQLITE_DONE) { +#line 542 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + break; +#line 3920 "SavedSearchDBTable.c" + } else { + gint _tmp145_ = 0; +#line 543 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp145_ = res; +#line 543 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp145_ != SQLITE_ROW) { +#line 3927 "SavedSearchDBTable.c" + gint _tmp146_ = 0; +#line 544 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp146_ = res; +#line 544 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_throw_error ("SavedSearchDBTable_Date.get_all_rows", _tmp146_, &_inner_error_); +#line 544 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 544 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 544 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 544 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 544 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (list); +#line 544 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 3945 "SavedSearchDBTable.c" + } else { +#line 544 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 544 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (list); +#line 544 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 544 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 544 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 3957 "SavedSearchDBTable.c" + } + } + } + } +#line 546 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp147_ = stmt; +#line 546 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp148_ = sqlite3_column_text (_tmp147_, 0); +#line 546 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp149_ = search_condition_search_type_from_string (_tmp148_); +#line 546 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp150_ = stmt; +#line 546 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp151_ = sqlite3_column_text (_tmp150_, 1); +#line 546 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp152_ = search_condition_date_context_from_string (_tmp151_); +#line 546 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp153_ = stmt; +#line 546 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp154_ = sqlite3_column_int64 (_tmp153_, 2); +#line 546 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp155_ = g_date_time_new_from_unix_local (_tmp154_); +#line 546 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp156_ = _tmp155_; +#line 546 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp157_ = stmt; +#line 546 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp158_ = sqlite3_column_int64 (_tmp157_, 3); +#line 546 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp159_ = g_date_time_new_from_unix_local (_tmp158_); +#line 546 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp160_ = _tmp159_; +#line 546 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp161_ = search_condition_date_new (_tmp149_, _tmp152_, _tmp156_, _tmp160_); +#line 546 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp162_ = _tmp161_; +#line 546 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_date_time_unref0 (_tmp160_); +#line 546 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_date_time_unref0 (_tmp156_); +#line 546 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + condition = _tmp162_; +#line 551 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp163_ = list; +#line 551 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp164_ = condition; +#line 551 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp163_, GEE_TYPE_COLLECTION, GeeCollection), G_TYPE_CHECK_INSTANCE_CAST (_tmp164_, TYPE_SEARCH_CONDITION, SearchCondition)); +#line 539 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (condition); +#line 4008 "SavedSearchDBTable.c" + } + } +#line 554 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + result = list; +#line 554 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 554 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return result; +#line 4017 "SavedSearchDBTable.c" +} + + +void saved_search_db_table_create_from_row (SavedSearchDBTable* self, SavedSearchRow* row, SavedSearchID* result, GError** error) { + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + SavedSearchRow* _tmp5_ = NULL; + const gchar* _tmp6_ = NULL; + gchar* _tmp7_ = NULL; + GDestroyNotify _tmp8_ = NULL; + gint _tmp9_ = 0; + gint _tmp10_ = 0; + sqlite3_stmt* _tmp11_ = NULL; + SavedSearchRow* _tmp12_ = NULL; + SearchOperator _tmp13_ = 0; + gchar* _tmp14_ = NULL; + GDestroyNotify _tmp15_ = NULL; + gint _tmp16_ = 0; + gint _tmp17_ = 0; + sqlite3_stmt* _tmp18_ = NULL; + gint _tmp19_ = 0; + gint _tmp20_ = 0; + SavedSearchID search_id = {0}; + sqlite3* _tmp22_ = NULL; + gint64 _tmp23_ = 0LL; + GError * _inner_error_ = NULL; +#line 558 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (IS_SAVED_SEARCH_DB_TABLE (self)); +#line 558 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (IS_SAVED_SEARCH_ROW (row)); +#line 560 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp0_ = database_table_db; +#line 560 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "INSERT INTO SavedSearchDBTable (name, operator) VALUES (?, ?)", -1, &_tmp1_, NULL); +#line 560 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 560 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp1_; +#line 560 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp2_; +#line 562 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp3_ = res; +#line 562 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 564 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp4_ = stmt; +#line 564 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp5_ = row; +#line 564 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp6_ = _tmp5_->name; +#line 564 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp7_ = g_strdup (_tmp6_); +#line 564 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp8_ = g_free; +#line 564 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp9_ = sqlite3_bind_text (_tmp4_, 1, _tmp7_, -1, _tmp8_); +#line 564 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp9_; +#line 565 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp10_ = res; +#line 565 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp10_ == SQLITE_OK, "res == Sqlite.OK"); +#line 566 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp11_ = stmt; +#line 566 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp12_ = row; +#line 566 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp13_ = _tmp12_->operator; +#line 566 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp14_ = search_operator_to_string (_tmp13_); +#line 566 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp15_ = g_free; +#line 566 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp16_ = sqlite3_bind_text (_tmp11_, 2, _tmp14_, -1, _tmp15_); +#line 566 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp16_; +#line 567 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp17_ = res; +#line 567 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp17_ == SQLITE_OK, "res == Sqlite.OK"); +#line 569 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp18_ = stmt; +#line 569 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp19_ = sqlite3_step (_tmp18_); +#line 569 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp19_; +#line 570 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp20_ = res; +#line 570 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp20_ != SQLITE_DONE) { +#line 4113 "SavedSearchDBTable.c" + gint _tmp21_ = 0; +#line 571 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp21_ = res; +#line 571 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_throw_error ("SavedSearchDBTable.create_from_row", _tmp21_, &_inner_error_); +#line 571 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 571 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 571 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 571 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 571 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 4129 "SavedSearchDBTable.c" + } else { +#line 571 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 571 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 571 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 571 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 4139 "SavedSearchDBTable.c" + } + } + } +#line 573 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp22_ = database_table_db; +#line 573 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp23_ = sqlite3_last_insert_rowid (_tmp22_); +#line 573 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + saved_search_id_init (&search_id, _tmp23_); +#line 4149 "SavedSearchDBTable.c" + { + GeeList* _sc_list = NULL; + SavedSearchRow* _tmp24_ = NULL; + GeeList* _tmp25_ = NULL; + GeeList* _tmp26_ = NULL; + gint _sc_size = 0; + GeeList* _tmp27_ = NULL; + gint _tmp28_ = 0; + gint _tmp29_ = 0; + gint _sc_index = 0; +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp24_ = row; +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp25_ = _tmp24_->conditions; +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp26_ = _g_object_ref0 (_tmp25_); +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sc_list = _tmp26_; +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp27_ = _sc_list; +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp28_ = gee_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_tmp27_, GEE_TYPE_COLLECTION, GeeCollection)); +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp29_ = _tmp28_; +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sc_size = _tmp29_; +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sc_index = -1; +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + while (TRUE) { +#line 4180 "SavedSearchDBTable.c" + gint _tmp30_ = 0; + gint _tmp31_ = 0; + gint _tmp32_ = 0; + SearchCondition* sc = NULL; + GeeList* _tmp33_ = NULL; + gint _tmp34_ = 0; + gpointer _tmp35_ = NULL; + SavedSearchID _tmp36_ = {0}; + SearchCondition* _tmp37_ = NULL; +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp30_ = _sc_index; +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sc_index = _tmp30_ + 1; +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp31_ = _sc_index; +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp32_ = _sc_size; +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (!(_tmp31_ < _tmp32_)) { +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + break; +#line 4202 "SavedSearchDBTable.c" + } +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp33_ = _sc_list; +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp34_ = _sc_index; +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp35_ = gee_list_get (_tmp33_, _tmp34_); +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + sc = (SearchCondition*) _tmp35_; +#line 576 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp36_ = search_id; +#line 576 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp37_ = sc; +#line 576 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + saved_search_db_table_add_condition (self, &_tmp36_, _tmp37_, &_inner_error_); +#line 576 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 576 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 576 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 576 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (sc); +#line 576 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (_sc_list); +#line 576 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 576 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 4232 "SavedSearchDBTable.c" + } else { +#line 576 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (sc); +#line 576 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (_sc_list); +#line 576 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 576 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 576 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 576 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 4246 "SavedSearchDBTable.c" + } + } +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _search_condition_unref0 (sc); +#line 4251 "SavedSearchDBTable.c" + } +#line 575 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (_sc_list); +#line 4255 "SavedSearchDBTable.c" + } +#line 579 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + *result = search_id; +#line 579 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 579 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 4263 "SavedSearchDBTable.c" +} + + +void saved_search_db_table_remove (SavedSearchDBTable* self, SavedSearchID* search_id, GError** error) { + SavedSearchID _tmp0_ = {0}; + SavedSearchID _tmp1_ = {0}; + gint64 _tmp2_ = 0LL; + GError * _inner_error_ = NULL; +#line 582 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (IS_SAVED_SEARCH_DB_TABLE (self)); +#line 582 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (search_id != NULL); +#line 583 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp0_ = *search_id; +#line 583 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + saved_search_db_table_remove_conditions_for_search_id (self, &_tmp0_, &_inner_error_); +#line 583 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 583 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 583 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 583 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 4288 "SavedSearchDBTable.c" + } else { +#line 583 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 583 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 583 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 4296 "SavedSearchDBTable.c" + } + } +#line 584 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp1_ = *search_id; +#line 584 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp2_ = _tmp1_.id; +#line 584 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_delete_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp2_, &_inner_error_); +#line 584 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 584 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 584 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 584 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 4313 "SavedSearchDBTable.c" + } else { +#line 584 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 584 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 584 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 4321 "SavedSearchDBTable.c" + } + } +} + + +SavedSearchRow* saved_search_db_table_get_row (SavedSearchDBTable* self, SavedSearchID* search_id, GError** error) { + SavedSearchRow* result = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + SavedSearchID _tmp5_ = {0}; + gint64 _tmp6_ = 0LL; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + sqlite3_stmt* _tmp9_ = NULL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + SavedSearchRow* row = NULL; + SavedSearchRow* _tmp14_ = NULL; + SavedSearchRow* _tmp15_ = NULL; + SavedSearchID _tmp16_ = {0}; + SavedSearchRow* _tmp17_ = NULL; + sqlite3_stmt* _tmp18_ = NULL; + const gchar* _tmp19_ = NULL; + gchar* _tmp20_ = NULL; + SavedSearchRow* _tmp21_ = NULL; + sqlite3_stmt* _tmp22_ = NULL; + const gchar* _tmp23_ = NULL; + SearchOperator _tmp24_ = 0; + GError * _inner_error_ = NULL; +#line 587 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_val_if_fail (IS_SAVED_SEARCH_DB_TABLE (self), NULL); +#line 587 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_val_if_fail (search_id != NULL, NULL); +#line 589 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp0_ = database_table_db; +#line 589 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "SELECT name, operator FROM SavedSearchDBTable WHERE id=?", -1, &_tmp1_, NULL); +#line 589 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 589 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp1_; +#line 589 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp2_; +#line 591 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp3_ = res; +#line 591 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 593 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp4_ = stmt; +#line 593 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp5_ = *search_id; +#line 593 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp6_ = _tmp5_.id; +#line 593 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp7_ = sqlite3_bind_int64 (_tmp4_, 1, _tmp6_); +#line 593 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp7_; +#line 594 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp8_ = res; +#line 594 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp8_ == SQLITE_OK, "res == Sqlite.OK"); +#line 596 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp9_ = stmt; +#line 596 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp10_ = sqlite3_step (_tmp9_); +#line 596 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp10_; +#line 597 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp11_ = res; +#line 597 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp11_ == SQLITE_DONE) { +#line 598 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + result = NULL; +#line 598 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 598 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return result; +#line 4404 "SavedSearchDBTable.c" + } else { + gint _tmp12_ = 0; +#line 599 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp12_ = res; +#line 599 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp12_ != SQLITE_ROW) { +#line 4411 "SavedSearchDBTable.c" + gint _tmp13_ = 0; +#line 600 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp13_ = res; +#line 600 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_throw_error ("SavedSearchDBTable.get_row", _tmp13_, &_inner_error_); +#line 600 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 600 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 600 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 600 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 600 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 4427 "SavedSearchDBTable.c" + } else { +#line 600 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 600 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 600 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 600 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 4437 "SavedSearchDBTable.c" + } + } + } + } +#line 602 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp14_ = saved_search_row_new (); +#line 602 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + row = _tmp14_; +#line 603 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp15_ = row; +#line 603 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp16_ = *search_id; +#line 603 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp15_->search_id = _tmp16_; +#line 604 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp17_ = row; +#line 604 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp18_ = stmt; +#line 604 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp19_ = sqlite3_column_text (_tmp18_, 0); +#line 604 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp20_ = g_strdup (_tmp19_); +#line 604 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_free0 (_tmp17_->name); +#line 604 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp17_->name = _tmp20_; +#line 605 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp21_ = row; +#line 605 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp22_ = stmt; +#line 605 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp23_ = sqlite3_column_text (_tmp22_, 1); +#line 605 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp24_ = search_operator_from_string (_tmp23_); +#line 605 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp21_->operator = _tmp24_; +#line 607 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + result = row; +#line 607 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 607 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return result; +#line 4480 "SavedSearchDBTable.c" +} + + +GeeList* saved_search_db_table_get_all_rows (SavedSearchDBTable* self, GError** error) { + GeeList* result = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + GeeList* rows = NULL; + GeeArrayList* _tmp4_ = NULL; + GError * _inner_error_ = NULL; +#line 610 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_val_if_fail (IS_SAVED_SEARCH_DB_TABLE (self), NULL); +#line 612 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp0_ = database_table_db; +#line 612 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "SELECT id, name, operator FROM SavedSearchDBTable", -1, &_tmp1_, NULL); +#line 612 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 612 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + stmt = _tmp1_; +#line 612 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp2_; +#line 614 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp3_ = res; +#line 614 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 616 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp4_ = gee_array_list_new (TYPE_SAVED_SEARCH_ROW, (GBoxedCopyFunc) saved_search_row_ref, saved_search_row_unref, NULL, NULL, NULL); +#line 616 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + rows = G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, GEE_TYPE_LIST, GeeList); +#line 4515 "SavedSearchDBTable.c" + { + gboolean _tmp5_ = FALSE; +#line 618 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp5_ = TRUE; +#line 618 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + while (TRUE) { +#line 4522 "SavedSearchDBTable.c" + sqlite3_stmt* _tmp6_ = NULL; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + SavedSearchRow* row = NULL; + SavedSearchRow* _tmp11_ = NULL; + SavedSearchRow* _tmp12_ = NULL; + sqlite3_stmt* _tmp13_ = NULL; + gint64 _tmp14_ = 0LL; + SavedSearchRow* _tmp15_ = NULL; + sqlite3_stmt* _tmp16_ = NULL; + const gchar* _tmp17_ = NULL; + gchar* _tmp18_ = NULL; + SavedSearchRow* _tmp19_ = NULL; + sqlite3_stmt* _tmp20_ = NULL; + const gchar* _tmp21_ = NULL; + SearchOperator _tmp22_ = 0; + GeeList* _tmp23_ = NULL; + SavedSearchRow* _tmp24_ = NULL; + SavedSearchID _tmp25_ = {0}; + GeeList* _tmp26_ = NULL; + SavedSearchRow* _tmp27_ = NULL; + GeeList* _tmp28_ = NULL; + GeeList* _tmp29_ = NULL; + SavedSearchRow* _tmp30_ = NULL; +#line 618 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (!_tmp5_) { +#line 4549 "SavedSearchDBTable.c" + } +#line 618 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp5_ = FALSE; +#line 619 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp6_ = stmt; +#line 619 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp7_ = sqlite3_step (_tmp6_); +#line 619 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + res = _tmp7_; +#line 620 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp8_ = res; +#line 620 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp8_ == SQLITE_DONE) { +#line 621 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + break; +#line 4565 "SavedSearchDBTable.c" + } else { + gint _tmp9_ = 0; +#line 622 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp9_ = res; +#line 622 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_tmp9_ != SQLITE_ROW) { +#line 4572 "SavedSearchDBTable.c" + gint _tmp10_ = 0; +#line 623 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp10_ = res; +#line 623 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_throw_error ("SavedSearchDBTable.get_all_rows", _tmp10_, &_inner_error_); +#line 623 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 623 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 623 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 623 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (rows); +#line 623 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 623 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 4590 "SavedSearchDBTable.c" + } else { +#line 623 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (rows); +#line 623 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 623 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 623 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 623 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 4602 "SavedSearchDBTable.c" + } + } + } + } +#line 625 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp11_ = saved_search_row_new (); +#line 625 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + row = _tmp11_; +#line 626 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp12_ = row; +#line 626 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp13_ = stmt; +#line 626 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp14_ = sqlite3_column_int64 (_tmp13_, 0); +#line 626 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + saved_search_id_init (&_tmp12_->search_id, _tmp14_); +#line 627 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp15_ = row; +#line 627 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp16_ = stmt; +#line 627 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp17_ = sqlite3_column_text (_tmp16_, 1); +#line 627 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp18_ = g_strdup (_tmp17_); +#line 627 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_free0 (_tmp15_->name); +#line 627 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp15_->name = _tmp18_; +#line 628 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp19_ = row; +#line 628 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp20_ = stmt; +#line 628 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp21_ = sqlite3_column_text (_tmp20_, 2); +#line 628 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp22_ = search_operator_from_string (_tmp21_); +#line 628 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp19_->operator = _tmp22_; +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp24_ = row; +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp25_ = _tmp24_->search_id; +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp26_ = saved_search_db_table_get_conditions_for_id (self, &_tmp25_, &_inner_error_); +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp23_ = _tmp26_; +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _saved_search_row_unref0 (row); +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (rows); +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 4663 "SavedSearchDBTable.c" + } else { +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _saved_search_row_unref0 (row); +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (rows); +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return NULL; +#line 4677 "SavedSearchDBTable.c" + } + } +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp27_ = row; +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp28_ = _tmp23_; +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp23_ = NULL; +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (_tmp27_->conditions); +#line 629 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp27_->conditions = _tmp28_; +#line 631 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp29_ = rows; +#line 631 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp30_ = row; +#line 631 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp29_, GEE_TYPE_COLLECTION, GeeCollection), _tmp30_); +#line 618 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _g_object_unref0 (_tmp23_); +#line 618 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _saved_search_row_unref0 (row); +#line 4700 "SavedSearchDBTable.c" + } + } +#line 634 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + result = rows; +#line 634 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _sqlite3_finalize0 (stmt); +#line 634 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return result; +#line 4709 "SavedSearchDBTable.c" +} + + +void saved_search_db_table_rename (SavedSearchDBTable* self, SavedSearchID* search_id, const gchar* new_name, GError** error) { + SavedSearchID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + const gchar* _tmp2_ = NULL; + GError * _inner_error_ = NULL; +#line 637 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (IS_SAVED_SEARCH_DB_TABLE (self)); +#line 637 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (search_id != NULL); +#line 637 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_return_if_fail (new_name != NULL); +#line 638 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp0_ = *search_id; +#line 638 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp1_ = _tmp0_.id; +#line 638 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + _tmp2_ = new_name; +#line 638 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + database_table_update_text_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "name", _tmp2_, &_inner_error_); +#line 638 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 638 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 638 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_propagate_error (error, _inner_error_); +#line 638 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 4740 "SavedSearchDBTable.c" + } else { +#line 638 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 638 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + g_clear_error (&_inner_error_); +#line 638 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + return; +#line 4748 "SavedSearchDBTable.c" + } + } +} + + +static void saved_search_db_table_class_init (SavedSearchDBTableClass * klass) { +#line 33 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + saved_search_db_table_parent_class = g_type_class_peek_parent (klass); +#line 33 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + ((DatabaseTableClass *) klass)->finalize = saved_search_db_table_finalize; +#line 4759 "SavedSearchDBTable.c" +} + + +static void saved_search_db_table_instance_init (SavedSearchDBTable * self) { +} + + +static void saved_search_db_table_finalize (DatabaseTable* obj) { + SavedSearchDBTable * self; +#line 33 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SAVED_SEARCH_DB_TABLE, SavedSearchDBTable); +#line 33 "/home/jens/Source/shotwell/src/db/SavedSearchDBTable.vala" + DATABASE_TABLE_CLASS (saved_search_db_table_parent_class)->finalize (obj); +#line 4773 "SavedSearchDBTable.c" +} + + +GType saved_search_db_table_get_type (void) { + static volatile gsize saved_search_db_table_type_id__volatile = 0; + if (g_once_init_enter (&saved_search_db_table_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (SavedSearchDBTableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) saved_search_db_table_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SavedSearchDBTable), 0, (GInstanceInitFunc) saved_search_db_table_instance_init, NULL }; + GType saved_search_db_table_type_id; + saved_search_db_table_type_id = g_type_register_static (TYPE_DATABASE_TABLE, "SavedSearchDBTable", &g_define_type_info, 0); + g_once_init_leave (&saved_search_db_table_type_id__volatile, saved_search_db_table_type_id); + } + return saved_search_db_table_type_id__volatile; +} + + + diff --git a/src/db/TagTable.c b/src/db/TagTable.c new file mode 100644 index 0000000..1c58788 --- /dev/null +++ b/src/db/TagTable.c @@ -0,0 +1,2248 @@ +/* TagTable.c generated by valac 0.32.1, the Vala compiler + * generated from TagTable.vala, do not modify */ + +/* 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + + +#define TYPE_TAG_ID (tag_id_get_type ()) +typedef struct _TagID TagID; + +#define TYPE_TAG_ROW (tag_row_get_type ()) +#define TAG_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TAG_ROW, TagRow)) +#define TAG_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TAG_ROW, TagRowClass)) +#define IS_TAG_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TAG_ROW)) +#define IS_TAG_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TAG_ROW)) +#define TAG_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TAG_ROW, TagRowClass)) + +typedef struct _TagRow TagRow; +typedef struct _TagRowClass TagRowClass; +typedef struct _TagRowPrivate TagRowPrivate; +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +typedef struct _ParamSpecTagRow ParamSpecTagRow; + +#define TYPE_DATABASE_TABLE (database_table_get_type ()) +#define DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATABASE_TABLE, DatabaseTable)) +#define DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATABASE_TABLE, DatabaseTableClass)) +#define IS_DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATABASE_TABLE)) +#define IS_DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATABASE_TABLE)) +#define DATABASE_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATABASE_TABLE, DatabaseTableClass)) + +typedef struct _DatabaseTable DatabaseTable; +typedef struct _DatabaseTableClass DatabaseTableClass; +typedef struct _DatabaseTablePrivate DatabaseTablePrivate; + +#define TYPE_TAG_TABLE (tag_table_get_type ()) +#define TAG_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TAG_TABLE, TagTable)) +#define TAG_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TAG_TABLE, TagTableClass)) +#define IS_TAG_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TAG_TABLE)) +#define IS_TAG_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TAG_TABLE)) +#define TAG_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TAG_TABLE, TagTableClass)) + +typedef struct _TagTable TagTable; +typedef struct _TagTableClass TagTableClass; +typedef struct _TagTablePrivate TagTablePrivate; +#define _sqlite3_finalize0(var) ((var == NULL) ? NULL : (var = (sqlite3_finalize (var), NULL))) +#define _database_table_unref0(var) ((var == NULL) ? NULL : (var = (database_table_unref (var), NULL))) +#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL))) +#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) +#define _tag_row_unref0(var) ((var == NULL) ? NULL : (var = (tag_row_unref (var), NULL))) +#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL))) + +#define TYPE_PHOTO_ID (photo_id_get_type ()) +typedef struct _PhotoID PhotoID; +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); +#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } +#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } +#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _TagID { + gint64 id; +}; + +struct _TagRow { + GTypeInstance parent_instance; + volatile int ref_count; + TagRowPrivate * priv; + TagID tag_id; + gchar* name; + GeeSet* source_id_list; + time_t time_created; +}; + +struct _TagRowClass { + GTypeClass parent_class; + void (*finalize) (TagRow *self); +}; + +struct _ParamSpecTagRow { + GParamSpec parent_instance; +}; + +struct _DatabaseTable { + GTypeInstance parent_instance; + volatile int ref_count; + DatabaseTablePrivate * priv; + gchar* table_name; +}; + +struct _DatabaseTableClass { + GTypeClass parent_class; + void (*finalize) (DatabaseTable *self); +}; + +struct _TagTable { + DatabaseTable parent_instance; + TagTablePrivate * priv; +}; + +struct _TagTableClass { + DatabaseTableClass parent_class; +}; + +typedef enum { + DATABASE_ERROR_ERROR, + DATABASE_ERROR_BACKING, + DATABASE_ERROR_MEMORY, + DATABASE_ERROR_ABORT, + DATABASE_ERROR_LIMITS, + DATABASE_ERROR_TYPESPEC +} DatabaseError; +#define DATABASE_ERROR database_error_quark () +struct _PhotoID { + gint64 id; +}; + + +static gpointer tag_row_parent_class = NULL; +static gpointer tag_table_parent_class = NULL; +static TagTable* tag_table_instance; +static TagTable* tag_table_instance = NULL; +extern sqlite3* database_table_db; + +GType tag_id_get_type (void) G_GNUC_CONST; +TagID* tag_id_dup (const TagID* self); +void tag_id_free (TagID* self); +#define TAG_ID_INVALID ((gint64) -1) +void tag_id_init (TagID *self, gint64 id); +gboolean tag_id_is_invalid (TagID *self); +gboolean tag_id_is_valid (TagID *self); +gpointer tag_row_ref (gpointer instance); +void tag_row_unref (gpointer instance); +GParamSpec* param_spec_tag_row (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_tag_row (GValue* value, gpointer v_object); +void value_take_tag_row (GValue* value, gpointer v_object); +gpointer value_get_tag_row (const GValue* value); +GType tag_row_get_type (void) G_GNUC_CONST; +enum { + TAG_ROW_DUMMY_PROPERTY +}; +TagRow* tag_row_new (void); +TagRow* tag_row_construct (GType object_type); +static void tag_row_finalize (TagRow* obj); +gpointer database_table_ref (gpointer instance); +void database_table_unref (gpointer instance); +GParamSpec* param_spec_database_table (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_database_table (GValue* value, gpointer v_object); +void value_take_database_table (GValue* value, gpointer v_object); +gpointer value_get_database_table (const GValue* value); +GType database_table_get_type (void) G_GNUC_CONST; +GType tag_table_get_type (void) G_GNUC_CONST; +enum { + TAG_TABLE_DUMMY_PROPERTY +}; +static TagTable* tag_table_new (void); +static TagTable* tag_table_construct (GType object_type); +DatabaseTable* database_table_construct (GType object_type); +void database_table_set_table_name (DatabaseTable* self, const gchar* table_name); +void database_table_fatal (const gchar* op, gint res); +TagTable* tag_table_get_instance (void); +void tag_table_upgrade_for_htags (void); +GQuark database_error_quark (void); +GeeList* tag_table_get_all_rows (TagTable* self, GError** error); +#define TAG_PATH_SEPARATOR_STRING "/" +void tag_table_rename (TagTable* self, TagID* tag_id, const gchar* new_name, GError** error); +TagRow* tag_table_add (TagTable* self, const gchar* name, GError** error); +gulong now_sec (void); +void database_table_throw_error (const gchar* method, gint res, GError** error); +void tag_table_create_from_row (TagTable* self, TagRow* row, TagID* result, GError** error); +static gchar* tag_table_serialize_source_ids (TagTable* self, GeeCollection* source_ids); +void tag_table_remove (TagTable* self, TagID* tag_id, GError** error); +void database_table_delete_by_id (DatabaseTable* self, gint64 id, GError** error); +gchar* tag_table_get_name (TagTable* self, TagID* tag_id, GError** error); +gboolean database_table_select_by_id (DatabaseTable* self, gint64 id, const gchar* columns, sqlite3_stmt** stmt); +TagRow* tag_table_get_row (TagTable* self, TagID* tag_id, GError** error); +static GeeSet* tag_table_unserialize_source_ids (TagTable* self, const gchar* text_list); +void database_table_update_text_by_id_2 (DatabaseTable* self, gint64 id, const gchar* column, const gchar* text, GError** error); +void tag_table_set_tagged_sources (TagTable* self, TagID* tag_id, GeeCollection* source_ids, GError** error); +gboolean is_string_empty (const gchar* s); +GType photo_id_get_type (void) G_GNUC_CONST; +PhotoID* photo_id_dup (const PhotoID* self); +void photo_id_free (PhotoID* self); +gchar* photo_id_upgrade_photo_id_to_source_id (PhotoID* photo_id); +gint64 parse_int64 (const gchar* str, gint num_base); +void photo_id_init (PhotoID *self, gint64 id); +static void tag_table_finalize (DatabaseTable* obj); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); +static gint _vala_array_length (gpointer array); + + +void tag_id_init (TagID *self, gint64 id) { + gint64 _tmp0_ = 0LL; +#line 12 "/home/jens/Source/shotwell/src/db/TagTable.vala" + memset (self, 0, sizeof (TagID)); +#line 13 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp0_ = id; +#line 13 "/home/jens/Source/shotwell/src/db/TagTable.vala" + (*self).id = _tmp0_; +#line 213 "TagTable.c" +} + + +gboolean tag_id_is_invalid (TagID *self) { + gboolean result = FALSE; + gint64 _tmp0_ = 0LL; +#line 17 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp0_ = (*self).id; +#line 17 "/home/jens/Source/shotwell/src/db/TagTable.vala" + result = _tmp0_ == TAG_ID_INVALID; +#line 17 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return result; +#line 226 "TagTable.c" +} + + +gboolean tag_id_is_valid (TagID *self) { + gboolean result = FALSE; + gint64 _tmp0_ = 0LL; +#line 21 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp0_ = (*self).id; +#line 21 "/home/jens/Source/shotwell/src/db/TagTable.vala" + result = _tmp0_ != TAG_ID_INVALID; +#line 21 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return result; +#line 239 "TagTable.c" +} + + +TagID* tag_id_dup (const TagID* self) { + TagID* dup; +#line 7 "/home/jens/Source/shotwell/src/db/TagTable.vala" + dup = g_new0 (TagID, 1); +#line 7 "/home/jens/Source/shotwell/src/db/TagTable.vala" + memcpy (dup, self, sizeof (TagID)); +#line 7 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return dup; +#line 251 "TagTable.c" +} + + +void tag_id_free (TagID* self) { +#line 7 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_free (self); +#line 258 "TagTable.c" +} + + +GType tag_id_get_type (void) { + static volatile gsize tag_id_type_id__volatile = 0; + if (g_once_init_enter (&tag_id_type_id__volatile)) { + GType tag_id_type_id; + tag_id_type_id = g_boxed_type_register_static ("TagID", (GBoxedCopyFunc) tag_id_dup, (GBoxedFreeFunc) tag_id_free); + g_once_init_leave (&tag_id_type_id__volatile, tag_id_type_id); + } + return tag_id_type_id__volatile; +} + + +TagRow* tag_row_construct (GType object_type) { + TagRow* self = NULL; +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + self = (TagRow*) g_type_create_instance (object_type); +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return self; +#line 279 "TagTable.c" +} + + +TagRow* tag_row_new (void) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return tag_row_construct (TYPE_TAG_ROW); +#line 286 "TagTable.c" +} + + +static void value_tag_row_init (GValue* value) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + value->data[0].v_pointer = NULL; +#line 293 "TagTable.c" +} + + +static void value_tag_row_free_value (GValue* value) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (value->data[0].v_pointer) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + tag_row_unref (value->data[0].v_pointer); +#line 302 "TagTable.c" + } +} + + +static void value_tag_row_copy_value (const GValue* src_value, GValue* dest_value) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (src_value->data[0].v_pointer) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + dest_value->data[0].v_pointer = tag_row_ref (src_value->data[0].v_pointer); +#line 312 "TagTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + dest_value->data[0].v_pointer = NULL; +#line 316 "TagTable.c" + } +} + + +static gpointer value_tag_row_peek_pointer (const GValue* value) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return value->data[0].v_pointer; +#line 324 "TagTable.c" +} + + +static gchar* value_tag_row_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (collect_values[0].v_pointer) { +#line 331 "TagTable.c" + TagRow* object; + object = collect_values[0].v_pointer; +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (object->parent_instance.g_class == NULL) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); +#line 338 "TagTable.c" + } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); +#line 342 "TagTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + value->data[0].v_pointer = tag_row_ref (object); +#line 346 "TagTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + value->data[0].v_pointer = NULL; +#line 350 "TagTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return NULL; +#line 354 "TagTable.c" +} + + +static gchar* value_tag_row_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + TagRow** object_p; + object_p = collect_values[0].v_pointer; +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (!object_p) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); +#line 365 "TagTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (!value->data[0].v_pointer) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + *object_p = NULL; +#line 371 "TagTable.c" + } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + *object_p = value->data[0].v_pointer; +#line 375 "TagTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + *object_p = tag_row_ref (value->data[0].v_pointer); +#line 379 "TagTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return NULL; +#line 383 "TagTable.c" +} + + +GParamSpec* param_spec_tag_row (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { + ParamSpecTagRow* spec; +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_val_if_fail (g_type_is_a (object_type, TYPE_TAG_ROW), NULL); +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + G_PARAM_SPEC (spec)->value_type = object_type; +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return G_PARAM_SPEC (spec); +#line 397 "TagTable.c" +} + + +gpointer value_get_tag_row (const GValue* value) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TAG_ROW), NULL); +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return value->data[0].v_pointer; +#line 406 "TagTable.c" +} + + +void value_set_tag_row (GValue* value, gpointer v_object) { + TagRow* old; +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TAG_ROW)); +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + old = value->data[0].v_pointer; +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (v_object) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TAG_ROW)); +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + value->data[0].v_pointer = v_object; +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + tag_row_ref (value->data[0].v_pointer); +#line 426 "TagTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + value->data[0].v_pointer = NULL; +#line 430 "TagTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (old) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + tag_row_unref (old); +#line 436 "TagTable.c" + } +} + + +void value_take_tag_row (GValue* value, gpointer v_object) { + TagRow* old; +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TAG_ROW)); +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + old = value->data[0].v_pointer; +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (v_object) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TAG_ROW)); +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + value->data[0].v_pointer = v_object; +#line 455 "TagTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + value->data[0].v_pointer = NULL; +#line 459 "TagTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (old) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + tag_row_unref (old); +#line 465 "TagTable.c" + } +} + + +static void tag_row_class_init (TagRowClass * klass) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + tag_row_parent_class = g_type_class_peek_parent (klass); +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + ((TagRowClass *) klass)->finalize = tag_row_finalize; +#line 475 "TagTable.c" +} + + +static void tag_row_instance_init (TagRow * self) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + self->ref_count = 1; +#line 482 "TagTable.c" +} + + +static void tag_row_finalize (TagRow* obj) { + TagRow * self; +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TAG_ROW, TagRow); +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_signal_handlers_destroy (self); +#line 27 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_free0 (self->name); +#line 28 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_object_unref0 (self->source_id_list); +#line 496 "TagTable.c" +} + + +GType tag_row_get_type (void) { + static volatile gsize tag_row_type_id__volatile = 0; + if (g_once_init_enter (&tag_row_type_id__volatile)) { + static const GTypeValueTable g_define_type_value_table = { value_tag_row_init, value_tag_row_free_value, value_tag_row_copy_value, value_tag_row_peek_pointer, "p", value_tag_row_collect_value, "p", value_tag_row_lcopy_value }; + static const GTypeInfo g_define_type_info = { sizeof (TagRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tag_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TagRow), 0, (GInstanceInitFunc) tag_row_instance_init, &g_define_type_value_table }; + static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; + GType tag_row_type_id; + tag_row_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TagRow", &g_define_type_info, &g_define_type_fundamental_info, 0); + g_once_init_leave (&tag_row_type_id__volatile, tag_row_type_id); + } + return tag_row_type_id__volatile; +} + + +gpointer tag_row_ref (gpointer instance) { + TagRow* self; + self = instance; +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_atomic_int_inc (&self->ref_count); +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return instance; +#line 521 "TagTable.c" +} + + +void tag_row_unref (gpointer instance) { + TagRow* self; + self = instance; +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (g_atomic_int_dec_and_test (&self->ref_count)) { +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + TAG_ROW_GET_CLASS (self)->finalize (self); +#line 25 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_type_free_instance ((GTypeInstance *) self); +#line 534 "TagTable.c" + } +} + + +static TagTable* tag_table_construct (GType object_type) { + TagTable* self = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; +#line 35 "/home/jens/Source/shotwell/src/db/TagTable.vala" + self = (TagTable*) database_table_construct (object_type); +#line 36 "/home/jens/Source/shotwell/src/db/TagTable.vala" + database_table_set_table_name (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), "TagTable"); +#line 39 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp0_ = database_table_db; +#line 39 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "CREATE TABLE IF NOT EXISTS " "TagTable " "(" "id INTEGER PRIMARY KEY, " "name TEXT UNIQUE NOT NULL, " "photo_id_list TEXT, " "time_created INTEGER" ")", -1, &_tmp1_, NULL); +#line 39 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 39 "/home/jens/Source/shotwell/src/db/TagTable.vala" + stmt = _tmp1_; +#line 39 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp2_; +#line 47 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp3_ = res; +#line 47 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 49 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp4_ = stmt; +#line 49 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp5_ = sqlite3_step (_tmp4_); +#line 49 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp5_; +#line 50 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp6_ = res; +#line 50 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_tmp6_ != SQLITE_DONE) { +#line 578 "TagTable.c" + gint _tmp7_ = 0; +#line 51 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp7_ = res; +#line 51 "/home/jens/Source/shotwell/src/db/TagTable.vala" + database_table_fatal ("create TagTable", _tmp7_); +#line 584 "TagTable.c" + } +#line 35 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 35 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return self; +#line 590 "TagTable.c" +} + + +static TagTable* tag_table_new (void) { +#line 35 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return tag_table_construct (TYPE_TAG_TABLE); +#line 597 "TagTable.c" +} + + +static gpointer _database_table_ref0 (gpointer self) { +#line 58 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return self ? database_table_ref (self) : NULL; +#line 604 "TagTable.c" +} + + +TagTable* tag_table_get_instance (void) { + TagTable* result = NULL; + TagTable* _tmp0_ = NULL; + TagTable* _tmp2_ = NULL; + TagTable* _tmp3_ = NULL; +#line 55 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp0_ = tag_table_instance; +#line 55 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_tmp0_ == NULL) { +#line 617 "TagTable.c" + TagTable* _tmp1_ = NULL; +#line 56 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp1_ = tag_table_new (); +#line 56 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _database_table_unref0 (tag_table_instance); +#line 56 "/home/jens/Source/shotwell/src/db/TagTable.vala" + tag_table_instance = _tmp1_; +#line 625 "TagTable.c" + } +#line 58 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp2_ = tag_table_instance; +#line 58 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp3_ = _database_table_ref0 (_tmp2_); +#line 58 "/home/jens/Source/shotwell/src/db/TagTable.vala" + result = _tmp3_; +#line 58 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return result; +#line 635 "TagTable.c" +} + + +static gpointer _g_object_ref0 (gpointer self) { +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return self ? g_object_ref (self) : NULL; +#line 642 "TagTable.c" +} + + +static gchar* string_replace (const gchar* self, const gchar* old, const gchar* replacement) { + gchar* result = NULL; + GError * _inner_error_ = NULL; +#line 1380 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + g_return_val_if_fail (self != NULL, NULL); +#line 1380 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + g_return_val_if_fail (old != NULL, NULL); +#line 1380 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + g_return_val_if_fail (replacement != NULL, NULL); +#line 655 "TagTable.c" + { + GRegex* regex = NULL; + const gchar* _tmp0_ = NULL; + gchar* _tmp1_ = NULL; + gchar* _tmp2_ = NULL; + GRegex* _tmp3_ = NULL; + GRegex* _tmp4_ = NULL; + gchar* _tmp5_ = NULL; + GRegex* _tmp6_ = NULL; + const gchar* _tmp7_ = NULL; + gchar* _tmp8_ = NULL; + gchar* _tmp9_ = NULL; +#line 1382 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _tmp0_ = old; +#line 1382 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _tmp1_ = g_regex_escape_string (_tmp0_, -1); +#line 1382 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _tmp2_ = _tmp1_; +#line 1382 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _tmp3_ = g_regex_new (_tmp2_, 0, 0, &_inner_error_); +#line 1382 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _tmp4_ = _tmp3_; +#line 1382 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _g_free0 (_tmp2_); +#line 1382 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + regex = _tmp4_; +#line 1382 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 1382 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + if (_inner_error_->domain == G_REGEX_ERROR) { +#line 686 "TagTable.c" + goto __catch19_g_regex_error; + } +#line 1382 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 1382 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + g_clear_error (&_inner_error_); +#line 1382 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + return NULL; +#line 695 "TagTable.c" + } +#line 1383 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _tmp6_ = regex; +#line 1383 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _tmp7_ = replacement; +#line 1383 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _tmp8_ = g_regex_replace_literal (_tmp6_, self, (gssize) -1, 0, _tmp7_, 0, &_inner_error_); +#line 1383 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _tmp5_ = _tmp8_; +#line 1383 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 1383 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _g_regex_unref0 (regex); +#line 1383 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + if (_inner_error_->domain == G_REGEX_ERROR) { +#line 711 "TagTable.c" + goto __catch19_g_regex_error; + } +#line 1383 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _g_regex_unref0 (regex); +#line 1383 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 1383 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + g_clear_error (&_inner_error_); +#line 1383 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + return NULL; +#line 722 "TagTable.c" + } +#line 1383 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _tmp9_ = _tmp5_; +#line 1383 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _tmp5_ = NULL; +#line 1383 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + result = _tmp9_; +#line 1383 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _g_free0 (_tmp5_); +#line 1383 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _g_regex_unref0 (regex); +#line 1383 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + return result; +#line 736 "TagTable.c" + } + goto __finally19; + __catch19_g_regex_error: + { + GError* e = NULL; +#line 1381 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + e = _inner_error_; +#line 1381 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _inner_error_ = NULL; +#line 1385 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + g_assert_not_reached (); +#line 1381 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _g_error_free0 (e); +#line 750 "TagTable.c" + } + __finally19: +#line 1381 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 1381 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 1381 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + g_clear_error (&_inner_error_); +#line 1381 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + return NULL; +#line 761 "TagTable.c" + } +} + + +void tag_table_upgrade_for_htags (void) { + TagTable* table = NULL; + TagTable* _tmp0_ = NULL; + GError * _inner_error_ = NULL; +#line 62 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp0_ = tag_table_get_instance (); +#line 62 "/home/jens/Source/shotwell/src/db/TagTable.vala" + table = _tmp0_; +#line 774 "TagTable.c" + { + GeeList* rows = NULL; + TagTable* _tmp1_ = NULL; + GeeList* _tmp2_ = NULL; +#line 65 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp1_ = table; +#line 65 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp2_ = tag_table_get_all_rows (_tmp1_, &_inner_error_); +#line 65 "/home/jens/Source/shotwell/src/db/TagTable.vala" + rows = _tmp2_; +#line 65 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 65 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 789 "TagTable.c" + goto __catch18_database_error; + } +#line 65 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _database_table_unref0 (table); +#line 65 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 65 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_clear_error (&_inner_error_); +#line 65 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return; +#line 800 "TagTable.c" + } + { + GeeList* _row_list = NULL; + GeeList* _tmp3_ = NULL; + GeeList* _tmp4_ = NULL; + gint _row_size = 0; + GeeList* _tmp5_ = NULL; + gint _tmp6_ = 0; + gint _tmp7_ = 0; + gint _row_index = 0; +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp3_ = rows; +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp4_ = _g_object_ref0 (_tmp3_); +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _row_list = _tmp4_; +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp5_ = _row_list; +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp6_ = gee_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, GEE_TYPE_COLLECTION, GeeCollection)); +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp7_ = _tmp6_; +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _row_size = _tmp7_; +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _row_index = -1; +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + while (TRUE) { +#line 829 "TagTable.c" + gint _tmp8_ = 0; + gint _tmp9_ = 0; + gint _tmp10_ = 0; + TagRow* row = NULL; + GeeList* _tmp11_ = NULL; + gint _tmp12_ = 0; + gpointer _tmp13_ = NULL; + TagRow* _tmp14_ = NULL; + TagRow* _tmp15_ = NULL; + const gchar* _tmp16_ = NULL; + gchar* _tmp17_ = NULL; + TagTable* _tmp18_ = NULL; + TagRow* _tmp19_ = NULL; + TagID _tmp20_ = {0}; + TagRow* _tmp21_ = NULL; + const gchar* _tmp22_ = NULL; +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp8_ = _row_index; +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _row_index = _tmp8_ + 1; +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp9_ = _row_index; +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp10_ = _row_size; +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (!(_tmp9_ < _tmp10_)) { +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + break; +#line 858 "TagTable.c" + } +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp11_ = _row_list; +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp12_ = _row_index; +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp13_ = gee_list_get (_tmp11_, _tmp12_); +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + row = (TagRow*) _tmp13_; +#line 68 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp14_ = row; +#line 68 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp15_ = row; +#line 68 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp16_ = _tmp15_->name; +#line 68 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp17_ = string_replace (_tmp16_, TAG_PATH_SEPARATOR_STRING, "-"); +#line 68 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_free0 (_tmp14_->name); +#line 68 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp14_->name = _tmp17_; +#line 69 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp18_ = table; +#line 69 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp19_ = row; +#line 69 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp20_ = _tmp19_->tag_id; +#line 69 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp21_ = row; +#line 69 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp22_ = _tmp21_->name; +#line 69 "/home/jens/Source/shotwell/src/db/TagTable.vala" + tag_table_rename (_tmp18_, &_tmp20_, _tmp22_, &_inner_error_); +#line 69 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 69 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tag_row_unref0 (row); +#line 69 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_object_unref0 (_row_list); +#line 69 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_object_unref0 (rows); +#line 69 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 902 "TagTable.c" + goto __catch18_database_error; + } +#line 69 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tag_row_unref0 (row); +#line 69 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_object_unref0 (_row_list); +#line 69 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_object_unref0 (rows); +#line 69 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _database_table_unref0 (table); +#line 69 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 69 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_clear_error (&_inner_error_); +#line 69 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return; +#line 919 "TagTable.c" + } +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tag_row_unref0 (row); +#line 923 "TagTable.c" + } +#line 67 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_object_unref0 (_row_list); +#line 927 "TagTable.c" + } +#line 64 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_object_unref0 (rows); +#line 931 "TagTable.c" + } + goto __finally18; + __catch18_database_error: + { + GError* e = NULL; + const gchar* _tmp23_ = NULL; +#line 64 "/home/jens/Source/shotwell/src/db/TagTable.vala" + e = _inner_error_; +#line 64 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _inner_error_ = NULL; +#line 72 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp23_ = e->message; +#line 72 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_error ("TagTable.vala:72: TagTable: can't upgrade tag names for hierarchical t" \ +"ag support: %s", _tmp23_); +#line 64 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_error_free0 (e); +#line 948 "TagTable.c" + } + __finally18: +#line 64 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 64 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _database_table_unref0 (table); +#line 64 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 64 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_clear_error (&_inner_error_); +#line 64 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return; +#line 961 "TagTable.c" + } +#line 61 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _database_table_unref0 (table); +#line 965 "TagTable.c" +} + + +TagRow* tag_table_add (TagTable* self, const gchar* name, GError** error) { + TagRow* result = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + time_t time_created = 0; + gulong _tmp4_ = 0UL; + sqlite3_stmt* _tmp5_ = NULL; + const gchar* _tmp6_ = NULL; + gchar* _tmp7_ = NULL; + GDestroyNotify _tmp8_ = NULL; + gint _tmp9_ = 0; + gint _tmp10_ = 0; + sqlite3_stmt* _tmp11_ = NULL; + time_t _tmp12_ = 0; + gint _tmp13_ = 0; + gint _tmp14_ = 0; + sqlite3_stmt* _tmp15_ = NULL; + gint _tmp16_ = 0; + gint _tmp17_ = 0; + TagRow* row = NULL; + TagRow* _tmp19_ = NULL; + TagRow* _tmp20_ = NULL; + sqlite3* _tmp21_ = NULL; + gint64 _tmp22_ = 0LL; + TagRow* _tmp23_ = NULL; + const gchar* _tmp24_ = NULL; + gchar* _tmp25_ = NULL; + TagRow* _tmp26_ = NULL; + TagRow* _tmp27_ = NULL; + time_t _tmp28_ = 0; + GError * _inner_error_ = NULL; +#line 76 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_val_if_fail (IS_TAG_TABLE (self), NULL); +#line 76 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_val_if_fail (name != NULL, NULL); +#line 78 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp0_ = database_table_db; +#line 78 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "INSERT INTO TagTable (name, time_created) VALUES (?, ?)", -1, &_tmp1_, NULL); +#line 78 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 78 "/home/jens/Source/shotwell/src/db/TagTable.vala" + stmt = _tmp1_; +#line 78 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp2_; +#line 80 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp3_ = res; +#line 80 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 82 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp4_ = now_sec (); +#line 82 "/home/jens/Source/shotwell/src/db/TagTable.vala" + time_created = (time_t) _tmp4_; +#line 84 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp5_ = stmt; +#line 84 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp6_ = name; +#line 84 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp7_ = g_strdup (_tmp6_); +#line 84 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp8_ = g_free; +#line 84 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp9_ = sqlite3_bind_text (_tmp5_, 1, _tmp7_, -1, _tmp8_); +#line 84 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp9_; +#line 85 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp10_ = res; +#line 85 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _vala_assert (_tmp10_ == SQLITE_OK, "res == Sqlite.OK"); +#line 86 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp11_ = stmt; +#line 86 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp12_ = time_created; +#line 86 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp13_ = sqlite3_bind_int64 (_tmp11_, 2, (gint64) _tmp12_); +#line 86 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp13_; +#line 87 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp14_ = res; +#line 87 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _vala_assert (_tmp14_ == SQLITE_OK, "res == Sqlite.OK"); +#line 89 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp15_ = stmt; +#line 89 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp16_ = sqlite3_step (_tmp15_); +#line 89 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp16_; +#line 90 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp17_ = res; +#line 90 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_tmp17_ != SQLITE_DONE) { +#line 1064 "TagTable.c" + gint _tmp18_ = 0; +#line 91 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp18_ = res; +#line 91 "/home/jens/Source/shotwell/src/db/TagTable.vala" + database_table_throw_error ("TagTable.add", _tmp18_, &_inner_error_); +#line 91 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 91 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 91 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_propagate_error (error, _inner_error_); +#line 91 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 91 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return NULL; +#line 1080 "TagTable.c" + } else { +#line 91 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 91 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 91 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_clear_error (&_inner_error_); +#line 91 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return NULL; +#line 1090 "TagTable.c" + } + } + } +#line 93 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp19_ = tag_row_new (); +#line 93 "/home/jens/Source/shotwell/src/db/TagTable.vala" + row = _tmp19_; +#line 94 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp20_ = row; +#line 94 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp21_ = database_table_db; +#line 94 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp22_ = sqlite3_last_insert_rowid (_tmp21_); +#line 94 "/home/jens/Source/shotwell/src/db/TagTable.vala" + tag_id_init (&_tmp20_->tag_id, _tmp22_); +#line 95 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp23_ = row; +#line 95 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp24_ = name; +#line 95 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp25_ = g_strdup (_tmp24_); +#line 95 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_free0 (_tmp23_->name); +#line 95 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp23_->name = _tmp25_; +#line 96 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp26_ = row; +#line 96 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_object_unref0 (_tmp26_->source_id_list); +#line 96 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp26_->source_id_list = NULL; +#line 97 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp27_ = row; +#line 97 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp28_ = time_created; +#line 97 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp27_->time_created = _tmp28_; +#line 99 "/home/jens/Source/shotwell/src/db/TagTable.vala" + result = row; +#line 99 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 99 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return result; +#line 1134 "TagTable.c" +} + + +void tag_table_create_from_row (TagTable* self, TagRow* row, TagID* result, GError** error) { + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + TagRow* _tmp5_ = NULL; + const gchar* _tmp6_ = NULL; + gchar* _tmp7_ = NULL; + GDestroyNotify _tmp8_ = NULL; + gint _tmp9_ = 0; + gint _tmp10_ = 0; + sqlite3_stmt* _tmp11_ = NULL; + TagRow* _tmp12_ = NULL; + GeeSet* _tmp13_ = NULL; + gchar* _tmp14_ = NULL; + GDestroyNotify _tmp15_ = NULL; + gint _tmp16_ = 0; + gint _tmp17_ = 0; + sqlite3_stmt* _tmp18_ = NULL; + TagRow* _tmp19_ = NULL; + time_t _tmp20_ = 0; + gint _tmp21_ = 0; + gint _tmp22_ = 0; + sqlite3_stmt* _tmp23_ = NULL; + gint _tmp24_ = 0; + gint _tmp25_ = 0; + sqlite3* _tmp27_ = NULL; + gint64 _tmp28_ = 0LL; + TagID _tmp29_ = {0}; + GError * _inner_error_ = NULL; +#line 103 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_if_fail (IS_TAG_TABLE (self)); +#line 103 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_if_fail (IS_TAG_ROW (row)); +#line 105 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp0_ = database_table_db; +#line 105 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "INSERT INTO TagTable (name, photo_id_list, time_created) VALUES (?, ?," \ +" ?)", -1, &_tmp1_, NULL); +#line 105 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 105 "/home/jens/Source/shotwell/src/db/TagTable.vala" + stmt = _tmp1_; +#line 105 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp2_; +#line 107 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp3_ = res; +#line 107 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 109 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp4_ = stmt; +#line 109 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp5_ = row; +#line 109 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp6_ = _tmp5_->name; +#line 109 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp7_ = g_strdup (_tmp6_); +#line 109 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp8_ = g_free; +#line 109 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp9_ = sqlite3_bind_text (_tmp4_, 1, _tmp7_, -1, _tmp8_); +#line 109 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp9_; +#line 110 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp10_ = res; +#line 110 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _vala_assert (_tmp10_ == SQLITE_OK, "res == Sqlite.OK"); +#line 111 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp11_ = stmt; +#line 111 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp12_ = row; +#line 111 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp13_ = _tmp12_->source_id_list; +#line 111 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp14_ = tag_table_serialize_source_ids (self, G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, GEE_TYPE_COLLECTION, GeeCollection)); +#line 111 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp15_ = g_free; +#line 111 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp16_ = sqlite3_bind_text (_tmp11_, 2, _tmp14_, -1, _tmp15_); +#line 111 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp16_; +#line 112 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp17_ = res; +#line 112 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _vala_assert (_tmp17_ == SQLITE_OK, "res == Sqlite.OK"); +#line 113 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp18_ = stmt; +#line 113 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp19_ = row; +#line 113 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp20_ = _tmp19_->time_created; +#line 113 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp21_ = sqlite3_bind_int64 (_tmp18_, 3, (gint64) _tmp20_); +#line 113 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp21_; +#line 114 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp22_ = res; +#line 114 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _vala_assert (_tmp22_ == SQLITE_OK, "res == Sqlite.OK"); +#line 116 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp23_ = stmt; +#line 116 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp24_ = sqlite3_step (_tmp23_); +#line 116 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp24_; +#line 117 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp25_ = res; +#line 117 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_tmp25_ != SQLITE_DONE) { +#line 1249 "TagTable.c" + gint _tmp26_ = 0; +#line 118 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp26_ = res; +#line 118 "/home/jens/Source/shotwell/src/db/TagTable.vala" + database_table_throw_error ("TagTable.create_from_row", _tmp26_, &_inner_error_); +#line 118 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 118 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 118 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_propagate_error (error, _inner_error_); +#line 118 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 118 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return; +#line 1265 "TagTable.c" + } else { +#line 118 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 118 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 118 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_clear_error (&_inner_error_); +#line 118 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return; +#line 1275 "TagTable.c" + } + } + } +#line 120 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp27_ = database_table_db; +#line 120 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp28_ = sqlite3_last_insert_rowid (_tmp27_); +#line 120 "/home/jens/Source/shotwell/src/db/TagTable.vala" + tag_id_init (&_tmp29_, _tmp28_); +#line 120 "/home/jens/Source/shotwell/src/db/TagTable.vala" + *result = _tmp29_; +#line 120 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 120 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return; +#line 1291 "TagTable.c" +} + + +void tag_table_remove (TagTable* self, TagID* tag_id, GError** error) { + TagID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + GError * _inner_error_ = NULL; +#line 123 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_if_fail (IS_TAG_TABLE (self)); +#line 123 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_if_fail (tag_id != NULL); +#line 124 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp0_ = *tag_id; +#line 124 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp1_ = _tmp0_.id; +#line 124 "/home/jens/Source/shotwell/src/db/TagTable.vala" + database_table_delete_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, &_inner_error_); +#line 124 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 124 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 124 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_propagate_error (error, _inner_error_); +#line 124 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return; +#line 1317 "TagTable.c" + } else { +#line 124 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 124 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_clear_error (&_inner_error_); +#line 124 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return; +#line 1325 "TagTable.c" + } + } +} + + +gchar* tag_table_get_name (TagTable* self, TagID* tag_id, GError** error) { + gchar* result = NULL; + sqlite3_stmt* stmt = NULL; + TagID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + sqlite3_stmt* _tmp2_ = NULL; + gboolean _tmp3_ = FALSE; + sqlite3_stmt* _tmp4_ = NULL; + const gchar* _tmp5_ = NULL; + gchar* _tmp6_ = NULL; +#line 127 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_val_if_fail (IS_TAG_TABLE (self), NULL); +#line 127 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_val_if_fail (tag_id != NULL, NULL); +#line 129 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp0_ = *tag_id; +#line 129 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp1_ = _tmp0_.id; +#line 129 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp3_ = database_table_select_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "name", &_tmp2_); +#line 129 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 129 "/home/jens/Source/shotwell/src/db/TagTable.vala" + stmt = _tmp2_; +#line 129 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (!_tmp3_) { +#line 130 "/home/jens/Source/shotwell/src/db/TagTable.vala" + result = NULL; +#line 130 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 130 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return result; +#line 1363 "TagTable.c" + } +#line 132 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp4_ = stmt; +#line 132 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp5_ = sqlite3_column_text (_tmp4_, 0); +#line 132 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp6_ = g_strdup (_tmp5_); +#line 132 "/home/jens/Source/shotwell/src/db/TagTable.vala" + result = _tmp6_; +#line 132 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 132 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return result; +#line 1377 "TagTable.c" +} + + +TagRow* tag_table_get_row (TagTable* self, TagID* tag_id, GError** error) { + TagRow* result = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + TagID _tmp5_ = {0}; + gint64 _tmp6_ = 0LL; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + sqlite3_stmt* _tmp9_ = NULL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + TagRow* row = NULL; + TagRow* _tmp14_ = NULL; + TagRow* _tmp15_ = NULL; + TagID _tmp16_ = {0}; + TagRow* _tmp17_ = NULL; + sqlite3_stmt* _tmp18_ = NULL; + const gchar* _tmp19_ = NULL; + gchar* _tmp20_ = NULL; + TagRow* _tmp21_ = NULL; + sqlite3_stmt* _tmp22_ = NULL; + const gchar* _tmp23_ = NULL; + GeeSet* _tmp24_ = NULL; + TagRow* _tmp25_ = NULL; + sqlite3_stmt* _tmp26_ = NULL; + gint64 _tmp27_ = 0LL; + GError * _inner_error_ = NULL; +#line 135 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_val_if_fail (IS_TAG_TABLE (self), NULL); +#line 135 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_val_if_fail (tag_id != NULL, NULL); +#line 137 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp0_ = database_table_db; +#line 137 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "SELECT name, photo_id_list, time_created FROM TagTable WHERE id=?", -1, &_tmp1_, NULL); +#line 137 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 137 "/home/jens/Source/shotwell/src/db/TagTable.vala" + stmt = _tmp1_; +#line 137 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp2_; +#line 139 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp3_ = res; +#line 139 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 141 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp4_ = stmt; +#line 141 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp5_ = *tag_id; +#line 141 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp6_ = _tmp5_.id; +#line 141 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp7_ = sqlite3_bind_int64 (_tmp4_, 1, _tmp6_); +#line 141 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp7_; +#line 142 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp8_ = res; +#line 142 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _vala_assert (_tmp8_ == SQLITE_OK, "res == Sqlite.OK"); +#line 144 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp9_ = stmt; +#line 144 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp10_ = sqlite3_step (_tmp9_); +#line 144 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp10_; +#line 145 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp11_ = res; +#line 145 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_tmp11_ == SQLITE_DONE) { +#line 146 "/home/jens/Source/shotwell/src/db/TagTable.vala" + result = NULL; +#line 146 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 146 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return result; +#line 1461 "TagTable.c" + } else { + gint _tmp12_ = 0; +#line 147 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp12_ = res; +#line 147 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_tmp12_ != SQLITE_ROW) { +#line 1468 "TagTable.c" + gint _tmp13_ = 0; +#line 148 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp13_ = res; +#line 148 "/home/jens/Source/shotwell/src/db/TagTable.vala" + database_table_throw_error ("TagTable.get_row", _tmp13_, &_inner_error_); +#line 148 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 148 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 148 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_propagate_error (error, _inner_error_); +#line 148 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 148 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return NULL; +#line 1484 "TagTable.c" + } else { +#line 148 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 148 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 148 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_clear_error (&_inner_error_); +#line 148 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return NULL; +#line 1494 "TagTable.c" + } + } + } + } +#line 150 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp14_ = tag_row_new (); +#line 150 "/home/jens/Source/shotwell/src/db/TagTable.vala" + row = _tmp14_; +#line 151 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp15_ = row; +#line 151 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp16_ = *tag_id; +#line 151 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp15_->tag_id = _tmp16_; +#line 152 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp17_ = row; +#line 152 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp18_ = stmt; +#line 152 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp19_ = sqlite3_column_text (_tmp18_, 0); +#line 152 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp20_ = g_strdup (_tmp19_); +#line 152 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_free0 (_tmp17_->name); +#line 152 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp17_->name = _tmp20_; +#line 153 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp21_ = row; +#line 153 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp22_ = stmt; +#line 153 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp23_ = sqlite3_column_text (_tmp22_, 1); +#line 153 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp24_ = tag_table_unserialize_source_ids (self, _tmp23_); +#line 153 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_object_unref0 (_tmp21_->source_id_list); +#line 153 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp21_->source_id_list = _tmp24_; +#line 154 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp25_ = row; +#line 154 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp26_ = stmt; +#line 154 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp27_ = sqlite3_column_int64 (_tmp26_, 2); +#line 154 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp25_->time_created = (time_t) _tmp27_; +#line 156 "/home/jens/Source/shotwell/src/db/TagTable.vala" + result = row; +#line 156 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 156 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return result; +#line 1547 "TagTable.c" +} + + +GeeList* tag_table_get_all_rows (TagTable* self, GError** error) { + GeeList* result = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + GeeList* rows = NULL; + GeeArrayList* _tmp4_ = NULL; + GError * _inner_error_ = NULL; +#line 159 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_val_if_fail (IS_TAG_TABLE (self), NULL); +#line 161 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp0_ = database_table_db; +#line 161 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "SELECT id, name, photo_id_list, time_created FROM TagTable", -1, &_tmp1_, NULL); +#line 161 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 161 "/home/jens/Source/shotwell/src/db/TagTable.vala" + stmt = _tmp1_; +#line 161 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp2_; +#line 163 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp3_ = res; +#line 163 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 165 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp4_ = gee_array_list_new (TYPE_TAG_ROW, (GBoxedCopyFunc) tag_row_ref, tag_row_unref, NULL, NULL, NULL); +#line 165 "/home/jens/Source/shotwell/src/db/TagTable.vala" + rows = G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, GEE_TYPE_LIST, GeeList); +#line 1582 "TagTable.c" + { + gboolean _tmp5_ = FALSE; +#line 167 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp5_ = TRUE; +#line 167 "/home/jens/Source/shotwell/src/db/TagTable.vala" + while (TRUE) { +#line 1589 "TagTable.c" + sqlite3_stmt* _tmp6_ = NULL; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + TagRow* row = NULL; + TagRow* _tmp11_ = NULL; + TagRow* _tmp12_ = NULL; + sqlite3_stmt* _tmp13_ = NULL; + gint64 _tmp14_ = 0LL; + TagRow* _tmp15_ = NULL; + sqlite3_stmt* _tmp16_ = NULL; + const gchar* _tmp17_ = NULL; + gchar* _tmp18_ = NULL; + TagRow* _tmp19_ = NULL; + sqlite3_stmt* _tmp20_ = NULL; + const gchar* _tmp21_ = NULL; + GeeSet* _tmp22_ = NULL; + TagRow* _tmp23_ = NULL; + sqlite3_stmt* _tmp24_ = NULL; + gint64 _tmp25_ = 0LL; + GeeList* _tmp26_ = NULL; + TagRow* _tmp27_ = NULL; +#line 167 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (!_tmp5_) { +#line 1613 "TagTable.c" + } +#line 167 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp5_ = FALSE; +#line 168 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp6_ = stmt; +#line 168 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp7_ = sqlite3_step (_tmp6_); +#line 168 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp7_; +#line 169 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp8_ = res; +#line 169 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_tmp8_ == SQLITE_DONE) { +#line 170 "/home/jens/Source/shotwell/src/db/TagTable.vala" + break; +#line 1629 "TagTable.c" + } else { + gint _tmp9_ = 0; +#line 171 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp9_ = res; +#line 171 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_tmp9_ != SQLITE_ROW) { +#line 1636 "TagTable.c" + gint _tmp10_ = 0; +#line 172 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp10_ = res; +#line 172 "/home/jens/Source/shotwell/src/db/TagTable.vala" + database_table_throw_error ("TagTable.get_all_rows", _tmp10_, &_inner_error_); +#line 172 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 172 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 172 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_propagate_error (error, _inner_error_); +#line 172 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_object_unref0 (rows); +#line 172 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 172 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return NULL; +#line 1654 "TagTable.c" + } else { +#line 172 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_object_unref0 (rows); +#line 172 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 172 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 172 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_clear_error (&_inner_error_); +#line 172 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return NULL; +#line 1666 "TagTable.c" + } + } + } + } +#line 175 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp11_ = tag_row_new (); +#line 175 "/home/jens/Source/shotwell/src/db/TagTable.vala" + row = _tmp11_; +#line 176 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp12_ = row; +#line 176 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp13_ = stmt; +#line 176 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp14_ = sqlite3_column_int64 (_tmp13_, 0); +#line 176 "/home/jens/Source/shotwell/src/db/TagTable.vala" + tag_id_init (&_tmp12_->tag_id, _tmp14_); +#line 177 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp15_ = row; +#line 177 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp16_ = stmt; +#line 177 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp17_ = sqlite3_column_text (_tmp16_, 1); +#line 177 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp18_ = g_strdup (_tmp17_); +#line 177 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_free0 (_tmp15_->name); +#line 177 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp15_->name = _tmp18_; +#line 178 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp19_ = row; +#line 178 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp20_ = stmt; +#line 178 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp21_ = sqlite3_column_text (_tmp20_, 2); +#line 178 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp22_ = tag_table_unserialize_source_ids (self, _tmp21_); +#line 178 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_object_unref0 (_tmp19_->source_id_list); +#line 178 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp19_->source_id_list = _tmp22_; +#line 179 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp23_ = row; +#line 179 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp24_ = stmt; +#line 179 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp25_ = sqlite3_column_int64 (_tmp24_, 3); +#line 179 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp23_->time_created = (time_t) _tmp25_; +#line 181 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp26_ = rows; +#line 181 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp27_ = row; +#line 181 "/home/jens/Source/shotwell/src/db/TagTable.vala" + gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp26_, GEE_TYPE_COLLECTION, GeeCollection), _tmp27_); +#line 167 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tag_row_unref0 (row); +#line 1723 "TagTable.c" + } + } +#line 184 "/home/jens/Source/shotwell/src/db/TagTable.vala" + result = rows; +#line 184 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 184 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return result; +#line 1732 "TagTable.c" +} + + +void tag_table_rename (TagTable* self, TagID* tag_id, const gchar* new_name, GError** error) { + TagID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + const gchar* _tmp2_ = NULL; + GError * _inner_error_ = NULL; +#line 187 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_if_fail (IS_TAG_TABLE (self)); +#line 187 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_if_fail (tag_id != NULL); +#line 187 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_if_fail (new_name != NULL); +#line 188 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp0_ = *tag_id; +#line 188 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp1_ = _tmp0_.id; +#line 188 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp2_ = new_name; +#line 188 "/home/jens/Source/shotwell/src/db/TagTable.vala" + database_table_update_text_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "name", _tmp2_, &_inner_error_); +#line 188 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 188 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 188 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_propagate_error (error, _inner_error_); +#line 188 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return; +#line 1763 "TagTable.c" + } else { +#line 188 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 188 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_clear_error (&_inner_error_); +#line 188 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return; +#line 1771 "TagTable.c" + } + } +} + + +void tag_table_set_tagged_sources (TagTable* self, TagID* tag_id, GeeCollection* source_ids, GError** error) { + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + GeeCollection* _tmp5_ = NULL; + gchar* _tmp6_ = NULL; + GDestroyNotify _tmp7_ = NULL; + gint _tmp8_ = 0; + gint _tmp9_ = 0; + sqlite3_stmt* _tmp10_ = NULL; + TagID _tmp11_ = {0}; + gint64 _tmp12_ = 0LL; + gint _tmp13_ = 0; + gint _tmp14_ = 0; + sqlite3_stmt* _tmp15_ = NULL; + gint _tmp16_ = 0; + gint _tmp17_ = 0; + GError * _inner_error_ = NULL; +#line 191 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_if_fail (IS_TAG_TABLE (self)); +#line 191 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_if_fail (tag_id != NULL); +#line 191 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_if_fail (GEE_IS_COLLECTION (source_ids)); +#line 193 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp0_ = database_table_db; +#line 193 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "UPDATE TagTable SET photo_id_list=? WHERE id=?", -1, &_tmp1_, NULL); +#line 193 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 193 "/home/jens/Source/shotwell/src/db/TagTable.vala" + stmt = _tmp1_; +#line 193 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp2_; +#line 194 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp3_ = res; +#line 194 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 196 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp4_ = stmt; +#line 196 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp5_ = source_ids; +#line 196 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp6_ = tag_table_serialize_source_ids (self, _tmp5_); +#line 196 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp7_ = g_free; +#line 196 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp8_ = sqlite3_bind_text (_tmp4_, 1, _tmp6_, -1, _tmp7_); +#line 196 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp8_; +#line 197 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp9_ = res; +#line 197 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _vala_assert (_tmp9_ == SQLITE_OK, "res == Sqlite.OK"); +#line 198 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp10_ = stmt; +#line 198 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp11_ = *tag_id; +#line 198 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp12_ = _tmp11_.id; +#line 198 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp13_ = sqlite3_bind_int64 (_tmp10_, 2, _tmp12_); +#line 198 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp13_; +#line 199 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp14_ = res; +#line 199 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _vala_assert (_tmp14_ == SQLITE_OK, "res == Sqlite.OK"); +#line 201 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp15_ = stmt; +#line 201 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp16_ = sqlite3_step (_tmp15_); +#line 201 "/home/jens/Source/shotwell/src/db/TagTable.vala" + res = _tmp16_; +#line 202 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp17_ = res; +#line 202 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_tmp17_ != SQLITE_DONE) { +#line 1859 "TagTable.c" + gint _tmp18_ = 0; +#line 203 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp18_ = res; +#line 203 "/home/jens/Source/shotwell/src/db/TagTable.vala" + database_table_throw_error ("TagTable.set_tagged_photos", _tmp18_, &_inner_error_); +#line 203 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 203 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 203 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_propagate_error (error, _inner_error_); +#line 203 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 203 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return; +#line 1875 "TagTable.c" + } else { +#line 203 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 203 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 203 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_clear_error (&_inner_error_); +#line 203 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return; +#line 1885 "TagTable.c" + } + } + } +#line 191 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _sqlite3_finalize0 (stmt); +#line 1891 "TagTable.c" +} + + +static gchar* tag_table_serialize_source_ids (TagTable* self, GeeCollection* source_ids) { + gchar* result = NULL; + GeeCollection* _tmp0_ = NULL; + GString* _result_ = NULL; + GString* _tmp1_ = NULL; + const gchar* _tmp11_ = NULL; + GString* _tmp12_ = NULL; + gssize _tmp13_ = 0L; + gchar* _tmp16_ = NULL; +#line 206 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_val_if_fail (IS_TAG_TABLE (self), NULL); +#line 206 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_val_if_fail ((source_ids == NULL) || GEE_IS_COLLECTION (source_ids), NULL); +#line 207 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp0_ = source_ids; +#line 207 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_tmp0_ == NULL) { +#line 208 "/home/jens/Source/shotwell/src/db/TagTable.vala" + result = NULL; +#line 208 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return result; +#line 1916 "TagTable.c" + } +#line 210 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp1_ = g_string_new (""); +#line 210 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _result_ = _tmp1_; +#line 1922 "TagTable.c" + { + GeeIterator* _source_id_it = NULL; + GeeCollection* _tmp2_ = NULL; + GeeIterator* _tmp3_ = NULL; +#line 212 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp2_ = source_ids; +#line 212 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp3_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, GEE_TYPE_ITERABLE, GeeIterable)); +#line 212 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _source_id_it = _tmp3_; +#line 212 "/home/jens/Source/shotwell/src/db/TagTable.vala" + while (TRUE) { +#line 1935 "TagTable.c" + GeeIterator* _tmp4_ = NULL; + gboolean _tmp5_ = FALSE; + gchar* source_id = NULL; + GeeIterator* _tmp6_ = NULL; + gpointer _tmp7_ = NULL; + GString* _tmp8_ = NULL; + const gchar* _tmp9_ = NULL; + GString* _tmp10_ = NULL; +#line 212 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp4_ = _source_id_it; +#line 212 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp5_ = gee_iterator_next (_tmp4_); +#line 212 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (!_tmp5_) { +#line 212 "/home/jens/Source/shotwell/src/db/TagTable.vala" + break; +#line 1952 "TagTable.c" + } +#line 212 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp6_ = _source_id_it; +#line 212 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp7_ = gee_iterator_get (_tmp6_); +#line 212 "/home/jens/Source/shotwell/src/db/TagTable.vala" + source_id = (gchar*) _tmp7_; +#line 213 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp8_ = _result_; +#line 213 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp9_ = source_id; +#line 213 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_string_append (_tmp8_, _tmp9_); +#line 214 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp10_ = _result_; +#line 214 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_string_append (_tmp10_, ","); +#line 212 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_free0 (source_id); +#line 1972 "TagTable.c" + } +#line 212 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_object_unref0 (_source_id_it); +#line 1976 "TagTable.c" + } +#line 217 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp12_ = _result_; +#line 217 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp13_ = _tmp12_->len; +#line 217 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_tmp13_ != ((gssize) 0)) { +#line 1984 "TagTable.c" + GString* _tmp14_ = NULL; + const gchar* _tmp15_ = NULL; +#line 217 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp14_ = _result_; +#line 217 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp15_ = _tmp14_->str; +#line 217 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp11_ = _tmp15_; +#line 1993 "TagTable.c" + } else { +#line 217 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp11_ = NULL; +#line 1997 "TagTable.c" + } +#line 217 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp16_ = g_strdup (_tmp11_); +#line 217 "/home/jens/Source/shotwell/src/db/TagTable.vala" + result = _tmp16_; +#line 217 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_string_free0 (_result_); +#line 217 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return result; +#line 2007 "TagTable.c" +} + + +static gchar string_get (const gchar* self, glong index) { + gchar result = '\0'; + glong _tmp0_ = 0L; + gchar _tmp1_ = '\0'; +#line 1086 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + g_return_val_if_fail (self != NULL, '\0'); +#line 1087 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _tmp0_ = index; +#line 1087 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + _tmp1_ = ((gchar*) self)[_tmp0_]; +#line 1087 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + result = _tmp1_; +#line 1087 "/usr/share/vala-0.32/vapi/glib-2.0.vapi" + return result; +#line 2025 "TagTable.c" +} + + +static GeeSet* tag_table_unserialize_source_ids (TagTable* self, const gchar* text_list) { + GeeSet* result = NULL; + GeeSet* _result_ = NULL; + GeeHashSet* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + gchar** split = NULL; + const gchar* _tmp2_ = NULL; + gchar** _tmp3_ = NULL; + gchar** _tmp4_ = NULL; + gint split_length1 = 0; + gint _split_size_ = 0; + gchar** _tmp5_ = NULL; + gint _tmp5__length1 = 0; +#line 220 "/home/jens/Source/shotwell/src/db/TagTable.vala" + g_return_val_if_fail (IS_TAG_TABLE (self), NULL); +#line 221 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL, NULL, NULL, NULL); +#line 221 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _result_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_SET, GeeSet); +#line 223 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp1_ = text_list; +#line 223 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_tmp1_ == NULL) { +#line 224 "/home/jens/Source/shotwell/src/db/TagTable.vala" + result = _result_; +#line 224 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return result; +#line 2056 "TagTable.c" + } +#line 226 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp2_ = text_list; +#line 226 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp4_ = _tmp3_ = g_strsplit (_tmp2_, ",", 0); +#line 226 "/home/jens/Source/shotwell/src/db/TagTable.vala" + split = _tmp4_; +#line 226 "/home/jens/Source/shotwell/src/db/TagTable.vala" + split_length1 = _vala_array_length (_tmp3_); +#line 226 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _split_size_ = split_length1; +#line 227 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp5_ = split; +#line 227 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp5__length1 = split_length1; +#line 2072 "TagTable.c" + { + gchar** token_collection = NULL; + gint token_collection_length1 = 0; + gint _token_collection_size_ = 0; + gint token_it = 0; +#line 227 "/home/jens/Source/shotwell/src/db/TagTable.vala" + token_collection = _tmp5_; +#line 227 "/home/jens/Source/shotwell/src/db/TagTable.vala" + token_collection_length1 = _tmp5__length1; +#line 227 "/home/jens/Source/shotwell/src/db/TagTable.vala" + for (token_it = 0; token_it < _tmp5__length1; token_it = token_it + 1) { +#line 2084 "TagTable.c" + gchar* _tmp6_ = NULL; + gchar* token = NULL; +#line 227 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp6_ = g_strdup (token_collection[token_it]); +#line 227 "/home/jens/Source/shotwell/src/db/TagTable.vala" + token = _tmp6_; +#line 2091 "TagTable.c" + { + const gchar* _tmp7_ = NULL; + gboolean _tmp8_ = FALSE; + const gchar* _tmp9_ = NULL; + gchar _tmp10_ = '\0'; + gboolean _tmp11_ = FALSE; +#line 228 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp7_ = token; +#line 228 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp8_ = is_string_empty (_tmp7_); +#line 228 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_tmp8_) { +#line 229 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_free0 (token); +#line 229 "/home/jens/Source/shotwell/src/db/TagTable.vala" + continue; +#line 2108 "TagTable.c" + } +#line 236 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp9_ = token; +#line 236 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp10_ = string_get (_tmp9_, (glong) 0); +#line 236 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp11_ = g_ascii_isdigit (_tmp10_); +#line 236 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_tmp11_) { +#line 2118 "TagTable.c" + GeeSet* _tmp12_ = NULL; + const gchar* _tmp13_ = NULL; + gint64 _tmp14_ = 0LL; + PhotoID _tmp15_ = {0}; + gchar* _tmp16_ = NULL; + gchar* _tmp17_ = NULL; +#line 238 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp12_ = _result_; +#line 238 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp13_ = token; +#line 238 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp14_ = parse_int64 (_tmp13_, 10); +#line 238 "/home/jens/Source/shotwell/src/db/TagTable.vala" + photo_id_init (&_tmp15_, _tmp14_); +#line 238 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp16_ = photo_id_upgrade_photo_id_to_source_id (&_tmp15_); +#line 238 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp17_ = _tmp16_; +#line 238 "/home/jens/Source/shotwell/src/db/TagTable.vala" + gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, GEE_TYPE_COLLECTION, GeeCollection), _tmp17_); +#line 238 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_free0 (_tmp17_); +#line 2141 "TagTable.c" + } else { + const gchar* _tmp18_ = NULL; + gchar _tmp19_ = '\0'; + gboolean _tmp20_ = FALSE; +#line 239 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp18_ = token; +#line 239 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp19_ = string_get (_tmp18_, (glong) 0); +#line 239 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp20_ = g_ascii_isalpha (_tmp19_); +#line 239 "/home/jens/Source/shotwell/src/db/TagTable.vala" + if (_tmp20_) { +#line 2154 "TagTable.c" + GeeSet* _tmp21_ = NULL; + const gchar* _tmp22_ = NULL; +#line 241 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp21_ = _result_; +#line 241 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _tmp22_ = token; +#line 241 "/home/jens/Source/shotwell/src/db/TagTable.vala" + gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, GEE_TYPE_COLLECTION, GeeCollection), _tmp22_); +#line 2163 "TagTable.c" + } + } +#line 227 "/home/jens/Source/shotwell/src/db/TagTable.vala" + _g_free0 (token); +#line 2168 "TagTable.c" + } + } + } +#line 245 "/home/jens/Source/shotwell/src/db/TagTable.vala" + result = _result_; +#line 245 "/home/jens/Source/shotwell/src/db/TagTable.vala" + split = (_vala_array_free (split, split_length1, (GDestroyNotify) g_free), NULL); +#line 245 "/home/jens/Source/shotwell/src/db/TagTable.vala" + return result; +#line 2178 "TagTable.c" +} + + +static void tag_table_class_init (TagTableClass * klass) { +#line 32 "/home/jens/Source/shotwell/src/db/TagTable.vala" + tag_table_parent_class = g_type_class_peek_parent (klass); +#line 32 "/home/jens/Source/shotwell/src/db/TagTable.vala" + ((DatabaseTableClass *) klass)->finalize = tag_table_finalize; +#line 2187 "TagTable.c" +} + + +static void tag_table_instance_init (TagTable * self) { +} + + +static void tag_table_finalize (DatabaseTable* obj) { + TagTable * self; +#line 32 "/home/jens/Source/shotwell/src/db/TagTable.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TAG_TABLE, TagTable); +#line 32 "/home/jens/Source/shotwell/src/db/TagTable.vala" + DATABASE_TABLE_CLASS (tag_table_parent_class)->finalize (obj); +#line 2201 "TagTable.c" +} + + +GType tag_table_get_type (void) { + static volatile gsize tag_table_type_id__volatile = 0; + if (g_once_init_enter (&tag_table_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (TagTableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tag_table_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TagTable), 0, (GInstanceInitFunc) tag_table_instance_init, NULL }; + GType tag_table_type_id; + tag_table_type_id = g_type_register_static (TYPE_DATABASE_TABLE, "TagTable", &g_define_type_info, 0); + g_once_init_leave (&tag_table_type_id__volatile, tag_table_type_id); + } + return tag_table_type_id__volatile; +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + +static gint _vala_array_length (gpointer array) { + int length; + length = 0; + if (array) { + while (((gpointer*) array)[length]) { + length++; + } + } + return length; +} + + + diff --git a/src/db/TombstoneTable.c b/src/db/TombstoneTable.c new file mode 100644 index 0000000..542e568 --- /dev/null +++ b/src/db/TombstoneTable.c @@ -0,0 +1,1295 @@ +/* TombstoneTable.c generated by valac 0.32.1, the Vala compiler + * generated from TombstoneTable.vala, do not modify */ + +/* 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. + */ + +#include +#include +#include +#include +#include +#include +#include + + +#define TYPE_TOMBSTONE_ID (tombstone_id_get_type ()) +typedef struct _TombstoneID TombstoneID; + +#define TYPE_TOMBSTONE_ROW (tombstone_row_get_type ()) +#define TOMBSTONE_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TOMBSTONE_ROW, TombstoneRow)) +#define TOMBSTONE_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TOMBSTONE_ROW, TombstoneRowClass)) +#define IS_TOMBSTONE_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TOMBSTONE_ROW)) +#define IS_TOMBSTONE_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TOMBSTONE_ROW)) +#define TOMBSTONE_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TOMBSTONE_ROW, TombstoneRowClass)) + +typedef struct _TombstoneRow TombstoneRow; +typedef struct _TombstoneRowClass TombstoneRowClass; +typedef struct _TombstoneRowPrivate TombstoneRowPrivate; + +#define TOMBSTONE_TYPE_REASON (tombstone_reason_get_type ()) +#define _g_free0(var) (var = (g_free (var), NULL)) +typedef struct _ParamSpecTombstoneRow ParamSpecTombstoneRow; + +#define TYPE_DATABASE_TABLE (database_table_get_type ()) +#define DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATABASE_TABLE, DatabaseTable)) +#define DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATABASE_TABLE, DatabaseTableClass)) +#define IS_DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATABASE_TABLE)) +#define IS_DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATABASE_TABLE)) +#define DATABASE_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATABASE_TABLE, DatabaseTableClass)) + +typedef struct _DatabaseTable DatabaseTable; +typedef struct _DatabaseTableClass DatabaseTableClass; +typedef struct _DatabaseTablePrivate DatabaseTablePrivate; + +#define TYPE_TOMBSTONE_TABLE (tombstone_table_get_type ()) +#define TOMBSTONE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TOMBSTONE_TABLE, TombstoneTable)) +#define TOMBSTONE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TOMBSTONE_TABLE, TombstoneTableClass)) +#define IS_TOMBSTONE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TOMBSTONE_TABLE)) +#define IS_TOMBSTONE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TOMBSTONE_TABLE)) +#define TOMBSTONE_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TOMBSTONE_TABLE, TombstoneTableClass)) + +typedef struct _TombstoneTable TombstoneTable; +typedef struct _TombstoneTableClass TombstoneTableClass; +typedef struct _TombstoneTablePrivate TombstoneTablePrivate; +#define _sqlite3_finalize0(var) ((var == NULL) ? NULL : (var = (sqlite3_finalize (var), NULL))) +#define _database_table_unref0(var) ((var == NULL) ? NULL : (var = (database_table_unref (var), NULL))) +#define _tombstone_row_unref0(var) ((var == NULL) ? NULL : (var = (tombstone_row_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); +#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } +#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } +#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _TombstoneID { + gint64 id; +}; + +typedef enum { + TOMBSTONE_REASON_REMOVED_BY_USER = 0, + TOMBSTONE_REASON_AUTO_DETECTED_DUPLICATE = 1 +} TombstoneReason; + +struct _TombstoneRow { + GTypeInstance parent_instance; + volatile int ref_count; + TombstoneRowPrivate * priv; + TombstoneID id; + gchar* filepath; + gint64 filesize; + gchar* md5; + time_t time_created; + TombstoneReason reason; +}; + +struct _TombstoneRowClass { + GTypeClass parent_class; + void (*finalize) (TombstoneRow *self); +}; + +struct _ParamSpecTombstoneRow { + GParamSpec parent_instance; +}; + +struct _DatabaseTable { + GTypeInstance parent_instance; + volatile int ref_count; + DatabaseTablePrivate * priv; + gchar* table_name; +}; + +struct _DatabaseTableClass { + GTypeClass parent_class; + void (*finalize) (DatabaseTable *self); +}; + +struct _TombstoneTable { + DatabaseTable parent_instance; + TombstoneTablePrivate * priv; +}; + +struct _TombstoneTableClass { + DatabaseTableClass parent_class; +}; + +typedef enum { + DATABASE_ERROR_ERROR, + DATABASE_ERROR_BACKING, + DATABASE_ERROR_MEMORY, + DATABASE_ERROR_ABORT, + DATABASE_ERROR_LIMITS, + DATABASE_ERROR_TYPESPEC +} DatabaseError; +#define DATABASE_ERROR database_error_quark () + +static gpointer tombstone_row_parent_class = NULL; +static gpointer tombstone_table_parent_class = NULL; +static TombstoneTable* tombstone_table_instance; +static TombstoneTable* tombstone_table_instance = NULL; +extern sqlite3* database_table_db; + +GType tombstone_id_get_type (void) G_GNUC_CONST; +TombstoneID* tombstone_id_dup (const TombstoneID* self); +void tombstone_id_free (TombstoneID* self); +#define TOMBSTONE_ID_INVALID ((gint64) -1) +void tombstone_id_init (TombstoneID *self, gint64 id); +gboolean tombstone_id_is_invalid (TombstoneID *self); +gboolean tombstone_id_is_valid (TombstoneID *self); +gpointer tombstone_row_ref (gpointer instance); +void tombstone_row_unref (gpointer instance); +GParamSpec* param_spec_tombstone_row (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_tombstone_row (GValue* value, gpointer v_object); +void value_take_tombstone_row (GValue* value, gpointer v_object); +gpointer value_get_tombstone_row (const GValue* value); +GType tombstone_row_get_type (void) G_GNUC_CONST; +GType tombstone_reason_get_type (void) G_GNUC_CONST; +enum { + TOMBSTONE_ROW_DUMMY_PROPERTY +}; +TombstoneRow* tombstone_row_new (void); +TombstoneRow* tombstone_row_construct (GType object_type); +static void tombstone_row_finalize (TombstoneRow* obj); +gpointer database_table_ref (gpointer instance); +void database_table_unref (gpointer instance); +GParamSpec* param_spec_database_table (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_database_table (GValue* value, gpointer v_object); +void value_take_database_table (GValue* value, gpointer v_object); +gpointer value_get_database_table (const GValue* value); +GType database_table_get_type (void) G_GNUC_CONST; +GType tombstone_table_get_type (void) G_GNUC_CONST; +enum { + TOMBSTONE_TABLE_DUMMY_PROPERTY +}; +static TombstoneTable* tombstone_table_new (void); +static TombstoneTable* tombstone_table_construct (GType object_type); +DatabaseTable* database_table_construct (GType object_type); +void database_table_set_table_name (DatabaseTable* self, const gchar* table_name); +void database_table_fatal (const gchar* op, gint res); +TombstoneTable* tombstone_table_get_instance (void); +GQuark database_error_quark (void); +TombstoneRow* tombstone_table_add (TombstoneTable* self, const gchar* filepath, gint64 filesize, const gchar* md5, TombstoneReason reason, GError** error); +gulong now_sec (void); +gint tombstone_reason_serialize (TombstoneReason self); +void database_table_throw_error (const gchar* method, gint res, GError** error); +TombstoneRow** tombstone_table_fetch_all (TombstoneTable* self, int* result_length1, GError** error); +gint database_table_get_row_count (DatabaseTable* self); +TombstoneReason tombstone_reason_unserialize (gint value); +void tombstone_table_update_file (TombstoneTable* self, TombstoneID* tombstone_id, const gchar* filepath, GError** error); +void database_table_update_text_by_id_2 (DatabaseTable* self, gint64 id, const gchar* column, const gchar* text, GError** error); +void tombstone_table_remove (TombstoneTable* self, TombstoneID* tombstone_id, GError** error); +void database_table_delete_by_id (DatabaseTable* self, gint64 id, GError** error); +static void tombstone_table_finalize (DatabaseTable* obj); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); + + +void tombstone_id_init (TombstoneID *self, gint64 id) { + gint64 _tmp0_ = 0LL; +#line 12 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + memset (self, 0, sizeof (TombstoneID)); +#line 13 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp0_ = id; +#line 13 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + (*self).id = _tmp0_; +#line 197 "TombstoneTable.c" +} + + +gboolean tombstone_id_is_invalid (TombstoneID *self) { + gboolean result = FALSE; + gint64 _tmp0_ = 0LL; +#line 17 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp0_ = (*self).id; +#line 17 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + result = _tmp0_ == TOMBSTONE_ID_INVALID; +#line 17 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return result; +#line 210 "TombstoneTable.c" +} + + +gboolean tombstone_id_is_valid (TombstoneID *self) { + gboolean result = FALSE; + gint64 _tmp0_ = 0LL; +#line 21 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp0_ = (*self).id; +#line 21 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + result = _tmp0_ != TOMBSTONE_ID_INVALID; +#line 21 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return result; +#line 223 "TombstoneTable.c" +} + + +TombstoneID* tombstone_id_dup (const TombstoneID* self) { + TombstoneID* dup; +#line 7 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + dup = g_new0 (TombstoneID, 1); +#line 7 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + memcpy (dup, self, sizeof (TombstoneID)); +#line 7 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return dup; +#line 235 "TombstoneTable.c" +} + + +void tombstone_id_free (TombstoneID* self) { +#line 7 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_free (self); +#line 242 "TombstoneTable.c" +} + + +GType tombstone_id_get_type (void) { + static volatile gsize tombstone_id_type_id__volatile = 0; + if (g_once_init_enter (&tombstone_id_type_id__volatile)) { + GType tombstone_id_type_id; + tombstone_id_type_id = g_boxed_type_register_static ("TombstoneID", (GBoxedCopyFunc) tombstone_id_dup, (GBoxedFreeFunc) tombstone_id_free); + g_once_init_leave (&tombstone_id_type_id__volatile, tombstone_id_type_id); + } + return tombstone_id_type_id__volatile; +} + + +TombstoneRow* tombstone_row_construct (GType object_type) { + TombstoneRow* self = NULL; +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + self = (TombstoneRow*) g_type_create_instance (object_type); +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return self; +#line 263 "TombstoneTable.c" +} + + +TombstoneRow* tombstone_row_new (void) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return tombstone_row_construct (TYPE_TOMBSTONE_ROW); +#line 270 "TombstoneTable.c" +} + + +static void value_tombstone_row_init (GValue* value) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + value->data[0].v_pointer = NULL; +#line 277 "TombstoneTable.c" +} + + +static void value_tombstone_row_free_value (GValue* value) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (value->data[0].v_pointer) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + tombstone_row_unref (value->data[0].v_pointer); +#line 286 "TombstoneTable.c" + } +} + + +static void value_tombstone_row_copy_value (const GValue* src_value, GValue* dest_value) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (src_value->data[0].v_pointer) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + dest_value->data[0].v_pointer = tombstone_row_ref (src_value->data[0].v_pointer); +#line 296 "TombstoneTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + dest_value->data[0].v_pointer = NULL; +#line 300 "TombstoneTable.c" + } +} + + +static gpointer value_tombstone_row_peek_pointer (const GValue* value) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return value->data[0].v_pointer; +#line 308 "TombstoneTable.c" +} + + +static gchar* value_tombstone_row_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (collect_values[0].v_pointer) { +#line 315 "TombstoneTable.c" + TombstoneRow* object; + object = collect_values[0].v_pointer; +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (object->parent_instance.g_class == NULL) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); +#line 322 "TombstoneTable.c" + } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); +#line 326 "TombstoneTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + value->data[0].v_pointer = tombstone_row_ref (object); +#line 330 "TombstoneTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + value->data[0].v_pointer = NULL; +#line 334 "TombstoneTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return NULL; +#line 338 "TombstoneTable.c" +} + + +static gchar* value_tombstone_row_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + TombstoneRow** object_p; + object_p = collect_values[0].v_pointer; +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (!object_p) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); +#line 349 "TombstoneTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (!value->data[0].v_pointer) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + *object_p = NULL; +#line 355 "TombstoneTable.c" + } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + *object_p = value->data[0].v_pointer; +#line 359 "TombstoneTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + *object_p = tombstone_row_ref (value->data[0].v_pointer); +#line 363 "TombstoneTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return NULL; +#line 367 "TombstoneTable.c" +} + + +GParamSpec* param_spec_tombstone_row (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { + ParamSpecTombstoneRow* spec; +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_return_val_if_fail (g_type_is_a (object_type, TYPE_TOMBSTONE_ROW), NULL); +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + G_PARAM_SPEC (spec)->value_type = object_type; +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return G_PARAM_SPEC (spec); +#line 381 "TombstoneTable.c" +} + + +gpointer value_get_tombstone_row (const GValue* value) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TOMBSTONE_ROW), NULL); +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return value->data[0].v_pointer; +#line 390 "TombstoneTable.c" +} + + +void value_set_tombstone_row (GValue* value, gpointer v_object) { + TombstoneRow* old; +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TOMBSTONE_ROW)); +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + old = value->data[0].v_pointer; +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (v_object) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TOMBSTONE_ROW)); +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + value->data[0].v_pointer = v_object; +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + tombstone_row_ref (value->data[0].v_pointer); +#line 410 "TombstoneTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + value->data[0].v_pointer = NULL; +#line 414 "TombstoneTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (old) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + tombstone_row_unref (old); +#line 420 "TombstoneTable.c" + } +} + + +void value_take_tombstone_row (GValue* value, gpointer v_object) { + TombstoneRow* old; +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TOMBSTONE_ROW)); +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + old = value->data[0].v_pointer; +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (v_object) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TOMBSTONE_ROW)); +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + value->data[0].v_pointer = v_object; +#line 439 "TombstoneTable.c" + } else { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + value->data[0].v_pointer = NULL; +#line 443 "TombstoneTable.c" + } +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (old) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + tombstone_row_unref (old); +#line 449 "TombstoneTable.c" + } +} + + +static void tombstone_row_class_init (TombstoneRowClass * klass) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + tombstone_row_parent_class = g_type_class_peek_parent (klass); +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + ((TombstoneRowClass *) klass)->finalize = tombstone_row_finalize; +#line 459 "TombstoneTable.c" +} + + +static void tombstone_row_instance_init (TombstoneRow * self) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + self->ref_count = 1; +#line 466 "TombstoneTable.c" +} + + +static void tombstone_row_finalize (TombstoneRow* obj) { + TombstoneRow * self; +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TOMBSTONE_ROW, TombstoneRow); +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_signal_handlers_destroy (self); +#line 27 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _g_free0 (self->filepath); +#line 29 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _g_free0 (self->md5); +#line 480 "TombstoneTable.c" +} + + +GType tombstone_row_get_type (void) { + static volatile gsize tombstone_row_type_id__volatile = 0; + if (g_once_init_enter (&tombstone_row_type_id__volatile)) { + static const GTypeValueTable g_define_type_value_table = { value_tombstone_row_init, value_tombstone_row_free_value, value_tombstone_row_copy_value, value_tombstone_row_peek_pointer, "p", value_tombstone_row_collect_value, "p", value_tombstone_row_lcopy_value }; + static const GTypeInfo g_define_type_info = { sizeof (TombstoneRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tombstone_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TombstoneRow), 0, (GInstanceInitFunc) tombstone_row_instance_init, &g_define_type_value_table }; + static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; + GType tombstone_row_type_id; + tombstone_row_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TombstoneRow", &g_define_type_info, &g_define_type_fundamental_info, 0); + g_once_init_leave (&tombstone_row_type_id__volatile, tombstone_row_type_id); + } + return tombstone_row_type_id__volatile; +} + + +gpointer tombstone_row_ref (gpointer instance) { + TombstoneRow* self; + self = instance; +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_atomic_int_inc (&self->ref_count); +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return instance; +#line 505 "TombstoneTable.c" +} + + +void tombstone_row_unref (gpointer instance) { + TombstoneRow* self; + self = instance; +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (g_atomic_int_dec_and_test (&self->ref_count)) { +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + TOMBSTONE_ROW_GET_CLASS (self)->finalize (self); +#line 25 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_type_free_instance ((GTypeInstance *) self); +#line 518 "TombstoneTable.c" + } +} + + +static TombstoneTable* tombstone_table_construct (GType object_type) { + TombstoneTable* self = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; +#line 37 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + self = (TombstoneTable*) database_table_construct (object_type); +#line 38 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + database_table_set_table_name (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), "TombstoneTable"); +#line 41 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp0_ = database_table_db; +#line 41 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "CREATE TABLE IF NOT EXISTS " "TombstoneTable " "(" "id INTEGER PRIMARY KEY, " "filepath TEXT NOT NULL, " "filesize INTEGER, " "md5 TEXT, " "time_created INTEGER, " "reason INTEGER DEFAULT 0 " ")", -1, &_tmp1_, NULL); +#line 41 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _sqlite3_finalize0 (stmt); +#line 41 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + stmt = _tmp1_; +#line 41 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + res = _tmp2_; +#line 51 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp3_ = res; +#line 51 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 53 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp4_ = stmt; +#line 53 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp5_ = sqlite3_step (_tmp4_); +#line 53 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + res = _tmp5_; +#line 54 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp6_ = res; +#line 54 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (_tmp6_ != SQLITE_DONE) { +#line 562 "TombstoneTable.c" + gint _tmp7_ = 0; +#line 55 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp7_ = res; +#line 55 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + database_table_fatal ("create TombstoneTable", _tmp7_); +#line 568 "TombstoneTable.c" + } +#line 37 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _sqlite3_finalize0 (stmt); +#line 37 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return self; +#line 574 "TombstoneTable.c" +} + + +static TombstoneTable* tombstone_table_new (void) { +#line 37 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return tombstone_table_construct (TYPE_TOMBSTONE_TABLE); +#line 581 "TombstoneTable.c" +} + + +static gpointer _database_table_ref0 (gpointer self) { +#line 62 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return self ? database_table_ref (self) : NULL; +#line 588 "TombstoneTable.c" +} + + +TombstoneTable* tombstone_table_get_instance (void) { + TombstoneTable* result = NULL; + TombstoneTable* _tmp0_ = NULL; + TombstoneTable* _tmp2_ = NULL; + TombstoneTable* _tmp3_ = NULL; +#line 59 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp0_ = tombstone_table_instance; +#line 59 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (_tmp0_ == NULL) { +#line 601 "TombstoneTable.c" + TombstoneTable* _tmp1_ = NULL; +#line 60 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp1_ = tombstone_table_new (); +#line 60 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _database_table_unref0 (tombstone_table_instance); +#line 60 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + tombstone_table_instance = _tmp1_; +#line 609 "TombstoneTable.c" + } +#line 62 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp2_ = tombstone_table_instance; +#line 62 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp3_ = _database_table_ref0 (_tmp2_); +#line 62 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + result = _tmp3_; +#line 62 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return result; +#line 619 "TombstoneTable.c" +} + + +TombstoneRow* tombstone_table_add (TombstoneTable* self, const gchar* filepath, gint64 filesize, const gchar* md5, TombstoneReason reason, GError** error) { + TombstoneRow* result = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + time_t time_created = 0; + gulong _tmp4_ = 0UL; + sqlite3_stmt* _tmp5_ = NULL; + const gchar* _tmp6_ = NULL; + gchar* _tmp7_ = NULL; + GDestroyNotify _tmp8_ = NULL; + gint _tmp9_ = 0; + gint _tmp10_ = 0; + sqlite3_stmt* _tmp11_ = NULL; + gint64 _tmp12_ = 0LL; + gint _tmp13_ = 0; + gint _tmp14_ = 0; + sqlite3_stmt* _tmp15_ = NULL; + const gchar* _tmp16_ = NULL; + gchar* _tmp17_ = NULL; + GDestroyNotify _tmp18_ = NULL; + gint _tmp19_ = 0; + gint _tmp20_ = 0; + sqlite3_stmt* _tmp21_ = NULL; + time_t _tmp22_ = 0; + gint _tmp23_ = 0; + gint _tmp24_ = 0; + sqlite3_stmt* _tmp25_ = NULL; + TombstoneReason _tmp26_ = 0; + gint _tmp27_ = 0; + gint _tmp28_ = 0; + gint _tmp29_ = 0; + sqlite3_stmt* _tmp30_ = NULL; + gint _tmp31_ = 0; + gint _tmp32_ = 0; + TombstoneRow* row = NULL; + TombstoneRow* _tmp34_ = NULL; + TombstoneRow* _tmp35_ = NULL; + sqlite3* _tmp36_ = NULL; + gint64 _tmp37_ = 0LL; + TombstoneRow* _tmp38_ = NULL; + const gchar* _tmp39_ = NULL; + gchar* _tmp40_ = NULL; + TombstoneRow* _tmp41_ = NULL; + gint64 _tmp42_ = 0LL; + TombstoneRow* _tmp43_ = NULL; + const gchar* _tmp44_ = NULL; + gchar* _tmp45_ = NULL; + TombstoneRow* _tmp46_ = NULL; + time_t _tmp47_ = 0; + TombstoneRow* _tmp48_ = NULL; + TombstoneReason _tmp49_ = 0; + GError * _inner_error_ = NULL; +#line 65 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_return_val_if_fail (IS_TOMBSTONE_TABLE (self), NULL); +#line 65 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_return_val_if_fail (filepath != NULL, NULL); +#line 68 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp0_ = database_table_db; +#line 68 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "INSERT INTO TombstoneTable " "(filepath, filesize, md5, time_created, reason) " "VALUES (?, ?, ?, ?, ?)", -1, &_tmp1_, NULL); +#line 68 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _sqlite3_finalize0 (stmt); +#line 68 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + stmt = _tmp1_; +#line 68 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + res = _tmp2_; +#line 72 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp3_ = res; +#line 72 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 74 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp4_ = now_sec (); +#line 74 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + time_created = (time_t) _tmp4_; +#line 76 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp5_ = stmt; +#line 76 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp6_ = filepath; +#line 76 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp7_ = g_strdup (_tmp6_); +#line 76 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp8_ = g_free; +#line 76 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp9_ = sqlite3_bind_text (_tmp5_, 1, _tmp7_, -1, _tmp8_); +#line 76 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + res = _tmp9_; +#line 77 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp10_ = res; +#line 77 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _vala_assert (_tmp10_ == SQLITE_OK, "res == Sqlite.OK"); +#line 78 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp11_ = stmt; +#line 78 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp12_ = filesize; +#line 78 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp13_ = sqlite3_bind_int64 (_tmp11_, 2, _tmp12_); +#line 78 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + res = _tmp13_; +#line 79 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp14_ = res; +#line 79 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _vala_assert (_tmp14_ == SQLITE_OK, "res == Sqlite.OK"); +#line 80 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp15_ = stmt; +#line 80 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp16_ = md5; +#line 80 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp17_ = g_strdup (_tmp16_); +#line 80 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp18_ = g_free; +#line 80 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp19_ = sqlite3_bind_text (_tmp15_, 3, _tmp17_, -1, _tmp18_); +#line 80 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + res = _tmp19_; +#line 81 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp20_ = res; +#line 81 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _vala_assert (_tmp20_ == SQLITE_OK, "res == Sqlite.OK"); +#line 82 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp21_ = stmt; +#line 82 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp22_ = time_created; +#line 82 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp23_ = sqlite3_bind_int64 (_tmp21_, 4, (gint64) _tmp22_); +#line 82 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + res = _tmp23_; +#line 83 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp24_ = res; +#line 83 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _vala_assert (_tmp24_ == SQLITE_OK, "res == Sqlite.OK"); +#line 84 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp25_ = stmt; +#line 84 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp26_ = reason; +#line 84 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp27_ = tombstone_reason_serialize (_tmp26_); +#line 84 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp28_ = sqlite3_bind_int (_tmp25_, 5, _tmp27_); +#line 84 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + res = _tmp28_; +#line 85 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp29_ = res; +#line 85 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _vala_assert (_tmp29_ == SQLITE_OK, "res == Sqlite.OK"); +#line 87 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp30_ = stmt; +#line 87 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp31_ = sqlite3_step (_tmp30_); +#line 87 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + res = _tmp31_; +#line 88 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp32_ = res; +#line 88 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (_tmp32_ != SQLITE_DONE) { +#line 781 "TombstoneTable.c" + gint _tmp33_ = 0; +#line 89 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp33_ = res; +#line 89 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + database_table_throw_error ("TombstoneTable.add", _tmp33_, &_inner_error_); +#line 89 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 89 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 89 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_propagate_error (error, _inner_error_); +#line 89 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _sqlite3_finalize0 (stmt); +#line 89 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return NULL; +#line 797 "TombstoneTable.c" + } else { +#line 89 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _sqlite3_finalize0 (stmt); +#line 89 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 89 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_clear_error (&_inner_error_); +#line 89 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return NULL; +#line 807 "TombstoneTable.c" + } + } + } +#line 91 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp34_ = tombstone_row_new (); +#line 91 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + row = _tmp34_; +#line 92 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp35_ = row; +#line 92 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp36_ = database_table_db; +#line 92 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp37_ = sqlite3_last_insert_rowid (_tmp36_); +#line 92 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + tombstone_id_init (&_tmp35_->id, _tmp37_); +#line 93 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp38_ = row; +#line 93 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp39_ = filepath; +#line 93 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp40_ = g_strdup (_tmp39_); +#line 93 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _g_free0 (_tmp38_->filepath); +#line 93 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp38_->filepath = _tmp40_; +#line 94 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp41_ = row; +#line 94 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp42_ = filesize; +#line 94 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp41_->filesize = _tmp42_; +#line 95 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp43_ = row; +#line 95 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp44_ = md5; +#line 95 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp45_ = g_strdup (_tmp44_); +#line 95 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _g_free0 (_tmp43_->md5); +#line 95 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp43_->md5 = _tmp45_; +#line 96 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp46_ = row; +#line 96 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp47_ = time_created; +#line 96 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp46_->time_created = _tmp47_; +#line 97 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp48_ = row; +#line 97 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp49_ = reason; +#line 97 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp48_->reason = _tmp49_; +#line 99 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + result = row; +#line 99 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _sqlite3_finalize0 (stmt); +#line 99 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return result; +#line 867 "TombstoneTable.c" +} + + +static gpointer _tombstone_row_ref0 (gpointer self) { +#line 130 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return self ? tombstone_row_ref (self) : NULL; +#line 874 "TombstoneTable.c" +} + + +TombstoneRow** tombstone_table_fetch_all (TombstoneTable* self, int* result_length1, GError** error) { + TombstoneRow** result = NULL; + gint row_count = 0; + gint _tmp0_ = 0; + gint _tmp1_ = 0; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp3_ = NULL; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + TombstoneRow** rows = NULL; + gint _tmp7_ = 0; + TombstoneRow** _tmp8_ = NULL; + gint rows_length1 = 0; + gint _rows_size_ = 0; + gint index = 0; + gint _tmp42_ = 0; + gint _tmp43_ = 0; + TombstoneRow** _tmp44_ = NULL; + gint _tmp44__length1 = 0; + GError * _inner_error_ = NULL; +#line 102 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_return_val_if_fail (IS_TOMBSTONE_TABLE (self), NULL); +#line 103 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp0_ = database_table_get_row_count (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable)); +#line 103 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + row_count = _tmp0_; +#line 104 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp1_ = row_count; +#line 104 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (_tmp1_ == 0) { +#line 910 "TombstoneTable.c" + TombstoneRow** _tmp2_ = NULL; + gint _tmp2__length1 = 0; +#line 105 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp2_ = NULL; +#line 105 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp2__length1 = 0; +#line 105 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (result_length1) { +#line 105 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + *result_length1 = _tmp2__length1; +#line 921 "TombstoneTable.c" + } +#line 105 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + result = _tmp2_; +#line 105 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return result; +#line 927 "TombstoneTable.c" + } +#line 108 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp3_ = database_table_db; +#line 108 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp5_ = sqlite3_prepare_v2 (_tmp3_, "SELECT id, filepath, filesize, md5, time_created, reason " "FROM TombstoneTable", -1, &_tmp4_, NULL); +#line 108 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _sqlite3_finalize0 (stmt); +#line 108 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + stmt = _tmp4_; +#line 108 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + res = _tmp5_; +#line 110 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp6_ = res; +#line 110 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _vala_assert (_tmp6_ == SQLITE_OK, "res == Sqlite.OK"); +#line 112 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp7_ = row_count; +#line 112 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp8_ = g_new0 (TombstoneRow*, _tmp7_ + 1); +#line 112 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + rows = _tmp8_; +#line 112 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + rows_length1 = _tmp7_; +#line 112 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _rows_size_ = rows_length1; +#line 114 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + index = 0; +#line 955 "TombstoneTable.c" + { + gboolean _tmp9_ = FALSE; +#line 115 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp9_ = TRUE; +#line 115 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + while (TRUE) { +#line 962 "TombstoneTable.c" + sqlite3_stmt* _tmp10_ = NULL; + gint _tmp11_ = 0; + gint _tmp12_ = 0; + TombstoneRow* row = NULL; + TombstoneRow* _tmp15_ = NULL; + TombstoneRow* _tmp16_ = NULL; + sqlite3_stmt* _tmp17_ = NULL; + gint64 _tmp18_ = 0LL; + TombstoneRow* _tmp19_ = NULL; + sqlite3_stmt* _tmp20_ = NULL; + const gchar* _tmp21_ = NULL; + gchar* _tmp22_ = NULL; + TombstoneRow* _tmp23_ = NULL; + sqlite3_stmt* _tmp24_ = NULL; + gint64 _tmp25_ = 0LL; + TombstoneRow* _tmp26_ = NULL; + sqlite3_stmt* _tmp27_ = NULL; + const gchar* _tmp28_ = NULL; + gchar* _tmp29_ = NULL; + TombstoneRow* _tmp30_ = NULL; + sqlite3_stmt* _tmp31_ = NULL; + gint64 _tmp32_ = 0LL; + TombstoneRow* _tmp33_ = NULL; + sqlite3_stmt* _tmp34_ = NULL; + gint _tmp35_ = 0; + TombstoneReason _tmp36_ = 0; + TombstoneRow** _tmp37_ = NULL; + gint _tmp37__length1 = 0; + gint _tmp38_ = 0; + TombstoneRow* _tmp39_ = NULL; + TombstoneRow* _tmp40_ = NULL; + TombstoneRow* _tmp41_ = NULL; +#line 115 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (!_tmp9_) { +#line 997 "TombstoneTable.c" + } +#line 115 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp9_ = FALSE; +#line 116 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp10_ = stmt; +#line 116 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp11_ = sqlite3_step (_tmp10_); +#line 116 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + res = _tmp11_; +#line 117 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp12_ = res; +#line 117 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (_tmp12_ == SQLITE_DONE) { +#line 118 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + break; +#line 1013 "TombstoneTable.c" + } else { + gint _tmp13_ = 0; +#line 119 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp13_ = res; +#line 119 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (_tmp13_ != SQLITE_ROW) { +#line 1020 "TombstoneTable.c" + gint _tmp14_ = 0; +#line 120 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp14_ = res; +#line 120 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + database_table_throw_error ("TombstoneTable.fetch_all", _tmp14_, &_inner_error_); +#line 120 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 120 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 120 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_propagate_error (error, _inner_error_); +#line 120 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + rows = (_vala_array_free (rows, rows_length1, (GDestroyNotify) tombstone_row_unref), NULL); +#line 120 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _sqlite3_finalize0 (stmt); +#line 120 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return NULL; +#line 1038 "TombstoneTable.c" + } else { +#line 120 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + rows = (_vala_array_free (rows, rows_length1, (GDestroyNotify) tombstone_row_unref), NULL); +#line 120 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _sqlite3_finalize0 (stmt); +#line 120 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 120 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_clear_error (&_inner_error_); +#line 120 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return NULL; +#line 1050 "TombstoneTable.c" + } + } + } + } +#line 122 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp15_ = tombstone_row_new (); +#line 122 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + row = _tmp15_; +#line 123 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp16_ = row; +#line 123 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp17_ = stmt; +#line 123 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp18_ = sqlite3_column_int64 (_tmp17_, 0); +#line 123 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + tombstone_id_init (&_tmp16_->id, _tmp18_); +#line 124 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp19_ = row; +#line 124 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp20_ = stmt; +#line 124 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp21_ = sqlite3_column_text (_tmp20_, 1); +#line 124 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp22_ = g_strdup (_tmp21_); +#line 124 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _g_free0 (_tmp19_->filepath); +#line 124 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp19_->filepath = _tmp22_; +#line 125 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp23_ = row; +#line 125 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp24_ = stmt; +#line 125 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp25_ = sqlite3_column_int64 (_tmp24_, 2); +#line 125 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp23_->filesize = _tmp25_; +#line 126 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp26_ = row; +#line 126 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp27_ = stmt; +#line 126 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp28_ = sqlite3_column_text (_tmp27_, 3); +#line 126 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp29_ = g_strdup (_tmp28_); +#line 126 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _g_free0 (_tmp26_->md5); +#line 126 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp26_->md5 = _tmp29_; +#line 127 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp30_ = row; +#line 127 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp31_ = stmt; +#line 127 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp32_ = sqlite3_column_int64 (_tmp31_, 4); +#line 127 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp30_->time_created = (time_t) _tmp32_; +#line 128 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp33_ = row; +#line 128 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp34_ = stmt; +#line 128 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp35_ = sqlite3_column_int (_tmp34_, 5); +#line 128 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp36_ = tombstone_reason_unserialize (_tmp35_); +#line 128 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp33_->reason = _tmp36_; +#line 130 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp37_ = rows; +#line 130 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp37__length1 = rows_length1; +#line 130 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp38_ = index; +#line 130 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + index = _tmp38_ + 1; +#line 130 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp39_ = row; +#line 130 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp40_ = _tombstone_row_ref0 (_tmp39_); +#line 130 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tombstone_row_unref0 (_tmp37_[_tmp38_]); +#line 130 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp37_[_tmp38_] = _tmp40_; +#line 130 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp41_ = _tmp37_[_tmp38_]; +#line 115 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tombstone_row_unref0 (row); +#line 1137 "TombstoneTable.c" + } + } +#line 133 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp42_ = index; +#line 133 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp43_ = row_count; +#line 133 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _vala_assert (_tmp42_ == _tmp43_, "index == row_count"); +#line 135 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp44_ = rows; +#line 135 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp44__length1 = rows_length1; +#line 135 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (result_length1) { +#line 135 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + *result_length1 = _tmp44__length1; +#line 1154 "TombstoneTable.c" + } +#line 135 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + result = _tmp44_; +#line 135 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _sqlite3_finalize0 (stmt); +#line 135 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return result; +#line 1162 "TombstoneTable.c" +} + + +void tombstone_table_update_file (TombstoneTable* self, TombstoneID* tombstone_id, const gchar* filepath, GError** error) { + TombstoneID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + const gchar* _tmp2_ = NULL; + GError * _inner_error_ = NULL; +#line 138 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_return_if_fail (IS_TOMBSTONE_TABLE (self)); +#line 138 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_return_if_fail (tombstone_id != NULL); +#line 138 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_return_if_fail (filepath != NULL); +#line 139 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp0_ = *tombstone_id; +#line 139 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp1_ = _tmp0_.id; +#line 139 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp2_ = filepath; +#line 139 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + database_table_update_text_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "filepath", _tmp2_, &_inner_error_); +#line 139 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 139 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 139 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_propagate_error (error, _inner_error_); +#line 139 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return; +#line 1193 "TombstoneTable.c" + } else { +#line 139 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 139 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_clear_error (&_inner_error_); +#line 139 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return; +#line 1201 "TombstoneTable.c" + } + } +} + + +void tombstone_table_remove (TombstoneTable* self, TombstoneID* tombstone_id, GError** error) { + TombstoneID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + GError * _inner_error_ = NULL; +#line 142 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_return_if_fail (IS_TOMBSTONE_TABLE (self)); +#line 142 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_return_if_fail (tombstone_id != NULL); +#line 143 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp0_ = *tombstone_id; +#line 143 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + _tmp1_ = _tmp0_.id; +#line 143 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + database_table_delete_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, &_inner_error_); +#line 143 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 143 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 143 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_propagate_error (error, _inner_error_); +#line 143 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return; +#line 1229 "TombstoneTable.c" + } else { +#line 143 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 143 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + g_clear_error (&_inner_error_); +#line 143 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + return; +#line 1237 "TombstoneTable.c" + } + } +} + + +static void tombstone_table_class_init (TombstoneTableClass * klass) { +#line 34 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + tombstone_table_parent_class = g_type_class_peek_parent (klass); +#line 34 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + ((DatabaseTableClass *) klass)->finalize = tombstone_table_finalize; +#line 1248 "TombstoneTable.c" +} + + +static void tombstone_table_instance_init (TombstoneTable * self) { +} + + +static void tombstone_table_finalize (DatabaseTable* obj) { + TombstoneTable * self; +#line 34 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TOMBSTONE_TABLE, TombstoneTable); +#line 34 "/home/jens/Source/shotwell/src/db/TombstoneTable.vala" + DATABASE_TABLE_CLASS (tombstone_table_parent_class)->finalize (obj); +#line 1262 "TombstoneTable.c" +} + + +GType tombstone_table_get_type (void) { + static volatile gsize tombstone_table_type_id__volatile = 0; + if (g_once_init_enter (&tombstone_table_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (TombstoneTableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tombstone_table_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TombstoneTable), 0, (GInstanceInitFunc) tombstone_table_instance_init, NULL }; + GType tombstone_table_type_id; + tombstone_table_type_id = g_type_register_static (TYPE_DATABASE_TABLE, "TombstoneTable", &g_define_type_info, 0); + g_once_init_leave (&tombstone_table_type_id__volatile, tombstone_table_type_id); + } + return tombstone_table_type_id__volatile; +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + + diff --git a/src/db/VersionTable.c b/src/db/VersionTable.c new file mode 100644 index 0000000..fa79d52 --- /dev/null +++ b/src/db/VersionTable.c @@ -0,0 +1,614 @@ +/* VersionTable.c generated by valac 0.32.1, the Vala compiler + * generated from VersionTable.vala, do not modify */ + +/* 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. + */ + +#include +#include +#include +#include +#include + + +#define TYPE_DATABASE_TABLE (database_table_get_type ()) +#define DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATABASE_TABLE, DatabaseTable)) +#define DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATABASE_TABLE, DatabaseTableClass)) +#define IS_DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATABASE_TABLE)) +#define IS_DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATABASE_TABLE)) +#define DATABASE_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATABASE_TABLE, DatabaseTableClass)) + +typedef struct _DatabaseTable DatabaseTable; +typedef struct _DatabaseTableClass DatabaseTableClass; +typedef struct _DatabaseTablePrivate DatabaseTablePrivate; + +#define TYPE_VERSION_TABLE (version_table_get_type ()) +#define VERSION_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_VERSION_TABLE, VersionTable)) +#define VERSION_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_VERSION_TABLE, VersionTableClass)) +#define IS_VERSION_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_VERSION_TABLE)) +#define IS_VERSION_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_VERSION_TABLE)) +#define VERSION_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_VERSION_TABLE, VersionTableClass)) + +typedef struct _VersionTable VersionTable; +typedef struct _VersionTableClass VersionTableClass; +typedef struct _VersionTablePrivate VersionTablePrivate; +#define _sqlite3_finalize0(var) ((var == NULL) ? NULL : (var = (sqlite3_finalize (var), NULL))) +#define _database_table_unref0(var) ((var == NULL) ? NULL : (var = (database_table_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); +#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } +#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } +#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _DatabaseTable { + GTypeInstance parent_instance; + volatile int ref_count; + DatabaseTablePrivate * priv; + gchar* table_name; +}; + +struct _DatabaseTableClass { + GTypeClass parent_class; + void (*finalize) (DatabaseTable *self); +}; + +struct _VersionTable { + DatabaseTable parent_instance; + VersionTablePrivate * priv; +}; + +struct _VersionTableClass { + DatabaseTableClass parent_class; +}; + + +static gpointer version_table_parent_class = NULL; +static VersionTable* version_table_instance; +static VersionTable* version_table_instance = NULL; +extern sqlite3* database_table_db; + +gpointer database_table_ref (gpointer instance); +void database_table_unref (gpointer instance); +GParamSpec* param_spec_database_table (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_database_table (GValue* value, gpointer v_object); +void value_take_database_table (GValue* value, gpointer v_object); +gpointer value_get_database_table (const GValue* value); +GType database_table_get_type (void) G_GNUC_CONST; +GType version_table_get_type (void) G_GNUC_CONST; +enum { + VERSION_TABLE_DUMMY_PROPERTY +}; +static VersionTable* version_table_new (void); +static VersionTable* version_table_construct (GType object_type); +DatabaseTable* database_table_construct (GType object_type); +void database_table_fatal (const gchar* op, gint res); +void database_table_set_table_name (DatabaseTable* self, const gchar* table_name); +VersionTable* version_table_get_instance (void); +gint version_table_get_version (VersionTable* self, gchar** app_version); +void version_table_set_version (VersionTable* self, gint version, const gchar* app_version, const gchar* user_data); +void version_table_update_version (VersionTable* self, gint version, const gchar* app_version); +static void version_table_finalize (DatabaseTable* obj); + + +static VersionTable* version_table_construct (GType object_type) { + VersionTable* self = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; +#line 10 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + self = (VersionTable*) database_table_construct (object_type); +#line 12 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp0_ = database_table_db; +#line 12 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "CREATE TABLE IF NOT EXISTS VersionTable (" "id INTEGER PRIMARY KEY, " "schema_version INTEGER, " "app_version TEXT, " "user_data TEXT NULL" ")", -1, &_tmp1_, NULL); +#line 12 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _sqlite3_finalize0 (stmt); +#line 12 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + stmt = _tmp1_; +#line 12 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + res = _tmp2_; +#line 18 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp3_ = res; +#line 18 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 20 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp4_ = stmt; +#line 20 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp5_ = sqlite3_step (_tmp4_); +#line 20 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + res = _tmp5_; +#line 21 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp6_ = res; +#line 21 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + if (_tmp6_ != SQLITE_DONE) { +#line 134 "VersionTable.c" + gint _tmp7_ = 0; +#line 22 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp7_ = res; +#line 22 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + database_table_fatal ("create version table", _tmp7_); +#line 140 "VersionTable.c" + } +#line 24 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + database_table_set_table_name (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), "VersionTable"); +#line 10 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _sqlite3_finalize0 (stmt); +#line 10 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + return self; +#line 148 "VersionTable.c" +} + + +static VersionTable* version_table_new (void) { +#line 10 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + return version_table_construct (TYPE_VERSION_TABLE); +#line 155 "VersionTable.c" +} + + +static gpointer _database_table_ref0 (gpointer self) { +#line 31 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + return self ? database_table_ref (self) : NULL; +#line 162 "VersionTable.c" +} + + +VersionTable* version_table_get_instance (void) { + VersionTable* result = NULL; + VersionTable* _tmp0_ = NULL; + VersionTable* _tmp2_ = NULL; + VersionTable* _tmp3_ = NULL; +#line 28 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp0_ = version_table_instance; +#line 28 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + if (_tmp0_ == NULL) { +#line 175 "VersionTable.c" + VersionTable* _tmp1_ = NULL; +#line 29 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp1_ = version_table_new (); +#line 29 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _database_table_unref0 (version_table_instance); +#line 29 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + version_table_instance = _tmp1_; +#line 183 "VersionTable.c" + } +#line 31 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp2_ = version_table_instance; +#line 31 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp3_ = _database_table_ref0 (_tmp2_); +#line 31 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + result = _tmp3_; +#line 31 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + return result; +#line 193 "VersionTable.c" +} + + +gint version_table_get_version (VersionTable* self, gchar** app_version) { + gchar* _vala_app_version = NULL; + gint result = 0; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + sqlite3_stmt* _tmp9_ = NULL; + const gchar* _tmp10_ = NULL; + gchar* _tmp11_ = NULL; + sqlite3_stmt* _tmp12_ = NULL; + gint _tmp13_ = 0; +#line 34 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + g_return_val_if_fail (IS_VERSION_TABLE (self), 0); +#line 36 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp0_ = database_table_db; +#line 36 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "SELECT schema_version, app_version FROM VersionTable ORDER BY schema_v" \ +"ersion DESC LIMIT 1", -1, &_tmp1_, NULL); +#line 36 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _sqlite3_finalize0 (stmt); +#line 36 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + stmt = _tmp1_; +#line 36 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + res = _tmp2_; +#line 38 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp3_ = res; +#line 38 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 40 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp4_ = stmt; +#line 40 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp5_ = sqlite3_step (_tmp4_); +#line 40 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + res = _tmp5_; +#line 41 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp6_ = res; +#line 41 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + if (_tmp6_ != SQLITE_ROW) { +#line 240 "VersionTable.c" + gint _tmp7_ = 0; +#line 42 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp7_ = res; +#line 42 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + if (_tmp7_ != SQLITE_DONE) { +#line 246 "VersionTable.c" + gint _tmp8_ = 0; +#line 43 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp8_ = res; +#line 43 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + database_table_fatal ("get_version", _tmp8_); +#line 252 "VersionTable.c" + } +#line 45 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _g_free0 (_vala_app_version); +#line 45 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _vala_app_version = NULL; +#line 47 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + result = -1; +#line 47 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _sqlite3_finalize0 (stmt); +#line 47 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + if (app_version) { +#line 47 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + *app_version = _vala_app_version; +#line 266 "VersionTable.c" + } else { +#line 47 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _g_free0 (_vala_app_version); +#line 270 "VersionTable.c" + } +#line 47 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + return result; +#line 274 "VersionTable.c" + } +#line 50 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp9_ = stmt; +#line 50 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp10_ = sqlite3_column_text (_tmp9_, 1); +#line 50 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp11_ = g_strdup (_tmp10_); +#line 50 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _g_free0 (_vala_app_version); +#line 50 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _vala_app_version = _tmp11_; +#line 52 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp12_ = stmt; +#line 52 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp13_ = sqlite3_column_int (_tmp12_, 0); +#line 52 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + result = _tmp13_; +#line 52 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _sqlite3_finalize0 (stmt); +#line 52 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + if (app_version) { +#line 52 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + *app_version = _vala_app_version; +#line 298 "VersionTable.c" + } else { +#line 52 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _g_free0 (_vala_app_version); +#line 302 "VersionTable.c" + } +#line 52 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + return result; +#line 306 "VersionTable.c" +} + + +void version_table_set_version (VersionTable* self, gint version, const gchar* app_version, const gchar* user_data) { + sqlite3_stmt* stmt = NULL; + gchar* bitbucket = NULL; + gchar* _tmp0_ = NULL; + gint _tmp1_ = 0; + gint res = 0; + sqlite3_stmt* _tmp10_ = NULL; + gint _tmp11_ = 0; + gint _tmp12_ = 0; + gint _tmp13_ = 0; + sqlite3_stmt* _tmp14_ = NULL; + const gchar* _tmp15_ = NULL; + gchar* _tmp16_ = NULL; + GDestroyNotify _tmp17_ = NULL; + gint _tmp18_ = 0; + gint _tmp19_ = 0; + sqlite3_stmt* _tmp20_ = NULL; + const gchar* _tmp21_ = NULL; + gchar* _tmp22_ = NULL; + GDestroyNotify _tmp23_ = NULL; + gint _tmp24_ = 0; + gint _tmp25_ = 0; + sqlite3_stmt* _tmp26_ = NULL; + gint _tmp27_ = 0; + gint _tmp28_ = 0; +#line 55 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + g_return_if_fail (IS_VERSION_TABLE (self)); +#line 55 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + g_return_if_fail (app_version != NULL); +#line 59 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp1_ = version_table_get_version (self, &_tmp0_); +#line 59 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _g_free0 (bitbucket); +#line 59 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + bitbucket = _tmp0_; +#line 59 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + if (_tmp1_ != -1) { +#line 347 "VersionTable.c" + gint res = 0; + sqlite3* _tmp2_ = NULL; + sqlite3_stmt* _tmp3_ = NULL; + gint _tmp4_ = 0; + gint _tmp5_ = 0; +#line 61 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp2_ = database_table_db; +#line 61 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp4_ = sqlite3_prepare_v2 (_tmp2_, "UPDATE VersionTable SET schema_version=?, app_version=?, user_data=?", -1, &_tmp3_, NULL); +#line 61 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _sqlite3_finalize0 (stmt); +#line 61 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + stmt = _tmp3_; +#line 61 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + res = _tmp4_; +#line 63 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp5_ = res; +#line 63 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _vala_assert (_tmp5_ == SQLITE_OK, "res == Sqlite.OK"); +#line 367 "VersionTable.c" + } else { + gint res = 0; + sqlite3* _tmp6_ = NULL; + sqlite3_stmt* _tmp7_ = NULL; + gint _tmp8_ = 0; + gint _tmp9_ = 0; +#line 66 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp6_ = database_table_db; +#line 66 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp8_ = sqlite3_prepare_v2 (_tmp6_, "INSERT INTO VersionTable (schema_version, app_version, user_data) VALU" \ +"ES (?,?, ?)", -1, &_tmp7_, NULL); +#line 66 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _sqlite3_finalize0 (stmt); +#line 66 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + stmt = _tmp7_; +#line 66 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + res = _tmp8_; +#line 68 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp9_ = res; +#line 68 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _vala_assert (_tmp9_ == SQLITE_OK, "res == Sqlite.OK"); +#line 388 "VersionTable.c" + } +#line 71 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp10_ = stmt; +#line 71 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp11_ = version; +#line 71 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp12_ = sqlite3_bind_int (_tmp10_, 1, _tmp11_); +#line 71 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + res = _tmp12_; +#line 72 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp13_ = res; +#line 72 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _vala_assert (_tmp13_ == SQLITE_OK, "res == Sqlite.OK"); +#line 73 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp14_ = stmt; +#line 73 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp15_ = app_version; +#line 73 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp16_ = g_strdup (_tmp15_); +#line 73 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp17_ = g_free; +#line 73 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp18_ = sqlite3_bind_text (_tmp14_, 2, _tmp16_, -1, _tmp17_); +#line 73 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + res = _tmp18_; +#line 74 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp19_ = res; +#line 74 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _vala_assert (_tmp19_ == SQLITE_OK, "res == Sqlite.OK"); +#line 75 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp20_ = stmt; +#line 75 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp21_ = user_data; +#line 75 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp22_ = g_strdup (_tmp21_); +#line 75 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp23_ = g_free; +#line 75 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp24_ = sqlite3_bind_text (_tmp20_, 3, _tmp22_, -1, _tmp23_); +#line 75 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + res = _tmp24_; +#line 76 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp25_ = res; +#line 76 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _vala_assert (_tmp25_ == SQLITE_OK, "res == Sqlite.OK"); +#line 78 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp26_ = stmt; +#line 78 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp27_ = sqlite3_step (_tmp26_); +#line 78 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + res = _tmp27_; +#line 79 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp28_ = res; +#line 79 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + if (_tmp28_ != SQLITE_DONE) { +#line 444 "VersionTable.c" + gint _tmp29_ = 0; + const gchar* _tmp30_ = NULL; + const gchar* _tmp31_ = NULL; + gchar* _tmp32_ = NULL; + gchar* _tmp33_ = NULL; + gint _tmp34_ = 0; +#line 80 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp29_ = version; +#line 80 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp30_ = app_version; +#line 80 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp31_ = user_data; +#line 80 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp32_ = g_strdup_printf ("set_version %d %s %s", _tmp29_, _tmp30_, _tmp31_); +#line 80 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp33_ = _tmp32_; +#line 80 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp34_ = res; +#line 80 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + database_table_fatal (_tmp33_, _tmp34_); +#line 80 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _g_free0 (_tmp33_); +#line 467 "VersionTable.c" + } +#line 55 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _g_free0 (bitbucket); +#line 55 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _sqlite3_finalize0 (stmt); +#line 473 "VersionTable.c" +} + + +void version_table_update_version (VersionTable* self, gint version, const gchar* app_version) { + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + gint _tmp7_ = 0; + sqlite3_stmt* _tmp8_ = NULL; + const gchar* _tmp9_ = NULL; + gchar* _tmp10_ = NULL; + GDestroyNotify _tmp11_ = NULL; + gint _tmp12_ = 0; + gint _tmp13_ = 0; + sqlite3_stmt* _tmp14_ = NULL; + gint _tmp15_ = 0; + gint _tmp16_ = 0; +#line 83 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + g_return_if_fail (IS_VERSION_TABLE (self)); +#line 83 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + g_return_if_fail (app_version != NULL); +#line 85 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp0_ = database_table_db; +#line 85 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "UPDATE VersionTable SET schema_version=?, app_version=?", -1, &_tmp1_, NULL); +#line 85 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _sqlite3_finalize0 (stmt); +#line 85 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + stmt = _tmp1_; +#line 85 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + res = _tmp2_; +#line 86 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp3_ = res; +#line 86 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 88 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp4_ = stmt; +#line 88 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp5_ = version; +#line 88 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp6_ = sqlite3_bind_int (_tmp4_, 1, _tmp5_); +#line 88 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + res = _tmp6_; +#line 89 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp7_ = res; +#line 89 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _vala_assert (_tmp7_ == SQLITE_OK, "res == Sqlite.OK"); +#line 90 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp8_ = stmt; +#line 90 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp9_ = app_version; +#line 90 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp10_ = g_strdup (_tmp9_); +#line 90 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp11_ = g_free; +#line 90 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp12_ = sqlite3_bind_text (_tmp8_, 2, _tmp10_, -1, _tmp11_); +#line 90 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + res = _tmp12_; +#line 91 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp13_ = res; +#line 91 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _vala_assert (_tmp13_ == SQLITE_OK, "res == Sqlite.OK"); +#line 93 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp14_ = stmt; +#line 93 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp15_ = sqlite3_step (_tmp14_); +#line 93 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + res = _tmp15_; +#line 94 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp16_ = res; +#line 94 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + if (_tmp16_ != SQLITE_DONE) { +#line 553 "VersionTable.c" + gint _tmp17_ = 0; + gchar* _tmp18_ = NULL; + gchar* _tmp19_ = NULL; + gint _tmp20_ = 0; +#line 95 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp17_ = version; +#line 95 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp18_ = g_strdup_printf ("update_version %d", _tmp17_); +#line 95 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp19_ = _tmp18_; +#line 95 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _tmp20_ = res; +#line 95 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + database_table_fatal (_tmp19_, _tmp20_); +#line 95 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _g_free0 (_tmp19_); +#line 570 "VersionTable.c" + } +#line 83 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + _sqlite3_finalize0 (stmt); +#line 574 "VersionTable.c" +} + + +static void version_table_class_init (VersionTableClass * klass) { +#line 7 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + version_table_parent_class = g_type_class_peek_parent (klass); +#line 7 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + ((DatabaseTableClass *) klass)->finalize = version_table_finalize; +#line 583 "VersionTable.c" +} + + +static void version_table_instance_init (VersionTable * self) { +} + + +static void version_table_finalize (DatabaseTable* obj) { + VersionTable * self; +#line 7 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_VERSION_TABLE, VersionTable); +#line 7 "/home/jens/Source/shotwell/src/db/VersionTable.vala" + DATABASE_TABLE_CLASS (version_table_parent_class)->finalize (obj); +#line 597 "VersionTable.c" +} + + +GType version_table_get_type (void) { + static volatile gsize version_table_type_id__volatile = 0; + if (g_once_init_enter (&version_table_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (VersionTableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) version_table_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (VersionTable), 0, (GInstanceInitFunc) version_table_instance_init, NULL }; + GType version_table_type_id; + version_table_type_id = g_type_register_static (TYPE_DATABASE_TABLE, "VersionTable", &g_define_type_info, 0); + g_once_init_leave (&version_table_type_id__volatile, version_table_type_id); + } + return version_table_type_id__volatile; +} + + + diff --git a/src/db/VideoTable.c b/src/db/VideoTable.c new file mode 100644 index 0000000..8b8d78a --- /dev/null +++ b/src/db/VideoTable.c @@ -0,0 +1,3373 @@ +/* VideoTable.c generated by valac 0.32.1, the Vala compiler + * generated from VideoTable.vala, do not modify */ + +/* 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define TYPE_VIDEO_ID (video_id_get_type ()) +typedef struct _VideoID VideoID; + +#define TYPE_VIDEO_ROW (video_row_get_type ()) +#define VIDEO_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_VIDEO_ROW, VideoRow)) +#define VIDEO_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_VIDEO_ROW, VideoRowClass)) +#define IS_VIDEO_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_VIDEO_ROW)) +#define IS_VIDEO_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_VIDEO_ROW)) +#define VIDEO_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_VIDEO_ROW, VideoRowClass)) + +typedef struct _VideoRow VideoRow; +typedef struct _VideoRowClass VideoRowClass; +typedef struct _VideoRowPrivate VideoRowPrivate; + +#define TYPE_IMPORT_ID (import_id_get_type ()) +typedef struct _ImportID ImportID; + +#define TYPE_EVENT_ID (event_id_get_type ()) +typedef struct _EventID EventID; + +#define TYPE_RATING (rating_get_type ()) +#define _g_free0(var) (var = (g_free (var), NULL)) +typedef struct _ParamSpecVideoRow ParamSpecVideoRow; + +#define TYPE_DATABASE_TABLE (database_table_get_type ()) +#define DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATABASE_TABLE, DatabaseTable)) +#define DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATABASE_TABLE, DatabaseTableClass)) +#define IS_DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATABASE_TABLE)) +#define IS_DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATABASE_TABLE)) +#define DATABASE_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATABASE_TABLE, DatabaseTableClass)) + +typedef struct _DatabaseTable DatabaseTable; +typedef struct _DatabaseTableClass DatabaseTableClass; +typedef struct _DatabaseTablePrivate DatabaseTablePrivate; + +#define TYPE_VIDEO_TABLE (video_table_get_type ()) +#define VIDEO_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_VIDEO_TABLE, VideoTable)) +#define VIDEO_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_VIDEO_TABLE, VideoTableClass)) +#define IS_VIDEO_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_VIDEO_TABLE)) +#define IS_VIDEO_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_VIDEO_TABLE)) +#define VIDEO_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_VIDEO_TABLE, VideoTableClass)) + +typedef struct _VideoTable VideoTable; +typedef struct _VideoTableClass VideoTableClass; +typedef struct _VideoTablePrivate VideoTablePrivate; +#define _sqlite3_finalize0(var) ((var == NULL) ? NULL : (var = (sqlite3_finalize (var), NULL))) +#define _database_table_unref0(var) ((var == NULL) ? NULL : (var = (database_table_unref (var), NULL))) +#define _video_row_unref0(var) ((var == NULL) ? NULL : (var = (video_row_unref (var), NULL))) +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); +#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } +#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } +#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _VideoID { + gint64 id; +}; + +struct _ImportID { + gint64 id; +}; + +struct _EventID { + gint64 id; +}; + +typedef enum { + RATING_REJECTED = -1, + RATING_UNRATED = 0, + RATING_ONE = 1, + RATING_TWO = 2, + RATING_THREE = 3, + RATING_FOUR = 4, + RATING_FIVE = 5 +} Rating; + +struct _VideoRow { + GTypeInstance parent_instance; + volatile int ref_count; + VideoRowPrivate * priv; + VideoID video_id; + gchar* filepath; + gint64 filesize; + time_t timestamp; + gint width; + gint height; + gdouble clip_duration; + gboolean is_interpretable; + time_t exposure_time; + ImportID import_id; + EventID event_id; + gchar* md5; + time_t time_created; + Rating rating; + gchar* title; + gchar* backlinks; + time_t time_reimported; + guint64 flags; + gchar* comment; +}; + +struct _VideoRowClass { + GTypeClass parent_class; + void (*finalize) (VideoRow *self); +}; + +struct _ParamSpecVideoRow { + GParamSpec parent_instance; +}; + +struct _DatabaseTable { + GTypeInstance parent_instance; + volatile int ref_count; + DatabaseTablePrivate * priv; + gchar* table_name; +}; + +struct _DatabaseTableClass { + GTypeClass parent_class; + void (*finalize) (DatabaseTable *self); +}; + +struct _VideoTable { + DatabaseTable parent_instance; + VideoTablePrivate * priv; +}; + +struct _VideoTableClass { + DatabaseTableClass parent_class; +}; + +typedef enum { + DATABASE_ERROR_ERROR, + DATABASE_ERROR_BACKING, + DATABASE_ERROR_MEMORY, + DATABASE_ERROR_ABORT, + DATABASE_ERROR_LIMITS, + DATABASE_ERROR_TYPESPEC +} DatabaseError; +#define DATABASE_ERROR database_error_quark () + +static gpointer video_row_parent_class = NULL; +static gpointer video_table_parent_class = NULL; +static VideoTable* video_table_instance; +static VideoTable* video_table_instance = NULL; +extern sqlite3* database_table_db; + +GType video_id_get_type (void) G_GNUC_CONST; +VideoID* video_id_dup (const VideoID* self); +void video_id_free (VideoID* self); +#define VIDEO_ID_INVALID ((gint64) -1) +void video_id_init (VideoID *self, gint64 id); +gboolean video_id_is_invalid (VideoID *self); +gboolean video_id_is_valid (VideoID *self); +guint video_id_hash (VideoID* a); +guint int64_hash (gint64* n); +gboolean video_id_equal (void* a, void* b); +gchar* video_id_upgrade_video_id_to_source_id (VideoID* video_id); +#define VIDEO_TYPENAME "video" +gpointer video_row_ref (gpointer instance); +void video_row_unref (gpointer instance); +GParamSpec* param_spec_video_row (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_video_row (GValue* value, gpointer v_object); +void value_take_video_row (GValue* value, gpointer v_object); +gpointer value_get_video_row (const GValue* value); +GType video_row_get_type (void) G_GNUC_CONST; +GType import_id_get_type (void) G_GNUC_CONST; +ImportID* import_id_dup (const ImportID* self); +void import_id_free (ImportID* self); +GType event_id_get_type (void) G_GNUC_CONST; +EventID* event_id_dup (const EventID* self); +void event_id_free (EventID* self); +GType rating_get_type (void) G_GNUC_CONST; +enum { + VIDEO_ROW_DUMMY_PROPERTY +}; +VideoRow* video_row_new (void); +VideoRow* video_row_construct (GType object_type); +static void video_row_finalize (VideoRow* obj); +gpointer database_table_ref (gpointer instance); +void database_table_unref (gpointer instance); +GParamSpec* param_spec_database_table (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_database_table (GValue* value, gpointer v_object); +void value_take_database_table (GValue* value, gpointer v_object); +gpointer value_get_database_table (const GValue* value); +GType database_table_get_type (void) G_GNUC_CONST; +GType video_table_get_type (void) G_GNUC_CONST; +enum { + VIDEO_TABLE_DUMMY_PROPERTY +}; +static VideoTable* video_table_new (void); +static VideoTable* video_table_construct (GType object_type); +DatabaseTable* database_table_construct (GType object_type); +void database_table_fatal (const gchar* op, gint res); +void database_table_set_table_name (DatabaseTable* self, const gchar* table_name); +VideoTable* video_table_get_instance (void); +GQuark database_error_quark (void); +void video_table_add (VideoTable* self, VideoRow* video_row, VideoID* result, GError** error); +gulong now_sec (void); +#define EVENT_ID_INVALID ((gint64) -1) +void database_table_throw_error (const gchar* method, gint res, GError** error); +void event_id_init (EventID *self, gint64 id); +gboolean video_table_drop_event (VideoTable* self, EventID* event_id); +VideoRow* video_table_get_row (VideoTable* self, VideoID* video_id); +Rating rating_unserialize (gint value); +GeeArrayList* video_table_get_all (VideoTable* self); +void video_table_set_filepath (VideoTable* self, VideoID* video_id, const gchar* filepath, GError** error); +void database_table_update_text_by_id_2 (DatabaseTable* self, gint64 id, const gchar* column, const gchar* text, GError** error); +void video_table_set_title (VideoTable* self, VideoID* video_id, const gchar* new_title, GError** error); +void video_table_set_comment (VideoTable* self, VideoID* video_id, const gchar* new_comment, GError** error); +void video_table_set_exposure_time (VideoTable* self, VideoID* video_id, time_t time, GError** error); +void database_table_update_int64_by_id_2 (DatabaseTable* self, gint64 id, const gchar* column, gint64 value, GError** error); +void video_table_set_rating (VideoTable* self, VideoID* video_id, Rating rating, GError** error); +gint rating_serialize (Rating self); +void video_table_set_flags (VideoTable* self, VideoID* video_id, guint64 flags, GError** error); +void video_table_update_backlinks (VideoTable* self, VideoID* video_id, const gchar* backlinks, GError** error); +void video_table_update_is_interpretable (VideoTable* self, VideoID* video_id, gboolean is_interpretable, GError** error); +void database_table_update_int_by_id_2 (DatabaseTable* self, gint64 id, const gchar* column, gint value, GError** error); +gboolean video_table_set_event (VideoTable* self, VideoID* video_id, EventID* event_id); +gboolean database_table_update_int64_by_id (DatabaseTable* self, gint64 id, const gchar* column, gint64 value); +void video_table_remove_by_file (VideoTable* self, GFile* file, GError** error); +void video_table_remove (VideoTable* self, VideoID* videoID, GError** error); +gboolean video_table_is_video_stored (VideoTable* self, GFile* file); +void video_table_get_id (VideoTable* self, GFile* file, VideoID* result); +GeeArrayList* video_table_get_videos (VideoTable* self, GError** error); +static sqlite3_stmt* video_table_get_duplicate_stmt (VideoTable* self, GFile* file, const gchar* md5); +gboolean video_table_has_duplicate (VideoTable* self, GFile* file, const gchar* md5); +VideoID* video_table_get_duplicate_ids (VideoTable* self, GFile* file, const gchar* md5, int* result_length1); +static void _vala_array_add3 (VideoID** array, int* length, int* size, const VideoID* value); +GeeArrayList* video_table_get_event_source_ids (VideoTable* self, EventID* event_id); +void video_table_set_timestamp (VideoTable* self, VideoID* video_id, time_t timestamp, GError** error); +static void video_table_finalize (DatabaseTable* obj); + + +void video_id_init (VideoID *self, gint64 id) { + gint64 _tmp0_ = 0LL; +#line 12 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + memset (self, 0, sizeof (VideoID)); +#line 13 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = id; +#line 13 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + (*self).id = _tmp0_; +#line 266 "VideoTable.c" +} + + +gboolean video_id_is_invalid (VideoID *self) { + gboolean result = FALSE; + gint64 _tmp0_ = 0LL; +#line 17 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = (*self).id; +#line 17 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = _tmp0_ == VIDEO_ID_INVALID; +#line 17 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 279 "VideoTable.c" +} + + +gboolean video_id_is_valid (VideoID *self) { + gboolean result = FALSE; + gint64 _tmp0_ = 0LL; +#line 21 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = (*self).id; +#line 21 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = _tmp0_ != VIDEO_ID_INVALID; +#line 21 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 292 "VideoTable.c" +} + + +guint video_id_hash (VideoID* a) { + guint result = 0U; + VideoID* _tmp0_ = NULL; + gint64 _tmp1_ = 0LL; + guint _tmp2_ = 0U; +#line 25 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = a; +#line 25 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp1_ = (*_tmp0_).id; +#line 25 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = int64_hash (&_tmp1_); +#line 25 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = _tmp2_; +#line 25 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 311 "VideoTable.c" +} + + +gboolean video_id_equal (void* a, void* b) { + gboolean result = FALSE; + void* _tmp0_ = NULL; + gint64 _tmp1_ = 0LL; + void* _tmp2_ = NULL; + gint64 _tmp3_ = 0LL; +#line 29 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = a; +#line 29 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp1_ = (*((VideoID*) _tmp0_)).id; +#line 29 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = b; +#line 29 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = (*((VideoID*) _tmp2_)).id; +#line 29 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = _tmp1_ == _tmp3_; +#line 29 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 333 "VideoTable.c" +} + + +gchar* video_id_upgrade_video_id_to_source_id (VideoID* video_id) { + gchar* result = NULL; + VideoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + gchar* _tmp2_ = NULL; +#line 32 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail (video_id != NULL, NULL); +#line 33 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = *video_id; +#line 33 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp1_ = _tmp0_.id; +#line 33 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = g_strdup_printf ("%s-%016" G_GINT64_MODIFIER "x", VIDEO_TYPENAME, _tmp1_); +#line 33 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = _tmp2_; +#line 33 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 354 "VideoTable.c" +} + + +VideoID* video_id_dup (const VideoID* self) { + VideoID* dup; +#line 7 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + dup = g_new0 (VideoID, 1); +#line 7 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + memcpy (dup, self, sizeof (VideoID)); +#line 7 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return dup; +#line 366 "VideoTable.c" +} + + +void video_id_free (VideoID* self) { +#line 7 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_free (self); +#line 373 "VideoTable.c" +} + + +GType video_id_get_type (void) { + static volatile gsize video_id_type_id__volatile = 0; + if (g_once_init_enter (&video_id_type_id__volatile)) { + GType video_id_type_id; + video_id_type_id = g_boxed_type_register_static ("VideoID", (GBoxedCopyFunc) video_id_dup, (GBoxedFreeFunc) video_id_free); + g_once_init_leave (&video_id_type_id__volatile, video_id_type_id); + } + return video_id_type_id__volatile; +} + + +VideoRow* video_row_construct (GType object_type) { + VideoRow* self = NULL; +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + self = (VideoRow*) g_type_create_instance (object_type); +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return self; +#line 394 "VideoTable.c" +} + + +VideoRow* video_row_new (void) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return video_row_construct (TYPE_VIDEO_ROW); +#line 401 "VideoTable.c" +} + + +static void value_video_row_init (GValue* value) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + value->data[0].v_pointer = NULL; +#line 408 "VideoTable.c" +} + + +static void value_video_row_free_value (GValue* value) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (value->data[0].v_pointer) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + video_row_unref (value->data[0].v_pointer); +#line 417 "VideoTable.c" + } +} + + +static void value_video_row_copy_value (const GValue* src_value, GValue* dest_value) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (src_value->data[0].v_pointer) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + dest_value->data[0].v_pointer = video_row_ref (src_value->data[0].v_pointer); +#line 427 "VideoTable.c" + } else { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + dest_value->data[0].v_pointer = NULL; +#line 431 "VideoTable.c" + } +} + + +static gpointer value_video_row_peek_pointer (const GValue* value) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return value->data[0].v_pointer; +#line 439 "VideoTable.c" +} + + +static gchar* value_video_row_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (collect_values[0].v_pointer) { +#line 446 "VideoTable.c" + VideoRow* object; + object = collect_values[0].v_pointer; +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (object->parent_instance.g_class == NULL) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); +#line 453 "VideoTable.c" + } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); +#line 457 "VideoTable.c" + } +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + value->data[0].v_pointer = video_row_ref (object); +#line 461 "VideoTable.c" + } else { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + value->data[0].v_pointer = NULL; +#line 465 "VideoTable.c" + } +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return NULL; +#line 469 "VideoTable.c" +} + + +static gchar* value_video_row_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + VideoRow** object_p; + object_p = collect_values[0].v_pointer; +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (!object_p) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); +#line 480 "VideoTable.c" + } +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (!value->data[0].v_pointer) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + *object_p = NULL; +#line 486 "VideoTable.c" + } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + *object_p = value->data[0].v_pointer; +#line 490 "VideoTable.c" + } else { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + *object_p = video_row_ref (value->data[0].v_pointer); +#line 494 "VideoTable.c" + } +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return NULL; +#line 498 "VideoTable.c" +} + + +GParamSpec* param_spec_video_row (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { + ParamSpecVideoRow* spec; +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail (g_type_is_a (object_type, TYPE_VIDEO_ROW), NULL); +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + G_PARAM_SPEC (spec)->value_type = object_type; +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return G_PARAM_SPEC (spec); +#line 512 "VideoTable.c" +} + + +gpointer value_get_video_row (const GValue* value) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_VIDEO_ROW), NULL); +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return value->data[0].v_pointer; +#line 521 "VideoTable.c" +} + + +void value_set_video_row (GValue* value, gpointer v_object) { + VideoRow* old; +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_VIDEO_ROW)); +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + old = value->data[0].v_pointer; +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (v_object) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_VIDEO_ROW)); +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + value->data[0].v_pointer = v_object; +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + video_row_ref (value->data[0].v_pointer); +#line 541 "VideoTable.c" + } else { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + value->data[0].v_pointer = NULL; +#line 545 "VideoTable.c" + } +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (old) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + video_row_unref (old); +#line 551 "VideoTable.c" + } +} + + +void value_take_video_row (GValue* value, gpointer v_object) { + VideoRow* old; +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_VIDEO_ROW)); +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + old = value->data[0].v_pointer; +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (v_object) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_VIDEO_ROW)); +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + value->data[0].v_pointer = v_object; +#line 570 "VideoTable.c" + } else { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + value->data[0].v_pointer = NULL; +#line 574 "VideoTable.c" + } +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (old) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + video_row_unref (old); +#line 580 "VideoTable.c" + } +} + + +static void video_row_class_init (VideoRowClass * klass) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + video_row_parent_class = g_type_class_peek_parent (klass); +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + ((VideoRowClass *) klass)->finalize = video_row_finalize; +#line 590 "VideoTable.c" +} + + +static void video_row_instance_init (VideoRow * self) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + self->ref_count = 1; +#line 597 "VideoTable.c" +} + + +static void video_row_finalize (VideoRow* obj) { + VideoRow * self; +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_VIDEO_ROW, VideoRow); +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_signal_handlers_destroy (self); +#line 39 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (self->filepath); +#line 49 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (self->md5); +#line 52 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (self->title); +#line 53 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (self->backlinks); +#line 56 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (self->comment); +#line 617 "VideoTable.c" +} + + +GType video_row_get_type (void) { + static volatile gsize video_row_type_id__volatile = 0; + if (g_once_init_enter (&video_row_type_id__volatile)) { + static const GTypeValueTable g_define_type_value_table = { value_video_row_init, value_video_row_free_value, value_video_row_copy_value, value_video_row_peek_pointer, "p", value_video_row_collect_value, "p", value_video_row_lcopy_value }; + static const GTypeInfo g_define_type_info = { sizeof (VideoRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) video_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (VideoRow), 0, (GInstanceInitFunc) video_row_instance_init, &g_define_type_value_table }; + static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; + GType video_row_type_id; + video_row_type_id = g_type_register_fundamental (g_type_fundamental_next (), "VideoRow", &g_define_type_info, &g_define_type_fundamental_info, 0); + g_once_init_leave (&video_row_type_id__volatile, video_row_type_id); + } + return video_row_type_id__volatile; +} + + +gpointer video_row_ref (gpointer instance) { + VideoRow* self; + self = instance; +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_atomic_int_inc (&self->ref_count); +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return instance; +#line 642 "VideoTable.c" +} + + +void video_row_unref (gpointer instance) { + VideoRow* self; + self = instance; +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (g_atomic_int_dec_and_test (&self->ref_count)) { +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + VIDEO_ROW_GET_CLASS (self)->finalize (self); +#line 37 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_type_free_instance ((GTypeInstance *) self); +#line 655 "VideoTable.c" + } +} + + +static VideoTable* video_table_construct (GType object_type) { + VideoTable* self = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + sqlite3_stmt* stmt2 = NULL; + gint res2 = 0; + sqlite3* _tmp8_ = NULL; + sqlite3_stmt* _tmp9_ = NULL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + sqlite3_stmt* _tmp12_ = NULL; + gint _tmp13_ = 0; + gint _tmp14_ = 0; +#line 62 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + self = (VideoTable*) database_table_construct (object_type); +#line 64 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = database_table_db; +#line 64 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "CREATE TABLE IF NOT EXISTS VideoTable (" "id INTEGER PRIMARY KEY, " "filename TEXT UNIQUE NOT NULL, " "width INTEGER, " "height INTEGER, " "clip_duration REAL, " "is_interpretable INTEGER, " "filesize INTEGER, " "timestamp INTEGER, " "exposure_time INTEGER, " "import_id INTEGER, " "event_id INTEGER, " "md5 TEXT, " "time_created INTEGER, " "rating INTEGER DEFAULT 0, " "title TEXT, " "backlinks TEXT, " "time_reimported INTEGER, " "flags INTEGER DEFAULT 0, " "comment TEXT " ")", -1, &_tmp1_, NULL); +#line 64 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 64 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + stmt = _tmp1_; +#line 64 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp2_; +#line 85 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = res; +#line 85 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 87 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp4_ = stmt; +#line 87 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp5_ = sqlite3_step (_tmp4_); +#line 87 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp5_; +#line 88 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp6_ = res; +#line 88 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp6_ != SQLITE_DONE) { +#line 706 "VideoTable.c" + gint _tmp7_ = 0; +#line 89 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp7_ = res; +#line 89 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + database_table_fatal ("VideoTable constructor", _tmp7_); +#line 712 "VideoTable.c" + } +#line 93 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp8_ = database_table_db; +#line 93 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp10_ = sqlite3_prepare_v2 (_tmp8_, "CREATE INDEX IF NOT EXISTS VideoEventIDIndex ON VideoTable (event_id)", -1, &_tmp9_, NULL); +#line 93 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt2); +#line 93 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + stmt2 = _tmp9_; +#line 93 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res2 = _tmp10_; +#line 95 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp11_ = res2; +#line 95 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp11_ == SQLITE_OK, "res2 == Sqlite.OK"); +#line 97 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp12_ = stmt2; +#line 97 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp13_ = sqlite3_step (_tmp12_); +#line 97 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res2 = _tmp13_; +#line 98 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp14_ = res2; +#line 98 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp14_ != SQLITE_DONE) { +#line 738 "VideoTable.c" + gint _tmp15_ = 0; +#line 99 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp15_ = res2; +#line 99 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + database_table_fatal ("VideoTable constructor", _tmp15_); +#line 744 "VideoTable.c" + } +#line 101 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + database_table_set_table_name (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), "VideoTable"); +#line 62 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt2); +#line 62 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 62 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return self; +#line 754 "VideoTable.c" +} + + +static VideoTable* video_table_new (void) { +#line 62 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return video_table_construct (TYPE_VIDEO_TABLE); +#line 761 "VideoTable.c" +} + + +static gpointer _database_table_ref0 (gpointer self) { +#line 108 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return self ? database_table_ref (self) : NULL; +#line 768 "VideoTable.c" +} + + +VideoTable* video_table_get_instance (void) { + VideoTable* result = NULL; + VideoTable* _tmp0_ = NULL; + VideoTable* _tmp2_ = NULL; + VideoTable* _tmp3_ = NULL; +#line 105 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = video_table_instance; +#line 105 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp0_ == NULL) { +#line 781 "VideoTable.c" + VideoTable* _tmp1_ = NULL; +#line 106 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp1_ = video_table_new (); +#line 106 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _database_table_unref0 (video_table_instance); +#line 106 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + video_table_instance = _tmp1_; +#line 789 "VideoTable.c" + } +#line 108 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = video_table_instance; +#line 108 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = _database_table_ref0 (_tmp2_); +#line 108 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = _tmp3_; +#line 108 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 799 "VideoTable.c" +} + + +void video_table_add (VideoTable* self, VideoRow* video_row, VideoID* result, GError** error) { + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + gulong time_created = 0UL; + gulong _tmp4_ = 0UL; + sqlite3_stmt* _tmp5_ = NULL; + VideoRow* _tmp6_ = NULL; + const gchar* _tmp7_ = NULL; + gchar* _tmp8_ = NULL; + GDestroyNotify _tmp9_ = NULL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + sqlite3_stmt* _tmp12_ = NULL; + VideoRow* _tmp13_ = NULL; + gint _tmp14_ = 0; + gint _tmp15_ = 0; + gint _tmp16_ = 0; + sqlite3_stmt* _tmp17_ = NULL; + VideoRow* _tmp18_ = NULL; + gint _tmp19_ = 0; + gint _tmp20_ = 0; + gint _tmp21_ = 0; + sqlite3_stmt* _tmp22_ = NULL; + VideoRow* _tmp23_ = NULL; + gdouble _tmp24_ = 0.0; + gint _tmp25_ = 0; + gint _tmp26_ = 0; + gint _tmp27_ = 0; + VideoRow* _tmp28_ = NULL; + gboolean _tmp29_ = FALSE; + sqlite3_stmt* _tmp30_ = NULL; + gint _tmp31_ = 0; + gint _tmp32_ = 0; + sqlite3_stmt* _tmp33_ = NULL; + VideoRow* _tmp34_ = NULL; + gint64 _tmp35_ = 0LL; + gint _tmp36_ = 0; + gint _tmp37_ = 0; + sqlite3_stmt* _tmp38_ = NULL; + VideoRow* _tmp39_ = NULL; + time_t _tmp40_ = 0; + gint _tmp41_ = 0; + gint _tmp42_ = 0; + sqlite3_stmt* _tmp43_ = NULL; + VideoRow* _tmp44_ = NULL; + time_t _tmp45_ = 0; + gint _tmp46_ = 0; + gint _tmp47_ = 0; + sqlite3_stmt* _tmp48_ = NULL; + VideoRow* _tmp49_ = NULL; + ImportID _tmp50_ = {0}; + gint64 _tmp51_ = 0LL; + gint _tmp52_ = 0; + gint _tmp53_ = 0; + sqlite3_stmt* _tmp54_ = NULL; + gint _tmp55_ = 0; + gint _tmp56_ = 0; + sqlite3_stmt* _tmp57_ = NULL; + VideoRow* _tmp58_ = NULL; + const gchar* _tmp59_ = NULL; + gchar* _tmp60_ = NULL; + GDestroyNotify _tmp61_ = NULL; + gint _tmp62_ = 0; + gint _tmp63_ = 0; + sqlite3_stmt* _tmp64_ = NULL; + gulong _tmp65_ = 0UL; + gint _tmp66_ = 0; + gint _tmp67_ = 0; + sqlite3_stmt* _tmp68_ = NULL; + VideoRow* _tmp69_ = NULL; + const gchar* _tmp70_ = NULL; + gchar* _tmp71_ = NULL; + GDestroyNotify _tmp72_ = NULL; + gint _tmp73_ = 0; + gint _tmp74_ = 0; + sqlite3_stmt* _tmp75_ = NULL; + VideoRow* _tmp76_ = NULL; + const gchar* _tmp77_ = NULL; + gchar* _tmp78_ = NULL; + GDestroyNotify _tmp79_ = NULL; + gint _tmp80_ = 0; + gint _tmp81_ = 0; + sqlite3_stmt* _tmp82_ = NULL; + gint _tmp83_ = 0; + gint _tmp84_ = 0; + VideoRow* _tmp87_ = NULL; + sqlite3* _tmp88_ = NULL; + gint64 _tmp89_ = 0LL; + VideoRow* _tmp90_ = NULL; + VideoRow* _tmp91_ = NULL; + gulong _tmp92_ = 0UL; + VideoRow* _tmp93_ = NULL; + VideoRow* _tmp94_ = NULL; + VideoID _tmp95_ = {0}; + GError * _inner_error_ = NULL; +#line 113 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (IS_VIDEO_TABLE (self)); +#line 113 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (IS_VIDEO_ROW (video_row)); +#line 115 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = database_table_db; +#line 115 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "INSERT INTO VideoTable (filename, width, height, clip_duration, is_int" \ +"erpretable, " "filesize, timestamp, exposure_time, import_id, event_id, md5, time_cre" \ +"ated, title, comment) " "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", -1, &_tmp1_, NULL); +#line 115 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 115 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + stmt = _tmp1_; +#line 115 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp2_; +#line 120 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = res; +#line 120 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 122 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp4_ = now_sec (); +#line 122 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + time_created = _tmp4_; +#line 124 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp5_ = stmt; +#line 124 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp6_ = video_row; +#line 124 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp7_ = _tmp6_->filepath; +#line 124 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp8_ = g_strdup (_tmp7_); +#line 124 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp9_ = g_free; +#line 124 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp10_ = sqlite3_bind_text (_tmp5_, 1, _tmp8_, -1, _tmp9_); +#line 124 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp10_; +#line 125 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp11_ = res; +#line 125 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp11_ == SQLITE_OK, "res == Sqlite.OK"); +#line 126 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp12_ = stmt; +#line 126 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp13_ = video_row; +#line 126 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp14_ = _tmp13_->width; +#line 126 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp15_ = sqlite3_bind_int (_tmp12_, 2, _tmp14_); +#line 126 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp15_; +#line 127 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp16_ = res; +#line 127 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp16_ == SQLITE_OK, "res == Sqlite.OK"); +#line 128 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp17_ = stmt; +#line 128 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp18_ = video_row; +#line 128 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp19_ = _tmp18_->height; +#line 128 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp20_ = sqlite3_bind_int (_tmp17_, 3, _tmp19_); +#line 128 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp20_; +#line 129 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp21_ = res; +#line 129 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp21_ == SQLITE_OK, "res == Sqlite.OK"); +#line 130 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp22_ = stmt; +#line 130 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp23_ = video_row; +#line 130 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp24_ = _tmp23_->clip_duration; +#line 130 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp25_ = sqlite3_bind_double (_tmp22_, 4, _tmp24_); +#line 130 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp25_; +#line 131 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp26_ = res; +#line 131 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp26_ == SQLITE_OK, "res == Sqlite.OK"); +#line 132 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp28_ = video_row; +#line 132 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp29_ = _tmp28_->is_interpretable; +#line 132 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp29_) { +#line 132 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp27_ = 1; +#line 992 "VideoTable.c" + } else { +#line 132 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp27_ = 0; +#line 996 "VideoTable.c" + } +#line 132 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp30_ = stmt; +#line 132 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp31_ = sqlite3_bind_int (_tmp30_, 5, _tmp27_); +#line 132 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp31_; +#line 133 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp32_ = res; +#line 133 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp32_ == SQLITE_OK, "res == Sqlite.OK"); +#line 134 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp33_ = stmt; +#line 134 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp34_ = video_row; +#line 134 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp35_ = _tmp34_->filesize; +#line 134 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp36_ = sqlite3_bind_int64 (_tmp33_, 6, _tmp35_); +#line 134 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp36_; +#line 135 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp37_ = res; +#line 135 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp37_ == SQLITE_OK, "res == Sqlite.OK"); +#line 136 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp38_ = stmt; +#line 136 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp39_ = video_row; +#line 136 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp40_ = _tmp39_->timestamp; +#line 136 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp41_ = sqlite3_bind_int64 (_tmp38_, 7, (gint64) _tmp40_); +#line 136 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp41_; +#line 137 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp42_ = res; +#line 137 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp42_ == SQLITE_OK, "res == Sqlite.OK"); +#line 138 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp43_ = stmt; +#line 138 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp44_ = video_row; +#line 138 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp45_ = _tmp44_->exposure_time; +#line 138 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp46_ = sqlite3_bind_int64 (_tmp43_, 8, (gint64) _tmp45_); +#line 138 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp46_; +#line 139 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp47_ = res; +#line 139 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp47_ == SQLITE_OK, "res == Sqlite.OK"); +#line 140 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp48_ = stmt; +#line 140 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp49_ = video_row; +#line 140 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp50_ = _tmp49_->import_id; +#line 140 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp51_ = _tmp50_.id; +#line 140 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp52_ = sqlite3_bind_int64 (_tmp48_, 9, _tmp51_); +#line 140 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp52_; +#line 141 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp53_ = res; +#line 141 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp53_ == SQLITE_OK, "res == Sqlite.OK"); +#line 142 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp54_ = stmt; +#line 142 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp55_ = sqlite3_bind_int64 (_tmp54_, 10, EVENT_ID_INVALID); +#line 142 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp55_; +#line 143 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp56_ = res; +#line 143 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp56_ == SQLITE_OK, "res == Sqlite.OK"); +#line 144 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp57_ = stmt; +#line 144 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp58_ = video_row; +#line 144 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp59_ = _tmp58_->md5; +#line 144 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp60_ = g_strdup (_tmp59_); +#line 144 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp61_ = g_free; +#line 144 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp62_ = sqlite3_bind_text (_tmp57_, 11, _tmp60_, -1, _tmp61_); +#line 144 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp62_; +#line 145 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp63_ = res; +#line 145 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp63_ == SQLITE_OK, "res == Sqlite.OK"); +#line 146 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp64_ = stmt; +#line 146 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp65_ = time_created; +#line 146 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp66_ = sqlite3_bind_int64 (_tmp64_, 12, (gint64) _tmp65_); +#line 146 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp66_; +#line 147 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp67_ = res; +#line 147 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp67_ == SQLITE_OK, "res == Sqlite.OK"); +#line 148 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp68_ = stmt; +#line 148 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp69_ = video_row; +#line 148 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp70_ = _tmp69_->title; +#line 148 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp71_ = g_strdup (_tmp70_); +#line 148 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp72_ = g_free; +#line 148 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp73_ = sqlite3_bind_text (_tmp68_, 13, _tmp71_, -1, _tmp72_); +#line 148 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp73_; +#line 149 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp74_ = res; +#line 149 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp74_ == SQLITE_OK, "res == Sqlite.OK"); +#line 150 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp75_ = stmt; +#line 150 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp76_ = video_row; +#line 150 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp77_ = _tmp76_->comment; +#line 150 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp78_ = g_strdup (_tmp77_); +#line 150 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp79_ = g_free; +#line 150 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp80_ = sqlite3_bind_text (_tmp75_, 14, _tmp78_, -1, _tmp79_); +#line 150 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp80_; +#line 151 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp81_ = res; +#line 151 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp81_ == SQLITE_OK, "res == Sqlite.OK"); +#line 153 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp82_ = stmt; +#line 153 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp83_ = sqlite3_step (_tmp82_); +#line 153 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp83_; +#line 154 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp84_ = res; +#line 154 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp84_ != SQLITE_DONE) { +#line 1152 "VideoTable.c" + gint _tmp85_ = 0; +#line 155 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp85_ = res; +#line 155 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp85_ != SQLITE_CONSTRAINT) { +#line 1158 "VideoTable.c" + gint _tmp86_ = 0; +#line 156 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp86_ = res; +#line 156 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + database_table_throw_error ("VideoTable.add", _tmp86_, &_inner_error_); +#line 156 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 156 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 156 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_propagate_error (error, _inner_error_); +#line 156 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 156 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 1174 "VideoTable.c" + } else { +#line 156 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 156 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 156 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_clear_error (&_inner_error_); +#line 156 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 1184 "VideoTable.c" + } + } + } + } +#line 160 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp87_ = video_row; +#line 160 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp88_ = database_table_db; +#line 160 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp89_ = sqlite3_last_insert_rowid (_tmp88_); +#line 160 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + video_id_init (&_tmp87_->video_id, _tmp89_); +#line 161 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp90_ = video_row; +#line 161 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + event_id_init (&_tmp90_->event_id, EVENT_ID_INVALID); +#line 162 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp91_ = video_row; +#line 162 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp92_ = time_created; +#line 162 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp91_->time_created = (time_t) _tmp92_; +#line 163 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp93_ = video_row; +#line 163 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp93_->flags = (guint64) 0; +#line 165 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp94_ = video_row; +#line 165 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp95_ = _tmp94_->video_id; +#line 165 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + *result = _tmp95_; +#line 165 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 165 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 1221 "VideoTable.c" +} + + +gboolean video_table_drop_event (VideoTable* self, EventID* event_id) { + gboolean result = FALSE; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + sqlite3_stmt* _tmp7_ = NULL; + EventID _tmp8_ = {0}; + gint64 _tmp9_ = 0LL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + sqlite3_stmt* _tmp12_ = NULL; + gint _tmp13_ = 0; + gint _tmp14_ = 0; +#line 168 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail (IS_VIDEO_TABLE (self), FALSE); +#line 168 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail (event_id != NULL, FALSE); +#line 170 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = database_table_db; +#line 170 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "UPDATE VideoTable SET event_id = ? WHERE event_id = ?", -1, &_tmp1_, NULL); +#line 170 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 170 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + stmt = _tmp1_; +#line 170 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp2_; +#line 171 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = res; +#line 171 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 173 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp4_ = stmt; +#line 173 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp5_ = sqlite3_bind_int64 (_tmp4_, 1, EVENT_ID_INVALID); +#line 173 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp5_; +#line 174 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp6_ = res; +#line 174 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp6_ == SQLITE_OK, "res == Sqlite.OK"); +#line 175 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp7_ = stmt; +#line 175 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp8_ = *event_id; +#line 175 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp9_ = _tmp8_.id; +#line 175 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp10_ = sqlite3_bind_int64 (_tmp7_, 2, _tmp9_); +#line 175 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp10_; +#line 176 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp11_ = res; +#line 176 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp11_ == SQLITE_OK, "res == Sqlite.OK"); +#line 178 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp12_ = stmt; +#line 178 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp13_ = sqlite3_step (_tmp12_); +#line 178 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp13_; +#line 179 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp14_ = res; +#line 179 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp14_ != SQLITE_DONE) { +#line 1296 "VideoTable.c" + gint _tmp15_ = 0; +#line 180 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp15_ = res; +#line 180 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + database_table_fatal ("VideoTable.drop_event", _tmp15_); +#line 182 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = FALSE; +#line 182 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 182 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 1308 "VideoTable.c" + } +#line 185 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = TRUE; +#line 185 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 185 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 1316 "VideoTable.c" +} + + +VideoRow* video_table_get_row (VideoTable* self, VideoID* video_id) { + VideoRow* result = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + VideoID _tmp5_ = {0}; + gint64 _tmp6_ = 0LL; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + sqlite3_stmt* _tmp9_ = NULL; + gint _tmp10_ = 0; + VideoRow* row = NULL; + VideoRow* _tmp11_ = NULL; + VideoRow* _tmp12_ = NULL; + VideoID _tmp13_ = {0}; + VideoRow* _tmp14_ = NULL; + sqlite3_stmt* _tmp15_ = NULL; + const gchar* _tmp16_ = NULL; + gchar* _tmp17_ = NULL; + VideoRow* _tmp18_ = NULL; + sqlite3_stmt* _tmp19_ = NULL; + gint _tmp20_ = 0; + VideoRow* _tmp21_ = NULL; + sqlite3_stmt* _tmp22_ = NULL; + gint _tmp23_ = 0; + VideoRow* _tmp24_ = NULL; + sqlite3_stmt* _tmp25_ = NULL; + gdouble _tmp26_ = 0.0; + VideoRow* _tmp27_ = NULL; + sqlite3_stmt* _tmp28_ = NULL; + gint _tmp29_ = 0; + VideoRow* _tmp30_ = NULL; + sqlite3_stmt* _tmp31_ = NULL; + gint64 _tmp32_ = 0LL; + VideoRow* _tmp33_ = NULL; + sqlite3_stmt* _tmp34_ = NULL; + gint64 _tmp35_ = 0LL; + VideoRow* _tmp36_ = NULL; + sqlite3_stmt* _tmp37_ = NULL; + gint64 _tmp38_ = 0LL; + VideoRow* _tmp39_ = NULL; + sqlite3_stmt* _tmp40_ = NULL; + gint64 _tmp41_ = 0LL; + VideoRow* _tmp42_ = NULL; + sqlite3_stmt* _tmp43_ = NULL; + gint64 _tmp44_ = 0LL; + VideoRow* _tmp45_ = NULL; + sqlite3_stmt* _tmp46_ = NULL; + const gchar* _tmp47_ = NULL; + gchar* _tmp48_ = NULL; + VideoRow* _tmp49_ = NULL; + sqlite3_stmt* _tmp50_ = NULL; + gint64 _tmp51_ = 0LL; + VideoRow* _tmp52_ = NULL; + sqlite3_stmt* _tmp53_ = NULL; + gint _tmp54_ = 0; + Rating _tmp55_ = 0; + VideoRow* _tmp56_ = NULL; + sqlite3_stmt* _tmp57_ = NULL; + const gchar* _tmp58_ = NULL; + gchar* _tmp59_ = NULL; + VideoRow* _tmp60_ = NULL; + sqlite3_stmt* _tmp61_ = NULL; + const gchar* _tmp62_ = NULL; + gchar* _tmp63_ = NULL; + VideoRow* _tmp64_ = NULL; + sqlite3_stmt* _tmp65_ = NULL; + gint64 _tmp66_ = 0LL; + VideoRow* _tmp67_ = NULL; + sqlite3_stmt* _tmp68_ = NULL; + gint64 _tmp69_ = 0LL; + VideoRow* _tmp70_ = NULL; + sqlite3_stmt* _tmp71_ = NULL; + const gchar* _tmp72_ = NULL; + gchar* _tmp73_ = NULL; +#line 188 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail (IS_VIDEO_TABLE (self), NULL); +#line 188 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail (video_id != NULL, NULL); +#line 190 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = database_table_db; +#line 190 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "SELECT filename, width, height, clip_duration, is_interpretable, files" \ +"ize, timestamp, " "exposure_time, import_id, event_id, md5, time_created, rating, title, " \ +"backlinks, " "time_reimported, flags, comment FROM VideoTable WHERE id=?", -1, &_tmp1_, NULL); +#line 190 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 190 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + stmt = _tmp1_; +#line 190 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp2_; +#line 195 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = res; +#line 195 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 197 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp4_ = stmt; +#line 197 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp5_ = *video_id; +#line 197 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp6_ = _tmp5_.id; +#line 197 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp7_ = sqlite3_bind_int64 (_tmp4_, 1, _tmp6_); +#line 197 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp7_; +#line 198 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp8_ = res; +#line 198 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp8_ == SQLITE_OK, "res == Sqlite.OK"); +#line 200 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp9_ = stmt; +#line 200 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp10_ = sqlite3_step (_tmp9_); +#line 200 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp10_ != SQLITE_ROW) { +#line 201 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = NULL; +#line 201 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 201 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 1443 "VideoTable.c" + } +#line 203 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp11_ = video_row_new (); +#line 203 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + row = _tmp11_; +#line 204 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp12_ = row; +#line 204 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp13_ = *video_id; +#line 204 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp12_->video_id = _tmp13_; +#line 205 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp14_ = row; +#line 205 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp15_ = stmt; +#line 205 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp16_ = sqlite3_column_text (_tmp15_, 0); +#line 205 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp17_ = g_strdup (_tmp16_); +#line 205 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (_tmp14_->filepath); +#line 205 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp14_->filepath = _tmp17_; +#line 206 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp18_ = row; +#line 206 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp19_ = stmt; +#line 206 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp20_ = sqlite3_column_int (_tmp19_, 1); +#line 206 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp18_->width = _tmp20_; +#line 207 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp21_ = row; +#line 207 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp22_ = stmt; +#line 207 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp23_ = sqlite3_column_int (_tmp22_, 2); +#line 207 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp21_->height = _tmp23_; +#line 208 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp24_ = row; +#line 208 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp25_ = stmt; +#line 208 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp26_ = sqlite3_column_double (_tmp25_, 3); +#line 208 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp24_->clip_duration = _tmp26_; +#line 209 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp27_ = row; +#line 209 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp28_ = stmt; +#line 209 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp29_ = sqlite3_column_int (_tmp28_, 4); +#line 209 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp27_->is_interpretable = _tmp29_ == 1; +#line 210 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp30_ = row; +#line 210 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp31_ = stmt; +#line 210 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp32_ = sqlite3_column_int64 (_tmp31_, 5); +#line 210 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp30_->filesize = _tmp32_; +#line 211 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp33_ = row; +#line 211 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp34_ = stmt; +#line 211 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp35_ = sqlite3_column_int64 (_tmp34_, 6); +#line 211 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp33_->timestamp = (time_t) _tmp35_; +#line 212 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp36_ = row; +#line 212 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp37_ = stmt; +#line 212 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp38_ = sqlite3_column_int64 (_tmp37_, 7); +#line 212 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp36_->exposure_time = (time_t) _tmp38_; +#line 213 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp39_ = row; +#line 213 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp40_ = stmt; +#line 213 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp41_ = sqlite3_column_int64 (_tmp40_, 8); +#line 213 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp39_->import_id.id = _tmp41_; +#line 214 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp42_ = row; +#line 214 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp43_ = stmt; +#line 214 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp44_ = sqlite3_column_int64 (_tmp43_, 9); +#line 214 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp42_->event_id.id = _tmp44_; +#line 215 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp45_ = row; +#line 215 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp46_ = stmt; +#line 215 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp47_ = sqlite3_column_text (_tmp46_, 10); +#line 215 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp48_ = g_strdup (_tmp47_); +#line 215 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (_tmp45_->md5); +#line 215 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp45_->md5 = _tmp48_; +#line 216 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp49_ = row; +#line 216 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp50_ = stmt; +#line 216 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp51_ = sqlite3_column_int64 (_tmp50_, 11); +#line 216 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp49_->time_created = (time_t) _tmp51_; +#line 217 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp52_ = row; +#line 217 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp53_ = stmt; +#line 217 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp54_ = sqlite3_column_int (_tmp53_, 12); +#line 217 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp55_ = rating_unserialize (_tmp54_); +#line 217 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp52_->rating = _tmp55_; +#line 218 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp56_ = row; +#line 218 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp57_ = stmt; +#line 218 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp58_ = sqlite3_column_text (_tmp57_, 13); +#line 218 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp59_ = g_strdup (_tmp58_); +#line 218 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (_tmp56_->title); +#line 218 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp56_->title = _tmp59_; +#line 219 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp60_ = row; +#line 219 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp61_ = stmt; +#line 219 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp62_ = sqlite3_column_text (_tmp61_, 14); +#line 219 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp63_ = g_strdup (_tmp62_); +#line 219 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (_tmp60_->backlinks); +#line 219 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp60_->backlinks = _tmp63_; +#line 220 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp64_ = row; +#line 220 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp65_ = stmt; +#line 220 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp66_ = sqlite3_column_int64 (_tmp65_, 15); +#line 220 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp64_->time_reimported = (time_t) _tmp66_; +#line 221 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp67_ = row; +#line 221 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp68_ = stmt; +#line 221 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp69_ = sqlite3_column_int64 (_tmp68_, 16); +#line 221 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp67_->flags = (guint64) _tmp69_; +#line 222 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp70_ = row; +#line 222 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp71_ = stmt; +#line 222 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp72_ = sqlite3_column_text (_tmp71_, 17); +#line 222 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp73_ = g_strdup (_tmp72_); +#line 222 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (_tmp70_->comment); +#line 222 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp70_->comment = _tmp73_; +#line 224 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = row; +#line 224 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 224 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 1627 "VideoTable.c" +} + + +GeeArrayList* video_table_get_all (VideoTable* self) { + GeeArrayList* result = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + GeeArrayList* all = NULL; + GeeArrayList* _tmp4_ = NULL; +#line 227 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail (IS_VIDEO_TABLE (self), NULL); +#line 229 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = database_table_db; +#line 229 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "SELECT id, filename, width, height, clip_duration, is_interpretable, f" \ +"ilesize, " "timestamp, exposure_time, import_id, event_id, md5, time_created, rati" \ +"ng, title, " "backlinks, time_reimported, flags, comment FROM VideoTable", -1, &_tmp1_, NULL); +#line 229 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 229 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + stmt = _tmp1_; +#line 229 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp2_; +#line 234 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = res; +#line 234 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 236 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp4_ = gee_array_list_new (TYPE_VIDEO_ROW, (GBoxedCopyFunc) video_row_ref, video_row_unref, NULL, NULL, NULL); +#line 236 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + all = _tmp4_; +#line 238 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + while (TRUE) { +#line 1663 "VideoTable.c" + sqlite3_stmt* _tmp5_ = NULL; + gint _tmp6_ = 0; + gint _tmp7_ = 0; + VideoRow* row = NULL; + VideoRow* _tmp8_ = NULL; + VideoRow* _tmp9_ = NULL; + sqlite3_stmt* _tmp10_ = NULL; + gint64 _tmp11_ = 0LL; + VideoRow* _tmp12_ = NULL; + sqlite3_stmt* _tmp13_ = NULL; + const gchar* _tmp14_ = NULL; + gchar* _tmp15_ = NULL; + VideoRow* _tmp16_ = NULL; + sqlite3_stmt* _tmp17_ = NULL; + gint _tmp18_ = 0; + VideoRow* _tmp19_ = NULL; + sqlite3_stmt* _tmp20_ = NULL; + gint _tmp21_ = 0; + VideoRow* _tmp22_ = NULL; + sqlite3_stmt* _tmp23_ = NULL; + gdouble _tmp24_ = 0.0; + VideoRow* _tmp25_ = NULL; + sqlite3_stmt* _tmp26_ = NULL; + gint _tmp27_ = 0; + VideoRow* _tmp28_ = NULL; + sqlite3_stmt* _tmp29_ = NULL; + gint64 _tmp30_ = 0LL; + VideoRow* _tmp31_ = NULL; + sqlite3_stmt* _tmp32_ = NULL; + gint64 _tmp33_ = 0LL; + VideoRow* _tmp34_ = NULL; + sqlite3_stmt* _tmp35_ = NULL; + gint64 _tmp36_ = 0LL; + VideoRow* _tmp37_ = NULL; + sqlite3_stmt* _tmp38_ = NULL; + gint64 _tmp39_ = 0LL; + VideoRow* _tmp40_ = NULL; + sqlite3_stmt* _tmp41_ = NULL; + gint64 _tmp42_ = 0LL; + VideoRow* _tmp43_ = NULL; + sqlite3_stmt* _tmp44_ = NULL; + const gchar* _tmp45_ = NULL; + gchar* _tmp46_ = NULL; + VideoRow* _tmp47_ = NULL; + sqlite3_stmt* _tmp48_ = NULL; + gint64 _tmp49_ = 0LL; + VideoRow* _tmp50_ = NULL; + sqlite3_stmt* _tmp51_ = NULL; + gint _tmp52_ = 0; + Rating _tmp53_ = 0; + VideoRow* _tmp54_ = NULL; + sqlite3_stmt* _tmp55_ = NULL; + const gchar* _tmp56_ = NULL; + gchar* _tmp57_ = NULL; + VideoRow* _tmp58_ = NULL; + sqlite3_stmt* _tmp59_ = NULL; + const gchar* _tmp60_ = NULL; + gchar* _tmp61_ = NULL; + VideoRow* _tmp62_ = NULL; + sqlite3_stmt* _tmp63_ = NULL; + gint64 _tmp64_ = 0LL; + VideoRow* _tmp65_ = NULL; + sqlite3_stmt* _tmp66_ = NULL; + gint64 _tmp67_ = 0LL; + VideoRow* _tmp68_ = NULL; + sqlite3_stmt* _tmp69_ = NULL; + const gchar* _tmp70_ = NULL; + gchar* _tmp71_ = NULL; + GeeArrayList* _tmp72_ = NULL; + VideoRow* _tmp73_ = NULL; +#line 238 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp5_ = stmt; +#line 238 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp6_ = sqlite3_step (_tmp5_); +#line 238 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp6_; +#line 238 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp7_ = res; +#line 238 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (!(_tmp7_ == SQLITE_ROW)) { +#line 238 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + break; +#line 1746 "VideoTable.c" + } +#line 239 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp8_ = video_row_new (); +#line 239 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + row = _tmp8_; +#line 240 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp9_ = row; +#line 240 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp10_ = stmt; +#line 240 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp11_ = sqlite3_column_int64 (_tmp10_, 0); +#line 240 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp9_->video_id.id = _tmp11_; +#line 241 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp12_ = row; +#line 241 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp13_ = stmt; +#line 241 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp14_ = sqlite3_column_text (_tmp13_, 1); +#line 241 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp15_ = g_strdup (_tmp14_); +#line 241 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (_tmp12_->filepath); +#line 241 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp12_->filepath = _tmp15_; +#line 242 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp16_ = row; +#line 242 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp17_ = stmt; +#line 242 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp18_ = sqlite3_column_int (_tmp17_, 2); +#line 242 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp16_->width = _tmp18_; +#line 243 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp19_ = row; +#line 243 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp20_ = stmt; +#line 243 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp21_ = sqlite3_column_int (_tmp20_, 3); +#line 243 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp19_->height = _tmp21_; +#line 244 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp22_ = row; +#line 244 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp23_ = stmt; +#line 244 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp24_ = sqlite3_column_double (_tmp23_, 4); +#line 244 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp22_->clip_duration = _tmp24_; +#line 245 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp25_ = row; +#line 245 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp26_ = stmt; +#line 245 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp27_ = sqlite3_column_int (_tmp26_, 5); +#line 245 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp25_->is_interpretable = _tmp27_ == 1; +#line 246 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp28_ = row; +#line 246 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp29_ = stmt; +#line 246 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp30_ = sqlite3_column_int64 (_tmp29_, 6); +#line 246 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp28_->filesize = _tmp30_; +#line 247 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp31_ = row; +#line 247 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp32_ = stmt; +#line 247 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp33_ = sqlite3_column_int64 (_tmp32_, 7); +#line 247 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp31_->timestamp = (time_t) _tmp33_; +#line 248 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp34_ = row; +#line 248 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp35_ = stmt; +#line 248 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp36_ = sqlite3_column_int64 (_tmp35_, 8); +#line 248 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp34_->exposure_time = (time_t) _tmp36_; +#line 249 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp37_ = row; +#line 249 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp38_ = stmt; +#line 249 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp39_ = sqlite3_column_int64 (_tmp38_, 9); +#line 249 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp37_->import_id.id = _tmp39_; +#line 250 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp40_ = row; +#line 250 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp41_ = stmt; +#line 250 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp42_ = sqlite3_column_int64 (_tmp41_, 10); +#line 250 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp40_->event_id.id = _tmp42_; +#line 251 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp43_ = row; +#line 251 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp44_ = stmt; +#line 251 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp45_ = sqlite3_column_text (_tmp44_, 11); +#line 251 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp46_ = g_strdup (_tmp45_); +#line 251 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (_tmp43_->md5); +#line 251 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp43_->md5 = _tmp46_; +#line 252 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp47_ = row; +#line 252 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp48_ = stmt; +#line 252 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp49_ = sqlite3_column_int64 (_tmp48_, 12); +#line 252 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp47_->time_created = (time_t) _tmp49_; +#line 253 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp50_ = row; +#line 253 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp51_ = stmt; +#line 253 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp52_ = sqlite3_column_int (_tmp51_, 13); +#line 253 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp53_ = rating_unserialize (_tmp52_); +#line 253 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp50_->rating = _tmp53_; +#line 254 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp54_ = row; +#line 254 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp55_ = stmt; +#line 254 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp56_ = sqlite3_column_text (_tmp55_, 14); +#line 254 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp57_ = g_strdup (_tmp56_); +#line 254 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (_tmp54_->title); +#line 254 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp54_->title = _tmp57_; +#line 255 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp58_ = row; +#line 255 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp59_ = stmt; +#line 255 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp60_ = sqlite3_column_text (_tmp59_, 15); +#line 255 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp61_ = g_strdup (_tmp60_); +#line 255 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (_tmp58_->backlinks); +#line 255 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp58_->backlinks = _tmp61_; +#line 256 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp62_ = row; +#line 256 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp63_ = stmt; +#line 256 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp64_ = sqlite3_column_int64 (_tmp63_, 16); +#line 256 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp62_->time_reimported = (time_t) _tmp64_; +#line 257 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp65_ = row; +#line 257 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp66_ = stmt; +#line 257 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp67_ = sqlite3_column_int64 (_tmp66_, 17); +#line 257 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp65_->flags = (guint64) _tmp67_; +#line 258 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp68_ = row; +#line 258 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp69_ = stmt; +#line 258 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp70_ = sqlite3_column_text (_tmp69_, 18); +#line 258 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp71_ = g_strdup (_tmp70_); +#line 258 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (_tmp68_->comment); +#line 258 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp68_->comment = _tmp71_; +#line 260 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp72_ = all; +#line 260 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp73_ = row; +#line 260 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + gee_abstract_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp72_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), _tmp73_); +#line 238 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _video_row_unref0 (row); +#line 1934 "VideoTable.c" + } +#line 263 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = all; +#line 263 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 263 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 1942 "VideoTable.c" +} + + +void video_table_set_filepath (VideoTable* self, VideoID* video_id, const gchar* filepath, GError** error) { + VideoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + const gchar* _tmp2_ = NULL; + GError * _inner_error_ = NULL; +#line 266 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (IS_VIDEO_TABLE (self)); +#line 266 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (video_id != NULL); +#line 266 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (filepath != NULL); +#line 267 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = *video_id; +#line 267 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp1_ = _tmp0_.id; +#line 267 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = filepath; +#line 267 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + database_table_update_text_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "filename", _tmp2_, &_inner_error_); +#line 267 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 267 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 267 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_propagate_error (error, _inner_error_); +#line 267 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 1973 "VideoTable.c" + } else { +#line 267 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 267 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_clear_error (&_inner_error_); +#line 267 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 1981 "VideoTable.c" + } + } +} + + +void video_table_set_title (VideoTable* self, VideoID* video_id, const gchar* new_title, GError** error) { + const gchar* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + VideoID _tmp3_ = {0}; + gint64 _tmp4_ = 0LL; + GError * _inner_error_ = NULL; +#line 270 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (IS_VIDEO_TABLE (self)); +#line 270 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (video_id != NULL); +#line 271 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp1_ = new_title; +#line 271 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp1_ != NULL) { +#line 2001 "VideoTable.c" + const gchar* _tmp2_ = NULL; +#line 271 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = new_title; +#line 271 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = _tmp2_; +#line 2007 "VideoTable.c" + } else { +#line 271 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = ""; +#line 2011 "VideoTable.c" + } +#line 271 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = *video_id; +#line 271 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp4_ = _tmp3_.id; +#line 271 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + database_table_update_text_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp4_, "title", _tmp0_, &_inner_error_); +#line 271 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 271 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 271 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_propagate_error (error, _inner_error_); +#line 271 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 2027 "VideoTable.c" + } else { +#line 271 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 271 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_clear_error (&_inner_error_); +#line 271 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 2035 "VideoTable.c" + } + } +} + + +void video_table_set_comment (VideoTable* self, VideoID* video_id, const gchar* new_comment, GError** error) { + const gchar* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + VideoID _tmp3_ = {0}; + gint64 _tmp4_ = 0LL; + GError * _inner_error_ = NULL; +#line 274 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (IS_VIDEO_TABLE (self)); +#line 274 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (video_id != NULL); +#line 275 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp1_ = new_comment; +#line 275 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp1_ != NULL) { +#line 2055 "VideoTable.c" + const gchar* _tmp2_ = NULL; +#line 275 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = new_comment; +#line 275 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = _tmp2_; +#line 2061 "VideoTable.c" + } else { +#line 275 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = ""; +#line 2065 "VideoTable.c" + } +#line 275 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = *video_id; +#line 275 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp4_ = _tmp3_.id; +#line 275 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + database_table_update_text_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp4_, "comment", _tmp0_, &_inner_error_); +#line 275 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 275 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 275 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_propagate_error (error, _inner_error_); +#line 275 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 2081 "VideoTable.c" + } else { +#line 275 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 275 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_clear_error (&_inner_error_); +#line 275 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 2089 "VideoTable.c" + } + } +} + + +void video_table_set_exposure_time (VideoTable* self, VideoID* video_id, time_t time, GError** error) { + VideoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + time_t _tmp2_ = 0; + GError * _inner_error_ = NULL; +#line 278 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (IS_VIDEO_TABLE (self)); +#line 278 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (video_id != NULL); +#line 279 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = *video_id; +#line 279 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp1_ = _tmp0_.id; +#line 279 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = time; +#line 279 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + database_table_update_int64_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "exposure_time", (gint64) _tmp2_, &_inner_error_); +#line 279 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 279 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 279 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_propagate_error (error, _inner_error_); +#line 279 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 2120 "VideoTable.c" + } else { +#line 279 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 279 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_clear_error (&_inner_error_); +#line 279 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 2128 "VideoTable.c" + } + } +} + + +void video_table_set_rating (VideoTable* self, VideoID* video_id, Rating rating, GError** error) { + VideoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + Rating _tmp2_ = 0; + gint _tmp3_ = 0; + GError * _inner_error_ = NULL; +#line 282 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (IS_VIDEO_TABLE (self)); +#line 282 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (video_id != NULL); +#line 283 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = *video_id; +#line 283 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp1_ = _tmp0_.id; +#line 283 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = rating; +#line 283 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = rating_serialize (_tmp2_); +#line 283 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + database_table_update_int64_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "rating", (gint64) _tmp3_, &_inner_error_); +#line 283 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 283 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 283 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_propagate_error (error, _inner_error_); +#line 283 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 2162 "VideoTable.c" + } else { +#line 283 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 283 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_clear_error (&_inner_error_); +#line 283 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 2170 "VideoTable.c" + } + } +} + + +void video_table_set_flags (VideoTable* self, VideoID* video_id, guint64 flags, GError** error) { + VideoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + guint64 _tmp2_ = 0ULL; + GError * _inner_error_ = NULL; +#line 286 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (IS_VIDEO_TABLE (self)); +#line 286 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (video_id != NULL); +#line 287 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = *video_id; +#line 287 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp1_ = _tmp0_.id; +#line 287 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = flags; +#line 287 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + database_table_update_int64_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "flags", (gint64) _tmp2_, &_inner_error_); +#line 287 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 287 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 287 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_propagate_error (error, _inner_error_); +#line 287 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 2201 "VideoTable.c" + } else { +#line 287 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 287 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_clear_error (&_inner_error_); +#line 287 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 2209 "VideoTable.c" + } + } +} + + +void video_table_update_backlinks (VideoTable* self, VideoID* video_id, const gchar* backlinks, GError** error) { + const gchar* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + VideoID _tmp3_ = {0}; + gint64 _tmp4_ = 0LL; + GError * _inner_error_ = NULL; +#line 290 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (IS_VIDEO_TABLE (self)); +#line 290 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (video_id != NULL); +#line 291 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp1_ = backlinks; +#line 291 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp1_ != NULL) { +#line 2229 "VideoTable.c" + const gchar* _tmp2_ = NULL; +#line 291 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = backlinks; +#line 291 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = _tmp2_; +#line 2235 "VideoTable.c" + } else { +#line 291 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = ""; +#line 2239 "VideoTable.c" + } +#line 291 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = *video_id; +#line 291 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp4_ = _tmp3_.id; +#line 291 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + database_table_update_text_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp4_, "backlinks", _tmp0_, &_inner_error_); +#line 291 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 291 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 291 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_propagate_error (error, _inner_error_); +#line 291 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 2255 "VideoTable.c" + } else { +#line 291 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 291 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_clear_error (&_inner_error_); +#line 291 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 2263 "VideoTable.c" + } + } +} + + +void video_table_update_is_interpretable (VideoTable* self, VideoID* video_id, gboolean is_interpretable, GError** error) { + gint _tmp0_ = 0; + gboolean _tmp1_ = FALSE; + VideoID _tmp2_ = {0}; + gint64 _tmp3_ = 0LL; + GError * _inner_error_ = NULL; +#line 294 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (IS_VIDEO_TABLE (self)); +#line 294 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (video_id != NULL); +#line 295 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp1_ = is_interpretable; +#line 295 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp1_) { +#line 295 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = 1; +#line 2285 "VideoTable.c" + } else { +#line 295 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = 0; +#line 2289 "VideoTable.c" + } +#line 295 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = *video_id; +#line 295 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = _tmp2_.id; +#line 295 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + database_table_update_int_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp3_, "is_interpretable", _tmp0_, &_inner_error_); +#line 295 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 295 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 295 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_propagate_error (error, _inner_error_); +#line 295 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 2305 "VideoTable.c" + } else { +#line 295 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 295 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_clear_error (&_inner_error_); +#line 295 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 2313 "VideoTable.c" + } + } +} + + +gboolean video_table_set_event (VideoTable* self, VideoID* video_id, EventID* event_id) { + gboolean result = FALSE; + VideoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + EventID _tmp2_ = {0}; + gint64 _tmp3_ = 0LL; + gboolean _tmp4_ = FALSE; +#line 298 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail (IS_VIDEO_TABLE (self), FALSE); +#line 298 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail (video_id != NULL, FALSE); +#line 298 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail (event_id != NULL, FALSE); +#line 299 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = *video_id; +#line 299 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp1_ = _tmp0_.id; +#line 299 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = *event_id; +#line 299 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = _tmp2_.id; +#line 299 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp4_ = database_table_update_int64_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "event_id", _tmp3_); +#line 299 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = _tmp4_; +#line 299 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 2346 "VideoTable.c" +} + + +void video_table_remove_by_file (VideoTable* self, GFile* file, GError** error) { + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + GFile* _tmp5_ = NULL; + gchar* _tmp6_ = NULL; + GDestroyNotify _tmp7_ = NULL; + gint _tmp8_ = 0; + gint _tmp9_ = 0; + sqlite3_stmt* _tmp10_ = NULL; + gint _tmp11_ = 0; + gint _tmp12_ = 0; + GError * _inner_error_ = NULL; +#line 302 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (IS_VIDEO_TABLE (self)); +#line 302 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (G_IS_FILE (file)); +#line 304 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = database_table_db; +#line 304 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "DELETE FROM VideoTable WHERE filename=?", -1, &_tmp1_, NULL); +#line 304 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 304 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + stmt = _tmp1_; +#line 304 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp2_; +#line 305 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = res; +#line 305 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 307 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp4_ = stmt; +#line 307 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp5_ = file; +#line 307 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp6_ = g_file_get_path (_tmp5_); +#line 307 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp7_ = g_free; +#line 307 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp8_ = sqlite3_bind_text (_tmp4_, 1, _tmp6_, -1, _tmp7_); +#line 307 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp8_; +#line 308 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp9_ = res; +#line 308 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp9_ == SQLITE_OK, "res == Sqlite.OK"); +#line 310 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp10_ = stmt; +#line 310 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp11_ = sqlite3_step (_tmp10_); +#line 310 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp11_; +#line 311 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp12_ = res; +#line 311 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp12_ != SQLITE_DONE) { +#line 2411 "VideoTable.c" + gint _tmp13_ = 0; +#line 312 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp13_ = res; +#line 312 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + database_table_throw_error ("VideoTable.remove_by_file", _tmp13_, &_inner_error_); +#line 312 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 312 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 312 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_propagate_error (error, _inner_error_); +#line 312 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 312 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 2427 "VideoTable.c" + } else { +#line 312 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 312 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 312 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_clear_error (&_inner_error_); +#line 312 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 2437 "VideoTable.c" + } + } + } +#line 302 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 2443 "VideoTable.c" +} + + +void video_table_remove (VideoTable* self, VideoID* videoID, GError** error) { + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + VideoID _tmp5_ = {0}; + gint64 _tmp6_ = 0LL; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + sqlite3_stmt* _tmp9_ = NULL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + GError * _inner_error_ = NULL; +#line 315 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (IS_VIDEO_TABLE (self)); +#line 315 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (videoID != NULL); +#line 317 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = database_table_db; +#line 317 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "DELETE FROM VideoTable WHERE id=?", -1, &_tmp1_, NULL); +#line 317 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 317 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + stmt = _tmp1_; +#line 317 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp2_; +#line 318 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = res; +#line 318 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 320 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp4_ = stmt; +#line 320 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp5_ = *videoID; +#line 320 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp6_ = _tmp5_.id; +#line 320 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp7_ = sqlite3_bind_int64 (_tmp4_, 1, _tmp6_); +#line 320 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp7_; +#line 321 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp8_ = res; +#line 321 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp8_ == SQLITE_OK, "res == Sqlite.OK"); +#line 323 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp9_ = stmt; +#line 323 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp10_ = sqlite3_step (_tmp9_); +#line 323 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp10_; +#line 324 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp11_ = res; +#line 324 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp11_ != SQLITE_DONE) { +#line 2505 "VideoTable.c" + gint _tmp12_ = 0; +#line 325 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp12_ = res; +#line 325 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + database_table_throw_error ("VideoTable.remove", _tmp12_, &_inner_error_); +#line 325 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 325 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 325 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_propagate_error (error, _inner_error_); +#line 325 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 325 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 2521 "VideoTable.c" + } else { +#line 325 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 325 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 325 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_clear_error (&_inner_error_); +#line 325 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 2531 "VideoTable.c" + } + } + } +#line 315 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 2537 "VideoTable.c" +} + + +gboolean video_table_is_video_stored (VideoTable* self, GFile* file) { + gboolean result = FALSE; + GFile* _tmp0_ = NULL; + VideoID _tmp1_ = {0}; + gboolean _tmp2_ = FALSE; +#line 328 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail (IS_VIDEO_TABLE (self), FALSE); +#line 328 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail (G_IS_FILE (file), FALSE); +#line 329 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = file; +#line 329 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + video_table_get_id (self, _tmp0_, &_tmp1_); +#line 329 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = video_id_is_valid (&_tmp1_); +#line 329 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = _tmp2_; +#line 329 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 2560 "VideoTable.c" +} + + +void video_table_get_id (VideoTable* self, GFile* file, VideoID* result) { + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + GFile* _tmp5_ = NULL; + gchar* _tmp6_ = NULL; + GDestroyNotify _tmp7_ = NULL; + gint _tmp8_ = 0; + gint _tmp9_ = 0; + sqlite3_stmt* _tmp10_ = NULL; + gint _tmp11_ = 0; + VideoID _tmp12_ = {0}; + gint _tmp13_ = 0; +#line 332 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (IS_VIDEO_TABLE (self)); +#line 332 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (G_IS_FILE (file)); +#line 334 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = database_table_db; +#line 334 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "SELECT ID FROM VideoTable WHERE filename=?", -1, &_tmp1_, NULL); +#line 334 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 334 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + stmt = _tmp1_; +#line 334 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp2_; +#line 335 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = res; +#line 335 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 337 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp4_ = stmt; +#line 337 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp5_ = file; +#line 337 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp6_ = g_file_get_path (_tmp5_); +#line 337 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp7_ = g_free; +#line 337 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp8_ = sqlite3_bind_text (_tmp4_, 1, _tmp6_, -1, _tmp7_); +#line 337 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp8_; +#line 338 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp9_ = res; +#line 338 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp9_ == SQLITE_OK, "res == Sqlite.OK"); +#line 340 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp10_ = stmt; +#line 340 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp11_ = sqlite3_step (_tmp10_); +#line 340 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp11_; +#line 342 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp13_ = res; +#line 342 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp13_ == SQLITE_ROW) { +#line 2625 "VideoTable.c" + sqlite3_stmt* _tmp14_ = NULL; + gint64 _tmp15_ = 0LL; +#line 342 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp14_ = stmt; +#line 342 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp15_ = sqlite3_column_int64 (_tmp14_, 0); +#line 342 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + video_id_init (&_tmp12_, _tmp15_); +#line 2634 "VideoTable.c" + } else { +#line 342 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + video_id_init (&_tmp12_, VIDEO_ID_INVALID); +#line 2638 "VideoTable.c" + } +#line 342 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + *result = _tmp12_; +#line 342 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 342 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 2646 "VideoTable.c" +} + + +GeeArrayList* video_table_get_videos (VideoTable* self, GError** error) { + GeeArrayList* result = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + GeeArrayList* video_ids = NULL; + GeeArrayList* _tmp4_ = NULL; + GError * _inner_error_ = NULL; +#line 345 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail (IS_VIDEO_TABLE (self), NULL); +#line 347 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = database_table_db; +#line 347 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "SELECT id FROM VideoTable", -1, &_tmp1_, NULL); +#line 347 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 347 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + stmt = _tmp1_; +#line 347 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp2_; +#line 348 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = res; +#line 348 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 350 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp4_ = gee_array_list_new (TYPE_VIDEO_ID, (GBoxedCopyFunc) video_id_dup, video_id_free, NULL, NULL, NULL); +#line 350 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + video_ids = _tmp4_; +#line 2681 "VideoTable.c" + { + gboolean _tmp5_ = FALSE; +#line 351 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp5_ = TRUE; +#line 351 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + while (TRUE) { +#line 2688 "VideoTable.c" + sqlite3_stmt* _tmp6_ = NULL; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + GeeArrayList* _tmp11_ = NULL; + sqlite3_stmt* _tmp12_ = NULL; + gint64 _tmp13_ = 0LL; + VideoID _tmp14_ = {0}; +#line 351 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (!_tmp5_) { +#line 2698 "VideoTable.c" + } +#line 351 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp5_ = FALSE; +#line 352 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp6_ = stmt; +#line 352 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp7_ = sqlite3_step (_tmp6_); +#line 352 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp7_; +#line 353 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp8_ = res; +#line 353 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp8_ == SQLITE_DONE) { +#line 354 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + break; +#line 2714 "VideoTable.c" + } else { + gint _tmp9_ = 0; +#line 355 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp9_ = res; +#line 355 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp9_ != SQLITE_ROW) { +#line 2721 "VideoTable.c" + gint _tmp10_ = 0; +#line 356 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp10_ = res; +#line 356 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + database_table_throw_error ("VideoTable.get_videos", _tmp10_, &_inner_error_); +#line 356 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 356 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 356 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_propagate_error (error, _inner_error_); +#line 356 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_object_unref0 (video_ids); +#line 356 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 356 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return NULL; +#line 2739 "VideoTable.c" + } else { +#line 356 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_object_unref0 (video_ids); +#line 356 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 356 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 356 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_clear_error (&_inner_error_); +#line 356 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return NULL; +#line 2751 "VideoTable.c" + } + } + } + } +#line 359 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp11_ = video_ids; +#line 359 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp12_ = stmt; +#line 359 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp13_ = sqlite3_column_int64 (_tmp12_, 0); +#line 359 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + video_id_init (&_tmp14_, _tmp13_); +#line 359 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + gee_abstract_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), &_tmp14_); +#line 2766 "VideoTable.c" + } + } +#line 362 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = video_ids; +#line 362 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 362 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 2775 "VideoTable.c" +} + + +static sqlite3_stmt* video_table_get_duplicate_stmt (VideoTable* self, GFile* file, const gchar* md5) { + sqlite3_stmt* result = NULL; + gboolean _tmp0_ = FALSE; + GFile* _tmp1_ = NULL; + gchar* sql = NULL; + gchar* _tmp3_ = NULL; + gboolean first = FALSE; + GFile* _tmp4_ = NULL; + const gchar* _tmp7_ = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp13_ = NULL; + const gchar* _tmp14_ = NULL; + sqlite3_stmt* _tmp15_ = NULL; + gint _tmp16_ = 0; + gint _tmp17_ = 0; + gint col = 0; + GFile* _tmp18_ = NULL; + const gchar* _tmp26_ = NULL; +#line 365 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail (IS_VIDEO_TABLE (self), NULL); +#line 365 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail ((file == NULL) || G_IS_FILE (file), NULL); +#line 366 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp1_ = file; +#line 366 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp1_ != NULL) { +#line 366 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = TRUE; +#line 2808 "VideoTable.c" + } else { + const gchar* _tmp2_ = NULL; +#line 366 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = md5; +#line 366 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = _tmp2_ != NULL; +#line 2815 "VideoTable.c" + } +#line 366 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp0_, "file != null || md5 != null"); +#line 368 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = g_strdup ("SELECT id FROM VideoTable WHERE"); +#line 368 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + sql = _tmp3_; +#line 369 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + first = TRUE; +#line 371 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp4_ = file; +#line 371 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp4_ != NULL) { +#line 2829 "VideoTable.c" + const gchar* _tmp5_ = NULL; + gchar* _tmp6_ = NULL; +#line 372 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp5_ = sql; +#line 372 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp6_ = g_strconcat (_tmp5_, " filename=?", NULL); +#line 372 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (sql); +#line 372 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + sql = _tmp6_; +#line 373 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + first = FALSE; +#line 2842 "VideoTable.c" + } +#line 376 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp7_ = md5; +#line 376 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp7_ != NULL) { +#line 2848 "VideoTable.c" + gboolean _tmp8_ = FALSE; + const gchar* _tmp11_ = NULL; + gchar* _tmp12_ = NULL; +#line 377 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp8_ = first; +#line 377 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (!_tmp8_) { +#line 2856 "VideoTable.c" + const gchar* _tmp9_ = NULL; + gchar* _tmp10_ = NULL; +#line 378 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp9_ = sql; +#line 378 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp10_ = g_strconcat (_tmp9_, " OR ", NULL); +#line 378 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (sql); +#line 378 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + sql = _tmp10_; +#line 2867 "VideoTable.c" + } +#line 380 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp11_ = sql; +#line 380 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp12_ = g_strconcat (_tmp11_, " md5=?", NULL); +#line 380 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (sql); +#line 380 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + sql = _tmp12_; +#line 2877 "VideoTable.c" + } +#line 384 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp13_ = database_table_db; +#line 384 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp14_ = sql; +#line 384 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp16_ = sqlite3_prepare_v2 (_tmp13_, _tmp14_, -1, &_tmp15_, NULL); +#line 384 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 384 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + stmt = _tmp15_; +#line 384 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp16_; +#line 385 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp17_ = res; +#line 385 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp17_ == SQLITE_OK, "res == Sqlite.OK"); +#line 387 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + col = 1; +#line 389 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp18_ = file; +#line 389 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp18_ != NULL) { +#line 2901 "VideoTable.c" + sqlite3_stmt* _tmp19_ = NULL; + gint _tmp20_ = 0; + GFile* _tmp21_ = NULL; + gchar* _tmp22_ = NULL; + GDestroyNotify _tmp23_ = NULL; + gint _tmp24_ = 0; + gint _tmp25_ = 0; +#line 390 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp19_ = stmt; +#line 390 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp20_ = col; +#line 390 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + col = _tmp20_ + 1; +#line 390 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp21_ = file; +#line 390 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp22_ = g_file_get_path (_tmp21_); +#line 390 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp23_ = g_free; +#line 390 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp24_ = sqlite3_bind_text (_tmp19_, _tmp20_, _tmp22_, -1, _tmp23_); +#line 390 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp24_; +#line 391 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp25_ = res; +#line 391 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp25_ == SQLITE_OK, "res == Sqlite.OK"); +#line 2929 "VideoTable.c" + } +#line 394 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp26_ = md5; +#line 394 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp26_ != NULL) { +#line 2935 "VideoTable.c" + sqlite3_stmt* _tmp27_ = NULL; + gint _tmp28_ = 0; + const gchar* _tmp29_ = NULL; + gchar* _tmp30_ = NULL; + GDestroyNotify _tmp31_ = NULL; + gint _tmp32_ = 0; + gint _tmp33_ = 0; +#line 395 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp27_ = stmt; +#line 395 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp28_ = col; +#line 395 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + col = _tmp28_ + 1; +#line 395 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp29_ = md5; +#line 395 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp30_ = g_strdup (_tmp29_); +#line 395 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp31_ = g_free; +#line 395 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp32_ = sqlite3_bind_text (_tmp27_, _tmp28_, _tmp30_, -1, _tmp31_); +#line 395 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp32_; +#line 396 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp33_ = res; +#line 396 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp33_ == SQLITE_OK, "res == Sqlite.OK"); +#line 2963 "VideoTable.c" + } +#line 399 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = stmt; +#line 399 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (sql); +#line 399 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 2971 "VideoTable.c" +} + + +gboolean video_table_has_duplicate (VideoTable* self, GFile* file, const gchar* md5) { + gboolean result = FALSE; + sqlite3_stmt* stmt = NULL; + GFile* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + sqlite3_stmt* _tmp2_ = NULL; + gint res = 0; + sqlite3_stmt* _tmp3_ = NULL; + gint _tmp4_ = 0; + gint _tmp5_ = 0; +#line 402 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail (IS_VIDEO_TABLE (self), FALSE); +#line 402 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail ((file == NULL) || G_IS_FILE (file), FALSE); +#line 403 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = file; +#line 403 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp1_ = md5; +#line 403 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = video_table_get_duplicate_stmt (self, _tmp0_, _tmp1_); +#line 403 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + stmt = _tmp2_; +#line 404 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = stmt; +#line 404 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp4_ = sqlite3_step (_tmp3_); +#line 404 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp4_; +#line 406 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp5_ = res; +#line 406 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp5_ == SQLITE_DONE) { +#line 408 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = FALSE; +#line 408 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 408 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 3013 "VideoTable.c" + } else { + gint _tmp6_ = 0; +#line 409 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp6_ = res; +#line 409 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp6_ == SQLITE_ROW) { +#line 411 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = TRUE; +#line 411 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 411 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 3026 "VideoTable.c" + } else { + gint _tmp7_ = 0; +#line 413 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp7_ = res; +#line 413 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + database_table_fatal ("VideoTable.has_duplicate", _tmp7_); +#line 3033 "VideoTable.c" + } + } +#line 416 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = FALSE; +#line 416 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 416 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 3042 "VideoTable.c" +} + + +static void _vala_array_add3 (VideoID** array, int* length, int* size, const VideoID* value) { +#line 426 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if ((*length) == (*size)) { +#line 426 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + *size = (*size) ? (2 * (*size)) : 4; +#line 426 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + *array = g_renew (VideoID, *array, *size); +#line 3053 "VideoTable.c" + } +#line 426 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + (*array)[(*length)++] = *value; +#line 3057 "VideoTable.c" +} + + +VideoID* video_table_get_duplicate_ids (VideoTable* self, GFile* file, const gchar* md5, int* result_length1) { + VideoID* result = NULL; + sqlite3_stmt* stmt = NULL; + GFile* _tmp0_ = NULL; + const gchar* _tmp1_ = NULL; + sqlite3_stmt* _tmp2_ = NULL; + VideoID* ids = NULL; + VideoID* _tmp3_ = NULL; + gint ids_length1 = 0; + gint _ids_size_ = 0; + gint res = 0; + sqlite3_stmt* _tmp4_ = NULL; + gint _tmp5_ = 0; + VideoID* _tmp13_ = NULL; + gint _tmp13__length1 = 0; +#line 419 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail (IS_VIDEO_TABLE (self), NULL); +#line 419 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail ((file == NULL) || G_IS_FILE (file), NULL); +#line 420 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = file; +#line 420 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp1_ = md5; +#line 420 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = video_table_get_duplicate_stmt (self, _tmp0_, _tmp1_); +#line 420 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + stmt = _tmp2_; +#line 422 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = g_new0 (VideoID, 0); +#line 422 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + ids = _tmp3_; +#line 422 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + ids_length1 = 0; +#line 422 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _ids_size_ = ids_length1; +#line 424 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp4_ = stmt; +#line 424 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp5_ = sqlite3_step (_tmp4_); +#line 424 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp5_; +#line 425 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + while (TRUE) { +#line 3104 "VideoTable.c" + gint _tmp6_ = 0; + VideoID* _tmp7_ = NULL; + gint _tmp7__length1 = 0; + sqlite3_stmt* _tmp8_ = NULL; + gint64 _tmp9_ = 0LL; + VideoID _tmp10_ = {0}; + sqlite3_stmt* _tmp11_ = NULL; + gint _tmp12_ = 0; +#line 425 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp6_ = res; +#line 425 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (!(_tmp6_ == SQLITE_ROW)) { +#line 425 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + break; +#line 3119 "VideoTable.c" + } +#line 426 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp7_ = ids; +#line 426 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp7__length1 = ids_length1; +#line 426 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp8_ = stmt; +#line 426 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp9_ = sqlite3_column_int64 (_tmp8_, 0); +#line 426 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + video_id_init (&_tmp10_, _tmp9_); +#line 426 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_array_add3 (&ids, &ids_length1, &_ids_size_, &_tmp10_); +#line 427 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp11_ = stmt; +#line 427 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp12_ = sqlite3_step (_tmp11_); +#line 427 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp12_; +#line 3139 "VideoTable.c" + } +#line 430 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp13_ = ids; +#line 430 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp13__length1 = ids_length1; +#line 430 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (result_length1) { +#line 430 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + *result_length1 = _tmp13__length1; +#line 3149 "VideoTable.c" + } +#line 430 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = _tmp13_; +#line 430 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 430 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 3157 "VideoTable.c" +} + + +GeeArrayList* video_table_get_event_source_ids (VideoTable* self, EventID* event_id) { + GeeArrayList* result = NULL; + sqlite3_stmt* stmt = NULL; + gint res = 0; + sqlite3* _tmp0_ = NULL; + sqlite3_stmt* _tmp1_ = NULL; + gint _tmp2_ = 0; + gint _tmp3_ = 0; + sqlite3_stmt* _tmp4_ = NULL; + EventID _tmp5_ = {0}; + gint64 _tmp6_ = 0LL; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + GeeArrayList* _result_ = NULL; + GeeArrayList* _tmp9_ = NULL; +#line 433 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail (IS_VIDEO_TABLE (self), NULL); +#line 433 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_val_if_fail (event_id != NULL, NULL); +#line 435 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = database_table_db; +#line 435 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = sqlite3_prepare_v2 (_tmp0_, "SELECT id FROM VideoTable WHERE event_id = ?", -1, &_tmp1_, NULL); +#line 435 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 435 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + stmt = _tmp1_; +#line 435 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp2_; +#line 436 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp3_ = res; +#line 436 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp3_ == SQLITE_OK, "res == Sqlite.OK"); +#line 438 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp4_ = stmt; +#line 438 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp5_ = *event_id; +#line 438 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp6_ = _tmp5_.id; +#line 438 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp7_ = sqlite3_bind_int64 (_tmp4_, 1, _tmp6_); +#line 438 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp7_; +#line 439 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp8_ = res; +#line 439 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _vala_assert (_tmp8_ == SQLITE_OK, "res == Sqlite.OK"); +#line 441 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp9_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL); +#line 441 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _result_ = _tmp9_; +#line 3212 "VideoTable.c" + { + gboolean _tmp10_ = FALSE; +#line 442 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp10_ = TRUE; +#line 442 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + while (TRUE) { +#line 3219 "VideoTable.c" + sqlite3_stmt* _tmp11_ = NULL; + gint _tmp12_ = 0; + gint _tmp13_ = 0; + GeeArrayList* _tmp16_ = NULL; + sqlite3_stmt* _tmp17_ = NULL; + gint64 _tmp18_ = 0LL; + VideoID _tmp19_ = {0}; + gchar* _tmp20_ = NULL; + gchar* _tmp21_ = NULL; +#line 442 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (!_tmp10_) { +#line 3231 "VideoTable.c" + } +#line 442 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp10_ = FALSE; +#line 443 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp11_ = stmt; +#line 443 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp12_ = sqlite3_step (_tmp11_); +#line 443 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + res = _tmp12_; +#line 444 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp13_ = res; +#line 444 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp13_ == SQLITE_DONE) { +#line 445 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + break; +#line 3247 "VideoTable.c" + } else { + gint _tmp14_ = 0; +#line 446 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp14_ = res; +#line 446 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_tmp14_ != SQLITE_ROW) { +#line 3254 "VideoTable.c" + gint _tmp15_ = 0; +#line 447 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp15_ = res; +#line 447 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + database_table_fatal ("get_event_source_ids", _tmp15_); +#line 449 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + break; +#line 3262 "VideoTable.c" + } + } +#line 452 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp16_ = _result_; +#line 452 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp17_ = stmt; +#line 452 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp18_ = sqlite3_column_int64 (_tmp17_, 0); +#line 452 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + video_id_init (&_tmp19_, _tmp18_); +#line 452 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp20_ = video_id_upgrade_video_id_to_source_id (&_tmp19_); +#line 452 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp21_ = _tmp20_; +#line 452 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + gee_abstract_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), _tmp21_); +#line 452 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _g_free0 (_tmp21_); +#line 3281 "VideoTable.c" + } + } +#line 455 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + result = _result_; +#line 455 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _sqlite3_finalize0 (stmt); +#line 455 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return result; +#line 3290 "VideoTable.c" +} + + +void video_table_set_timestamp (VideoTable* self, VideoID* video_id, time_t timestamp, GError** error) { + VideoID _tmp0_ = {0}; + gint64 _tmp1_ = 0LL; + time_t _tmp2_ = 0; + GError * _inner_error_ = NULL; +#line 458 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (IS_VIDEO_TABLE (self)); +#line 458 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_return_if_fail (video_id != NULL); +#line 459 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp0_ = *video_id; +#line 459 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp1_ = _tmp0_.id; +#line 459 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + _tmp2_ = timestamp; +#line 459 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + database_table_update_int64_by_id_2 (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "timestamp", (gint64) _tmp2_, &_inner_error_); +#line 459 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (G_UNLIKELY (_inner_error_ != NULL)) { +#line 459 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + if (_inner_error_->domain == DATABASE_ERROR) { +#line 459 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_propagate_error (error, _inner_error_); +#line 459 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 3319 "VideoTable.c" + } else { +#line 459 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); +#line 459 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + g_clear_error (&_inner_error_); +#line 459 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + return; +#line 3327 "VideoTable.c" + } + } +} + + +static void video_table_class_init (VideoTableClass * klass) { +#line 59 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + video_table_parent_class = g_type_class_peek_parent (klass); +#line 59 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + ((DatabaseTableClass *) klass)->finalize = video_table_finalize; +#line 3338 "VideoTable.c" +} + + +static void video_table_instance_init (VideoTable * self) { +} + + +static void video_table_finalize (DatabaseTable* obj) { + VideoTable * self; +#line 59 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_VIDEO_TABLE, VideoTable); +#line 59 "/home/jens/Source/shotwell/src/db/VideoTable.vala" + DATABASE_TABLE_CLASS (video_table_parent_class)->finalize (obj); +#line 3352 "VideoTable.c" +} + + +GType video_table_get_type (void) { + static volatile gsize video_table_type_id__volatile = 0; + if (g_once_init_enter (&video_table_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (VideoTableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) video_table_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (VideoTable), 0, (GInstanceInitFunc) video_table_instance_init, NULL }; + GType video_table_type_id; + video_table_type_id = g_type_register_static (TYPE_DATABASE_TABLE, "VideoTable", &g_define_type_info, 0); + g_once_init_leave (&video_table_type_id__volatile, video_table_type_id); + } + return video_table_type_id__volatile; +} + + + diff --git a/src/db/mk/db.mk b/src/db/mk/db.mk deleted file mode 100644 index 421961a..0000000 --- a/src/db/mk/db.mk +++ /dev/null @@ -1,35 +0,0 @@ - -# UNIT_NAME is the Vala namespace. A file named UNIT_NAME.vala must be in this directory with -# a init() and terminate() function declared in the namespace. -UNIT_NAME := Db - -# UNIT_DIR should match the subdirectory the files are located in. Generally UNIT_NAME in all -# lowercase. The name of this file should be UNIT_DIR.mk. -UNIT_DIR := db - -# All Vala files in the unit should be listed here with no subdirectory prefix. -# -# NOTE: Do *not* include the unit's master file, i.e. UNIT_NAME.vala. -UNIT_FILES := \ - DatabaseTable.vala \ - PhotoTable.vala \ - EventTable.vala \ - TagTable.vala \ - TombstoneTable.vala \ - VideoTable.vala \ - VersionTable.vala \ - SavedSearchDBTable.vala - -# Any unit this unit relies upon (and should be initialized before it's initialized) should -# be listed here using its Vala namespace. -# -# NOTE: All units are assumed to rely upon the unit-unit. Do not include that here. -UNIT_USES := - -# List any additional files that are used in the build process as a part of this unit that should -# be packaged in the tarball. File names should be relative to the unit's home directory. -UNIT_RC := - -# unitize.mk must be called at the end of each UNIT_DIR.mk file. -include unitize.mk - -- cgit v1.2.3