/* sqlheavy-gen-orm.c generated by valac 0.16.0, the Vala compiler
 * generated from sqlheavy-gen-orm.vala, do not modify */


#include <glib.h>
#include <glib-object.h>
#include <vala.h>
#include <stdlib.h>
#include <string.h>
#include <valagee.h>
#include <SQLHeavy.h>
#include <stdio.h>
#include <glib/gstdio.h>


#define SQL_HEAVY_TYPE_GENERATOR (sql_heavy_generator_get_type ())
#define SQL_HEAVY_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SQL_HEAVY_TYPE_GENERATOR, SQLHeavyGenerator))
#define SQL_HEAVY_GENERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SQL_HEAVY_TYPE_GENERATOR, SQLHeavyGeneratorClass))
#define SQL_HEAVY_IS_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SQL_HEAVY_TYPE_GENERATOR))
#define SQL_HEAVY_IS_GENERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SQL_HEAVY_TYPE_GENERATOR))
#define SQL_HEAVY_GENERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SQL_HEAVY_TYPE_GENERATOR, SQLHeavyGeneratorClass))

typedef struct _SQLHeavyGenerator SQLHeavyGenerator;
typedef struct _SQLHeavyGeneratorClass SQLHeavyGeneratorClass;
typedef struct _SQLHeavyGeneratorPrivate SQLHeavyGeneratorPrivate;
#define _vala_code_context_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_context_unref (var), NULL)))
#define __g_slist_free__g_free0_0(var) ((var == NULL) ? NULL : (var = (_g_slist_free__g_free0_ (var), NULL)))
#define _vala_map_unref0(var) ((var == NULL) ? NULL : (var = (vala_map_unref (var), NULL)))
#define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _vala_iterator_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterator_unref (var), NULL)))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _vala_source_reference_unref0(var) ((var == NULL) ? NULL : (var = (vala_source_reference_unref (var), NULL)))
#define _vala_source_file_unref0(var) ((var == NULL) ? NULL : (var = (vala_source_file_unref (var), NULL)))
#define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _vala_code_visitor_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_visitor_unref (var), NULL)))
#define _g_key_file_free0(var) ((var == NULL) ? NULL : (var = (g_key_file_free (var), NULL)))
#define _g_option_context_free0(var) ((var == NULL) ? NULL : (var = (g_option_context_free (var), NULL)))

typedef enum  {
	SQL_HEAVY_GENERATOR_ERROR_CONFIGURATION,
	SQL_HEAVY_GENERATOR_ERROR_METADATA,
	SQL_HEAVY_GENERATOR_ERROR_SYMBOL_RESOLVER,
	SQL_HEAVY_GENERATOR_ERROR_DATABASE,
	SQL_HEAVY_GENERATOR_ERROR_SELECTOR
} SQLHeavyGeneratorError;
#define SQL_HEAVY_GENERATOR_ERROR sql_heavy_generator_error_quark ()
struct _SQLHeavyGenerator {
	GObject parent_instance;
	SQLHeavyGeneratorPrivate * priv;
};

struct _SQLHeavyGeneratorClass {
	GObjectClass parent_class;
};

struct _SQLHeavyGeneratorPrivate {
	ValaCodeContext* context;
	GSList* databases;
	ValaHashMap* cache;
	ValaHashMap* wildcard_cache;
};


static gpointer sql_heavy_generator_parent_class = NULL;
static gchar** sql_heavy_generator_sources;
static gchar** sql_heavy_generator_sources = NULL;
static gchar** sql_heavy_generator_vapi_directories;
static gchar** sql_heavy_generator_vapi_directories = NULL;
static gchar** sql_heavy_generator_packages;
static gchar** sql_heavy_generator_packages = NULL;
static gchar* sql_heavy_generator_metadata_location;
static gchar* sql_heavy_generator_metadata_location = NULL;
static gchar* sql_heavy_generator_output_location;
static gchar* sql_heavy_generator_output_location = NULL;
static gboolean sql_heavy_generator_write_properties;
static gboolean sql_heavy_generator_write_properties = FALSE;

GQuark sql_heavy_generator_error_quark (void);
GType sql_heavy_generator_get_type (void) G_GNUC_CONST;
#define SQL_HEAVY_GENERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SQL_HEAVY_TYPE_GENERATOR, SQLHeavyGeneratorPrivate))
enum  {
	SQL_HEAVY_GENERATOR_DUMMY_PROPERTY
};
static void _g_free0_ (gpointer var);
static void _g_slist_free__g_free0_ (GSList* self);
static ValaHashMap* sql_heavy_generator_get_symbol_properties (SQLHeavyGenerator* self, const gchar* symbol);
static void sql_heavy_generator_set_symbol_property (SQLHeavyGenerator* self, const gchar* symbol, const gchar* key, const gchar* value);
static gchar* sql_heavy_generator_get_symbol_property (SQLHeavyGenerator* self, const gchar* symbol, const gchar* key);
static gchar* sql_heavy_generator_get_symbol_name (SQLHeavyGenerator* self, const gchar* symbol);
gboolean sql_heavy_generator_symbol_is_hidden (SQLHeavyGenerator* self, const gchar* symbol);
static ValaDataType* sql_heavy_generator_type_from_string (const gchar* datatype);
static ValaDataType* sql_heavy_generator_get_data_type (SQLHeavyGenerator* self, const gchar* symbol);
static void sql_heavy_generator_parse_field (SQLHeavyGenerator* self, SQLHeavyTable* table, gint field, ValaClass* cl, ValaSwitchStatement* signals, ValaSourceReference* source_reference, GError** error);
static void sql_heavy_generator_parse_table (SQLHeavyGenerator* self, SQLHeavyTable* table, ValaNamespace* ns, ValaSourceReference* source_reference, GError** error);
static void sql_heavy_generator_parse_database (SQLHeavyGenerator* self, SQLHeavyDatabase* db, GError** error);
void sql_heavy_generator_run (SQLHeavyGenerator* self, GError** error);
static gchar* sql_heavy_generator_parse_selector (const gchar* selector, gboolean* wildcard, GError** error);
static void sql_heavy_generator_parse_metadata (SQLHeavyGenerator* self, GError** error);
void sql_heavy_generator_configure (SQLHeavyGenerator* self, GError** error);
static gint sql_heavy_generator_main (gchar** args, int args_length1);
SQLHeavyGenerator* sql_heavy_generator_new (void);
SQLHeavyGenerator* sql_heavy_generator_construct (GType object_type);
static void sql_heavy_generator_finalize (GObject* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);

static const GOptionEntry SQL_HEAVY_GENERATOR_options[7] = {{"metadata", 'm', 0, G_OPTION_ARG_FILENAME, &sql_heavy_generator_metadata_location, "Load metadata from FILE", "FILE..."}, {"vapidir", (gchar) 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &sql_heavy_generator_vapi_directories, "Look for package bindings in DIRECTORY", "DIRECTORY..."}, {"pkg", (gchar) 0, 0, G_OPTION_ARG_STRING_ARRAY, &sql_heavy_generator_packages, "Include binding for PACKAGE", "PACKAGE..."}, {"output", 'o', 0, G_OPTION_ARG_FILENAME, &sql_heavy_generator_output_location, "Output to FILE", "FILE..."}, {"properties", 'p', 0, G_OPTION_ARG_NONE, &sql_heavy_generator_write_properties, "Write properties instead of methods", NULL}, {"", (gchar) 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &sql_heavy_generator_sources, "SQLite databases", "DATABASE..."}, {NULL}};

GQuark sql_heavy_generator_error_quark (void) {
	return g_quark_from_static_string ("sql_heavy_generator_error-quark");
}


static void _g_free0_ (gpointer var) {
	var = (g_free (var), NULL);
}


static void _g_slist_free__g_free0_ (GSList* self) {
	g_slist_foreach (self, (GFunc) _g_free0_, NULL);
	g_slist_free (self);
}


static ValaHashMap* sql_heavy_generator_get_symbol_properties (SQLHeavyGenerator* self, const gchar* symbol) {
	ValaHashMap* result = NULL;
	ValaHashMap* _tmp0_;
	const gchar* _tmp1_;
	gpointer _tmp2_ = NULL;
	ValaHashMap* map;
	ValaHashMap* _tmp3_;
	GHashFunc _tmp4_;
	GEqualFunc _tmp5_;
	GEqualFunc _tmp6_;
	ValaHashMap* _tmp7_;
	ValaHashMap* _tmp38_;
	const gchar* _tmp39_;
	ValaHashMap* _tmp40_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (symbol != NULL, NULL);
	_tmp0_ = self->priv->cache;
	_tmp1_ = symbol;
	_tmp2_ = vala_map_get ((ValaMap*) _tmp0_, _tmp1_);
	map = (ValaHashMap*) _tmp2_;
	_tmp3_ = map;
	if (_tmp3_ != NULL) {
		result = map;
		return result;
	}
	_tmp4_ = g_str_hash;
	_tmp5_ = g_str_equal;
	_tmp6_ = g_str_equal;
	_tmp7_ = vala_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, _tmp4_, _tmp5_, _tmp6_);
	_vala_map_unref0 (map);
	map = _tmp7_;
	{
		ValaHashMap* _tmp8_;
		ValaSet* _tmp9_ = NULL;
		ValaSet* _tmp10_;
		ValaIterator* _tmp11_ = NULL;
		ValaIterator* _tmp12_;
		ValaIterator* _selector_it;
		_tmp8_ = self->priv->wildcard_cache;
		_tmp9_ = vala_map_get_keys ((ValaMap*) _tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = vala_iterable_iterator ((ValaIterable*) _tmp10_);
		_tmp12_ = _tmp11_;
		_vala_iterable_unref0 (_tmp10_);
		_selector_it = _tmp12_;
		while (TRUE) {
			ValaIterator* _tmp13_;
			gboolean _tmp14_ = FALSE;
			ValaIterator* _tmp15_;
			gpointer _tmp16_ = NULL;
			gchar* selector;
			const gchar* _tmp17_;
			const gchar* _tmp18_;
			gboolean _tmp19_ = FALSE;
			_tmp13_ = _selector_it;
			_tmp14_ = vala_iterator_next (_tmp13_);
			if (!_tmp14_) {
				break;
			}
			_tmp15_ = _selector_it;
			_tmp16_ = vala_iterator_get (_tmp15_);
			selector = (gchar*) _tmp16_;
			_tmp17_ = selector;
			_tmp18_ = symbol;
			_tmp19_ = g_pattern_match_simple (_tmp17_, _tmp18_);
			if (_tmp19_) {
				ValaHashMap* _tmp20_;
				const gchar* _tmp21_;
				gpointer _tmp22_ = NULL;
				ValaHashMap* wmap;
				_tmp20_ = self->priv->wildcard_cache;
				_tmp21_ = selector;
				_tmp22_ = vala_map_get ((ValaMap*) _tmp20_, _tmp21_);
				wmap = (ValaHashMap*) _tmp22_;
				{
					ValaHashMap* _tmp23_;
					ValaSet* _tmp24_ = NULL;
					ValaSet* _tmp25_;
					ValaIterator* _tmp26_ = NULL;
					ValaIterator* _tmp27_;
					ValaIterator* _key_it;
					_tmp23_ = wmap;
					_tmp24_ = vala_map_get_keys ((ValaMap*) _tmp23_);
					_tmp25_ = _tmp24_;
					_tmp26_ = vala_iterable_iterator ((ValaIterable*) _tmp25_);
					_tmp27_ = _tmp26_;
					_vala_iterable_unref0 (_tmp25_);
					_key_it = _tmp27_;
					while (TRUE) {
						ValaIterator* _tmp28_;
						gboolean _tmp29_ = FALSE;
						ValaIterator* _tmp30_;
						gpointer _tmp31_ = NULL;
						gchar* key;
						ValaHashMap* _tmp32_;
						const gchar* _tmp33_;
						ValaHashMap* _tmp34_;
						const gchar* _tmp35_;
						gpointer _tmp36_ = NULL;
						gchar* _tmp37_;
						_tmp28_ = _key_it;
						_tmp29_ = vala_iterator_next (_tmp28_);
						if (!_tmp29_) {
							break;
						}
						_tmp30_ = _key_it;
						_tmp31_ = vala_iterator_get (_tmp30_);
						key = (gchar*) _tmp31_;
						_tmp32_ = map;
						_tmp33_ = key;
						_tmp34_ = wmap;
						_tmp35_ = key;
						_tmp36_ = vala_map_get ((ValaMap*) _tmp34_, _tmp35_);
						_tmp37_ = (gchar*) _tmp36_;
						vala_map_set ((ValaMap*) _tmp32_, _tmp33_, _tmp37_);
						_g_free0 (_tmp37_);
						_g_free0 (key);
					}
					_vala_iterator_unref0 (_key_it);
				}
				_vala_map_unref0 (wmap);
			}
			_g_free0 (selector);
		}
		_vala_iterator_unref0 (_selector_it);
	}
	_tmp38_ = self->priv->cache;
	_tmp39_ = symbol;
	_tmp40_ = map;
	vala_map_set ((ValaMap*) _tmp38_, _tmp39_, _tmp40_);
	result = map;
	return result;
}


static void sql_heavy_generator_set_symbol_property (SQLHeavyGenerator* self, const gchar* symbol, const gchar* key, const gchar* value) {
	const gchar* _tmp0_;
	ValaHashMap* _tmp1_ = NULL;
	ValaHashMap* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (symbol != NULL);
	g_return_if_fail (key != NULL);
	g_return_if_fail (value != NULL);
	_tmp0_ = symbol;
	_tmp1_ = sql_heavy_generator_get_symbol_properties (self, _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = key;
	_tmp4_ = value;
	vala_map_set ((ValaMap*) _tmp2_, _tmp3_, _tmp4_);
	_vala_map_unref0 (_tmp2_);
}


static gchar* sql_heavy_generator_get_symbol_property (SQLHeavyGenerator* self, const gchar* symbol, const gchar* key) {
	gchar* result = NULL;
	const gchar* _tmp0_;
	ValaHashMap* _tmp1_ = NULL;
	ValaHashMap* _tmp2_;
	const gchar* _tmp3_;
	gpointer _tmp4_ = NULL;
	gchar* _tmp5_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (symbol != NULL, NULL);
	g_return_val_if_fail (key != NULL, NULL);
	_tmp0_ = symbol;
	_tmp1_ = sql_heavy_generator_get_symbol_properties (self, _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = key;
	_tmp4_ = vala_map_get ((ValaMap*) _tmp2_, _tmp3_);
	_tmp5_ = (gchar*) _tmp4_;
	_vala_map_unref0 (_tmp2_);
	result = _tmp5_;
	return result;
}


static const gchar* string_offset (const gchar* self, glong offset) {
	const gchar* result = NULL;
	glong _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = offset;
	result = (const gchar*) (((gchar*) self) + _tmp0_);
	return result;
}


static gchar* sql_heavy_generator_get_symbol_name (SQLHeavyGenerator* self, const gchar* symbol) {
	gchar* result = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_ = NULL;
	gchar* sym;
	const gchar* _tmp2_;
	gint sym_t;
	gboolean tb;
	gboolean sb;
	gboolean tf;
	const gchar* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	GString* _tmp6_;
	GString* name;
	const gchar* _tmp80_;
	GString* _tmp81_;
	const gchar* _tmp82_;
	GString* _tmp83_;
	const gchar* _tmp84_;
	gchar* _tmp85_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (symbol != NULL, NULL);
	_tmp0_ = symbol;
	_tmp1_ = sql_heavy_generator_get_symbol_property (self, _tmp0_, "name");
	sym = _tmp1_;
	_tmp2_ = sym;
	if (_tmp2_ != NULL) {
		result = sym;
		return result;
	}
	sym_t = 3;
	tb = TRUE;
	sb = TRUE;
	tf = TRUE;
	_tmp3_ = symbol;
	_tmp4_ = strlen (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_string_sized_new ((gsize) (_tmp5_ * 2));
	name = _tmp6_;
	{
		const gchar* _tmp7_;
		gchar* _tmp8_;
		gboolean _tmp9_;
		_tmp7_ = symbol;
		_tmp8_ = g_strdup (_tmp7_);
		_g_free0 (sym);
		sym = _tmp8_;
		_tmp9_ = TRUE;
		while (TRUE) {
			gboolean _tmp10_;
			const gchar* _tmp14_;
			gunichar _tmp15_ = 0U;
			gunichar c;
			gunichar _tmp16_;
			gboolean _tmp17_;
			gunichar _tmp20_;
			gboolean _tmp27_ = FALSE;
			gunichar _tmp28_;
			gboolean _tmp29_ = FALSE;
			gboolean _tmp31_;
			gunichar _tmp67_ = 0U;
			gboolean _tmp68_;
			GString* _tmp78_;
			gunichar _tmp79_;
			_tmp10_ = _tmp9_;
			if (!_tmp10_) {
				const gchar* _tmp11_;
				const gchar* _tmp12_ = NULL;
				gchar* _tmp13_;
				_tmp11_ = sym;
				_tmp12_ = string_offset (_tmp11_, (glong) 1);
				_tmp13_ = g_strdup (_tmp12_);
				_g_free0 (sym);
				sym = _tmp13_;
			}
			_tmp9_ = FALSE;
			_tmp14_ = sym;
			_tmp15_ = g_utf8_get_char_validated (_tmp14_, (gssize) (-1));
			c = _tmp15_;
			_tmp16_ = c;
			if (_tmp16_ <= ((gunichar) 0)) {
				break;
			}
			_tmp17_ = sb;
			if (_tmp17_) {
				gunichar _tmp18_;
				_tmp18_ = c;
				if (_tmp18_ == ((gunichar) '@')) {
					sym_t = 1;
					continue;
				} else {
					gunichar _tmp19_;
					_tmp19_ = c;
					if (_tmp19_ == ((gunichar) '%')) {
						sym_t = 2;
						continue;
					}
				}
			}
			_tmp20_ = c;
			if (_tmp20_ == ((gunichar) '_')) {
				tb = TRUE;
				tf = TRUE;
				continue;
			} else {
				gunichar _tmp21_;
				_tmp21_ = c;
				if (_tmp21_ == ((gunichar) '/')) {
					gint _tmp22_;
					gint _tmp23_ = 0;
					gboolean _tmp24_;
					gboolean _tmp25_;
					GString* _tmp26_;
					_tmp22_ = sym_t;
					_tmp23_ = MIN (3, _tmp22_ + 1);
					sym_t = _tmp23_;
					sb = TRUE;
					_tmp24_ = sb;
					tb = _tmp24_;
					_tmp25_ = tb;
					tf = _tmp25_;
					_tmp26_ = name;
					g_string_truncate (_tmp26_, (gsize) 0);
					continue;
				}
			}
			_tmp28_ = c;
			_tmp29_ = g_unichar_isupper (_tmp28_);
			if (_tmp29_) {
				gboolean _tmp30_;
				_tmp30_ = tb;
				_tmp27_ = !_tmp30_;
			} else {
				_tmp27_ = FALSE;
			}
			_tmp31_ = _tmp27_;
			if (_tmp31_) {
				gint _tmp32_;
				gunichar _tmp34_ = 0U;
				gint _tmp35_;
				GString* _tmp40_;
				gunichar _tmp41_;
				_tmp32_ = sym_t;
				if (_tmp32_ == 3) {
					GString* _tmp33_;
					_tmp33_ = name;
					g_string_append_c (_tmp33_, '_');
				}
				tb = TRUE;
				tf = FALSE;
				_tmp35_ = sym_t;
				if (_tmp35_ == 3) {
					gunichar _tmp36_;
					gunichar _tmp37_ = 0U;
					_tmp36_ = c;
					_tmp37_ = g_unichar_tolower (_tmp36_);
					_tmp34_ = _tmp37_;
				} else {
					gunichar _tmp38_;
					gunichar _tmp39_ = 0U;
					_tmp38_ = c;
					_tmp39_ = g_unichar_toupper (_tmp38_);
					_tmp34_ = _tmp39_;
				}
				_tmp40_ = name;
				_tmp41_ = _tmp34_;
				g_string_append_unichar (_tmp40_, _tmp41_);
				continue;
			} else {
				gboolean _tmp42_ = FALSE;
				gunichar _tmp43_;
				gboolean _tmp44_ = FALSE;
				gboolean _tmp46_;
				_tmp43_ = c;
				_tmp44_ = g_unichar_islower (_tmp43_);
				if (_tmp44_) {
					gboolean _tmp45_;
					_tmp45_ = tb;
					_tmp42_ = _tmp45_;
				} else {
					_tmp42_ = FALSE;
				}
				_tmp46_ = _tmp42_;
				if (_tmp46_) {
					gboolean _tmp47_ = FALSE;
					gboolean _tmp48_;
					gboolean _tmp50_;
					gboolean _tmp66_;
					_tmp48_ = tf;
					if (_tmp48_) {
						gint _tmp49_;
						_tmp49_ = sym_t;
						_tmp47_ = _tmp49_ != 3;
					} else {
						_tmp47_ = FALSE;
					}
					_tmp50_ = _tmp47_;
					if (_tmp50_) {
						GString* _tmp51_;
						gunichar _tmp52_;
						gunichar _tmp53_ = 0U;
						_tmp51_ = name;
						_tmp52_ = c;
						_tmp53_ = g_unichar_toupper (_tmp52_);
						g_string_append_unichar (_tmp51_, _tmp53_);
					} else {
						gboolean _tmp54_ = FALSE;
						gboolean _tmp55_ = FALSE;
						gboolean _tmp56_;
						gboolean _tmp58_;
						gboolean _tmp60_;
						_tmp56_ = tf;
						if (_tmp56_) {
							gboolean _tmp57_;
							_tmp57_ = sb;
							_tmp55_ = !_tmp57_;
						} else {
							_tmp55_ = FALSE;
						}
						_tmp58_ = _tmp55_;
						if (_tmp58_) {
							gint _tmp59_;
							_tmp59_ = sym_t;
							_tmp54_ = _tmp59_ == 3;
						} else {
							_tmp54_ = FALSE;
						}
						_tmp60_ = _tmp54_;
						if (_tmp60_) {
							GString* _tmp61_;
							GString* _tmp62_;
							gunichar _tmp63_;
							_tmp61_ = name;
							g_string_append_c (_tmp61_, '_');
							_tmp62_ = name;
							_tmp63_ = c;
							g_string_append_unichar (_tmp62_, _tmp63_);
						} else {
							GString* _tmp64_;
							gunichar _tmp65_;
							_tmp64_ = name;
							_tmp65_ = c;
							g_string_append_unichar (_tmp64_, _tmp65_);
						}
					}
					tf = FALSE;
					_tmp66_ = tf;
					tb = _tmp66_;
					continue;
				}
			}
			sb = FALSE;
			_tmp68_ = tb;
			if (_tmp68_) {
				gunichar _tmp69_ = 0U;
				gint _tmp70_;
				gunichar _tmp75_;
				_tmp70_ = sym_t;
				if (_tmp70_ == 3) {
					gunichar _tmp71_;
					gunichar _tmp72_ = 0U;
					_tmp71_ = c;
					_tmp72_ = g_unichar_tolower (_tmp71_);
					_tmp69_ = _tmp72_;
				} else {
					gunichar _tmp73_;
					gunichar _tmp74_ = 0U;
					_tmp73_ = c;
					_tmp74_ = g_unichar_toupper (_tmp73_);
					_tmp69_ = _tmp74_;
				}
				_tmp75_ = _tmp69_;
				_tmp67_ = _tmp75_;
			} else {
				gunichar _tmp76_;
				gunichar _tmp77_ = 0U;
				_tmp76_ = c;
				_tmp77_ = g_unichar_tolower (_tmp76_);
				_tmp67_ = _tmp77_;
			}
			_tmp78_ = name;
			_tmp79_ = _tmp67_;
			g_string_append_unichar (_tmp78_, _tmp79_);
			tf = FALSE;
		}
	}
	_tmp80_ = symbol;
	_tmp81_ = name;
	_tmp82_ = _tmp81_->str;
	sql_heavy_generator_set_symbol_property (self, _tmp80_, "name", _tmp82_);
	_tmp83_ = name;
	_tmp84_ = _tmp83_->str;
	_tmp85_ = g_strdup (_tmp84_);
	result = _tmp85_;
	_g_string_free0 (name);
	_g_free0 (sym);
	return result;
}


gboolean sql_heavy_generator_symbol_is_hidden (SQLHeavyGenerator* self, const gchar* symbol) {
	gboolean result = FALSE;
	const gchar* _tmp0_;
	gchar* _tmp1_ = NULL;
	gchar* p;
	gboolean _tmp2_ = FALSE;
	const gchar* _tmp3_;
	gboolean _tmp11_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (symbol != NULL, FALSE);
	_tmp0_ = symbol;
	_tmp1_ = sql_heavy_generator_get_symbol_property (self, _tmp0_, "hidden");
	p = _tmp1_;
	_tmp3_ = p;
	if (_tmp3_ != NULL) {
		gboolean _tmp4_ = FALSE;
		gboolean _tmp5_ = FALSE;
		const gchar* _tmp6_;
		gboolean _tmp8_;
		gboolean _tmp10_;
		_tmp6_ = p;
		if (g_strcmp0 (_tmp6_, "1") == 0) {
			_tmp5_ = TRUE;
		} else {
			const gchar* _tmp7_;
			_tmp7_ = p;
			_tmp5_ = g_strcmp0 (_tmp7_, "true") == 0;
		}
		_tmp8_ = _tmp5_;
		if (_tmp8_) {
			_tmp4_ = TRUE;
		} else {
			const gchar* _tmp9_;
			_tmp9_ = p;
			_tmp4_ = g_strcmp0 (_tmp9_, "yes") == 0;
		}
		_tmp10_ = _tmp4_;
		_tmp2_ = _tmp10_;
	} else {
		_tmp2_ = FALSE;
	}
	_tmp11_ = _tmp2_;
	result = _tmp11_;
	_g_free0 (p);
	return result;
}


static glong string_strnlen (gchar* str, glong maxlen) {
	glong result = 0L;
	gchar* _tmp0_;
	glong _tmp1_;
	gchar* _tmp2_ = NULL;
	gchar* end;
	gchar* _tmp3_;
	_tmp0_ = str;
	_tmp1_ = maxlen;
	_tmp2_ = memchr (_tmp0_, 0, (gsize) _tmp1_);
	end = _tmp2_;
	_tmp3_ = end;
	if (_tmp3_ == NULL) {
		glong _tmp4_;
		_tmp4_ = maxlen;
		result = _tmp4_;
		return result;
	} else {
		gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp5_ = end;
		_tmp6_ = str;
		result = (glong) (_tmp5_ - _tmp6_);
		return result;
	}
}


static gchar* string_substring (const gchar* self, glong offset, glong len) {
	gchar* result = NULL;
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	glong _tmp1_;
	gboolean _tmp3_;
	glong _tmp9_;
	glong _tmp15_;
	glong _tmp18_;
	glong _tmp19_;
	glong _tmp20_;
	glong _tmp21_;
	glong _tmp22_;
	gchar* _tmp23_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = offset;
	if (_tmp1_ >= ((glong) 0)) {
		glong _tmp2_;
		_tmp2_ = len;
		_tmp0_ = _tmp2_ >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	_tmp3_ = _tmp0_;
	if (_tmp3_) {
		glong _tmp4_;
		glong _tmp5_;
		glong _tmp6_ = 0L;
		_tmp4_ = offset;
		_tmp5_ = len;
		_tmp6_ = string_strnlen ((gchar*) self, _tmp4_ + _tmp5_);
		string_length = _tmp6_;
	} else {
		gint _tmp7_;
		gint _tmp8_;
		_tmp7_ = strlen (self);
		_tmp8_ = _tmp7_;
		string_length = (glong) _tmp8_;
	}
	_tmp9_ = offset;
	if (_tmp9_ < ((glong) 0)) {
		glong _tmp10_;
		glong _tmp11_;
		glong _tmp12_;
		_tmp10_ = string_length;
		_tmp11_ = offset;
		offset = _tmp10_ + _tmp11_;
		_tmp12_ = offset;
		g_return_val_if_fail (_tmp12_ >= ((glong) 0), NULL);
	} else {
		glong _tmp13_;
		glong _tmp14_;
		_tmp13_ = offset;
		_tmp14_ = string_length;
		g_return_val_if_fail (_tmp13_ <= _tmp14_, NULL);
	}
	_tmp15_ = len;
	if (_tmp15_ < ((glong) 0)) {
		glong _tmp16_;
		glong _tmp17_;
		_tmp16_ = string_length;
		_tmp17_ = offset;
		len = _tmp16_ - _tmp17_;
	}
	_tmp18_ = offset;
	_tmp19_ = len;
	_tmp20_ = string_length;
	g_return_val_if_fail ((_tmp18_ + _tmp19_) <= _tmp20_, NULL);
	_tmp21_ = offset;
	_tmp22_ = len;
	_tmp23_ = g_strndup (((gchar*) self) + _tmp21_, (gsize) _tmp22_);
	result = _tmp23_;
	return result;
}


static ValaDataType* sql_heavy_generator_type_from_string (const gchar* datatype) {
	ValaDataType* result = NULL;
	gboolean is_array;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* internal_datatype;
	ValaUnresolvedSymbol* symbol;
	const gchar* _tmp2_;
	gboolean _tmp3_ = FALSE;
	const gchar* _tmp6_;
	gchar** _tmp7_;
	gchar** _tmp8_ = NULL;
	ValaUnresolvedSymbol* _tmp12_;
	ValaUnresolvedType* _tmp13_;
	ValaUnresolvedType* data_type;
	gboolean _tmp14_;
	g_return_val_if_fail (datatype != NULL, NULL);
	is_array = FALSE;
	_tmp0_ = datatype;
	_tmp1_ = g_strdup (_tmp0_);
	internal_datatype = _tmp1_;
	symbol = NULL;
	_tmp2_ = datatype;
	_tmp3_ = g_str_has_suffix (_tmp2_, "[]");
	if (_tmp3_) {
		const gchar* _tmp4_;
		gchar* _tmp5_ = NULL;
		_tmp4_ = internal_datatype;
		_tmp5_ = string_substring (_tmp4_, (glong) 0, (glong) (-2));
		_g_free0 (internal_datatype);
		internal_datatype = _tmp5_;
		is_array = TRUE;
	}
	_tmp6_ = internal_datatype;
	_tmp8_ = _tmp7_ = g_strsplit (_tmp6_, ".", 0);
	{
		gchar** m_collection = NULL;
		gint m_collection_length1 = 0;
		gint _m_collection_size_ = 0;
		gint m_it = 0;
		m_collection = _tmp8_;
		m_collection_length1 = _vala_array_length (_tmp7_);
		for (m_it = 0; m_it < _vala_array_length (_tmp7_); m_it = m_it + 1) {
			const gchar* m = NULL;
			m = m_collection[m_it];
			{
				ValaUnresolvedSymbol* _tmp9_;
				const gchar* _tmp10_;
				ValaUnresolvedSymbol* _tmp11_;
				_tmp9_ = symbol;
				_tmp10_ = m;
				_tmp11_ = vala_unresolved_symbol_new (_tmp9_, _tmp10_, NULL);
				_vala_code_node_unref0 (symbol);
				symbol = _tmp11_;
			}
		}
		m_collection = (_vala_array_free (m_collection, m_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp12_ = symbol;
	_tmp13_ = vala_unresolved_type_new_from_symbol (_tmp12_, NULL);
	data_type = _tmp13_;
	_tmp14_ = is_array;
	if (_tmp14_) {
		ValaUnresolvedType* _tmp15_;
		ValaArrayType* _tmp16_;
		_tmp15_ = data_type;
		_tmp16_ = vala_array_type_new ((ValaDataType*) _tmp15_, 1, NULL);
		result = (ValaDataType*) _tmp16_;
		_vala_code_node_unref0 (data_type);
		_vala_code_node_unref0 (symbol);
		_g_free0 (internal_datatype);
		return result;
	} else {
		result = (ValaDataType*) data_type;
		_vala_code_node_unref0 (symbol);
		_g_free0 (internal_datatype);
		return result;
	}
	_vala_code_node_unref0 (data_type);
	_vala_code_node_unref0 (symbol);
	_g_free0 (internal_datatype);
}


static ValaDataType* sql_heavy_generator_get_data_type (SQLHeavyGenerator* self, const gchar* symbol) {
	ValaDataType* result = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_ = NULL;
	gchar* name;
	ValaDataType* _tmp2_ = NULL;
	const gchar* _tmp3_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (symbol != NULL, NULL);
	_tmp0_ = symbol;
	_tmp1_ = sql_heavy_generator_get_symbol_property (self, _tmp0_, "type");
	name = _tmp1_;
	_tmp3_ = name;
	if (_tmp3_ == NULL) {
		_vala_code_node_unref0 (_tmp2_);
		_tmp2_ = NULL;
	} else {
		const gchar* _tmp4_;
		ValaDataType* _tmp5_ = NULL;
		_tmp4_ = name;
		_tmp5_ = sql_heavy_generator_type_from_string (_tmp4_);
		_vala_code_node_unref0 (_tmp2_);
		_tmp2_ = _tmp5_;
	}
	result = _tmp2_;
	_g_free0 (name);
	return result;
}


static const gchar* string_to_string (const gchar* self) {
	const gchar* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}


static gchar* string_replace (const gchar* self, const gchar* old, const gchar* replacement) {
	gchar* result = NULL;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	{
		const gchar* _tmp0_;
		gchar* _tmp1_ = NULL;
		gchar* _tmp2_;
		GRegex* _tmp3_;
		GRegex* _tmp4_;
		GRegex* regex;
		GRegex* _tmp5_;
		const gchar* _tmp6_;
		gchar* _tmp7_ = NULL;
		gchar* _tmp8_;
		_tmp0_ = old;
		_tmp1_ = g_regex_escape_string (_tmp0_, -1);
		_tmp2_ = _tmp1_;
		_tmp3_ = g_regex_new (_tmp2_, 0, 0, &_inner_error_);
		_tmp4_ = _tmp3_;
		_g_free0 (_tmp2_);
		regex = _tmp4_;
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return NULL;
		}
		_tmp5_ = regex;
		_tmp6_ = replacement;
		_tmp7_ = g_regex_replace_literal (_tmp5_, self, (gssize) (-1), 0, _tmp6_, 0, &_inner_error_);
		_tmp8_ = _tmp7_;
		if (_inner_error_ != NULL) {
			_g_regex_unref0 (regex);
			if (_inner_error_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			_g_regex_unref0 (regex);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return NULL;
		}
		result = _tmp8_;
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		GError* e = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		g_assert_not_reached ();
		_g_error_free0 (e);
	}
	__finally0:
	if (_inner_error_ != NULL) {
		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);
		g_clear_error (&_inner_error_);
		return NULL;
	}
}


static void sql_heavy_generator_parse_field (SQLHeavyGenerator* self, SQLHeavyTable* table, gint field, ValaClass* cl, ValaSwitchStatement* signals, ValaSourceReference* source_reference, GError** error) {
	SQLHeavyTable* _tmp0_;
	SQLHeavyQueryable* _tmp1_;
	SQLHeavyQueryable* _tmp2_;
	SQLHeavyDatabase* _tmp3_;
	SQLHeavyDatabase* _tmp4_;
	SQLHeavyDatabase* db;
	SQLHeavyDatabase* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_ = NULL;
	gchar* _tmp9_;
	gchar** _tmp10_;
	gchar** _tmp11_ = NULL;
	gchar** _tmp12_;
	gint _tmp12__length1;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* db_symbol;
	SQLHeavyTable* _tmp16_;
	gint _tmp17_;
	gchar* _tmp18_ = NULL;
	gchar* _tmp19_;
	const gchar* _tmp20_;
	gchar* _tmp21_ = NULL;
	gchar* _tmp22_;
	const gchar* _tmp23_ = NULL;
	SQLHeavyTable* _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_ = NULL;
	gchar* _tmp28_;
	const gchar* _tmp29_ = NULL;
	gchar* _tmp30_ = NULL;
	gchar* _tmp31_;
	gchar* symbol;
	const gchar* _tmp32_;
	gchar* _tmp33_ = NULL;
	gchar* name;
	const gchar* _tmp34_;
	gboolean _tmp35_ = FALSE;
	const gchar* _tmp36_;
	ValaDataType* _tmp37_ = NULL;
	ValaDataType* data_type;
	ValaDataType* _tmp38_;
	ValaDataType* _tmp86_;
	ValaDataType* _tmp87_ = NULL;
	ValaDataType* data_type_get;
	ValaDataType* _tmp88_;
	ValaSourceReference* _tmp89_;
	ValaSwitchSection* _tmp90_;
	ValaSwitchSection* switch_section;
	ValaSwitchStatement* _tmp91_;
	ValaSwitchSection* _tmp92_;
	ValaSwitchSection* _tmp93_;
	const gchar* _tmp94_;
	const gchar* _tmp95_ = NULL;
	gchar* _tmp96_ = NULL;
	gchar* _tmp97_;
	ValaSourceReference* _tmp98_;
	ValaStringLiteral* _tmp99_;
	ValaStringLiteral* _tmp100_;
	ValaSourceReference* _tmp101_;
	ValaSwitchLabel* _tmp102_;
	ValaSwitchLabel* _tmp103_;
	ValaMethodCall* emit_changed_notify = NULL;
	gboolean _tmp104_;
	ValaSwitchSection* _tmp440_;
	ValaMethodCall* _tmp441_;
	ValaSourceReference* _tmp442_;
	ValaExpressionStatement* _tmp443_;
	ValaExpressionStatement* _tmp444_;
	ValaSwitchSection* _tmp445_;
	ValaSourceReference* _tmp446_;
	ValaBreakStatement* _tmp447_;
	ValaBreakStatement* _tmp448_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (table != NULL);
	g_return_if_fail (cl != NULL);
	g_return_if_fail (signals != NULL);
	g_return_if_fail (source_reference != NULL);
	_tmp0_ = table;
	_tmp1_ = sql_heavy_table_get_queryable (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = sql_heavy_queryable_get_database (_tmp2_);
	_tmp4_ = _tmp3_;
	db = _tmp4_;
	_tmp5_ = db;
	_tmp6_ = sql_heavy_database_get_filename (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_path_get_basename (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp11_ = _tmp10_ = g_strsplit (_tmp9_, ".", 2);
	_tmp12_ = _tmp11_;
	_tmp12__length1 = _vala_array_length (_tmp10_);
	_tmp13_ = _tmp12_[0];
	_tmp14_ = g_strdup (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp12_ = (_vala_array_free (_tmp12_, _tmp12__length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (_tmp9_);
	db_symbol = _tmp15_;
	_tmp16_ = table;
	_tmp17_ = field;
	_tmp18_ = sql_heavy_table_field_name (_tmp16_, _tmp17_, &_inner_error_);
	_tmp19_ = _tmp18_;
	if (_inner_error_ != NULL) {
		if ((_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) || (_inner_error_->domain == SQL_HEAVY_ERROR)) {
			g_propagate_error (error, _inner_error_);
			_g_free0 (db_symbol);
			_g_object_unref0 (db);
			return;
		} else {
			_g_free0 (db_symbol);
			_g_object_unref0 (db);
			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);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	_tmp20_ = db_symbol;
	_tmp21_ = g_path_get_basename (_tmp20_);
	_tmp22_ = _tmp21_;
	_tmp23_ = string_to_string (_tmp22_);
	_tmp24_ = table;
	_tmp25_ = sql_heavy_table_get_name (_tmp24_);
	_tmp26_ = _tmp25_;
	_tmp27_ = string_to_string (_tmp26_);
	_tmp28_ = _tmp19_;
	_tmp29_ = string_to_string (_tmp28_);
	_tmp30_ = g_strconcat ("@", _tmp23_, "/", _tmp27_, "/", _tmp29_, NULL);
	_tmp31_ = _tmp30_;
	_g_free0 (_tmp28_);
	_g_free0 (_tmp22_);
	symbol = _tmp31_;
	_tmp32_ = symbol;
	_tmp33_ = sql_heavy_generator_get_symbol_name (self, _tmp32_);
	name = _tmp33_;
	_tmp34_ = symbol;
	_tmp35_ = sql_heavy_generator_symbol_is_hidden (self, _tmp34_);
	if (_tmp35_) {
		_g_free0 (name);
		_g_free0 (symbol);
		_g_free0 (db_symbol);
		_g_object_unref0 (db);
		return;
	}
	_tmp36_ = symbol;
	_tmp37_ = sql_heavy_generator_get_data_type (self, _tmp36_);
	data_type = _tmp37_;
	_tmp38_ = data_type;
	if (_tmp38_ == NULL) {
		SQLHeavyTable* _tmp39_;
		gint _tmp40_;
		gchar* _tmp41_ = NULL;
		gchar* _tmp42_;
		gchar* _tmp43_;
		gchar* _tmp44_ = NULL;
		gchar* _tmp45_;
		gchar** _tmp46_;
		gchar** _tmp47_ = NULL;
		gchar** _tmp48_;
		gint _tmp48__length1;
		gchar** affinity;
		gint affinity_length1;
		gint _affinity_size_;
		gchar** _tmp49_;
		gint _tmp49__length1;
		const gchar* _tmp50_;
		gchar** _tmp83_;
		gint _tmp83__length1;
		const gchar* _tmp84_;
		ValaDataType* _tmp85_ = NULL;
		_tmp39_ = table;
		_tmp40_ = field;
		_tmp41_ = sql_heavy_table_field_affinity (_tmp39_, _tmp40_, &_inner_error_);
		_tmp42_ = _tmp41_;
		if (_inner_error_ != NULL) {
			if ((_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) || (_inner_error_->domain == SQL_HEAVY_ERROR)) {
				g_propagate_error (error, _inner_error_);
				_vala_code_node_unref0 (data_type);
				_g_free0 (name);
				_g_free0 (symbol);
				_g_free0 (db_symbol);
				_g_object_unref0 (db);
				return;
			} else {
				_vala_code_node_unref0 (data_type);
				_g_free0 (name);
				_g_free0 (symbol);
				_g_free0 (db_symbol);
				_g_object_unref0 (db);
				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);
				g_clear_error (&_inner_error_);
				return;
			}
		}
		_tmp43_ = _tmp42_;
		_tmp44_ = g_utf8_strdown (_tmp43_, (gssize) (-1));
		_tmp45_ = _tmp44_;
		_tmp47_ = _tmp46_ = g_strsplit (_tmp45_, " ", 0);
		_tmp48_ = _tmp47_;
		_tmp48__length1 = _vala_array_length (_tmp46_);
		_g_free0 (_tmp45_);
		_g_free0 (_tmp43_);
		affinity = _tmp48_;
		affinity_length1 = _tmp48__length1;
		_affinity_size_ = affinity_length1;
		_tmp49_ = affinity;
		_tmp49__length1 = affinity_length1;
		_tmp50_ = _tmp49_[0];
		if (g_strcmp0 (_tmp50_, "integer") == 0) {
			gchar** _tmp51_;
			gint _tmp51__length1;
			gchar* _tmp52_;
			gchar* _tmp53_;
			_tmp51_ = affinity;
			_tmp51__length1 = affinity_length1;
			_tmp52_ = g_strdup ("int");
			_g_free0 (_tmp51_[0]);
			_tmp51_[0] = _tmp52_;
			_tmp53_ = _tmp51_[0];
		} else {
			gboolean _tmp54_ = FALSE;
			gboolean _tmp55_ = FALSE;
			gchar** _tmp56_;
			gint _tmp56__length1;
			const gchar* _tmp57_;
			gboolean _tmp61_;
			gboolean _tmp65_;
			_tmp56_ = affinity;
			_tmp56__length1 = affinity_length1;
			_tmp57_ = _tmp56_[0];
			if (g_strcmp0 (_tmp57_, "text") == 0) {
				_tmp55_ = TRUE;
			} else {
				gchar** _tmp58_;
				gint _tmp58__length1;
				const gchar* _tmp59_;
				gboolean _tmp60_ = FALSE;
				_tmp58_ = affinity;
				_tmp58__length1 = affinity_length1;
				_tmp59_ = _tmp58_[0];
				_tmp60_ = g_str_has_prefix (_tmp59_, "varchar");
				_tmp55_ = _tmp60_;
			}
			_tmp61_ = _tmp55_;
			if (_tmp61_) {
				_tmp54_ = TRUE;
			} else {
				gchar** _tmp62_;
				gint _tmp62__length1;
				const gchar* _tmp63_;
				gboolean _tmp64_ = FALSE;
				_tmp62_ = affinity;
				_tmp62__length1 = affinity_length1;
				_tmp63_ = _tmp62_[0];
				_tmp64_ = g_str_has_prefix (_tmp63_, "char");
				_tmp54_ = _tmp64_;
			}
			_tmp65_ = _tmp54_;
			if (_tmp65_) {
				gchar** _tmp66_;
				gint _tmp66__length1;
				gchar* _tmp67_;
				gchar* _tmp68_;
				_tmp66_ = affinity;
				_tmp66__length1 = affinity_length1;
				_tmp67_ = g_strdup ("string");
				_g_free0 (_tmp66_[0]);
				_tmp66_[0] = _tmp67_;
				_tmp68_ = _tmp66_[0];
			} else {
				gchar** _tmp69_;
				gint _tmp69__length1;
				const gchar* _tmp70_;
				_tmp69_ = affinity;
				_tmp69__length1 = affinity_length1;
				_tmp70_ = _tmp69_[0];
				if (g_strcmp0 (_tmp70_, "blob") == 0) {
					gchar** _tmp71_;
					gint _tmp71__length1;
					gchar* _tmp72_;
					gchar* _tmp73_;
					_tmp71_ = affinity;
					_tmp71__length1 = affinity_length1;
					_tmp72_ = g_strdup ("uint8[]");
					_g_free0 (_tmp71_[0]);
					_tmp71_[0] = _tmp72_;
					_tmp73_ = _tmp71_[0];
				} else {
					gboolean _tmp74_ = FALSE;
					gchar** _tmp75_;
					gint _tmp75__length1;
					const gchar* _tmp76_;
					gboolean _tmp79_;
					_tmp75_ = affinity;
					_tmp75__length1 = affinity_length1;
					_tmp76_ = _tmp75_[0];
					if (g_strcmp0 (_tmp76_, "timestamp") == 0) {
						_tmp74_ = TRUE;
					} else {
						gchar** _tmp77_;
						gint _tmp77__length1;
						const gchar* _tmp78_;
						_tmp77_ = affinity;
						_tmp77__length1 = affinity_length1;
						_tmp78_ = _tmp77_[0];
						_tmp74_ = g_strcmp0 (_tmp78_, "datetime") == 0;
					}
					_tmp79_ = _tmp74_;
					if (_tmp79_) {
						gchar** _tmp80_;
						gint _tmp80__length1;
						gchar* _tmp81_;
						gchar* _tmp82_;
						_tmp80_ = affinity;
						_tmp80__length1 = affinity_length1;
						_tmp81_ = g_strdup ("time_t");
						_g_free0 (_tmp80_[0]);
						_tmp80_[0] = _tmp81_;
						_tmp82_ = _tmp80_[0];
					}
				}
			}
		}
		_tmp83_ = affinity;
		_tmp83__length1 = affinity_length1;
		_tmp84_ = _tmp83_[0];
		_tmp85_ = sql_heavy_generator_type_from_string (_tmp84_);
		_vala_code_node_unref0 (data_type);
		data_type = _tmp85_;
		affinity = (_vala_array_free (affinity, affinity_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp86_ = data_type;
	_tmp87_ = vala_data_type_copy (_tmp86_);
	data_type_get = _tmp87_;
	_tmp88_ = data_type_get;
	vala_data_type_set_value_owned (_tmp88_, TRUE);
	_tmp89_ = source_reference;
	_tmp90_ = vala_switch_section_new (_tmp89_);
	switch_section = _tmp90_;
	_tmp91_ = signals;
	_tmp92_ = switch_section;
	vala_switch_statement_add_section (_tmp91_, _tmp92_);
	_tmp93_ = switch_section;
	_tmp94_ = name;
	_tmp95_ = string_to_string (_tmp94_);
	_tmp96_ = g_strconcat ("\"", _tmp95_, "\"", NULL);
	_tmp97_ = _tmp96_;
	_tmp98_ = source_reference;
	_tmp99_ = vala_string_literal_new (_tmp97_, _tmp98_);
	_tmp100_ = _tmp99_;
	_tmp101_ = source_reference;
	_tmp102_ = vala_switch_label_new ((ValaExpression*) _tmp100_, _tmp101_);
	_tmp103_ = _tmp102_;
	vala_switch_section_add_label (_tmp93_, _tmp103_);
	_vala_code_node_unref0 (_tmp103_);
	_vala_code_node_unref0 (_tmp100_);
	_g_free0 (_tmp97_);
	_tmp104_ = sql_heavy_generator_write_properties;
	if (!_tmp104_) {
		const gchar* _tmp105_;
		const gchar* _tmp106_ = NULL;
		gchar* _tmp107_ = NULL;
		gchar* _tmp108_;
		ValaSourceReference* _tmp109_;
		ValaVoidType* _tmp110_;
		ValaVoidType* _tmp111_;
		ValaSourceReference* _tmp112_;
		ValaSignal* _tmp113_;
		ValaSignal* _tmp114_;
		ValaSignal* changed_signal;
		ValaSignal* _tmp115_;
		ValaClass* _tmp116_;
		ValaSignal* _tmp117_;
		ValaStringLiteral* _tmp118_;
		ValaStringLiteral* _tmp119_;
		const gchar* _tmp120_;
		const gchar* _tmp121_ = NULL;
		gchar* _tmp122_ = NULL;
		gchar* _tmp123_;
		ValaSourceReference* _tmp124_;
		ValaMemberAccess* _tmp125_;
		ValaMemberAccess* _tmp126_;
		ValaSourceReference* _tmp127_;
		ValaMethodCall* _tmp128_;
		_tmp105_ = name;
		_tmp106_ = string_to_string (_tmp105_);
		_tmp107_ = g_strconcat (_tmp106_, "_changed", NULL);
		_tmp108_ = _tmp107_;
		_tmp109_ = source_reference;
		_tmp110_ = vala_void_type_new (_tmp109_);
		_tmp111_ = _tmp110_;
		_tmp112_ = source_reference;
		_tmp113_ = vala_signal_new (_tmp108_, (ValaDataType*) _tmp111_, _tmp112_, NULL);
		_tmp114_ = _tmp113_;
		_vala_code_node_unref0 (_tmp111_);
		_g_free0 (_tmp108_);
		changed_signal = _tmp114_;
		_tmp115_ = changed_signal;
		vala_symbol_set_access ((ValaSymbol*) _tmp115_, VALA_SYMBOL_ACCESSIBILITY_PUBLIC);
		_tmp116_ = cl;
		_tmp117_ = changed_signal;
		vala_symbol_add_signal ((ValaSymbol*) _tmp116_, _tmp117_);
		_tmp118_ = vala_string_literal_new ("this", NULL);
		_tmp119_ = _tmp118_;
		_tmp120_ = name;
		_tmp121_ = string_to_string (_tmp120_);
		_tmp122_ = g_strconcat (_tmp121_, "_changed", NULL);
		_tmp123_ = _tmp122_;
		_tmp124_ = source_reference;
		_tmp125_ = vala_member_access_new ((ValaExpression*) _tmp119_, _tmp123_, _tmp124_);
		_tmp126_ = _tmp125_;
		_tmp127_ = source_reference;
		_tmp128_ = vala_method_call_new ((ValaExpression*) _tmp126_, _tmp127_);
		_vala_code_node_unref0 (emit_changed_notify);
		emit_changed_notify = _tmp128_;
		_vala_code_node_unref0 (_tmp126_);
		_g_free0 (_tmp123_);
		_vala_code_node_unref0 (_tmp119_);
		{
			const gchar* _tmp129_;
			const gchar* _tmp130_ = NULL;
			gchar* _tmp131_ = NULL;
			gchar* _tmp132_;
			ValaDataType* _tmp133_;
			ValaSourceReference* _tmp134_;
			ValaMethod* _tmp135_;
			ValaMethod* _tmp136_;
			ValaMethod* get_method;
			ValaClass* _tmp137_;
			ValaMethod* _tmp138_;
			ValaMethod* _tmp139_;
			ValaMethod* _tmp140_;
			ValaDataType* _tmp141_ = NULL;
			ValaDataType* _tmp142_;
			ValaSourceReference* _tmp143_;
			ValaBlock* _tmp144_;
			ValaBlock* block;
			ValaStringLiteral* _tmp145_;
			ValaStringLiteral* _tmp146_;
			ValaDataType* _tmp147_;
			gchar* _tmp148_ = NULL;
			gchar* _tmp149_;
			const gchar* _tmp150_ = NULL;
			gchar* _tmp151_ = NULL;
			gchar* _tmp152_;
			ValaSourceReference* _tmp153_;
			ValaMemberAccess* _tmp154_;
			ValaMemberAccess* _tmp155_;
			ValaSourceReference* _tmp156_;
			ValaMethodCall* _tmp157_;
			ValaMethodCall* _tmp158_;
			ValaMethodCall* call;
			SQLHeavyTable* _tmp159_;
			gint _tmp160_;
			gchar* _tmp161_ = NULL;
			gchar* _tmp162_;
			ValaMethodCall* _tmp163_;
			gchar* _tmp164_;
			const gchar* _tmp165_ = NULL;
			gchar* _tmp166_ = NULL;
			gchar* _tmp167_;
			ValaSourceReference* _tmp168_;
			ValaStringLiteral* _tmp169_;
			ValaStringLiteral* _tmp170_;
			ValaBlock* _tmp171_;
			ValaMethodCall* _tmp172_;
			ValaSourceReference* _tmp173_;
			ValaReturnStatement* _tmp174_;
			ValaReturnStatement* _tmp175_;
			ValaMethod* _tmp176_;
			ValaBlock* _tmp177_;
			_tmp129_ = name;
			_tmp130_ = string_to_string (_tmp129_);
			_tmp131_ = g_strconcat ("get_", _tmp130_, NULL);
			_tmp132_ = _tmp131_;
			_tmp133_ = data_type_get;
			_tmp134_ = source_reference;
			_tmp135_ = vala_method_new (_tmp132_, _tmp133_, _tmp134_, NULL);
			_tmp136_ = _tmp135_;
			_g_free0 (_tmp132_);
			get_method = _tmp136_;
			_tmp137_ = cl;
			_tmp138_ = get_method;
			vala_symbol_add_method ((ValaSymbol*) _tmp137_, _tmp138_);
			_tmp139_ = get_method;
			vala_symbol_set_access ((ValaSymbol*) _tmp139_, VALA_SYMBOL_ACCESSIBILITY_PUBLIC);
			_tmp140_ = get_method;
			_tmp141_ = sql_heavy_generator_type_from_string ("SQLHeavy.Error");
			_tmp142_ = _tmp141_;
			vala_code_node_add_error_type ((ValaCodeNode*) _tmp140_, _tmp142_);
			_vala_code_node_unref0 (_tmp142_);
			_tmp143_ = source_reference;
			_tmp144_ = vala_block_new (_tmp143_);
			block = _tmp144_;
			_tmp145_ = vala_string_literal_new ("this", NULL);
			_tmp146_ = _tmp145_;
			_tmp147_ = data_type_get;
			_tmp148_ = vala_code_node_to_string ((ValaCodeNode*) _tmp147_);
			_tmp149_ = _tmp148_;
			_tmp150_ = string_to_string (_tmp149_);
			_tmp151_ = g_strconcat ("get_", _tmp150_, NULL);
			_tmp152_ = _tmp151_;
			_tmp153_ = source_reference;
			_tmp154_ = vala_member_access_new ((ValaExpression*) _tmp146_, _tmp152_, _tmp153_);
			_tmp155_ = _tmp154_;
			_tmp156_ = source_reference;
			_tmp157_ = vala_method_call_new ((ValaExpression*) _tmp155_, _tmp156_);
			_tmp158_ = _tmp157_;
			_vala_code_node_unref0 (_tmp155_);
			_g_free0 (_tmp152_);
			_g_free0 (_tmp149_);
			_vala_code_node_unref0 (_tmp146_);
			call = _tmp158_;
			_tmp159_ = table;
			_tmp160_ = field;
			_tmp161_ = sql_heavy_table_field_name (_tmp159_, _tmp160_, &_inner_error_);
			_tmp162_ = _tmp161_;
			if (_inner_error_ != NULL) {
				if ((_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) || (_inner_error_->domain == SQL_HEAVY_ERROR)) {
					g_propagate_error (error, _inner_error_);
					_vala_code_node_unref0 (call);
					_vala_code_node_unref0 (block);
					_vala_code_node_unref0 (get_method);
					_vala_code_node_unref0 (changed_signal);
					_vala_code_node_unref0 (emit_changed_notify);
					_vala_code_node_unref0 (switch_section);
					_vala_code_node_unref0 (data_type_get);
					_vala_code_node_unref0 (data_type);
					_g_free0 (name);
					_g_free0 (symbol);
					_g_free0 (db_symbol);
					_g_object_unref0 (db);
					return;
				} else {
					_vala_code_node_unref0 (call);
					_vala_code_node_unref0 (block);
					_vala_code_node_unref0 (get_method);
					_vala_code_node_unref0 (changed_signal);
					_vala_code_node_unref0 (emit_changed_notify);
					_vala_code_node_unref0 (switch_section);
					_vala_code_node_unref0 (data_type_get);
					_vala_code_node_unref0 (data_type);
					_g_free0 (name);
					_g_free0 (symbol);
					_g_free0 (db_symbol);
					_g_object_unref0 (db);
					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);
					g_clear_error (&_inner_error_);
					return;
				}
			}
			_tmp163_ = call;
			_tmp164_ = _tmp162_;
			_tmp165_ = string_to_string (_tmp164_);
			_tmp166_ = g_strconcat ("\"", _tmp165_, "\"", NULL);
			_tmp167_ = _tmp166_;
			_tmp168_ = source_reference;
			_tmp169_ = vala_string_literal_new (_tmp167_, _tmp168_);
			_tmp170_ = _tmp169_;
			vala_method_call_add_argument (_tmp163_, (ValaExpression*) _tmp170_);
			_vala_code_node_unref0 (_tmp170_);
			_g_free0 (_tmp167_);
			_g_free0 (_tmp164_);
			_tmp171_ = block;
			_tmp172_ = call;
			_tmp173_ = source_reference;
			_tmp174_ = vala_return_statement_new ((ValaExpression*) _tmp172_, _tmp173_);
			_tmp175_ = _tmp174_;
			vala_block_add_statement (_tmp171_, (ValaStatement*) _tmp175_);
			_vala_code_node_unref0 (_tmp175_);
			_tmp176_ = get_method;
			_tmp177_ = block;
			vala_subroutine_set_body ((ValaSubroutine*) _tmp176_, _tmp177_);
			_vala_code_node_unref0 (call);
			_vala_code_node_unref0 (block);
			_vala_code_node_unref0 (get_method);
		}
		{
			const gchar* _tmp178_;
			const gchar* _tmp179_ = NULL;
			gchar* _tmp180_ = NULL;
			gchar* _tmp181_;
			ValaSourceReference* _tmp182_;
			ValaVoidType* _tmp183_;
			ValaVoidType* _tmp184_;
			ValaSourceReference* _tmp185_;
			ValaMethod* _tmp186_;
			ValaMethod* _tmp187_;
			ValaMethod* set_method;
			ValaMethod* _tmp188_;
			ValaDataType* _tmp189_;
			ValaSourceReference* _tmp190_;
			ValaParameter* _tmp191_;
			ValaParameter* _tmp192_;
			ValaClass* _tmp193_;
			ValaMethod* _tmp194_;
			ValaMethod* _tmp195_;
			ValaMethod* _tmp196_;
			ValaDataType* _tmp197_ = NULL;
			ValaDataType* _tmp198_;
			ValaSourceReference* _tmp199_;
			ValaBlock* _tmp200_;
			ValaBlock* block;
			ValaStringLiteral* _tmp201_;
			ValaStringLiteral* _tmp202_;
			ValaDataType* _tmp203_;
			gchar* _tmp204_ = NULL;
			gchar* _tmp205_;
			const gchar* _tmp206_ = NULL;
			gchar* _tmp207_ = NULL;
			gchar* _tmp208_;
			ValaSourceReference* _tmp209_;
			ValaMemberAccess* _tmp210_;
			ValaMemberAccess* _tmp211_;
			ValaSourceReference* _tmp212_;
			ValaMethodCall* _tmp213_;
			ValaMethodCall* _tmp214_;
			ValaMethodCall* call;
			SQLHeavyTable* _tmp215_;
			gint _tmp216_;
			gchar* _tmp217_ = NULL;
			gchar* _tmp218_;
			ValaMethodCall* _tmp219_;
			gchar* _tmp220_;
			const gchar* _tmp221_ = NULL;
			gchar* _tmp222_ = NULL;
			gchar* _tmp223_;
			ValaSourceReference* _tmp224_;
			ValaStringLiteral* _tmp225_;
			ValaStringLiteral* _tmp226_;
			ValaBlock* _tmp227_;
			ValaMethodCall* _tmp228_;
			ValaSourceReference* _tmp229_;
			ValaExpressionStatement* _tmp230_;
			ValaExpressionStatement* _tmp231_;
			ValaMethod* _tmp232_;
			ValaBlock* _tmp233_;
			_tmp178_ = name;
			_tmp179_ = string_to_string (_tmp178_);
			_tmp180_ = g_strconcat ("set_", _tmp179_, NULL);
			_tmp181_ = _tmp180_;
			_tmp182_ = source_reference;
			_tmp183_ = vala_void_type_new (_tmp182_);
			_tmp184_ = _tmp183_;
			_tmp185_ = source_reference;
			_tmp186_ = vala_method_new (_tmp181_, (ValaDataType*) _tmp184_, _tmp185_, NULL);
			_tmp187_ = _tmp186_;
			_vala_code_node_unref0 (_tmp184_);
			_g_free0 (_tmp181_);
			set_method = _tmp187_;
			_tmp188_ = set_method;
			_tmp189_ = data_type;
			_tmp190_ = source_reference;
			_tmp191_ = vala_parameter_new ("value", _tmp189_, _tmp190_);
			_tmp192_ = _tmp191_;
			vala_method_add_parameter (_tmp188_, _tmp192_);
			_vala_code_node_unref0 (_tmp192_);
			_tmp193_ = cl;
			_tmp194_ = set_method;
			vala_symbol_add_method ((ValaSymbol*) _tmp193_, _tmp194_);
			_tmp195_ = set_method;
			vala_symbol_set_access ((ValaSymbol*) _tmp195_, VALA_SYMBOL_ACCESSIBILITY_PUBLIC);
			_tmp196_ = set_method;
			_tmp197_ = sql_heavy_generator_type_from_string ("SQLHeavy.Error");
			_tmp198_ = _tmp197_;
			vala_code_node_add_error_type ((ValaCodeNode*) _tmp196_, _tmp198_);
			_vala_code_node_unref0 (_tmp198_);
			_tmp199_ = source_reference;
			_tmp200_ = vala_block_new (_tmp199_);
			block = _tmp200_;
			_tmp201_ = vala_string_literal_new ("this", NULL);
			_tmp202_ = _tmp201_;
			_tmp203_ = data_type;
			_tmp204_ = vala_code_node_to_string ((ValaCodeNode*) _tmp203_);
			_tmp205_ = _tmp204_;
			_tmp206_ = string_to_string (_tmp205_);
			_tmp207_ = g_strconcat ("set_", _tmp206_, NULL);
			_tmp208_ = _tmp207_;
			_tmp209_ = source_reference;
			_tmp210_ = vala_member_access_new ((ValaExpression*) _tmp202_, _tmp208_, _tmp209_);
			_tmp211_ = _tmp210_;
			_tmp212_ = source_reference;
			_tmp213_ = vala_method_call_new ((ValaExpression*) _tmp211_, _tmp212_);
			_tmp214_ = _tmp213_;
			_vala_code_node_unref0 (_tmp211_);
			_g_free0 (_tmp208_);
			_g_free0 (_tmp205_);
			_vala_code_node_unref0 (_tmp202_);
			call = _tmp214_;
			_tmp215_ = table;
			_tmp216_ = field;
			_tmp217_ = sql_heavy_table_field_name (_tmp215_, _tmp216_, &_inner_error_);
			_tmp218_ = _tmp217_;
			if (_inner_error_ != NULL) {
				if ((_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) || (_inner_error_->domain == SQL_HEAVY_ERROR)) {
					g_propagate_error (error, _inner_error_);
					_vala_code_node_unref0 (call);
					_vala_code_node_unref0 (block);
					_vala_code_node_unref0 (set_method);
					_vala_code_node_unref0 (changed_signal);
					_vala_code_node_unref0 (emit_changed_notify);
					_vala_code_node_unref0 (switch_section);
					_vala_code_node_unref0 (data_type_get);
					_vala_code_node_unref0 (data_type);
					_g_free0 (name);
					_g_free0 (symbol);
					_g_free0 (db_symbol);
					_g_object_unref0 (db);
					return;
				} else {
					_vala_code_node_unref0 (call);
					_vala_code_node_unref0 (block);
					_vala_code_node_unref0 (set_method);
					_vala_code_node_unref0 (changed_signal);
					_vala_code_node_unref0 (emit_changed_notify);
					_vala_code_node_unref0 (switch_section);
					_vala_code_node_unref0 (data_type_get);
					_vala_code_node_unref0 (data_type);
					_g_free0 (name);
					_g_free0 (symbol);
					_g_free0 (db_symbol);
					_g_object_unref0 (db);
					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);
					g_clear_error (&_inner_error_);
					return;
				}
			}
			_tmp219_ = call;
			_tmp220_ = _tmp218_;
			_tmp221_ = string_to_string (_tmp220_);
			_tmp222_ = g_strconcat ("\"", _tmp221_, "\"", NULL);
			_tmp223_ = _tmp222_;
			_tmp224_ = source_reference;
			_tmp225_ = vala_string_literal_new (_tmp223_, _tmp224_);
			_tmp226_ = _tmp225_;
			vala_method_call_add_argument (_tmp219_, (ValaExpression*) _tmp226_);
			_vala_code_node_unref0 (_tmp226_);
			_g_free0 (_tmp223_);
			_g_free0 (_tmp220_);
			_tmp227_ = block;
			_tmp228_ = call;
			_tmp229_ = source_reference;
			_tmp230_ = vala_expression_statement_new ((ValaExpression*) _tmp228_, _tmp229_);
			_tmp231_ = _tmp230_;
			vala_block_add_statement (_tmp227_, (ValaStatement*) _tmp231_);
			_vala_code_node_unref0 (_tmp231_);
			_tmp232_ = set_method;
			_tmp233_ = block;
			vala_subroutine_set_body ((ValaSubroutine*) _tmp232_, _tmp233_);
			_vala_code_node_unref0 (call);
			_vala_code_node_unref0 (block);
			_vala_code_node_unref0 (set_method);
		}
		_vala_code_node_unref0 (changed_signal);
	} else {
		ValaPropertyAccessor* get_accessor = NULL;
		ValaPropertyAccessor* set_accessor = NULL;
		ValaSourceReference* _tmp234_;
		ValaStringLiteral* _tmp235_;
		ValaStringLiteral* _tmp236_;
		ValaSourceReference* _tmp237_;
		ValaMemberAccess* _tmp238_;
		ValaMemberAccess* _tmp239_;
		ValaSourceReference* _tmp240_;
		ValaMethodCall* _tmp241_;
		ValaMethodCall* _tmp242_;
		const gchar* _tmp243_;
		gchar* _tmp244_ = NULL;
		gchar* _tmp245_;
		gchar* _tmp246_;
		gchar* _tmp247_;
		gchar* _tmp248_;
		gchar* _tmp249_;
		ValaSourceReference* _tmp250_;
		ValaStringLiteral* _tmp251_;
		ValaStringLiteral* _tmp252_;
		const gchar* _tmp431_;
		ValaDataType* _tmp432_;
		ValaPropertyAccessor* _tmp433_;
		ValaPropertyAccessor* _tmp434_;
		ValaSourceReference* _tmp435_;
		ValaProperty* _tmp436_;
		ValaProperty* prop;
		ValaProperty* _tmp437_;
		ValaClass* _tmp438_;
		ValaProperty* _tmp439_;
		_tmp234_ = source_reference;
		_tmp235_ = vala_string_literal_new ("this", _tmp234_);
		_tmp236_ = _tmp235_;
		_tmp237_ = source_reference;
		_tmp238_ = vala_member_access_new ((ValaExpression*) _tmp236_, "notify_property", _tmp237_);
		_tmp239_ = _tmp238_;
		_tmp240_ = source_reference;
		_tmp241_ = vala_method_call_new ((ValaExpression*) _tmp239_, _tmp240_);
		_vala_code_node_unref0 (emit_changed_notify);
		emit_changed_notify = _tmp241_;
		_vala_code_node_unref0 (_tmp239_);
		_vala_code_node_unref0 (_tmp236_);
		_tmp242_ = emit_changed_notify;
		_tmp243_ = name;
		_tmp244_ = string_replace (_tmp243_, "_", "-");
		_tmp245_ = _tmp244_;
		_tmp246_ = g_strconcat ("\"", _tmp245_, NULL);
		_tmp247_ = _tmp246_;
		_tmp248_ = g_strconcat (_tmp247_, "\"", NULL);
		_tmp249_ = _tmp248_;
		_tmp250_ = source_reference;
		_tmp251_ = vala_string_literal_new (_tmp249_, _tmp250_);
		_tmp252_ = _tmp251_;
		vala_method_call_add_argument (_tmp242_, (ValaExpression*) _tmp252_);
		_vala_code_node_unref0 (_tmp252_);
		_g_free0 (_tmp249_);
		_g_free0 (_tmp247_);
		_g_free0 (_tmp245_);
		{
			ValaSourceReference* _tmp253_;
			ValaBlock* _tmp254_;
			ValaBlock* block;
			ValaSourceReference* _tmp255_;
			ValaBlock* _tmp256_;
			ValaBlock* try_block;
			ValaSourceReference* _tmp257_;
			ValaBlock* _tmp258_;
			ValaBlock* catch_block;
			ValaBlock* _tmp259_;
			ValaSourceReference* _tmp260_;
			ValaTryStatement* _tmp261_;
			ValaTryStatement* try_stmt;
			ValaStringLiteral* _tmp262_;
			ValaStringLiteral* _tmp263_;
			ValaDataType* _tmp264_;
			gchar* _tmp265_ = NULL;
			gchar* _tmp266_;
			const gchar* _tmp267_ = NULL;
			gchar* _tmp268_ = NULL;
			gchar* _tmp269_;
			ValaSourceReference* _tmp270_;
			ValaMemberAccess* _tmp271_;
			ValaMemberAccess* _tmp272_;
			ValaSourceReference* _tmp273_;
			ValaMethodCall* _tmp274_;
			ValaMethodCall* _tmp275_;
			ValaMethodCall* call;
			SQLHeavyTable* _tmp276_;
			gint _tmp277_;
			gchar* _tmp278_ = NULL;
			gchar* _tmp279_;
			ValaMethodCall* _tmp280_;
			gchar* _tmp281_;
			const gchar* _tmp282_ = NULL;
			gchar* _tmp283_ = NULL;
			gchar* _tmp284_;
			ValaSourceReference* _tmp285_;
			ValaStringLiteral* _tmp286_;
			ValaStringLiteral* _tmp287_;
			ValaBlock* _tmp288_;
			ValaMethodCall* _tmp289_;
			ValaSourceReference* _tmp290_;
			ValaReturnStatement* _tmp291_;
			ValaReturnStatement* _tmp292_;
			ValaStringLiteral* _tmp293_;
			ValaStringLiteral* _tmp294_;
			ValaSourceReference* _tmp295_;
			ValaMemberAccess* _tmp296_;
			ValaMemberAccess* _tmp297_;
			ValaSourceReference* _tmp298_;
			ValaMethodCall* _tmp299_;
			ValaMethodCall* _tmp300_;
			ValaMethodCall* error_call;
			ValaMethodCall* _tmp301_;
			const gchar* _tmp302_;
			const gchar* _tmp303_ = NULL;
			gchar* _tmp304_ = NULL;
			gchar* _tmp305_;
			ValaSourceReference* _tmp306_;
			ValaStringLiteral* _tmp307_;
			ValaStringLiteral* _tmp308_;
			ValaMethodCall* _tmp309_;
			ValaMemberAccess* _tmp310_;
			ValaMemberAccess* _tmp311_;
			ValaSourceReference* _tmp312_;
			ValaMemberAccess* _tmp313_;
			ValaMemberAccess* _tmp314_;
			ValaBlock* _tmp315_;
			ValaMethodCall* _tmp316_;
			ValaSourceReference* _tmp317_;
			ValaExpressionStatement* _tmp318_;
			ValaExpressionStatement* _tmp319_;
			ValaSourceReference* _tmp320_;
			ValaStringLiteral* _tmp321_;
			ValaStringLiteral* _tmp322_;
			ValaSourceReference* _tmp323_;
			ValaMemberAccess* _tmp324_;
			ValaMemberAccess* _tmp325_;
			ValaMethodCall* _tmp326_;
			ValaMethodCall* _tmp327_;
			ValaMethodCall* anr;
			ValaBlock* _tmp328_;
			ValaMethodCall* _tmp329_;
			ValaSourceReference* _tmp330_;
			ValaExpressionStatement* _tmp331_;
			ValaExpressionStatement* _tmp332_;
			ValaTryStatement* _tmp333_;
			ValaDataType* _tmp334_ = NULL;
			ValaDataType* _tmp335_;
			ValaBlock* _tmp336_;
			ValaSourceReference* _tmp337_;
			ValaCatchClause* _tmp338_;
			ValaCatchClause* _tmp339_;
			ValaBlock* _tmp340_;
			ValaTryStatement* _tmp341_;
			ValaDataType* _tmp342_;
			ValaBlock* _tmp343_;
			ValaSourceReference* _tmp344_;
			ValaPropertyAccessor* _tmp345_;
			_tmp253_ = source_reference;
			_tmp254_ = vala_block_new (_tmp253_);
			block = _tmp254_;
			_tmp255_ = source_reference;
			_tmp256_ = vala_block_new (_tmp255_);
			try_block = _tmp256_;
			_tmp257_ = source_reference;
			_tmp258_ = vala_block_new (_tmp257_);
			catch_block = _tmp258_;
			_tmp259_ = try_block;
			_tmp260_ = source_reference;
			_tmp261_ = vala_try_statement_new (_tmp259_, NULL, _tmp260_);
			try_stmt = _tmp261_;
			_tmp262_ = vala_string_literal_new ("this", NULL);
			_tmp263_ = _tmp262_;
			_tmp264_ = data_type_get;
			_tmp265_ = vala_code_node_to_string ((ValaCodeNode*) _tmp264_);
			_tmp266_ = _tmp265_;
			_tmp267_ = string_to_string (_tmp266_);
			_tmp268_ = g_strconcat ("get_", _tmp267_, NULL);
			_tmp269_ = _tmp268_;
			_tmp270_ = source_reference;
			_tmp271_ = vala_member_access_new ((ValaExpression*) _tmp263_, _tmp269_, _tmp270_);
			_tmp272_ = _tmp271_;
			_tmp273_ = source_reference;
			_tmp274_ = vala_method_call_new ((ValaExpression*) _tmp272_, _tmp273_);
			_tmp275_ = _tmp274_;
			_vala_code_node_unref0 (_tmp272_);
			_g_free0 (_tmp269_);
			_g_free0 (_tmp266_);
			_vala_code_node_unref0 (_tmp263_);
			call = _tmp275_;
			_tmp276_ = table;
			_tmp277_ = field;
			_tmp278_ = sql_heavy_table_field_name (_tmp276_, _tmp277_, &_inner_error_);
			_tmp279_ = _tmp278_;
			if (_inner_error_ != NULL) {
				if ((_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) || (_inner_error_->domain == SQL_HEAVY_ERROR)) {
					g_propagate_error (error, _inner_error_);
					_vala_code_node_unref0 (call);
					_vala_code_node_unref0 (try_stmt);
					_vala_code_node_unref0 (catch_block);
					_vala_code_node_unref0 (try_block);
					_vala_code_node_unref0 (block);
					_vala_code_node_unref0 (set_accessor);
					_vala_code_node_unref0 (get_accessor);
					_vala_code_node_unref0 (emit_changed_notify);
					_vala_code_node_unref0 (switch_section);
					_vala_code_node_unref0 (data_type_get);
					_vala_code_node_unref0 (data_type);
					_g_free0 (name);
					_g_free0 (symbol);
					_g_free0 (db_symbol);
					_g_object_unref0 (db);
					return;
				} else {
					_vala_code_node_unref0 (call);
					_vala_code_node_unref0 (try_stmt);
					_vala_code_node_unref0 (catch_block);
					_vala_code_node_unref0 (try_block);
					_vala_code_node_unref0 (block);
					_vala_code_node_unref0 (set_accessor);
					_vala_code_node_unref0 (get_accessor);
					_vala_code_node_unref0 (emit_changed_notify);
					_vala_code_node_unref0 (switch_section);
					_vala_code_node_unref0 (data_type_get);
					_vala_code_node_unref0 (data_type);
					_g_free0 (name);
					_g_free0 (symbol);
					_g_free0 (db_symbol);
					_g_object_unref0 (db);
					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);
					g_clear_error (&_inner_error_);
					return;
				}
			}
			_tmp280_ = call;
			_tmp281_ = _tmp279_;
			_tmp282_ = string_to_string (_tmp281_);
			_tmp283_ = g_strconcat ("\"", _tmp282_, "\"", NULL);
			_tmp284_ = _tmp283_;
			_tmp285_ = source_reference;
			_tmp286_ = vala_string_literal_new (_tmp284_, _tmp285_);
			_tmp287_ = _tmp286_;
			vala_method_call_add_argument (_tmp280_, (ValaExpression*) _tmp287_);
			_vala_code_node_unref0 (_tmp287_);
			_g_free0 (_tmp284_);
			_g_free0 (_tmp281_);
			_tmp288_ = try_block;
			_tmp289_ = call;
			_tmp290_ = source_reference;
			_tmp291_ = vala_return_statement_new ((ValaExpression*) _tmp289_, _tmp290_);
			_tmp292_ = _tmp291_;
			vala_block_add_statement (_tmp288_, (ValaStatement*) _tmp292_);
			_vala_code_node_unref0 (_tmp292_);
			_tmp293_ = vala_string_literal_new ("GLib", NULL);
			_tmp294_ = _tmp293_;
			_tmp295_ = source_reference;
			_tmp296_ = vala_member_access_new ((ValaExpression*) _tmp294_, "error", _tmp295_);
			_tmp297_ = _tmp296_;
			_tmp298_ = source_reference;
			_tmp299_ = vala_method_call_new ((ValaExpression*) _tmp297_, _tmp298_);
			_tmp300_ = _tmp299_;
			_vala_code_node_unref0 (_tmp297_);
			_vala_code_node_unref0 (_tmp294_);
			error_call = _tmp300_;
			_tmp301_ = error_call;
			_tmp302_ = name;
			_tmp303_ = string_to_string (_tmp302_);
			_tmp304_ = g_strconcat ("\"Unable to retrieve `", _tmp303_, "': %s\"", NULL);
			_tmp305_ = _tmp304_;
			_tmp306_ = source_reference;
			_tmp307_ = vala_string_literal_new (_tmp305_, _tmp306_);
			_tmp308_ = _tmp307_;
			vala_method_call_add_argument (_tmp301_, (ValaExpression*) _tmp308_);
			_vala_code_node_unref0 (_tmp308_);
			_g_free0 (_tmp305_);
			_tmp309_ = error_call;
			_tmp310_ = vala_member_access_new (NULL, "e", NULL);
			_tmp311_ = _tmp310_;
			_tmp312_ = source_reference;
			_tmp313_ = vala_member_access_new ((ValaExpression*) _tmp311_, "message", _tmp312_);
			_tmp314_ = _tmp313_;
			vala_method_call_add_argument (_tmp309_, (ValaExpression*) _tmp314_);
			_vala_code_node_unref0 (_tmp314_);
			_vala_code_node_unref0 (_tmp311_);
			_tmp315_ = catch_block;
			_tmp316_ = error_call;
			_tmp317_ = source_reference;
			_tmp318_ = vala_expression_statement_new ((ValaExpression*) _tmp316_, _tmp317_);
			_tmp319_ = _tmp318_;
			vala_block_add_statement (_tmp315_, (ValaStatement*) _tmp319_);
			_vala_code_node_unref0 (_tmp319_);
			_tmp320_ = source_reference;
			_tmp321_ = vala_string_literal_new ("GLib", _tmp320_);
			_tmp322_ = _tmp321_;
			_tmp323_ = source_reference;
			_tmp324_ = vala_member_access_new ((ValaExpression*) _tmp322_, "assert_not_reached", _tmp323_);
			_tmp325_ = _tmp324_;
			_tmp326_ = vala_method_call_new ((ValaExpression*) _tmp325_, NULL);
			_tmp327_ = _tmp326_;
			_vala_code_node_unref0 (_tmp325_);
			_vala_code_node_unref0 (_tmp322_);
			anr = _tmp327_;
			_tmp328_ = catch_block;
			_tmp329_ = anr;
			_tmp330_ = source_reference;
			_tmp331_ = vala_expression_statement_new ((ValaExpression*) _tmp329_, _tmp330_);
			_tmp332_ = _tmp331_;
			vala_block_add_statement (_tmp328_, (ValaStatement*) _tmp332_);
			_vala_code_node_unref0 (_tmp332_);
			_tmp333_ = try_stmt;
			_tmp334_ = sql_heavy_generator_type_from_string ("SQLHeavy.Error");
			_tmp335_ = _tmp334_;
			_tmp336_ = catch_block;
			_tmp337_ = source_reference;
			_tmp338_ = vala_catch_clause_new (_tmp335_, "e", _tmp336_, _tmp337_);
			_tmp339_ = _tmp338_;
			vala_try_statement_add_catch_clause (_tmp333_, _tmp339_);
			_vala_code_node_unref0 (_tmp339_);
			_vala_code_node_unref0 (_tmp335_);
			_tmp340_ = block;
			_tmp341_ = try_stmt;
			vala_block_add_statement (_tmp340_, (ValaStatement*) _tmp341_);
			_tmp342_ = data_type_get;
			_tmp343_ = block;
			_tmp344_ = source_reference;
			_tmp345_ = vala_property_accessor_new (TRUE, FALSE, FALSE, _tmp342_, _tmp343_, _tmp344_, NULL);
			_vala_code_node_unref0 (get_accessor);
			get_accessor = _tmp345_;
			_vala_code_node_unref0 (anr);
			_vala_code_node_unref0 (error_call);
			_vala_code_node_unref0 (call);
			_vala_code_node_unref0 (try_stmt);
			_vala_code_node_unref0 (catch_block);
			_vala_code_node_unref0 (try_block);
			_vala_code_node_unref0 (block);
		}
		{
			ValaSourceReference* _tmp346_;
			ValaBlock* _tmp347_;
			ValaBlock* block;
			ValaSourceReference* _tmp348_;
			ValaBlock* _tmp349_;
			ValaBlock* try_block;
			ValaSourceReference* _tmp350_;
			ValaBlock* _tmp351_;
			ValaBlock* catch_block;
			ValaBlock* _tmp352_;
			ValaSourceReference* _tmp353_;
			ValaTryStatement* _tmp354_;
			ValaTryStatement* try_stmt;
			ValaSourceReference* _tmp355_;
			ValaStringLiteral* _tmp356_;
			ValaStringLiteral* _tmp357_;
			ValaDataType* _tmp358_;
			gchar* _tmp359_ = NULL;
			gchar* _tmp360_;
			const gchar* _tmp361_ = NULL;
			gchar* _tmp362_ = NULL;
			gchar* _tmp363_;
			ValaSourceReference* _tmp364_;
			ValaMemberAccess* _tmp365_;
			ValaMemberAccess* _tmp366_;
			ValaSourceReference* _tmp367_;
			ValaMethodCall* _tmp368_;
			ValaMethodCall* _tmp369_;
			ValaMethodCall* call;
			SQLHeavyTable* _tmp370_;
			gint _tmp371_;
			gchar* _tmp372_ = NULL;
			gchar* _tmp373_;
			ValaMethodCall* _tmp374_;
			gchar* _tmp375_;
			const gchar* _tmp376_ = NULL;
			gchar* _tmp377_ = NULL;
			gchar* _tmp378_;
			ValaSourceReference* _tmp379_;
			ValaStringLiteral* _tmp380_;
			ValaStringLiteral* _tmp381_;
			ValaMethodCall* _tmp382_;
			ValaSourceReference* _tmp383_;
			ValaMemberAccess* _tmp384_;
			ValaMemberAccess* _tmp385_;
			ValaBlock* _tmp386_;
			ValaMethodCall* _tmp387_;
			ValaSourceReference* _tmp388_;
			ValaExpressionStatement* _tmp389_;
			ValaExpressionStatement* _tmp390_;
			ValaStringLiteral* _tmp391_;
			ValaStringLiteral* _tmp392_;
			ValaSourceReference* _tmp393_;
			ValaMemberAccess* _tmp394_;
			ValaMemberAccess* _tmp395_;
			ValaSourceReference* _tmp396_;
			ValaMethodCall* _tmp397_;
			ValaMethodCall* _tmp398_;
			ValaMethodCall* error_call;
			ValaMethodCall* _tmp399_;
			const gchar* _tmp400_;
			const gchar* _tmp401_ = NULL;
			gchar* _tmp402_ = NULL;
			gchar* _tmp403_;
			ValaSourceReference* _tmp404_;
			ValaStringLiteral* _tmp405_;
			ValaStringLiteral* _tmp406_;
			ValaMethodCall* _tmp407_;
			ValaMemberAccess* _tmp408_;
			ValaMemberAccess* _tmp409_;
			ValaSourceReference* _tmp410_;
			ValaMemberAccess* _tmp411_;
			ValaMemberAccess* _tmp412_;
			ValaBlock* _tmp413_;
			ValaMethodCall* _tmp414_;
			ValaSourceReference* _tmp415_;
			ValaExpressionStatement* _tmp416_;
			ValaExpressionStatement* _tmp417_;
			ValaTryStatement* _tmp418_;
			ValaDataType* _tmp419_ = NULL;
			ValaDataType* _tmp420_;
			ValaBlock* _tmp421_;
			ValaSourceReference* _tmp422_;
			ValaCatchClause* _tmp423_;
			ValaCatchClause* _tmp424_;
			ValaBlock* _tmp425_;
			ValaTryStatement* _tmp426_;
			ValaDataType* _tmp427_;
			ValaBlock* _tmp428_;
			ValaSourceReference* _tmp429_;
			ValaPropertyAccessor* _tmp430_;
			_tmp346_ = source_reference;
			_tmp347_ = vala_block_new (_tmp346_);
			block = _tmp347_;
			_tmp348_ = source_reference;
			_tmp349_ = vala_block_new (_tmp348_);
			try_block = _tmp349_;
			_tmp350_ = source_reference;
			_tmp351_ = vala_block_new (_tmp350_);
			catch_block = _tmp351_;
			_tmp352_ = try_block;
			_tmp353_ = source_reference;
			_tmp354_ = vala_try_statement_new (_tmp352_, NULL, _tmp353_);
			try_stmt = _tmp354_;
			_tmp355_ = source_reference;
			_tmp356_ = vala_string_literal_new ("this", _tmp355_);
			_tmp357_ = _tmp356_;
			_tmp358_ = data_type_get;
			_tmp359_ = vala_code_node_to_string ((ValaCodeNode*) _tmp358_);
			_tmp360_ = _tmp359_;
			_tmp361_ = string_to_string (_tmp360_);
			_tmp362_ = g_strconcat ("set_", _tmp361_, NULL);
			_tmp363_ = _tmp362_;
			_tmp364_ = source_reference;
			_tmp365_ = vala_member_access_new ((ValaExpression*) _tmp357_, _tmp363_, _tmp364_);
			_tmp366_ = _tmp365_;
			_tmp367_ = source_reference;
			_tmp368_ = vala_method_call_new ((ValaExpression*) _tmp366_, _tmp367_);
			_tmp369_ = _tmp368_;
			_vala_code_node_unref0 (_tmp366_);
			_g_free0 (_tmp363_);
			_g_free0 (_tmp360_);
			_vala_code_node_unref0 (_tmp357_);
			call = _tmp369_;
			_tmp370_ = table;
			_tmp371_ = field;
			_tmp372_ = sql_heavy_table_field_name (_tmp370_, _tmp371_, &_inner_error_);
			_tmp373_ = _tmp372_;
			if (_inner_error_ != NULL) {
				if ((_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) || (_inner_error_->domain == SQL_HEAVY_ERROR)) {
					g_propagate_error (error, _inner_error_);
					_vala_code_node_unref0 (call);
					_vala_code_node_unref0 (try_stmt);
					_vala_code_node_unref0 (catch_block);
					_vala_code_node_unref0 (try_block);
					_vala_code_node_unref0 (block);
					_vala_code_node_unref0 (set_accessor);
					_vala_code_node_unref0 (get_accessor);
					_vala_code_node_unref0 (emit_changed_notify);
					_vala_code_node_unref0 (switch_section);
					_vala_code_node_unref0 (data_type_get);
					_vala_code_node_unref0 (data_type);
					_g_free0 (name);
					_g_free0 (symbol);
					_g_free0 (db_symbol);
					_g_object_unref0 (db);
					return;
				} else {
					_vala_code_node_unref0 (call);
					_vala_code_node_unref0 (try_stmt);
					_vala_code_node_unref0 (catch_block);
					_vala_code_node_unref0 (try_block);
					_vala_code_node_unref0 (block);
					_vala_code_node_unref0 (set_accessor);
					_vala_code_node_unref0 (get_accessor);
					_vala_code_node_unref0 (emit_changed_notify);
					_vala_code_node_unref0 (switch_section);
					_vala_code_node_unref0 (data_type_get);
					_vala_code_node_unref0 (data_type);
					_g_free0 (name);
					_g_free0 (symbol);
					_g_free0 (db_symbol);
					_g_object_unref0 (db);
					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);
					g_clear_error (&_inner_error_);
					return;
				}
			}
			_tmp374_ = call;
			_tmp375_ = _tmp373_;
			_tmp376_ = string_to_string (_tmp375_);
			_tmp377_ = g_strconcat ("\"", _tmp376_, "\"", NULL);
			_tmp378_ = _tmp377_;
			_tmp379_ = source_reference;
			_tmp380_ = vala_string_literal_new (_tmp378_, _tmp379_);
			_tmp381_ = _tmp380_;
			vala_method_call_add_argument (_tmp374_, (ValaExpression*) _tmp381_);
			_vala_code_node_unref0 (_tmp381_);
			_g_free0 (_tmp378_);
			_g_free0 (_tmp375_);
			_tmp382_ = call;
			_tmp383_ = source_reference;
			_tmp384_ = vala_member_access_new (NULL, "value", _tmp383_);
			_tmp385_ = _tmp384_;
			vala_method_call_add_argument (_tmp382_, (ValaExpression*) _tmp385_);
			_vala_code_node_unref0 (_tmp385_);
			_tmp386_ = try_block;
			_tmp387_ = call;
			_tmp388_ = source_reference;
			_tmp389_ = vala_expression_statement_new ((ValaExpression*) _tmp387_, _tmp388_);
			_tmp390_ = _tmp389_;
			vala_block_add_statement (_tmp386_, (ValaStatement*) _tmp390_);
			_vala_code_node_unref0 (_tmp390_);
			_tmp391_ = vala_string_literal_new ("GLib", NULL);
			_tmp392_ = _tmp391_;
			_tmp393_ = source_reference;
			_tmp394_ = vala_member_access_new ((ValaExpression*) _tmp392_, "error", _tmp393_);
			_tmp395_ = _tmp394_;
			_tmp396_ = source_reference;
			_tmp397_ = vala_method_call_new ((ValaExpression*) _tmp395_, _tmp396_);
			_tmp398_ = _tmp397_;
			_vala_code_node_unref0 (_tmp395_);
			_vala_code_node_unref0 (_tmp392_);
			error_call = _tmp398_;
			_tmp399_ = error_call;
			_tmp400_ = name;
			_tmp401_ = string_to_string (_tmp400_);
			_tmp402_ = g_strconcat ("\"Unable to set `", _tmp401_, "': %s\"", NULL);
			_tmp403_ = _tmp402_;
			_tmp404_ = source_reference;
			_tmp405_ = vala_string_literal_new (_tmp403_, _tmp404_);
			_tmp406_ = _tmp405_;
			vala_method_call_add_argument (_tmp399_, (ValaExpression*) _tmp406_);
			_vala_code_node_unref0 (_tmp406_);
			_g_free0 (_tmp403_);
			_tmp407_ = error_call;
			_tmp408_ = vala_member_access_new (NULL, "e", NULL);
			_tmp409_ = _tmp408_;
			_tmp410_ = source_reference;
			_tmp411_ = vala_member_access_new ((ValaExpression*) _tmp409_, "message", _tmp410_);
			_tmp412_ = _tmp411_;
			vala_method_call_add_argument (_tmp407_, (ValaExpression*) _tmp412_);
			_vala_code_node_unref0 (_tmp412_);
			_vala_code_node_unref0 (_tmp409_);
			_tmp413_ = catch_block;
			_tmp414_ = error_call;
			_tmp415_ = source_reference;
			_tmp416_ = vala_expression_statement_new ((ValaExpression*) _tmp414_, _tmp415_);
			_tmp417_ = _tmp416_;
			vala_block_add_statement (_tmp413_, (ValaStatement*) _tmp417_);
			_vala_code_node_unref0 (_tmp417_);
			_tmp418_ = try_stmt;
			_tmp419_ = sql_heavy_generator_type_from_string ("SQLHeavy.Error");
			_tmp420_ = _tmp419_;
			_tmp421_ = catch_block;
			_tmp422_ = source_reference;
			_tmp423_ = vala_catch_clause_new (_tmp420_, "e", _tmp421_, _tmp422_);
			_tmp424_ = _tmp423_;
			vala_try_statement_add_catch_clause (_tmp418_, _tmp424_);
			_vala_code_node_unref0 (_tmp424_);
			_vala_code_node_unref0 (_tmp420_);
			_tmp425_ = block;
			_tmp426_ = try_stmt;
			vala_block_add_statement (_tmp425_, (ValaStatement*) _tmp426_);
			_tmp427_ = data_type;
			_tmp428_ = block;
			_tmp429_ = source_reference;
			_tmp430_ = vala_property_accessor_new (FALSE, TRUE, FALSE, _tmp427_, _tmp428_, _tmp429_, NULL);
			_vala_code_node_unref0 (set_accessor);
			set_accessor = _tmp430_;
			_vala_code_node_unref0 (error_call);
			_vala_code_node_unref0 (call);
			_vala_code_node_unref0 (try_stmt);
			_vala_code_node_unref0 (catch_block);
			_vala_code_node_unref0 (try_block);
			_vala_code_node_unref0 (block);
		}
		_tmp431_ = name;
		_tmp432_ = data_type;
		_tmp433_ = get_accessor;
		_tmp434_ = set_accessor;
		_tmp435_ = source_reference;
		_tmp436_ = vala_property_new (_tmp431_, _tmp432_, _tmp433_, _tmp434_, _tmp435_, NULL);
		prop = _tmp436_;
		_tmp437_ = prop;
		vala_symbol_set_access ((ValaSymbol*) _tmp437_, VALA_SYMBOL_ACCESSIBILITY_PUBLIC);
		_tmp438_ = cl;
		_tmp439_ = prop;
		vala_symbol_add_property ((ValaSymbol*) _tmp438_, _tmp439_);
		_vala_code_node_unref0 (prop);
		_vala_code_node_unref0 (set_accessor);
		_vala_code_node_unref0 (get_accessor);
	}
	_tmp440_ = switch_section;
	_tmp441_ = emit_changed_notify;
	_tmp442_ = source_reference;
	_tmp443_ = vala_expression_statement_new ((ValaExpression*) _tmp441_, _tmp442_);
	_tmp444_ = _tmp443_;
	vala_block_add_statement ((ValaBlock*) _tmp440_, (ValaStatement*) _tmp444_);
	_vala_code_node_unref0 (_tmp444_);
	_tmp445_ = switch_section;
	_tmp446_ = source_reference;
	_tmp447_ = vala_break_statement_new (_tmp446_);
	_tmp448_ = _tmp447_;
	vala_block_add_statement ((ValaBlock*) _tmp445_, (ValaStatement*) _tmp448_);
	_vala_code_node_unref0 (_tmp448_);
	_vala_code_node_unref0 (emit_changed_notify);
	_vala_code_node_unref0 (switch_section);
	_vala_code_node_unref0 (data_type_get);
	_vala_code_node_unref0 (data_type);
	_g_free0 (name);
	_g_free0 (symbol);
	_g_free0 (db_symbol);
	_g_object_unref0 (db);
}


static void sql_heavy_generator_parse_table (SQLHeavyGenerator* self, SQLHeavyTable* table, ValaNamespace* ns, ValaSourceReference* source_reference, GError** error) {
	SQLHeavyTable* _tmp0_;
	SQLHeavyQueryable* _tmp1_;
	SQLHeavyQueryable* _tmp2_;
	SQLHeavyDatabase* _tmp3_;
	SQLHeavyDatabase* _tmp4_;
	SQLHeavyDatabase* db;
	SQLHeavyDatabase* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_ = NULL;
	gchar* _tmp9_;
	gchar** _tmp10_;
	gchar** _tmp11_ = NULL;
	gchar** _tmp12_;
	gint _tmp12__length1;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* db_symbol;
	const gchar* _tmp16_;
	gchar* _tmp17_ = NULL;
	gchar* _tmp18_;
	const gchar* _tmp19_ = NULL;
	SQLHeavyTable* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_ = NULL;
	gchar* _tmp24_ = NULL;
	gchar* _tmp25_;
	gchar* symbol;
	const gchar* _tmp26_;
	gchar* _tmp27_ = NULL;
	gchar* symbol_name;
	const gchar* _tmp28_;
	gboolean _tmp29_ = FALSE;
	ValaNamespace* _tmp30_;
	ValaScope* _tmp31_;
	ValaScope* _tmp32_;
	const gchar* _tmp33_;
	ValaSymbol* _tmp34_ = NULL;
	ValaClass* cl;
	ValaClass* _tmp35_;
	ValaClass* _tmp42_;
	ValaDataType* _tmp43_ = NULL;
	ValaDataType* _tmp44_;
	ValaSwitchStatement* signals_switch = NULL;
	ValaSourceReference* _tmp136_;
	ValaConstructor* _tmp137_;
	ValaConstructor* con;
	ValaConstructor* _tmp138_;
	ValaSourceReference* _tmp139_;
	ValaBlock* _tmp140_;
	ValaBlock* _tmp141_;
	ValaStringLiteral* _tmp142_;
	ValaStringLiteral* _tmp143_;
	ValaSourceReference* _tmp144_;
	ValaMemberAccess* _tmp145_;
	ValaMemberAccess* _tmp146_;
	ValaSourceReference* _tmp147_;
	ValaMemberAccess* _tmp148_;
	ValaMemberAccess* _tmp149_;
	ValaSourceReference* _tmp150_;
	ValaMethodCall* _tmp151_;
	ValaMethodCall* _tmp152_;
	ValaMethodCall* conn_call;
	ValaMethodCall* _tmp153_;
	ValaStringLiteral* _tmp154_;
	ValaStringLiteral* _tmp155_;
	ValaSourceReference* _tmp156_;
	ValaMemberAccess* _tmp157_;
	ValaMemberAccess* _tmp158_;
	ValaConstructor* _tmp159_;
	ValaBlock* _tmp160_;
	ValaBlock* _tmp161_;
	ValaMethodCall* _tmp162_;
	ValaSourceReference* _tmp163_;
	ValaExpressionStatement* _tmp164_;
	ValaExpressionStatement* _tmp165_;
	ValaClass* _tmp166_;
	ValaConstructor* _tmp167_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (table != NULL);
	g_return_if_fail (ns != NULL);
	g_return_if_fail (source_reference != NULL);
	_tmp0_ = table;
	_tmp1_ = sql_heavy_table_get_queryable (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = sql_heavy_queryable_get_database (_tmp2_);
	_tmp4_ = _tmp3_;
	db = _tmp4_;
	_tmp5_ = db;
	_tmp6_ = sql_heavy_database_get_filename (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_path_get_basename (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp11_ = _tmp10_ = g_strsplit (_tmp9_, ".", 2);
	_tmp12_ = _tmp11_;
	_tmp12__length1 = _vala_array_length (_tmp10_);
	_tmp13_ = _tmp12_[0];
	_tmp14_ = g_strdup (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp12_ = (_vala_array_free (_tmp12_, _tmp12__length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (_tmp9_);
	db_symbol = _tmp15_;
	_tmp16_ = db_symbol;
	_tmp17_ = g_path_get_basename (_tmp16_);
	_tmp18_ = _tmp17_;
	_tmp19_ = string_to_string (_tmp18_);
	_tmp20_ = table;
	_tmp21_ = sql_heavy_table_get_name (_tmp20_);
	_tmp22_ = _tmp21_;
	_tmp23_ = string_to_string (_tmp22_);
	_tmp24_ = g_strconcat ("@", _tmp19_, "/", _tmp23_, NULL);
	_tmp25_ = _tmp24_;
	_g_free0 (_tmp18_);
	symbol = _tmp25_;
	_tmp26_ = symbol;
	_tmp27_ = sql_heavy_generator_get_symbol_name (self, _tmp26_);
	symbol_name = _tmp27_;
	_tmp28_ = symbol;
	_tmp29_ = sql_heavy_generator_symbol_is_hidden (self, _tmp28_);
	if (_tmp29_) {
		_g_free0 (symbol_name);
		_g_free0 (symbol);
		_g_free0 (db_symbol);
		_g_object_unref0 (db);
		return;
	}
	_tmp30_ = ns;
	_tmp31_ = vala_symbol_get_scope ((ValaSymbol*) _tmp30_);
	_tmp32_ = _tmp31_;
	_tmp33_ = symbol_name;
	_tmp34_ = vala_scope_lookup (_tmp32_, _tmp33_);
	cl = VALA_IS_CLASS (_tmp34_) ? ((ValaClass*) _tmp34_) : NULL;
	_tmp35_ = cl;
	if (_tmp35_ == NULL) {
		const gchar* _tmp36_;
		ValaSourceReference* _tmp37_;
		ValaClass* _tmp38_;
		ValaClass* _tmp39_;
		ValaNamespace* _tmp40_;
		ValaClass* _tmp41_;
		_tmp36_ = symbol_name;
		_tmp37_ = source_reference;
		_tmp38_ = vala_class_new (_tmp36_, _tmp37_, NULL);
		_vala_code_node_unref0 (cl);
		cl = _tmp38_;
		_tmp39_ = cl;
		vala_symbol_set_access ((ValaSymbol*) _tmp39_, VALA_SYMBOL_ACCESSIBILITY_PUBLIC);
		_tmp40_ = ns;
		_tmp41_ = cl;
		vala_symbol_add_class ((ValaSymbol*) _tmp40_, _tmp41_);
	}
	_tmp42_ = cl;
	_tmp43_ = sql_heavy_generator_type_from_string ("SQLHeavy.Row");
	_tmp44_ = _tmp43_;
	vala_class_add_base_type (_tmp42_, _tmp44_);
	_vala_code_node_unref0 (_tmp44_);
	{
		ValaVoidType* _tmp45_;
		ValaVoidType* _tmp46_;
		ValaMethod* _tmp47_;
		ValaMethod* _tmp48_;
		ValaMethod* register_notify;
		ValaMethod* _tmp49_;
		ValaMethod* _tmp50_;
		ValaDataType* _tmp51_ = NULL;
		ValaDataType* _tmp52_;
		ValaParameter* _tmp53_;
		ValaParameter* _tmp54_;
		ValaSourceReference* _tmp55_;
		ValaBlock* _tmp56_;
		ValaBlock* block;
		ValaSourceReference* _tmp57_;
		ValaBlock* _tmp58_;
		ValaBlock* try_block;
		ValaSourceReference* _tmp59_;
		ValaBlock* _tmp60_;
		ValaBlock* catch_block;
		ValaBlock* _tmp61_;
		ValaSourceReference* _tmp62_;
		ValaTryStatement* _tmp63_;
		ValaTryStatement* try_stmt;
		ValaDataType* _tmp64_ = NULL;
		ValaDataType* _tmp65_;
		ValaStringLiteral* _tmp66_;
		ValaStringLiteral* _tmp67_;
		ValaSourceReference* _tmp68_;
		ValaLocalVariable* _tmp69_;
		ValaLocalVariable* _tmp70_;
		ValaLocalVariable* field_name;
		ValaBlock* _tmp71_;
		ValaLocalVariable* _tmp72_;
		ValaSourceReference* _tmp73_;
		ValaDeclarationStatement* _tmp74_;
		ValaDeclarationStatement* _tmp75_;
		ValaBlock* _tmp76_;
		ValaTryStatement* _tmp77_;
		ValaStringLiteral* _tmp78_;
		ValaStringLiteral* _tmp79_;
		ValaMemberAccess* _tmp80_;
		ValaMemberAccess* _tmp81_;
		ValaMethodCall* _tmp82_;
		ValaMethodCall* _tmp83_;
		ValaMethodCall* get_field_name;
		ValaMethodCall* _tmp84_;
		ValaMemberAccess* _tmp85_;
		ValaMemberAccess* _tmp86_;
		ValaBlock* _tmp87_;
		ValaStringLiteral* _tmp88_;
		ValaStringLiteral* _tmp89_;
		ValaMethodCall* _tmp90_;
		ValaAssignment* _tmp91_;
		ValaAssignment* _tmp92_;
		ValaExpressionStatement* _tmp93_;
		ValaExpressionStatement* _tmp94_;
		ValaStringLiteral* _tmp95_;
		ValaStringLiteral* _tmp96_;
		ValaMemberAccess* _tmp97_;
		ValaMemberAccess* _tmp98_;
		ValaSourceReference* _tmp99_;
		ValaMethodCall* _tmp100_;
		ValaMethodCall* _tmp101_;
		ValaMethodCall* warn_call;
		ValaMethodCall* _tmp102_;
		ValaSourceReference* _tmp103_;
		ValaStringLiteral* _tmp104_;
		ValaStringLiteral* _tmp105_;
		ValaMethodCall* _tmp106_;
		ValaSourceReference* _tmp107_;
		ValaMemberAccess* _tmp108_;
		ValaMemberAccess* _tmp109_;
		ValaBlock* _tmp110_;
		ValaMethodCall* _tmp111_;
		ValaSourceReference* _tmp112_;
		ValaExpressionStatement* _tmp113_;
		ValaExpressionStatement* _tmp114_;
		ValaBlock* _tmp115_;
		ValaSourceReference* _tmp116_;
		ValaReturnStatement* _tmp117_;
		ValaReturnStatement* _tmp118_;
		ValaTryStatement* _tmp119_;
		ValaDataType* _tmp120_ = NULL;
		ValaDataType* _tmp121_;
		ValaBlock* _tmp122_;
		ValaSourceReference* _tmp123_;
		ValaCatchClause* _tmp124_;
		ValaCatchClause* _tmp125_;
		ValaStringLiteral* _tmp126_;
		ValaStringLiteral* _tmp127_;
		ValaSourceReference* _tmp128_;
		ValaSwitchStatement* _tmp129_;
		ValaBlock* _tmp130_;
		ValaSwitchStatement* _tmp131_;
		ValaMethod* _tmp132_;
		ValaBlock* _tmp133_;
		ValaClass* _tmp134_;
		ValaMethod* _tmp135_;
		_tmp45_ = vala_void_type_new (NULL);
		_tmp46_ = _tmp45_;
		_tmp47_ = vala_method_new ("emit_change_notification", (ValaDataType*) _tmp46_, NULL, NULL);
		_tmp48_ = _tmp47_;
		_vala_code_node_unref0 (_tmp46_);
		register_notify = _tmp48_;
		_tmp49_ = register_notify;
		vala_symbol_set_access ((ValaSymbol*) _tmp49_, VALA_SYMBOL_ACCESSIBILITY_PRIVATE);
		_tmp50_ = register_notify;
		_tmp51_ = sql_heavy_generator_type_from_string ("int");
		_tmp52_ = _tmp51_;
		_tmp53_ = vala_parameter_new ("field", _tmp52_, NULL);
		_tmp54_ = _tmp53_;
		vala_method_add_parameter (_tmp50_, _tmp54_);
		_vala_code_node_unref0 (_tmp54_);
		_vala_code_node_unref0 (_tmp52_);
		_tmp55_ = source_reference;
		_tmp56_ = vala_block_new (_tmp55_);
		block = _tmp56_;
		_tmp57_ = source_reference;
		_tmp58_ = vala_block_new (_tmp57_);
		try_block = _tmp58_;
		_tmp59_ = source_reference;
		_tmp60_ = vala_block_new (_tmp59_);
		catch_block = _tmp60_;
		_tmp61_ = try_block;
		_tmp62_ = source_reference;
		_tmp63_ = vala_try_statement_new (_tmp61_, NULL, _tmp62_);
		try_stmt = _tmp63_;
		_tmp64_ = sql_heavy_generator_type_from_string ("string");
		_tmp65_ = _tmp64_;
		_tmp66_ = vala_string_literal_new ("null", NULL);
		_tmp67_ = _tmp66_;
		_tmp68_ = source_reference;
		_tmp69_ = vala_local_variable_new (_tmp65_, "field_name", (ValaExpression*) _tmp67_, _tmp68_);
		_tmp70_ = _tmp69_;
		_vala_code_node_unref0 (_tmp67_);
		_vala_code_node_unref0 (_tmp65_);
		field_name = _tmp70_;
		_tmp71_ = block;
		_tmp72_ = field_name;
		_tmp73_ = source_reference;
		_tmp74_ = vala_declaration_statement_new ((ValaSymbol*) _tmp72_, _tmp73_);
		_tmp75_ = _tmp74_;
		vala_block_add_statement (_tmp71_, (ValaStatement*) _tmp75_);
		_vala_code_node_unref0 (_tmp75_);
		_tmp76_ = block;
		_tmp77_ = try_stmt;
		vala_block_add_statement (_tmp76_, (ValaStatement*) _tmp77_);
		_tmp78_ = vala_string_literal_new ("this", NULL);
		_tmp79_ = _tmp78_;
		_tmp80_ = vala_member_access_new ((ValaExpression*) _tmp79_, "field_name", NULL);
		_tmp81_ = _tmp80_;
		_tmp82_ = vala_method_call_new ((ValaExpression*) _tmp81_, NULL);
		_tmp83_ = _tmp82_;
		_vala_code_node_unref0 (_tmp81_);
		_vala_code_node_unref0 (_tmp79_);
		get_field_name = _tmp83_;
		_tmp84_ = get_field_name;
		_tmp85_ = vala_member_access_new (NULL, "field", NULL);
		_tmp86_ = _tmp85_;
		vala_method_call_add_argument (_tmp84_, (ValaExpression*) _tmp86_);
		_vala_code_node_unref0 (_tmp86_);
		_tmp87_ = try_block;
		_tmp88_ = vala_string_literal_new ("field_name", NULL);
		_tmp89_ = _tmp88_;
		_tmp90_ = get_field_name;
		_tmp91_ = vala_assignment_new ((ValaExpression*) _tmp89_, (ValaExpression*) _tmp90_, VALA_ASSIGNMENT_OPERATOR_SIMPLE, NULL);
		_tmp92_ = _tmp91_;
		_tmp93_ = vala_expression_statement_new ((ValaExpression*) _tmp92_, NULL);
		_tmp94_ = _tmp93_;
		vala_block_add_statement (_tmp87_, (ValaStatement*) _tmp94_);
		_vala_code_node_unref0 (_tmp94_);
		_vala_code_node_unref0 (_tmp92_);
		_vala_code_node_unref0 (_tmp89_);
		_tmp95_ = vala_string_literal_new ("GLib", NULL);
		_tmp96_ = _tmp95_;
		_tmp97_ = vala_member_access_new ((ValaExpression*) _tmp96_, "warning", NULL);
		_tmp98_ = _tmp97_;
		_tmp99_ = source_reference;
		_tmp100_ = vala_method_call_new ((ValaExpression*) _tmp98_, _tmp99_);
		_tmp101_ = _tmp100_;
		_vala_code_node_unref0 (_tmp98_);
		_vala_code_node_unref0 (_tmp96_);
		warn_call = _tmp101_;
		_tmp102_ = warn_call;
		_tmp103_ = source_reference;
		_tmp104_ = vala_string_literal_new ("\"" "Unknown field: %d" "\"", _tmp103_);
		_tmp105_ = _tmp104_;
		vala_method_call_add_argument (_tmp102_, (ValaExpression*) _tmp105_);
		_vala_code_node_unref0 (_tmp105_);
		_tmp106_ = warn_call;
		_tmp107_ = source_reference;
		_tmp108_ = vala_member_access_new (NULL, "field", _tmp107_);
		_tmp109_ = _tmp108_;
		vala_method_call_add_argument (_tmp106_, (ValaExpression*) _tmp109_);
		_vala_code_node_unref0 (_tmp109_);
		_tmp110_ = catch_block;
		_tmp111_ = warn_call;
		_tmp112_ = source_reference;
		_tmp113_ = vala_expression_statement_new ((ValaExpression*) _tmp111_, _tmp112_);
		_tmp114_ = _tmp113_;
		vala_block_add_statement (_tmp110_, (ValaStatement*) _tmp114_);
		_vala_code_node_unref0 (_tmp114_);
		_tmp115_ = catch_block;
		_tmp116_ = source_reference;
		_tmp117_ = vala_return_statement_new (NULL, _tmp116_);
		_tmp118_ = _tmp117_;
		vala_block_add_statement (_tmp115_, (ValaStatement*) _tmp118_);
		_vala_code_node_unref0 (_tmp118_);
		_tmp119_ = try_stmt;
		_tmp120_ = sql_heavy_generator_type_from_string ("SQLHeavy.Error");
		_tmp121_ = _tmp120_;
		_tmp122_ = catch_block;
		_tmp123_ = source_reference;
		_tmp124_ = vala_catch_clause_new (_tmp121_, "e", _tmp122_, _tmp123_);
		_tmp125_ = _tmp124_;
		vala_try_statement_add_catch_clause (_tmp119_, _tmp125_);
		_vala_code_node_unref0 (_tmp125_);
		_vala_code_node_unref0 (_tmp121_);
		_tmp126_ = vala_string_literal_new ("field_name", NULL);
		_tmp127_ = _tmp126_;
		_tmp128_ = source_reference;
		_tmp129_ = vala_switch_statement_new ((ValaExpression*) _tmp127_, _tmp128_);
		_vala_code_node_unref0 (signals_switch);
		signals_switch = _tmp129_;
		_vala_code_node_unref0 (_tmp127_);
		_tmp130_ = block;
		_tmp131_ = signals_switch;
		vala_block_add_statement (_tmp130_, (ValaStatement*) _tmp131_);
		_tmp132_ = register_notify;
		_tmp133_ = block;
		vala_subroutine_set_body ((ValaSubroutine*) _tmp132_, _tmp133_);
		_tmp134_ = cl;
		_tmp135_ = register_notify;
		vala_symbol_add_method ((ValaSymbol*) _tmp134_, _tmp135_);
		_vala_code_node_unref0 (warn_call);
		_vala_code_node_unref0 (get_field_name);
		_vala_code_node_unref0 (field_name);
		_vala_code_node_unref0 (try_stmt);
		_vala_code_node_unref0 (catch_block);
		_vala_code_node_unref0 (try_block);
		_vala_code_node_unref0 (block);
		_vala_code_node_unref0 (register_notify);
	}
	_tmp136_ = source_reference;
	_tmp137_ = vala_constructor_new (_tmp136_);
	con = _tmp137_;
	_tmp138_ = con;
	_tmp139_ = source_reference;
	_tmp140_ = vala_block_new (_tmp139_);
	_tmp141_ = _tmp140_;
	vala_subroutine_set_body ((ValaSubroutine*) _tmp138_, _tmp141_);
	_vala_code_node_unref0 (_tmp141_);
	_tmp142_ = vala_string_literal_new ("this", NULL);
	_tmp143_ = _tmp142_;
	_tmp144_ = source_reference;
	_tmp145_ = vala_member_access_new ((ValaExpression*) _tmp143_, "field_changed", _tmp144_);
	_tmp146_ = _tmp145_;
	_tmp147_ = source_reference;
	_tmp148_ = vala_member_access_new ((ValaExpression*) _tmp146_, "connect", _tmp147_);
	_tmp149_ = _tmp148_;
	_tmp150_ = source_reference;
	_tmp151_ = vala_method_call_new ((ValaExpression*) _tmp149_, _tmp150_);
	_tmp152_ = _tmp151_;
	_vala_code_node_unref0 (_tmp149_);
	_vala_code_node_unref0 (_tmp146_);
	_vala_code_node_unref0 (_tmp143_);
	conn_call = _tmp152_;
	_tmp153_ = conn_call;
	_tmp154_ = vala_string_literal_new ("this", NULL);
	_tmp155_ = _tmp154_;
	_tmp156_ = source_reference;
	_tmp157_ = vala_member_access_new ((ValaExpression*) _tmp155_, "emit_change_notification", _tmp156_);
	_tmp158_ = _tmp157_;
	vala_method_call_add_argument (_tmp153_, (ValaExpression*) _tmp158_);
	_vala_code_node_unref0 (_tmp158_);
	_vala_code_node_unref0 (_tmp155_);
	_tmp159_ = con;
	_tmp160_ = vala_subroutine_get_body ((ValaSubroutine*) _tmp159_);
	_tmp161_ = _tmp160_;
	_tmp162_ = conn_call;
	_tmp163_ = source_reference;
	_tmp164_ = vala_expression_statement_new ((ValaExpression*) _tmp162_, _tmp163_);
	_tmp165_ = _tmp164_;
	vala_block_add_statement (_tmp161_, (ValaStatement*) _tmp165_);
	_vala_code_node_unref0 (_tmp165_);
	_tmp166_ = cl;
	_tmp167_ = con;
	vala_class_set_constructor (_tmp166_, _tmp167_);
	{
		gint field;
		field = 0;
		{
			gboolean _tmp168_;
			_tmp168_ = TRUE;
			while (TRUE) {
				gboolean _tmp169_;
				gint _tmp171_;
				SQLHeavyTable* _tmp172_;
				gint _tmp173_;
				gint _tmp174_;
				SQLHeavyTable* _tmp175_;
				gint _tmp176_;
				ValaClass* _tmp177_;
				ValaSwitchStatement* _tmp178_;
				ValaSourceReference* _tmp179_;
				_tmp169_ = _tmp168_;
				if (!_tmp169_) {
					gint _tmp170_;
					_tmp170_ = field;
					field = _tmp170_ + 1;
				}
				_tmp168_ = FALSE;
				_tmp171_ = field;
				_tmp172_ = table;
				_tmp173_ = sql_heavy_table_get_field_count (_tmp172_);
				_tmp174_ = _tmp173_;
				if (!(_tmp171_ < _tmp174_)) {
					break;
				}
				_tmp175_ = table;
				_tmp176_ = field;
				_tmp177_ = cl;
				_tmp178_ = signals_switch;
				_tmp179_ = source_reference;
				sql_heavy_generator_parse_field (self, _tmp175_, _tmp176_, _tmp177_, _tmp178_, _tmp179_, &_inner_error_);
				if (_inner_error_ != NULL) {
					if ((_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) || (_inner_error_->domain == SQL_HEAVY_ERROR)) {
						g_propagate_error (error, _inner_error_);
						_vala_code_node_unref0 (conn_call);
						_vala_code_node_unref0 (con);
						_vala_code_node_unref0 (signals_switch);
						_vala_code_node_unref0 (cl);
						_g_free0 (symbol_name);
						_g_free0 (symbol);
						_g_free0 (db_symbol);
						_g_object_unref0 (db);
						return;
					} else {
						_vala_code_node_unref0 (conn_call);
						_vala_code_node_unref0 (con);
						_vala_code_node_unref0 (signals_switch);
						_vala_code_node_unref0 (cl);
						_g_free0 (symbol_name);
						_g_free0 (symbol);
						_g_free0 (db_symbol);
						_g_object_unref0 (db);
						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);
						g_clear_error (&_inner_error_);
						return;
					}
				}
			}
		}
	}
	_vala_code_node_unref0 (conn_call);
	_vala_code_node_unref0 (con);
	_vala_code_node_unref0 (signals_switch);
	_vala_code_node_unref0 (cl);
	_g_free0 (symbol_name);
	_g_free0 (symbol);
	_g_free0 (db_symbol);
	_g_object_unref0 (db);
}


static void sql_heavy_generator_parse_database (SQLHeavyGenerator* self, SQLHeavyDatabase* db, GError** error) {
	SQLHeavyDatabase* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_ = NULL;
	gchar* _tmp4_;
	gchar** _tmp5_;
	gchar** _tmp6_ = NULL;
	gchar** _tmp7_;
	gint _tmp7__length1;
	const gchar* _tmp8_;
	gchar* _tmp9_ = NULL;
	gchar* _tmp10_;
	gchar* symbol;
	const gchar* _tmp11_;
	gchar* _tmp12_ = NULL;
	gchar* symbol_name;
	ValaCodeContext* _tmp13_;
	ValaNamespace* _tmp14_;
	ValaNamespace* _tmp15_;
	ValaScope* _tmp16_;
	ValaScope* _tmp17_;
	const gchar* _tmp18_;
	ValaSymbol* _tmp19_ = NULL;
	ValaNamespace* ns;
	ValaCodeContext* _tmp20_;
	SQLHeavyDatabase* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	ValaSourceFile* _tmp24_;
	ValaSourceFile* source_file;
	ValaSourceFile* _tmp25_;
	ValaSourceReference* _tmp26_;
	ValaSourceReference* source_reference;
	ValaNamespace* _tmp27_;
	const gchar* _tmp35_;
	gboolean _tmp36_ = FALSE;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (db != NULL);
	_tmp0_ = db;
	_tmp1_ = sql_heavy_database_get_filename (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_path_get_basename (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp6_ = _tmp5_ = g_strsplit (_tmp4_, ".", 2);
	_tmp7_ = _tmp6_;
	_tmp7__length1 = _vala_array_length (_tmp5_);
	_tmp8_ = _tmp7_[0];
	_tmp9_ = g_strconcat ("@", _tmp8_, NULL);
	_tmp10_ = _tmp9_;
	_tmp7_ = (_vala_array_free (_tmp7_, _tmp7__length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (_tmp4_);
	symbol = _tmp10_;
	_tmp11_ = symbol;
	_tmp12_ = sql_heavy_generator_get_symbol_name (self, _tmp11_);
	symbol_name = _tmp12_;
	_tmp13_ = self->priv->context;
	_tmp14_ = vala_code_context_get_root (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = vala_symbol_get_scope ((ValaSymbol*) _tmp15_);
	_tmp17_ = _tmp16_;
	_tmp18_ = symbol_name;
	_tmp19_ = vala_scope_lookup (_tmp17_, _tmp18_);
	ns = VALA_IS_NAMESPACE (_tmp19_) ? ((ValaNamespace*) _tmp19_) : NULL;
	_tmp20_ = self->priv->context;
	_tmp21_ = db;
	_tmp22_ = sql_heavy_database_get_filename (_tmp21_);
	_tmp23_ = _tmp22_;
	_tmp24_ = vala_source_file_new (_tmp20_, VALA_SOURCE_FILE_TYPE_NONE, _tmp23_, NULL, FALSE);
	source_file = _tmp24_;
	_tmp25_ = source_file;
	_tmp26_ = vala_source_reference_new (_tmp25_, 0, 0, 0, 0);
	source_reference = _tmp26_;
	_tmp27_ = ns;
	if (_tmp27_ == NULL) {
		const gchar* _tmp28_;
		ValaSourceReference* _tmp29_;
		ValaNamespace* _tmp30_;
		ValaCodeContext* _tmp31_;
		ValaNamespace* _tmp32_;
		ValaNamespace* _tmp33_;
		ValaNamespace* _tmp34_;
		_tmp28_ = symbol_name;
		_tmp29_ = source_reference;
		_tmp30_ = vala_namespace_new (_tmp28_, _tmp29_);
		_vala_code_node_unref0 (ns);
		ns = _tmp30_;
		_tmp31_ = self->priv->context;
		_tmp32_ = vala_code_context_get_root (_tmp31_);
		_tmp33_ = _tmp32_;
		_tmp34_ = ns;
		vala_symbol_add_namespace ((ValaSymbol*) _tmp33_, _tmp34_);
	}
	_tmp35_ = symbol;
	_tmp36_ = sql_heavy_generator_symbol_is_hidden (self, _tmp35_);
	if (_tmp36_) {
		_vala_source_reference_unref0 (source_reference);
		_vala_source_file_unref0 (source_file);
		_vala_code_node_unref0 (ns);
		_g_free0 (symbol_name);
		_g_free0 (symbol);
		return;
	}
	{
		SQLHeavyDatabase* _tmp37_;
		GHashTable* _tmp38_ = NULL;
		GHashTable* tables;
		GHashTable* _tmp39_;
		GList* _tmp40_ = NULL;
		_tmp37_ = db;
		_tmp38_ = sql_heavy_database_get_tables (_tmp37_, &_inner_error_);
		tables = _tmp38_;
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == SQL_HEAVY_ERROR) {
				goto __catch1_sql_heavy_error;
			}
			_vala_source_reference_unref0 (source_reference);
			_vala_source_file_unref0 (source_file);
			_vala_code_node_unref0 (ns);
			_g_free0 (symbol_name);
			_g_free0 (symbol);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
		_tmp39_ = tables;
		_tmp40_ = g_hash_table_get_values (_tmp39_);
		{
			GList* table_collection = NULL;
			GList* table_it = NULL;
			table_collection = _tmp40_;
			for (table_it = table_collection; table_it != NULL; table_it = table_it->next) {
				SQLHeavyTable* table = NULL;
				table = (SQLHeavyTable*) table_it->data;
				{
					SQLHeavyTable* _tmp41_;
					ValaNamespace* _tmp42_;
					ValaSourceReference* _tmp43_;
					_tmp41_ = table;
					_tmp42_ = ns;
					_tmp43_ = source_reference;
					sql_heavy_generator_parse_table (self, _tmp41_, _tmp42_, _tmp43_, &_inner_error_);
					if (_inner_error_ != NULL) {
						_g_list_free0 (table_collection);
						_g_hash_table_unref0 (tables);
						if (_inner_error_->domain == SQL_HEAVY_ERROR) {
							goto __catch1_sql_heavy_error;
						}
						goto __finally1;
					}
				}
			}
			_g_list_free0 (table_collection);
		}
		_g_hash_table_unref0 (tables);
	}
	goto __finally1;
	__catch1_sql_heavy_error:
	{
		GError* e = NULL;
		GError* _tmp44_;
		const gchar* _tmp45_;
		GError* _tmp46_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp44_ = e;
		_tmp45_ = _tmp44_->message;
		_tmp46_ = g_error_new (SQL_HEAVY_GENERATOR_ERROR, SQL_HEAVY_GENERATOR_ERROR_DATABASE, "Database error: %s", _tmp45_);
		_inner_error_ = _tmp46_;
		_g_error_free0 (e);
		goto __finally1;
	}
	__finally1:
	if (_inner_error_ != NULL) {
		if (_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) {
			g_propagate_error (error, _inner_error_);
			_vala_source_reference_unref0 (source_reference);
			_vala_source_file_unref0 (source_file);
			_vala_code_node_unref0 (ns);
			_g_free0 (symbol_name);
			_g_free0 (symbol);
			return;
		} else {
			_vala_source_reference_unref0 (source_reference);
			_vala_source_file_unref0 (source_file);
			_vala_code_node_unref0 (ns);
			_g_free0 (symbol_name);
			_g_free0 (symbol);
			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);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	_vala_source_reference_unref0 (source_reference);
	_vala_source_file_unref0 (source_file);
	_vala_code_node_unref0 (ns);
	_g_free0 (symbol_name);
	_g_free0 (symbol);
}


void sql_heavy_generator_run (SQLHeavyGenerator* self, GError** error) {
	const gchar* _tmp0_;
	ValaParser* _tmp2_;
	ValaParser* parser;
	ValaParser* _tmp3_;
	ValaCodeContext* _tmp4_;
	GSList* _tmp5_;
	ValaSymbolResolver* _tmp13_;
	ValaSymbolResolver* resolver;
	ValaSymbolResolver* _tmp14_;
	ValaCodeContext* _tmp15_;
	ValaCodeContext* _tmp16_;
	ValaReport* _tmp17_;
	ValaReport* _tmp18_;
	gint _tmp19_ = 0;
	ValaCodeContext* _tmp21_;
	ValaSemanticAnalyzer* _tmp22_;
	ValaSemanticAnalyzer* _tmp23_;
	ValaCodeContext* _tmp24_;
	ValaCodeWriter* _tmp25_;
	ValaCodeWriter* code_writer;
	ValaCodeWriter* _tmp26_;
	ValaCodeContext* _tmp27_;
	const gchar* _tmp28_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = sql_heavy_generator_output_location;
	if (_tmp0_ == NULL) {
		FILE* _tmp1_;
		_tmp1_ = stderr;
		fprintf (_tmp1_, "You must supply an output location\n");
		return;
	}
	_tmp2_ = vala_parser_new ();
	parser = _tmp2_;
	_tmp3_ = parser;
	_tmp4_ = self->priv->context;
	vala_parser_parse (_tmp3_, _tmp4_);
	_tmp5_ = self->priv->databases;
	{
		GSList* dbfile_collection = NULL;
		GSList* dbfile_it = NULL;
		dbfile_collection = _tmp5_;
		for (dbfile_it = dbfile_collection; dbfile_it != NULL; dbfile_it = dbfile_it->next) {
			const gchar* dbfile = NULL;
			dbfile = (const gchar*) dbfile_it->data;
			{
				SQLHeavyDatabase* db = NULL;
				SQLHeavyDatabase* _tmp12_;
				{
					const gchar* _tmp6_;
					SQLHeavyDatabase* _tmp7_;
					SQLHeavyDatabase* _tmp8_;
					_tmp6_ = dbfile;
					_tmp7_ = sql_heavy_database_new (_tmp6_, SQL_HEAVY_FILE_MODE_READ, &_inner_error_);
					_tmp8_ = _tmp7_;
					if (_inner_error_ != NULL) {
						if (_inner_error_->domain == SQL_HEAVY_ERROR) {
							goto __catch2_sql_heavy_error;
						}
						_g_object_unref0 (db);
						_vala_code_visitor_unref0 (parser);
						g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
						g_clear_error (&_inner_error_);
						return;
					}
					_g_object_unref0 (db);
					db = _tmp8_;
				}
				goto __finally2;
				__catch2_sql_heavy_error:
				{
					GError* e = NULL;
					GError* _tmp9_;
					const gchar* _tmp10_;
					GError* _tmp11_;
					e = _inner_error_;
					_inner_error_ = NULL;
					_tmp9_ = e;
					_tmp10_ = _tmp9_->message;
					_tmp11_ = g_error_new (SQL_HEAVY_GENERATOR_ERROR, SQL_HEAVY_GENERATOR_ERROR_CONFIGURATION, "Unable to open database: %s", _tmp10_);
					_inner_error_ = _tmp11_;
					_g_error_free0 (e);
					goto __finally2;
				}
				__finally2:
				if (_inner_error_ != NULL) {
					if (_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) {
						g_propagate_error (error, _inner_error_);
						_g_object_unref0 (db);
						_vala_code_visitor_unref0 (parser);
						return;
					} else {
						_g_object_unref0 (db);
						_vala_code_visitor_unref0 (parser);
						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);
						g_clear_error (&_inner_error_);
						return;
					}
				}
				_tmp12_ = db;
				sql_heavy_generator_parse_database (self, _tmp12_, &_inner_error_);
				if (_inner_error_ != NULL) {
					if (_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) {
						g_propagate_error (error, _inner_error_);
						_g_object_unref0 (db);
						_vala_code_visitor_unref0 (parser);
						return;
					} else {
						_g_object_unref0 (db);
						_vala_code_visitor_unref0 (parser);
						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);
						g_clear_error (&_inner_error_);
						return;
					}
				}
				_g_object_unref0 (db);
			}
		}
	}
	_tmp13_ = vala_symbol_resolver_new ();
	resolver = _tmp13_;
	_tmp14_ = resolver;
	_tmp15_ = self->priv->context;
	vala_symbol_resolver_resolve (_tmp14_, _tmp15_);
	_tmp16_ = self->priv->context;
	_tmp17_ = vala_code_context_get_report (_tmp16_);
	_tmp18_ = _tmp17_;
	_tmp19_ = vala_report_get_errors (_tmp18_);
	if (_tmp19_ > 0) {
		GError* _tmp20_;
		_tmp20_ = g_error_new_literal (SQL_HEAVY_GENERATOR_ERROR, SQL_HEAVY_GENERATOR_ERROR_SYMBOL_RESOLVER, "Error resolving symbols.");
		_inner_error_ = _tmp20_;
		if (_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) {
			g_propagate_error (error, _inner_error_);
			_vala_code_visitor_unref0 (resolver);
			_vala_code_visitor_unref0 (parser);
			return;
		} else {
			_vala_code_visitor_unref0 (resolver);
			_vala_code_visitor_unref0 (parser);
			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);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	_tmp21_ = self->priv->context;
	_tmp22_ = vala_code_context_get_analyzer (_tmp21_);
	_tmp23_ = _tmp22_;
	_tmp24_ = self->priv->context;
	vala_semantic_analyzer_analyze (_tmp23_, _tmp24_);
	_tmp25_ = vala_code_writer_new (VALA_CODE_WRITER_TYPE_DUMP);
	code_writer = _tmp25_;
	_tmp26_ = code_writer;
	_tmp27_ = self->priv->context;
	_tmp28_ = sql_heavy_generator_output_location;
	vala_code_writer_write_file (_tmp26_, _tmp27_, _tmp28_);
	_vala_code_visitor_unref0 (code_writer);
	_vala_code_visitor_unref0 (resolver);
	_vala_code_visitor_unref0 (parser);
}


static gunichar string_get_char (const gchar* self, glong index) {
	gunichar result = 0U;
	glong _tmp0_;
	gunichar _tmp1_ = 0U;
	g_return_val_if_fail (self != NULL, 0U);
	_tmp0_ = index;
	_tmp1_ = g_utf8_get_char (((gchar*) self) + _tmp0_);
	result = _tmp1_;
	return result;
}


static gchar* sql_heavy_generator_parse_selector (const gchar* selector, gboolean* wildcard, GError** error) {
	gboolean _vala_wildcard = FALSE;
	gchar* result = NULL;
	gchar** _tmp0_ = NULL;
	gchar** real_selector;
	gint real_selector_length1;
	gint _real_selector_size_;
	const gchar* _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_ = NULL;
	gchar** segments;
	gint segments_length1;
	gint _segments_size_;
	gint pos;
	gchar** _tmp62_;
	gint _tmp62__length1;
	gchar* _tmp63_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (selector != NULL, NULL);
	_vala_wildcard = FALSE;
	_tmp0_ = g_new0 (gchar*, 3 + 1);
	real_selector = _tmp0_;
	real_selector_length1 = 3;
	_real_selector_size_ = real_selector_length1;
	_tmp1_ = selector;
	_tmp3_ = _tmp2_ = g_strsplit (_tmp1_, "/", 3);
	segments = _tmp3_;
	segments_length1 = _vala_array_length (_tmp2_);
	_segments_size_ = segments_length1;
	pos = 0;
	{
		gint seg;
		seg = 0;
		{
			gboolean _tmp4_;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean _tmp5_;
				gint _tmp7_;
				gchar** _tmp8_;
				gint _tmp8__length1;
				gchar** _tmp9_;
				gint _tmp9__length1;
				gint _tmp10_;
				const gchar* _tmp11_;
				gunichar _tmp12_ = 0U;
				gunichar first_char;
				gboolean _tmp13_ = FALSE;
				gunichar _tmp14_;
				gboolean _tmp16_;
				gchar** _tmp43_;
				gint _tmp43__length1;
				gint _tmp44_;
				const gchar* _tmp45_;
				gboolean _tmp46_ = FALSE;
				gint _tmp47_;
				gboolean _tmp51_;
				gchar** _tmp54_;
				gint _tmp54__length1;
				gint _tmp55_;
				gchar** _tmp56_;
				gint _tmp56__length1;
				gint _tmp57_;
				const gchar* _tmp58_;
				gchar* _tmp59_;
				gchar* _tmp60_;
				gint _tmp61_;
				_tmp5_ = _tmp4_;
				if (!_tmp5_) {
					gint _tmp6_;
					_tmp6_ = seg;
					seg = _tmp6_ + 1;
				}
				_tmp4_ = FALSE;
				_tmp7_ = seg;
				_tmp8_ = segments;
				_tmp8__length1 = segments_length1;
				if (!(_tmp7_ < _tmp8__length1)) {
					break;
				}
				_tmp9_ = segments;
				_tmp9__length1 = segments_length1;
				_tmp10_ = seg;
				_tmp11_ = _tmp9_[_tmp10_];
				_tmp12_ = string_get_char (_tmp11_, (glong) 0);
				first_char = _tmp12_;
				_tmp14_ = first_char;
				if (_tmp14_ == ((gunichar) '%')) {
					_tmp13_ = TRUE;
				} else {
					gunichar _tmp15_;
					_tmp15_ = first_char;
					_tmp13_ = _tmp15_ == ((gunichar) '@');
				}
				_tmp16_ = _tmp13_;
				if (_tmp16_) {
					gint dest_pos = 0;
					gunichar _tmp17_;
					_tmp17_ = first_char;
					if (_tmp17_ == ((gunichar) '%')) {
						gchar** _tmp18_;
						gint _tmp18__length1;
						gint _tmp19_;
						gchar** _tmp20_;
						gint _tmp20__length1;
						gint _tmp21_;
						const gchar* _tmp22_;
						const gchar* _tmp23_ = NULL;
						gchar* _tmp24_;
						gchar* _tmp25_;
						_tmp18_ = segments;
						_tmp18__length1 = segments_length1;
						_tmp19_ = seg;
						_tmp20_ = segments;
						_tmp20__length1 = segments_length1;
						_tmp21_ = seg;
						_tmp22_ = _tmp20_[_tmp21_];
						_tmp23_ = string_offset (_tmp22_, (glong) 1);
						_tmp24_ = g_strdup (_tmp23_);
						_g_free0 (_tmp18_[_tmp19_]);
						_tmp18_[_tmp19_] = _tmp24_;
						_tmp25_ = _tmp18_[_tmp19_];
						dest_pos = 1;
					} else {
						dest_pos = 0;
					}
					while (TRUE) {
						gint _tmp26_;
						gint _tmp27_;
						gchar** _tmp28_;
						gint _tmp28__length1;
						gint _tmp29_;
						gchar* _tmp30_;
						gchar* _tmp31_;
						gint _tmp32_;
						_tmp26_ = pos;
						_tmp27_ = dest_pos;
						if (!(_tmp26_ < _tmp27_)) {
							break;
						}
						_vala_wildcard = TRUE;
						_tmp28_ = real_selector;
						_tmp28__length1 = real_selector_length1;
						_tmp29_ = pos;
						_tmp30_ = g_strdup ("*");
						_g_free0 (_tmp28_[_tmp29_]);
						_tmp28_[_tmp29_] = _tmp30_;
						_tmp31_ = _tmp28_[_tmp29_];
						_tmp32_ = pos;
						pos = _tmp32_ + 1;
					}
				} else {
					gboolean _tmp33_ = FALSE;
					gint _tmp34_;
					gboolean _tmp36_;
					_tmp34_ = pos;
					if (_tmp34_ == 0) {
						gunichar _tmp35_;
						_tmp35_ = first_char;
						_tmp33_ = _tmp35_ != ((gunichar) '*');
					} else {
						_tmp33_ = FALSE;
					}
					_tmp36_ = _tmp33_;
					if (_tmp36_) {
						gchar** _tmp37_;
						gint _tmp37__length1;
						gchar* _tmp38_;
						gchar* _tmp39_;
						gchar** _tmp40_;
						gint _tmp40__length1;
						gchar* _tmp41_;
						gchar* _tmp42_;
						_vala_wildcard = TRUE;
						_tmp37_ = real_selector;
						_tmp37__length1 = real_selector_length1;
						_tmp38_ = g_strdup ("*");
						_g_free0 (_tmp37_[0]);
						_tmp37_[0] = _tmp38_;
						_tmp39_ = _tmp37_[0];
						_tmp40_ = real_selector;
						_tmp40__length1 = real_selector_length1;
						_tmp41_ = g_strdup ("*");
						_g_free0 (_tmp40_[1]);
						_tmp40_[1] = _tmp41_;
						_tmp42_ = _tmp40_[1];
						pos = 2;
					}
				}
				_tmp43_ = segments;
				_tmp43__length1 = segments_length1;
				_tmp44_ = seg;
				_tmp45_ = _tmp43_[_tmp44_];
				if (g_strcmp0 (_tmp45_, "*") == 0) {
					_vala_wildcard = TRUE;
				}
				_tmp47_ = pos;
				if (_tmp47_ > 2) {
					_tmp46_ = TRUE;
				} else {
					gchar** _tmp48_;
					gint _tmp48__length1;
					gint _tmp49_;
					const gchar* _tmp50_;
					_tmp48_ = real_selector;
					_tmp48__length1 = real_selector_length1;
					_tmp49_ = pos;
					_tmp50_ = _tmp48_[_tmp49_];
					_tmp46_ = _tmp50_ != NULL;
				}
				_tmp51_ = _tmp46_;
				if (_tmp51_) {
					const gchar* _tmp52_;
					GError* _tmp53_;
					_tmp52_ = selector;
					_tmp53_ = g_error_new (SQL_HEAVY_GENERATOR_ERROR, SQL_HEAVY_GENERATOR_ERROR_SELECTOR, "Invalid selector (%s).", _tmp52_);
					_inner_error_ = _tmp53_;
					if (_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) {
						g_propagate_error (error, _inner_error_);
						segments = (_vala_array_free (segments, segments_length1, (GDestroyNotify) g_free), NULL);
						real_selector = (_vala_array_free (real_selector, real_selector_length1, (GDestroyNotify) g_free), NULL);
						return NULL;
					} else {
						segments = (_vala_array_free (segments, segments_length1, (GDestroyNotify) g_free), NULL);
						real_selector = (_vala_array_free (real_selector, real_selector_length1, (GDestroyNotify) g_free), NULL);
						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);
						g_clear_error (&_inner_error_);
						return NULL;
					}
				}
				_tmp54_ = real_selector;
				_tmp54__length1 = real_selector_length1;
				_tmp55_ = pos;
				_tmp56_ = segments;
				_tmp56__length1 = segments_length1;
				_tmp57_ = seg;
				_tmp58_ = _tmp56_[_tmp57_];
				_tmp59_ = g_strdup (_tmp58_);
				_g_free0 (_tmp54_[_tmp55_]);
				_tmp54_[_tmp55_] = _tmp59_;
				_tmp60_ = _tmp54_[_tmp55_];
				_tmp61_ = pos;
				pos = _tmp61_ + 1;
			}
		}
	}
	_tmp62_ = real_selector;
	_tmp62__length1 = real_selector_length1;
	_tmp63_ = g_strjoinv ("/", _tmp62_);
	result = _tmp63_;
	segments = (_vala_array_free (segments, segments_length1, (GDestroyNotify) g_free), NULL);
	real_selector = (_vala_array_free (real_selector, real_selector_length1, (GDestroyNotify) g_free), NULL);
	if (wildcard) {
		*wildcard = _vala_wildcard;
	}
	return result;
}


static gpointer _vala_map_ref0 (gpointer self) {
	return self ? vala_map_ref (self) : NULL;
}


static void sql_heavy_generator_parse_metadata (SQLHeavyGenerator* self, GError** error) {
	GKeyFile* _tmp0_;
	GKeyFile* metadata;
	GKeyFile* _tmp1_;
	const gchar* _tmp2_;
	GKeyFile* _tmp3_;
	gsize _tmp4_;
	gchar** _tmp5_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_key_file_new ();
	metadata = _tmp0_;
	_tmp1_ = metadata;
	_tmp2_ = sql_heavy_generator_metadata_location;
	g_key_file_load_from_file (_tmp1_, _tmp2_, G_KEY_FILE_NONE, &_inner_error_);
	if (_inner_error_ != NULL) {
		if ((_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) || (_inner_error_->domain == G_KEY_FILE_ERROR)) {
			g_propagate_error (error, _inner_error_);
			_g_key_file_free0 (metadata);
			return;
		} else {
			_g_key_file_free0 (metadata);
			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);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	_tmp3_ = metadata;
	_tmp5_ = g_key_file_get_groups (_tmp3_, &_tmp4_);
	{
		gchar** group_collection = NULL;
		gint group_collection_length1 = 0;
		gint _group_collection_size_ = 0;
		gint group_it = 0;
		group_collection = _tmp5_;
		group_collection_length1 = _tmp4_;
		for (group_it = 0; group_it < _tmp4_; group_it = group_it + 1) {
			const gchar* group = NULL;
			group = group_collection[group_it];
			{
				gboolean is_wildcard = FALSE;
				const gchar* _tmp6_;
				gboolean _tmp7_ = FALSE;
				gchar* _tmp8_ = NULL;
				gchar* selector;
				ValaHashMap* _tmp9_ = NULL;
				gboolean _tmp10_;
				ValaHashMap* _tmp13_;
				ValaHashMap* _tmp14_;
				ValaHashMap* cache;
				ValaHashMap* _tmp15_;
				const gchar* _tmp16_;
				gpointer _tmp17_ = NULL;
				ValaHashMap* properties;
				ValaHashMap* _tmp18_;
				GKeyFile* _tmp26_;
				const gchar* _tmp27_;
				gsize _tmp28_;
				gchar** _tmp29_ = NULL;
				gchar** _tmp30_;
				gint _tmp30__length1;
				gint __tmp30__size_;
				_tmp6_ = group;
				_tmp8_ = sql_heavy_generator_parse_selector (_tmp6_, &_tmp7_, &_inner_error_);
				is_wildcard = _tmp7_;
				selector = _tmp8_;
				if (_inner_error_ != NULL) {
					if ((_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) || (_inner_error_->domain == G_KEY_FILE_ERROR)) {
						g_propagate_error (error, _inner_error_);
						group_collection = (_vala_array_free (group_collection, group_collection_length1, (GDestroyNotify) g_free), NULL);
						_g_key_file_free0 (metadata);
						return;
					} else {
						group_collection = (_vala_array_free (group_collection, group_collection_length1, (GDestroyNotify) g_free), NULL);
						_g_key_file_free0 (metadata);
						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);
						g_clear_error (&_inner_error_);
						return;
					}
				}
				_tmp10_ = is_wildcard;
				if (_tmp10_) {
					ValaHashMap* _tmp11_;
					_tmp11_ = self->priv->wildcard_cache;
					_tmp9_ = _tmp11_;
				} else {
					ValaHashMap* _tmp12_;
					_tmp12_ = self->priv->cache;
					_tmp9_ = _tmp12_;
				}
				_tmp13_ = _tmp9_;
				_tmp14_ = _vala_map_ref0 (_tmp13_);
				cache = _tmp14_;
				_tmp15_ = cache;
				_tmp16_ = selector;
				_tmp17_ = vala_map_get ((ValaMap*) _tmp15_, _tmp16_);
				properties = (ValaHashMap*) _tmp17_;
				_tmp18_ = properties;
				if (_tmp18_ == NULL) {
					GHashFunc _tmp19_;
					GEqualFunc _tmp20_;
					GEqualFunc _tmp21_;
					ValaHashMap* _tmp22_;
					ValaHashMap* _tmp23_;
					const gchar* _tmp24_;
					ValaHashMap* _tmp25_;
					_tmp19_ = g_str_hash;
					_tmp20_ = g_str_equal;
					_tmp21_ = g_str_equal;
					_tmp22_ = vala_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, _tmp19_, _tmp20_, _tmp21_);
					_vala_map_unref0 (properties);
					properties = _tmp22_;
					_tmp23_ = cache;
					_tmp24_ = selector;
					_tmp25_ = properties;
					vala_map_set ((ValaMap*) _tmp23_, _tmp24_, _tmp25_);
				}
				_tmp26_ = metadata;
				_tmp27_ = group;
				_tmp29_ = g_key_file_get_keys (_tmp26_, _tmp27_, &_tmp28_, &_inner_error_);
				_tmp30_ = _tmp29_;
				_tmp30__length1 = _tmp28_;
				__tmp30__size_ = _tmp30__length1;
				if (_inner_error_ != NULL) {
					if ((_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) || (_inner_error_->domain == G_KEY_FILE_ERROR)) {
						g_propagate_error (error, _inner_error_);
						_vala_map_unref0 (properties);
						_vala_map_unref0 (cache);
						_g_free0 (selector);
						group_collection = (_vala_array_free (group_collection, group_collection_length1, (GDestroyNotify) g_free), NULL);
						_g_key_file_free0 (metadata);
						return;
					} else {
						_vala_map_unref0 (properties);
						_vala_map_unref0 (cache);
						_g_free0 (selector);
						group_collection = (_vala_array_free (group_collection, group_collection_length1, (GDestroyNotify) g_free), NULL);
						_g_key_file_free0 (metadata);
						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);
						g_clear_error (&_inner_error_);
						return;
					}
				}
				{
					gchar** key_collection = NULL;
					gint key_collection_length1 = 0;
					gint _key_collection_size_ = 0;
					gint key_it = 0;
					key_collection = _tmp30_;
					key_collection_length1 = _tmp30__length1;
					for (key_it = 0; key_it < _tmp30__length1; key_it = key_it + 1) {
						const gchar* key = NULL;
						key = key_collection[key_it];
						{
							GKeyFile* _tmp31_;
							const gchar* _tmp32_;
							const gchar* _tmp33_;
							gchar* _tmp34_ = NULL;
							gchar* _tmp35_;
							ValaHashMap* _tmp36_;
							const gchar* _tmp37_;
							gchar* _tmp38_;
							_tmp31_ = metadata;
							_tmp32_ = group;
							_tmp33_ = key;
							_tmp34_ = g_key_file_get_string (_tmp31_, _tmp32_, _tmp33_, &_inner_error_);
							_tmp35_ = _tmp34_;
							if (_inner_error_ != NULL) {
								if ((_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) || (_inner_error_->domain == G_KEY_FILE_ERROR)) {
									g_propagate_error (error, _inner_error_);
									key_collection = (_vala_array_free (key_collection, key_collection_length1, (GDestroyNotify) g_free), NULL);
									_vala_map_unref0 (properties);
									_vala_map_unref0 (cache);
									_g_free0 (selector);
									group_collection = (_vala_array_free (group_collection, group_collection_length1, (GDestroyNotify) g_free), NULL);
									_g_key_file_free0 (metadata);
									return;
								} else {
									key_collection = (_vala_array_free (key_collection, key_collection_length1, (GDestroyNotify) g_free), NULL);
									_vala_map_unref0 (properties);
									_vala_map_unref0 (cache);
									_g_free0 (selector);
									group_collection = (_vala_array_free (group_collection, group_collection_length1, (GDestroyNotify) g_free), NULL);
									_g_key_file_free0 (metadata);
									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);
									g_clear_error (&_inner_error_);
									return;
								}
							}
							_tmp36_ = properties;
							_tmp37_ = key;
							_tmp38_ = _tmp35_;
							vala_map_set ((ValaMap*) _tmp36_, _tmp37_, _tmp38_);
							_g_free0 (_tmp38_);
						}
					}
					key_collection = (_vala_array_free (key_collection, key_collection_length1, (GDestroyNotify) g_free), NULL);
				}
				_vala_map_unref0 (properties);
				_vala_map_unref0 (cache);
				_g_free0 (selector);
			}
		}
		group_collection = (_vala_array_free (group_collection, group_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_g_key_file_free0 (metadata);
}


void sql_heavy_generator_configure (SQLHeavyGenerator* self, GError** error) {
	const gchar* _tmp0_;
	ValaCodeContext* _tmp7_;
	ValaCodeContext* _tmp8_;
	ValaCodeContext* _tmp9_;
	ValaCodeContext* _tmp10_;
	ValaCodeContext* _tmp11_;
	gchar* _tmp12_ = NULL;
	gchar* _tmp13_;
	gchar* _tmp14_ = NULL;
	gchar* _tmp15_;
	gchar** _tmp16_;
	gint _tmp16__length1;
	gchar** _tmp19_;
	gint _tmp19__length1;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = sql_heavy_generator_metadata_location;
	if (_tmp0_ != NULL) {
		{
			sql_heavy_generator_parse_metadata (self, &_inner_error_);
			if (_inner_error_ != NULL) {
				if (_inner_error_->domain == G_KEY_FILE_ERROR) {
					goto __catch3_g_key_file_error;
				}
				if (_inner_error_->domain == G_FILE_ERROR) {
					goto __catch3_g_file_error;
				}
				goto __finally3;
			}
		}
		goto __finally3;
		__catch3_g_key_file_error:
		{
			GError* e = NULL;
			GError* _tmp1_;
			const gchar* _tmp2_;
			GError* _tmp3_;
			e = _inner_error_;
			_inner_error_ = NULL;
			_tmp1_ = e;
			_tmp2_ = _tmp1_->message;
			_tmp3_ = g_error_new (SQL_HEAVY_GENERATOR_ERROR, SQL_HEAVY_GENERATOR_ERROR_CONFIGURATION, "Unable to load metadata file: %s", _tmp2_);
			_inner_error_ = _tmp3_;
			_g_error_free0 (e);
			goto __finally3;
		}
		goto __finally3;
		__catch3_g_file_error:
		{
			GError* e = NULL;
			GError* _tmp4_;
			const gchar* _tmp5_;
			GError* _tmp6_;
			e = _inner_error_;
			_inner_error_ = NULL;
			_tmp4_ = e;
			_tmp5_ = _tmp4_->message;
			_tmp6_ = g_error_new (SQL_HEAVY_GENERATOR_ERROR, SQL_HEAVY_GENERATOR_ERROR_CONFIGURATION, "Unable to load metadata file: %s", _tmp5_);
			_inner_error_ = _tmp6_;
			_g_error_free0 (e);
			goto __finally3;
		}
		__finally3:
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) {
				g_propagate_error (error, _inner_error_);
				return;
			} else {
				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);
				g_clear_error (&_inner_error_);
				return;
			}
		}
	}
	_tmp7_ = self->priv->context;
	vala_code_context_set_profile (_tmp7_, VALA_PROFILE_GOBJECT);
	_tmp8_ = self->priv->context;
	vala_code_context_push (_tmp8_);
	_tmp9_ = self->priv->context;
	vala_code_context_add_external_package (_tmp9_, "glib-2.0");
	_tmp10_ = self->priv->context;
	vala_code_context_add_external_package (_tmp10_, "gobject-2.0");
	_tmp11_ = self->priv->context;
	_tmp12_ = sql_heavy_version_api ();
	_tmp13_ = _tmp12_;
	_tmp14_ = g_strdup_printf ("sqlheavy-%s", _tmp13_);
	_tmp15_ = _tmp14_;
	vala_code_context_add_external_package (_tmp11_, _tmp15_);
	_g_free0 (_tmp15_);
	_g_free0 (_tmp13_);
	_tmp16_ = sql_heavy_generator_packages;
	_tmp16__length1 = _vala_array_length (sql_heavy_generator_packages);
	{
		gchar** pkg_collection = NULL;
		gint pkg_collection_length1 = 0;
		gint _pkg_collection_size_ = 0;
		gint pkg_it = 0;
		pkg_collection = _tmp16_;
		pkg_collection_length1 = _tmp16__length1;
		for (pkg_it = 0; pkg_it < _tmp16__length1; pkg_it = pkg_it + 1) {
			const gchar* pkg = NULL;
			pkg = pkg_collection[pkg_it];
			{
				ValaCodeContext* _tmp17_;
				const gchar* _tmp18_;
				_tmp17_ = self->priv->context;
				_tmp18_ = pkg;
				vala_code_context_add_external_package (_tmp17_, _tmp18_);
			}
		}
	}
	_tmp19_ = sql_heavy_generator_sources;
	_tmp19__length1 = _vala_array_length (sql_heavy_generator_sources);
	{
		gchar** source_collection = NULL;
		gint source_collection_length1 = 0;
		gint _source_collection_size_ = 0;
		gint source_it = 0;
		source_collection = _tmp19_;
		source_collection_length1 = _tmp19__length1;
		for (source_it = 0; source_it < _tmp19__length1; source_it = source_it + 1) {
			const gchar* source = NULL;
			source = source_collection[source_it];
			{
				const gchar* _tmp20_;
				gboolean _tmp21_ = FALSE;
				_tmp20_ = source;
				_tmp21_ = g_str_has_suffix (_tmp20_, ".vala");
				if (_tmp21_) {
					const gchar* _tmp22_;
					gboolean _tmp23_ = FALSE;
					_tmp22_ = source;
					_tmp23_ = g_file_test (_tmp22_, G_FILE_TEST_EXISTS);
					if (_tmp23_) {
						ValaCodeContext* _tmp24_;
						ValaCodeContext* _tmp25_;
						const gchar* _tmp26_;
						ValaSourceFile* _tmp27_;
						ValaSourceFile* _tmp28_;
						_tmp24_ = self->priv->context;
						_tmp25_ = self->priv->context;
						_tmp26_ = source;
						_tmp27_ = vala_source_file_new (_tmp25_, VALA_SOURCE_FILE_TYPE_NONE, _tmp26_, NULL, FALSE);
						_tmp28_ = _tmp27_;
						vala_code_context_add_source_file (_tmp24_, _tmp28_);
						_vala_source_file_unref0 (_tmp28_);
					} else {
						const gchar* _tmp29_;
						const gchar* _tmp30_ = NULL;
						gchar* _tmp31_ = NULL;
						gchar* _tmp32_;
						GError* _tmp33_;
						GError* _tmp34_;
						_tmp29_ = source;
						_tmp30_ = string_to_string (_tmp29_);
						_tmp31_ = g_strconcat ("Source file '", _tmp30_, "' does not exist.", NULL);
						_tmp32_ = _tmp31_;
						_tmp33_ = g_error_new_literal (SQL_HEAVY_GENERATOR_ERROR, SQL_HEAVY_GENERATOR_ERROR_CONFIGURATION, _tmp32_);
						_tmp34_ = _tmp33_;
						_g_free0 (_tmp32_);
						_inner_error_ = _tmp34_;
						if (_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) {
							g_propagate_error (error, _inner_error_);
							return;
						} else {
							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);
							g_clear_error (&_inner_error_);
							return;
						}
					}
				} else {
					const gchar* _tmp35_;
					gchar* _tmp36_;
					_tmp35_ = source;
					_tmp36_ = g_strdup (_tmp35_);
					self->priv->databases = g_slist_prepend (self->priv->databases, _tmp36_);
				}
			}
		}
	}
}


static gint sql_heavy_generator_main (gchar** args, int args_length1) {
	gint result = 0;
	gchar** _tmp18_;
	gint _tmp18__length1;
	SQLHeavyGenerator* _tmp20_;
	SQLHeavyGenerator* generator;
	GError * _inner_error_ = NULL;
	{
		GOptionContext* _tmp0_;
		GOptionContext* opt_context;
		GOptionContext* _tmp1_;
		GOptionContext* _tmp2_;
		GOptionContext* _tmp3_;
		GOptionContext* _tmp4_;
		GOptionContext* _tmp5_;
		_tmp0_ = g_option_context_new ("- SQLHeavy ORM Generator");
		opt_context = _tmp0_;
		_tmp1_ = opt_context;
		g_option_context_set_help_enabled (_tmp1_, TRUE);
		_tmp2_ = opt_context;
		g_option_context_add_main_entries (_tmp2_, SQL_HEAVY_GENERATOR_options, NULL);
		_tmp3_ = opt_context;
		g_option_context_set_summary (_tmp3_, "This tool will generate a Vala file which provides an object for each\n" \
"table in the specified database(s), each of which extends the\n" \
"SQLHeavyRow class.");
		_tmp4_ = opt_context;
		g_option_context_set_description (_tmp4_, "Copyright 2010 Evan Nemerson.\n" \
"Released under versions 2.1 and 3 of the LGPL.\n" \
"\n" \
"For more information, or to report a bug, see\n" \
"<http://code.google.com/p/sqlheavy>");
		_tmp5_ = opt_context;
		g_option_context_parse (_tmp5_, &args_length1, &args, &_inner_error_);
		if (_inner_error_ != NULL) {
			_g_option_context_free0 (opt_context);
			if (_inner_error_->domain == G_OPTION_ERROR) {
				goto __catch4_g_option_error;
			}
			_g_option_context_free0 (opt_context);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return 0;
		}
		_g_option_context_free0 (opt_context);
	}
	goto __finally4;
	__catch4_g_option_error:
	{
		GError* e = NULL;
		FILE* _tmp6_;
		GError* _tmp7_;
		const gchar* _tmp8_;
		const gchar* _tmp9_ = NULL;
		gchar* _tmp10_ = NULL;
		gchar* _tmp11_;
		FILE* _tmp12_;
		gchar** _tmp13_;
		gint _tmp13__length1;
		const gchar* _tmp14_;
		const gchar* _tmp15_ = NULL;
		gchar* _tmp16_ = NULL;
		gchar* _tmp17_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp6_ = stdout;
		_tmp7_ = e;
		_tmp8_ = _tmp7_->message;
		_tmp9_ = string_to_string (_tmp8_);
		_tmp10_ = g_strconcat (_tmp9_, "\n", NULL);
		_tmp11_ = _tmp10_;
		fputs (_tmp11_, _tmp6_);
		_g_free0 (_tmp11_);
		_tmp12_ = stdout;
		_tmp13_ = args;
		_tmp13__length1 = args_length1;
		_tmp14_ = _tmp13_[0];
		_tmp15_ = string_to_string (_tmp14_);
		_tmp16_ = g_strconcat ("Run '", _tmp15_, " --help' to see a full list of available command line options.\n", NULL);
		_tmp17_ = _tmp16_;
		fputs (_tmp17_, _tmp12_);
		_g_free0 (_tmp17_);
		result = 1;
		_g_error_free0 (e);
		return result;
	}
	__finally4:
	if (_inner_error_ != NULL) {
		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);
		g_clear_error (&_inner_error_);
		return 0;
	}
	_tmp18_ = sql_heavy_generator_sources;
	_tmp18__length1 = _vala_array_length (sql_heavy_generator_sources);
	if (_tmp18_ == NULL) {
		FILE* _tmp19_;
		_tmp19_ = stderr;
		fputs ("No databases specified.\n", _tmp19_);
		result = 1;
		return result;
	}
	_tmp20_ = sql_heavy_generator_new ();
	generator = _tmp20_;
	{
		SQLHeavyGenerator* _tmp21_;
		SQLHeavyGenerator* _tmp22_;
		_tmp21_ = generator;
		sql_heavy_generator_configure (_tmp21_, &_inner_error_);
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) {
				goto __catch5_sql_heavy_generator_error;
			}
			_g_object_unref0 (generator);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return 0;
		}
		_tmp22_ = generator;
		sql_heavy_generator_run (_tmp22_, &_inner_error_);
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == SQL_HEAVY_GENERATOR_ERROR) {
				goto __catch5_sql_heavy_generator_error;
			}
			_g_object_unref0 (generator);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return 0;
		}
	}
	goto __finally5;
	__catch5_sql_heavy_generator_error:
	{
		GError* e = NULL;
		FILE* _tmp23_;
		GError* _tmp24_;
		const gchar* _tmp25_;
		const gchar* _tmp26_ = NULL;
		gchar* _tmp27_ = NULL;
		gchar* _tmp28_;
		FILE* _tmp29_;
		gchar** _tmp30_;
		gint _tmp30__length1;
		const gchar* _tmp31_;
		const gchar* _tmp32_ = NULL;
		gchar* _tmp33_ = NULL;
		gchar* _tmp34_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp23_ = stderr;
		_tmp24_ = e;
		_tmp25_ = _tmp24_->message;
		_tmp26_ = string_to_string (_tmp25_);
		_tmp27_ = g_strconcat ("Error: ", _tmp26_, "\n", NULL);
		_tmp28_ = _tmp27_;
		fputs (_tmp28_, _tmp23_);
		_g_free0 (_tmp28_);
		_tmp29_ = stdout;
		_tmp30_ = args;
		_tmp30__length1 = args_length1;
		_tmp31_ = _tmp30_[0];
		_tmp32_ = string_to_string (_tmp31_);
		_tmp33_ = g_strconcat ("Run '", _tmp32_, " --help' to see a full list of available command line options.\n", NULL);
		_tmp34_ = _tmp33_;
		fputs (_tmp34_, _tmp29_);
		_g_free0 (_tmp34_);
		result = 1;
		_g_error_free0 (e);
		_g_object_unref0 (generator);
		return result;
	}
	__finally5:
	if (_inner_error_ != NULL) {
		_g_object_unref0 (generator);
		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);
		g_clear_error (&_inner_error_);
		return 0;
	}
	result = 0;
	_g_object_unref0 (generator);
	return result;
}


int main (int argc, char ** argv) {
	g_type_init ();
	return sql_heavy_generator_main (argv, argc);
}


SQLHeavyGenerator* sql_heavy_generator_construct (GType object_type) {
	SQLHeavyGenerator * self = NULL;
	self = (SQLHeavyGenerator*) g_object_new (object_type, NULL);
	return self;
}


SQLHeavyGenerator* sql_heavy_generator_new (void) {
	return sql_heavy_generator_construct (SQL_HEAVY_TYPE_GENERATOR);
}


static void sql_heavy_generator_class_init (SQLHeavyGeneratorClass * klass) {
	sql_heavy_generator_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (SQLHeavyGeneratorPrivate));
	G_OBJECT_CLASS (klass)->finalize = sql_heavy_generator_finalize;
}


static void sql_heavy_generator_instance_init (SQLHeavyGenerator * self) {
	ValaCodeContext* _tmp0_;
	GHashFunc _tmp1_;
	GEqualFunc _tmp2_;
	GEqualFunc _tmp3_;
	ValaHashMap* _tmp4_;
	GHashFunc _tmp5_;
	GEqualFunc _tmp6_;
	GEqualFunc _tmp7_;
	ValaHashMap* _tmp8_;
	self->priv = SQL_HEAVY_GENERATOR_GET_PRIVATE (self);
	_tmp0_ = vala_code_context_new ();
	self->priv->context = _tmp0_;
	self->priv->databases = NULL;
	_tmp1_ = g_str_hash;
	_tmp2_ = g_str_equal;
	_tmp3_ = g_direct_equal;
	_tmp4_ = vala_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, VALA_TYPE_HASH_MAP, (GBoxedCopyFunc) vala_map_ref, vala_map_unref, _tmp1_, _tmp2_, _tmp3_);
	self->priv->cache = _tmp4_;
	_tmp5_ = g_str_hash;
	_tmp6_ = g_str_equal;
	_tmp7_ = g_direct_equal;
	_tmp8_ = vala_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, VALA_TYPE_HASH_MAP, (GBoxedCopyFunc) vala_map_ref, vala_map_unref, _tmp5_, _tmp6_, _tmp7_);
	self->priv->wildcard_cache = _tmp8_;
}


static void sql_heavy_generator_finalize (GObject* obj) {
	SQLHeavyGenerator * self;
	self = SQL_HEAVY_GENERATOR (obj);
	_vala_code_context_unref0 (self->priv->context);
	__g_slist_free__g_free0_0 (self->priv->databases);
	_vala_map_unref0 (self->priv->cache);
	_vala_map_unref0 (self->priv->wildcard_cache);
	G_OBJECT_CLASS (sql_heavy_generator_parent_class)->finalize (obj);
}


GType sql_heavy_generator_get_type (void) {
	static volatile gsize sql_heavy_generator_type_id__volatile = 0;
	if (g_once_init_enter (&sql_heavy_generator_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SQLHeavyGeneratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sql_heavy_generator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SQLHeavyGenerator), 0, (GInstanceInitFunc) sql_heavy_generator_instance_init, NULL };
		GType sql_heavy_generator_type_id;
		sql_heavy_generator_type_id = g_type_register_static (G_TYPE_OBJECT, "SQLHeavyGenerator", &g_define_type_info, 0);
		g_once_init_leave (&sql_heavy_generator_type_id__volatile, sql_heavy_generator_type_id);
	}
	return sql_heavy_generator_type_id__volatile;
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}


static gint _vala_array_length (gpointer array) {
	int length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}



