/* VersionTable.c generated by valac 0.34.7, 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 <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <sqlite3.h>


#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;
}