/* EventTable.c generated by valac 0.40.4, 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 <glib.h>
#include <glib-object.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <sqlite3.h>
#include <gee.h>
#include <gobject/gvaluecollector.h>


#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;
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;
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)
{
#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"
	(*self).id = id;
#line 274 "EventTable.c"
}


gboolean
event_id_is_invalid (EventID *self)
{
	gboolean result = FALSE;
	gint64 _tmp0_;
#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 289 "EventTable.c"
}


gboolean
event_id_is_valid (EventID *self)
{
	gboolean result = FALSE;
	gint64 _tmp0_;
#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 304 "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 318 "EventTable.c"
}


void
event_id_free (EventID* self)
{
#line 7 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	g_free (self);
#line 327 "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 352 "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 361 "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 370 "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 381 "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 394 "EventTable.c"
	} else {
#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		dest_value->data[0].v_pointer = NULL;
#line 398 "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 408 "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 420 "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 427 "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 431 "EventTable.c"
		}
#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		value->data[0].v_pointer = event_row_ref (object);
#line 435 "EventTable.c"
	} else {
#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		value->data[0].v_pointer = NULL;
#line 439 "EventTable.c"
	}
#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	return NULL;
#line 443 "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 459 "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 465 "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 469 "EventTable.c"
	} else {
#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		*object_p = event_row_ref (value->data[0].v_pointer);
#line 473 "EventTable.c"
	}
#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	return NULL;
#line 477 "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 497 "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 508 "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 531 "EventTable.c"
	} else {
#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		value->data[0].v_pointer = NULL;
#line 535 "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 541 "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 563 "EventTable.c"
	} else {
#line 25 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		value->data[0].v_pointer = NULL;
#line 567 "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 573 "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 585 "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 594 "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 612 "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 641 "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 656 "EventTable.c"
	}
}


static EventTable*
event_table_construct (GType object_type)
{
	EventTable* self = NULL;
	sqlite3_stmt* stmt = NULL;
	gint res = 0;
	sqlite3* _tmp0_;
	sqlite3_stmt* _tmp1_ = NULL;
	gint _tmp2_;
	gint _tmp3_;
	sqlite3_stmt* _tmp4_;
	gint _tmp5_;
#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"
	res = sqlite3_step (_tmp4_);
#line 49 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp5_ = res;
#line 49 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	if (_tmp5_ != SQLITE_DONE) {
#line 697 "EventTable.c"
		gint _tmp6_;
#line 50 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		_tmp6_ = res;
#line 50 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		database_table_fatal ("create photo table", _tmp6_);
#line 703 "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 711 "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 720 "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 729 "EventTable.c"
}


EventTable*
event_table_get_instance (void)
{
	EventTable* result = NULL;
	EventTable* _tmp0_;
	EventTable* _tmp2_;
	EventTable* _tmp3_;
#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 744 "EventTable.c"
		EventTable* _tmp1_;
#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 752 "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 762 "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_;
	MediaCollectionRegistry* _tmp1_;
	gboolean _tmp2_;
#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_ = media_collection_registry_is_valid_source_id (_tmp1_, primary_source_id);
#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 (_tmp2_) {
#line 787 "EventTable.c"
		gchar* _tmp3_;
#line 65 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		_tmp3_ = g_strdup (primary_source_id);
#line 65 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		result = _tmp3_;
#line 65 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		return result;
#line 795 "EventTable.c"
	}
#line 67 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	if (primary_photo_id != PHOTO_ID_INVALID) {
#line 799 "EventTable.c"
		PhotoID _tmp4_ = {0};
		gchar* _tmp5_;
#line 69 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		photo_id_init (&_tmp4_, primary_photo_id);
#line 69 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		_tmp5_ = photo_id_upgrade_photo_id_to_source_id (&_tmp4_);
#line 69 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		result = _tmp5_;
#line 69 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		return result;
#line 810 "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 816 "EventTable.c"
}


EventRow*
event_table_create (EventTable* self,
                    const gchar* primary_source_id,
                    const gchar* comment,
                    GError** error)
{
	EventRow* result = NULL;
	gboolean _tmp0_ = FALSE;
	sqlite3_stmt* stmt = NULL;
	gint res = 0;
	sqlite3* _tmp1_;
	sqlite3_stmt* _tmp2_ = NULL;
	gint _tmp3_;
	gint _tmp4_;
	time_t time_created = 0;
	sqlite3_stmt* _tmp5_;
	gchar* _tmp6_;
	GDestroyNotify _tmp7_;
	gint _tmp8_;
	sqlite3_stmt* _tmp9_;
	time_t _tmp10_;
	gint _tmp11_;
	sqlite3_stmt* _tmp12_;
	gchar* _tmp13_;
	GDestroyNotify _tmp14_;
	gint _tmp15_;
	sqlite3_stmt* _tmp16_;
	gint _tmp17_;
	EventRow* row = NULL;
	EventRow* _tmp19_;
	EventRow* _tmp20_;
	sqlite3* _tmp21_;
	EventRow* _tmp22_;
	EventRow* _tmp23_;
	gchar* _tmp24_;
	EventRow* _tmp25_;
	time_t _tmp26_;
	EventRow* _tmp27_;
	gchar* _tmp28_;
	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"
	if (primary_source_id != NULL) {
#line 75 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		_tmp0_ = g_strcmp0 (primary_source_id, "") != 0;
#line 866 "EventTable.c"
	} else {
#line 75 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		_tmp0_ = FALSE;
#line 870 "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"
	_tmp1_ = database_table_db;
#line 78 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp3_ = sqlite3_prepare_v2 (_tmp1_, "INSERT INTO EventTable (primary_source_id, time_created, comment) VALU" \
"ES (?, ?, ?)", -1, &_tmp2_, 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 = _tmp2_;
#line 78 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	res = _tmp3_;
#line 81 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp4_ = res;
#line 81 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_vala_assert (_tmp4_ == SQLITE_OK, "res == Sqlite.OK");
#line 83 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	time_created = (time_t) now_sec ();
#line 85 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp5_ = stmt;
#line 85 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp6_ = g_strdup (primary_source_id);
#line 85 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp7_ = g_free;
#line 85 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	res = sqlite3_bind_text (_tmp5_, 1, _tmp6_, -1, _tmp7_);
#line 86 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp8_ = res;
#line 86 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_vala_assert (_tmp8_ == SQLITE_OK, "res == Sqlite.OK");
#line 87 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp9_ = stmt;
#line 87 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp10_ = time_created;
#line 87 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	res = sqlite3_bind_int64 (_tmp9_, 2, (gint64) _tmp10_);
#line 88 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp11_ = res;
#line 88 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_vala_assert (_tmp11_ == SQLITE_OK, "res == Sqlite.OK");
#line 89 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp12_ = stmt;
#line 89 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp13_ = g_strdup (comment);
#line 89 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp14_ = g_free;
#line 89 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	res = sqlite3_bind_text (_tmp12_, 3, _tmp13_, -1, _tmp14_);
#line 90 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp15_ = res;
#line 90 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_vala_assert (_tmp15_ == SQLITE_OK, "res == Sqlite.OK");
#line 92 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp16_ = stmt;
#line 92 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	res = sqlite3_step (_tmp16_);
#line 93 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp17_ = res;
#line 93 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	if (_tmp17_ != SQLITE_DONE) {
#line 932 "EventTable.c"
		gint _tmp18_;
#line 94 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		_tmp18_ = res;
#line 94 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		database_table_throw_error ("EventTable.create", _tmp18_, &_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 948 "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 958 "EventTable.c"
			}
		}
	}
#line 96 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp19_ = event_row_new ();
#line 96 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	row = _tmp19_;
#line 97 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp20_ = row;
#line 97 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp21_ = database_table_db;
#line 97 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	event_id_init (&_tmp20_->event_id, sqlite3_last_insert_rowid (_tmp21_));
#line 98 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp22_ = row;
#line 98 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_g_free0 (_tmp22_->name);
#line 98 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp22_->name = NULL;
#line 99 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp23_ = row;
#line 99 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp24_ = g_strdup (primary_source_id);
#line 99 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_g_free0 (_tmp23_->primary_source_id);
#line 99 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp23_->primary_source_id = _tmp24_;
#line 100 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp25_ = row;
#line 100 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp26_ = time_created;
#line 100 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp25_->time_created = _tmp26_;
#line 101 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp27_ = row;
#line 101 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp28_ = g_strdup (comment);
#line 101 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_g_free0 (_tmp27_->comment);
#line 101 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp27_->comment = _tmp28_;
#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 1006 "EventTable.c"
}


void
event_table_create_from_row (EventTable* self,
                             EventRow* row,
                             EventID* result)
{
	sqlite3_stmt* stmt = NULL;
	gint res = 0;
	sqlite3* _tmp0_;
	sqlite3_stmt* _tmp1_ = NULL;
	gint _tmp2_;
	gint _tmp3_;
	sqlite3_stmt* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	GDestroyNotify _tmp7_;
	gint _tmp8_;
	sqlite3_stmt* _tmp9_;
	gint _tmp10_;
	sqlite3_stmt* _tmp11_;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	GDestroyNotify _tmp14_;
	gint _tmp15_;
	sqlite3_stmt* _tmp16_;
	time_t _tmp17_;
	gint _tmp18_;
	sqlite3_stmt* _tmp19_;
	const gchar* _tmp20_;
	gchar* _tmp21_;
	GDestroyNotify _tmp22_;
	gint _tmp23_;
	sqlite3_stmt* _tmp24_;
	gint _tmp25_;
	sqlite3* _tmp28_;
	EventID _tmp29_ = {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->name;
#line 115 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp6_ = g_strdup (_tmp5_);
#line 115 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp7_ = g_free;
#line 115 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	res = sqlite3_bind_text (_tmp4_, 1, _tmp6_, -1, _tmp7_);
#line 116 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp8_ = res;
#line 116 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_vala_assert (_tmp8_ == SQLITE_OK, "res == Sqlite.OK");
#line 117 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp9_ = stmt;
#line 117 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	res = sqlite3_bind_int64 (_tmp9_, 2, PHOTO_ID_INVALID);
#line 118 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp10_ = res;
#line 118 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_vala_assert (_tmp10_ == SQLITE_OK, "res == Sqlite.OK");
#line 119 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp11_ = stmt;
#line 119 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp12_ = row->primary_source_id;
#line 119 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp13_ = g_strdup (_tmp12_);
#line 119 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp14_ = g_free;
#line 119 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	res = sqlite3_bind_text (_tmp11_, 3, _tmp13_, -1, _tmp14_);
#line 120 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp15_ = res;
#line 120 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_vala_assert (_tmp15_ == SQLITE_OK, "res == Sqlite.OK");
#line 121 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp16_ = stmt;
#line 121 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp17_ = row->time_created;
#line 121 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	res = sqlite3_bind_int64 (_tmp16_, 4, (gint64) _tmp17_);
#line 122 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp18_ = res;
#line 122 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_vala_assert (_tmp18_ == SQLITE_OK, "res == Sqlite.OK");
#line 123 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp19_ = stmt;
#line 123 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp20_ = row->comment;
#line 123 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp21_ = g_strdup (_tmp20_);
#line 123 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp22_ = g_free;
#line 123 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	res = sqlite3_bind_text (_tmp19_, 5, _tmp21_, -1, _tmp22_);
#line 124 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp23_ = res;
#line 124 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_vala_assert (_tmp23_ == SQLITE_OK, "res == Sqlite.OK");
#line 126 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp24_ = stmt;
#line 126 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	res = sqlite3_step (_tmp24_);
#line 127 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp25_ = res;
#line 127 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	if (_tmp25_ != SQLITE_DONE) {
#line 1131 "EventTable.c"
		gint _tmp26_;
		EventID _tmp27_ = {0};
#line 128 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		_tmp26_ = res;
#line 128 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		database_table_fatal ("Event create_from_row", _tmp26_);
#line 130 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		event_id_init (&_tmp27_, EVENT_ID_INVALID);
#line 130 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		*result = _tmp27_;
#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 1146 "EventTable.c"
	}
#line 133 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp28_ = database_table_db;
#line 133 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	event_id_init (&_tmp29_, sqlite3_last_insert_rowid (_tmp28_));
#line 133 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	*result = _tmp29_;
#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 1158 "EventTable.c"
}


EventRow*
event_table_get_row (EventTable* self,
                     EventID* event_id)
{
	EventRow* result = NULL;
	sqlite3_stmt* stmt = NULL;
	gint res = 0;
	sqlite3* _tmp0_;
	sqlite3_stmt* _tmp1_ = NULL;
	gint _tmp2_;
	gint _tmp3_;
	sqlite3_stmt* _tmp4_;
	EventID _tmp5_;
	gint64 _tmp6_;
	gint _tmp7_;
	sqlite3_stmt* _tmp8_;
	EventRow* row = NULL;
	EventRow* _tmp9_;
	EventRow* _tmp10_;
	EventID _tmp11_;
	EventRow* _tmp12_;
	sqlite3_stmt* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	gboolean _tmp16_ = FALSE;
	EventRow* _tmp17_;
	const gchar* _tmp18_;
	EventRow* _tmp24_;
	sqlite3_stmt* _tmp25_;
	sqlite3_stmt* _tmp26_;
	const gchar* _tmp27_;
	gchar* _tmp28_;
	EventRow* _tmp29_;
	sqlite3_stmt* _tmp30_;
	EventRow* _tmp31_;
	sqlite3_stmt* _tmp32_;
	const gchar* _tmp33_;
	gchar* _tmp34_;
#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"
	res = sqlite3_bind_int64 (_tmp4_, 1, _tmp6_);
#line 143 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp7_ = res;
#line 143 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_vala_assert (_tmp7_ == SQLITE_OK, "res == Sqlite.OK");
#line 145 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp8_ = stmt;
#line 145 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	if (sqlite3_step (_tmp8_) != 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 1240 "EventTable.c"
	}
#line 148 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp9_ = event_row_new ();
#line 148 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	row = _tmp9_;
#line 149 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp10_ = row;
#line 149 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp11_ = *event_id;
#line 149 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp10_->event_id = _tmp11_;
#line 150 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp12_ = row;
#line 150 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp13_ = stmt;
#line 150 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp14_ = sqlite3_column_text (_tmp13_, 0);
#line 150 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp15_ = g_strdup (_tmp14_);
#line 150 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_g_free0 (_tmp12_->name);
#line 150 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp12_->name = _tmp15_;
#line 151 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp17_ = row;
#line 151 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp18_ = _tmp17_->name;
#line 151 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	if (_tmp18_ != NULL) {
#line 1270 "EventTable.c"
		EventRow* _tmp19_;
		const gchar* _tmp20_;
		gint _tmp21_;
		gint _tmp22_;
#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"
		_tmp21_ = strlen (_tmp20_);
#line 151 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		_tmp22_ = _tmp21_;
#line 151 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		_tmp16_ = _tmp22_ == 0;
#line 1285 "EventTable.c"
	} else {
#line 151 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		_tmp16_ = FALSE;
#line 1289 "EventTable.c"
	}
#line 151 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	if (_tmp16_) {
#line 1293 "EventTable.c"
		EventRow* _tmp23_;
#line 152 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		_tmp23_ = row;
#line 152 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		_g_free0 (_tmp23_->name);
#line 152 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		_tmp23_->name = NULL;
#line 1301 "EventTable.c"
	}
#line 153 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp24_ = row;
#line 153 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp25_ = stmt;
#line 153 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp26_ = stmt;
#line 153 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp27_ = sqlite3_column_text (_tmp26_, 2);
#line 153 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp28_ = event_table_source_id_upgrade (self, sqlite3_column_int64 (_tmp25_, 1), _tmp27_);
#line 153 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_g_free0 (_tmp24_->primary_source_id);
#line 153 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp24_->primary_source_id = _tmp28_;
#line 154 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp29_ = row;
#line 154 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp30_ = stmt;
#line 154 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp29_->time_created = (time_t) sqlite3_column_int64 (_tmp30_, 3);
#line 155 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp31_ = row;
#line 155 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp32_ = stmt;
#line 155 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp33_ = sqlite3_column_text (_tmp32_, 4);
#line 155 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp34_ = g_strdup (_tmp33_);
#line 155 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_g_free0 (_tmp31_->comment);
#line 155 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp31_->comment = _tmp34_;
#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 1341 "EventTable.c"
}


void
event_table_remove (EventTable* self,
                    EventID* event_id,
                    GError** error)
{
	EventID _tmp0_;
	gint64 _tmp1_;
	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 1371 "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 1379 "EventTable.c"
		}
	}
}


GeeArrayList*
event_table_get_events (EventTable* self)
{
	GeeArrayList* result = NULL;
	sqlite3_stmt* stmt = NULL;
	gint res = 0;
	sqlite3* _tmp0_;
	sqlite3_stmt* _tmp1_ = NULL;
	gint _tmp2_;
	gint _tmp3_;
	GeeArrayList* event_rows = NULL;
	GeeArrayList* _tmp4_;
#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, (GDestroyNotify) event_row_unref, NULL, NULL, NULL);
#line 170 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	event_rows = _tmp4_;
#line 1417 "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 1424 "EventTable.c"
			sqlite3_stmt* _tmp6_;
			gint _tmp7_;
			EventRow* row = NULL;
			EventRow* _tmp10_;
			EventRow* _tmp11_;
			sqlite3_stmt* _tmp12_;
			EventRow* _tmp13_;
			sqlite3_stmt* _tmp14_;
			const gchar* _tmp15_;
			gchar* _tmp16_;
			EventRow* _tmp17_;
			sqlite3_stmt* _tmp18_;
			sqlite3_stmt* _tmp19_;
			const gchar* _tmp20_;
			gchar* _tmp21_;
			EventRow* _tmp22_;
			sqlite3_stmt* _tmp23_;
			EventRow* _tmp24_;
			sqlite3_stmt* _tmp25_;
			const gchar* _tmp26_;
			gchar* _tmp27_;
			GeeArrayList* _tmp28_;
			EventRow* _tmp29_;
#line 171 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			if (!_tmp5_) {
#line 1450 "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"
			res = sqlite3_step (_tmp6_);
#line 173 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp7_ = res;
#line 173 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			if (_tmp7_ == SQLITE_DONE) {
#line 174 "/home/jens/Source/shotwell/src/db/EventTable.vala"
				break;
#line 1464 "EventTable.c"
			} else {
				gint _tmp8_;
#line 175 "/home/jens/Source/shotwell/src/db/EventTable.vala"
				_tmp8_ = res;
#line 175 "/home/jens/Source/shotwell/src/db/EventTable.vala"
				if (_tmp8_ != SQLITE_ROW) {
#line 1471 "EventTable.c"
					gint _tmp9_;
#line 176 "/home/jens/Source/shotwell/src/db/EventTable.vala"
					_tmp9_ = res;
#line 176 "/home/jens/Source/shotwell/src/db/EventTable.vala"
					database_table_fatal ("get_events", _tmp9_);
#line 178 "/home/jens/Source/shotwell/src/db/EventTable.vala"
					break;
#line 1479 "EventTable.c"
				}
			}
#line 181 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp10_ = event_row_new ();
#line 181 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			row = _tmp10_;
#line 183 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp11_ = row;
#line 183 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp12_ = stmt;
#line 183 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			event_id_init (&_tmp11_->event_id, sqlite3_column_int64 (_tmp12_, 0));
#line 184 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp13_ = row;
#line 184 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp14_ = stmt;
#line 184 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp15_ = sqlite3_column_text (_tmp14_, 1);
#line 184 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp16_ = g_strdup (_tmp15_);
#line 184 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_g_free0 (_tmp13_->name);
#line 184 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp13_->name = _tmp16_;
#line 185 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp17_ = row;
#line 185 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp18_ = stmt;
#line 185 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp19_ = stmt;
#line 185 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp20_ = sqlite3_column_text (_tmp19_, 3);
#line 185 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp21_ = event_table_source_id_upgrade (self, sqlite3_column_int64 (_tmp18_, 2), _tmp20_);
#line 185 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_g_free0 (_tmp17_->primary_source_id);
#line 185 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp17_->primary_source_id = _tmp21_;
#line 186 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp22_ = row;
#line 186 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp23_ = stmt;
#line 186 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp22_->time_created = (time_t) sqlite3_column_int64 (_tmp23_, 4);
#line 187 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp24_ = row;
#line 187 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp25_ = stmt;
#line 187 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp26_ = sqlite3_column_text (_tmp25_, 5);
#line 187 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp27_ = g_strdup (_tmp26_);
#line 187 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_g_free0 (_tmp24_->comment);
#line 187 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp24_->comment = _tmp27_;
#line 189 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp28_ = event_rows;
#line 189 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_tmp29_ = row;
#line 189 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			gee_abstract_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp28_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), _tmp29_);
#line 171 "/home/jens/Source/shotwell/src/db/EventTable.vala"
			_event_row_unref0 (row);
#line 1544 "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 1553 "EventTable.c"
}


gboolean
event_table_rename (EventTable* self,
                    EventID* event_id,
                    const gchar* name)
{
	gboolean result = FALSE;
	const gchar* _tmp0_ = NULL;
	EventID _tmp1_;
	gint64 _tmp2_;
#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"
	if (name != NULL) {
#line 196 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		_tmp0_ = name;
#line 1574 "EventTable.c"
	} else {
#line 196 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		_tmp0_ = "";
#line 1578 "EventTable.c"
	}
#line 196 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp1_ = *event_id;
#line 196 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp2_ = _tmp1_.id;
#line 196 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	result = database_table_update_text_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp2_, "name", _tmp0_);
#line 196 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	return result;
#line 1588 "EventTable.c"
}


gchar*
event_table_get_name (EventTable* self,
                      EventID* event_id)
{
	gchar* result = NULL;
	sqlite3_stmt* stmt = NULL;
	EventID _tmp0_;
	gint64 _tmp1_;
	sqlite3_stmt* _tmp2_ = NULL;
	gboolean _tmp3_;
	gchar* name = NULL;
	sqlite3_stmt* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_ = NULL;
	gboolean _tmp8_ = FALSE;
	const gchar* _tmp9_;
	gchar* _tmp14_;
#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 1632 "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 1646 "EventTable.c"
		const gchar* _tmp10_;
		gint _tmp11_;
		gint _tmp12_;
#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 1658 "EventTable.c"
	} else {
#line 206 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		_tmp8_ = FALSE;
#line 1662 "EventTable.c"
	}
#line 206 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	if (_tmp8_) {
#line 1666 "EventTable.c"
		const gchar* _tmp13_;
#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 1672 "EventTable.c"
	} else {
#line 206 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		_tmp7_ = NULL;
#line 1676 "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 1688 "EventTable.c"
}


gchar*
event_table_get_primary_source_id (EventTable* self,
                                   EventID* event_id)
{
	gchar* result = NULL;
	sqlite3_stmt* stmt = NULL;
	EventID _tmp0_;
	gint64 _tmp1_;
	sqlite3_stmt* _tmp2_ = NULL;
	gboolean _tmp3_;
	sqlite3_stmt* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
#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 1727 "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 1741 "EventTable.c"
}


gboolean
event_table_set_primary_source_id (EventTable* self,
                                   EventID* event_id,
                                   const gchar* primary_source_id)
{
	gboolean result = FALSE;
	EventID _tmp0_;
	gint64 _tmp1_;
#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"
	result = database_table_update_text_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp1_, "primary_source_id", primary_source_id);
#line 218 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	return result;
#line 1767 "EventTable.c"
}


time_t
event_table_get_time_created (EventTable* self,
                              EventID* event_id)
{
	time_t result = 0;
	sqlite3_stmt* stmt = NULL;
	EventID _tmp0_;
	gint64 _tmp1_;
	sqlite3_stmt* _tmp2_ = NULL;
	gboolean _tmp3_;
	sqlite3_stmt* _tmp4_;
#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 1804 "EventTable.c"
	}
#line 226 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp4_ = stmt;
#line 226 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	result = (time_t) sqlite3_column_int64 (_tmp4_, 0);
#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 1814 "EventTable.c"
}


gboolean
event_table_set_comment (EventTable* self,
                         EventID* event_id,
                         const gchar* new_comment)
{
	gboolean result = FALSE;
	const gchar* _tmp0_ = NULL;
	EventID _tmp1_;
	gint64 _tmp2_;
#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"
	if (new_comment != NULL) {
#line 230 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		_tmp0_ = new_comment;
#line 1837 "EventTable.c"
	} else {
#line 230 "/home/jens/Source/shotwell/src/db/EventTable.vala"
		_tmp0_ = "";
#line 1841 "EventTable.c"
	}
#line 230 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp1_ = *event_id;
#line 230 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	_tmp2_ = _tmp1_.id;
#line 230 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	result = database_table_update_text_by_id (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_TABLE, DatabaseTable), _tmp2_, "comment", _tmp0_);
#line 230 "/home/jens/Source/shotwell/src/db/EventTable.vala"
	return result;
#line 1851 "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 1862 "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 1880 "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;
}