/* row.c generated by valac 0.56.19, the Vala compiler
 * generated from row.vala, do not modify */

#include "qlite.h"
#include <gee.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <sqlite3.h>
#include <gobject/gvaluecollector.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _QliteParamSpecRow QliteParamSpecRow;
#define _qlite_database_unref0(var) ((var == NULL) ? NULL : (var = (qlite_database_unref (var), NULL)))
#define _sqlite3_finalize0(var) ((var == NULL) ? NULL : (var = (sqlite3_finalize (var), NULL)))
typedef struct _QliteParamSpecRowIterator QliteParamSpecRowIterator;
#define _qlite_row_unref0(var) ((var == NULL) ? NULL : (var = (qlite_row_unref (var), NULL)))
typedef struct _QliteParamSpecRowOption QliteParamSpecRowOption;

struct _QliteRowPrivate {
	GeeMap* text_map;
	GeeMap* int_map;
	GeeMap* real_map;
};

struct _QliteParamSpecRow {
	GParamSpec parent_instance;
};

struct _QliteRowIteratorPrivate {
	QliteDatabase* db;
	sqlite3_stmt* stmt;
};

struct _QliteParamSpecRowIterator {
	GParamSpec parent_instance;
};

struct _QliteRowOptionPrivate {
	QliteRow* _inner;
};

struct _QliteParamSpecRowOption {
	GParamSpec parent_instance;
};

static gint QliteRow_private_offset;
static gpointer qlite_row_parent_class = NULL;
static gint QliteRowIterator_private_offset;
static gpointer qlite_row_iterator_parent_class = NULL;
static gint QliteRowOption_private_offset;
static gpointer qlite_row_option_parent_class = NULL;

static gdouble* _double_dup (gdouble* self);
VALA_EXTERN QliteRow* qlite_row_new (sqlite3_stmt* stmt);
VALA_EXTERN QliteRow* qlite_row_construct (GType object_type,
                               sqlite3_stmt* stmt);
static gchar* qlite_row_field_name (QliteRow* self,
                             const gchar* field,
                             const gchar* table);
static void qlite_row_finalize (QliteRow * obj);
static GType qlite_row_get_type_once (void);
VALA_EXTERN sqlite3_stmt* qlite_statement_builder_prepare (QliteStatementBuilder* self);
VALA_EXTERN sqlite3_stmt* qlite_database_prepare (QliteDatabase* self,
                                      const gchar* sql);
VALA_EXTERN gint qlite_database_errcode (QliteDatabase* self);
VALA_EXTERN gchar* qlite_database_errmsg (QliteDatabase* self);
static void qlite_row_iterator_finalize (QliteRowIterator * obj);
static GType qlite_row_iterator_get_type_once (void);
static void qlite_row_option_set_inner (QliteRowOption* self,
                                 QliteRow* value);
VALA_EXTERN glong qlite_row_option_get_integer (QliteRowOption* self,
                                    const gchar* field,
                                    glong def);
static void qlite_row_option_finalize (QliteRowOption * obj);
static GType qlite_row_option_get_type_once (void);

static inline gpointer
qlite_row_get_instance_private (QliteRow* self)
{
	return G_STRUCT_MEMBER_P (self, QliteRow_private_offset);
}

static gdouble*
_double_dup (gdouble* self)
{
	gdouble* dup;
	dup = g_new0 (gdouble, 1);
	memcpy (dup, self, sizeof (gdouble));
	return dup;
}

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

QliteRow*
qlite_row_construct (GType object_type,
                     sqlite3_stmt* stmt)
{
	QliteRow* self = NULL;
	g_return_val_if_fail (stmt != NULL, NULL);
	self = (QliteRow*) g_type_create_instance (object_type);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				gchar* column_name = NULL;
				const gchar* _tmp2_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(i < sqlite3_column_count (stmt))) {
					break;
				}
				_tmp2_ = sqlite3_column_origin_name (stmt, i);
				if (_tmp2_ != NULL) {
					const gchar* _tmp3_;
					const gchar* _tmp4_;
					const gchar* _tmp5_;
					const gchar* _tmp6_;
					gchar* _tmp7_;
					_tmp3_ = sqlite3_column_table_name (stmt, i);
					_tmp4_ = string_to_string (_tmp3_);
					_tmp5_ = sqlite3_column_origin_name (stmt, i);
					_tmp6_ = string_to_string (_tmp5_);
					_tmp7_ = g_strconcat (_tmp4_, ".", _tmp6_, NULL);
					_g_free0 (column_name);
					column_name = _tmp7_;
				} else {
					const gchar* _tmp8_;
					gchar* _tmp9_;
					_tmp8_ = sqlite3_column_name (stmt, i);
					_tmp9_ = g_strdup (_tmp8_);
					_g_free0 (column_name);
					column_name = _tmp9_;
				}
				switch (sqlite3_column_type (stmt, i)) {
					case SQLITE3_TEXT:
					{
						GeeMap* _tmp10_;
						const gchar* _tmp11_;
						const gchar* _tmp12_;
						_tmp10_ = self->priv->text_map;
						_tmp11_ = column_name;
						_tmp12_ = (const gchar*) sqlite3_column_text (stmt, i);
						gee_map_set (_tmp10_, _tmp11_, _tmp12_);
						break;
					}
					case SQLITE_INTEGER:
					{
						GeeMap* _tmp13_;
						const gchar* _tmp14_;
						_tmp13_ = self->priv->int_map;
						_tmp14_ = column_name;
						gee_map_set (_tmp13_, _tmp14_, (gpointer) ((gintptr) sqlite3_column_int64 (stmt, i)));
						break;
					}
					case SQLITE_FLOAT:
					{
						GeeMap* _tmp15_;
						const gchar* _tmp16_;
						gdouble _tmp17_;
						_tmp15_ = self->priv->real_map;
						_tmp16_ = column_name;
						_tmp17_ = sqlite3_column_double (stmt, i);
						gee_map_set (_tmp15_, _tmp16_, &_tmp17_);
						break;
					}
					default:
					break;
				}
				_g_free0 (column_name);
			}
		}
	}
	return self;
}

QliteRow*
qlite_row_new (sqlite3_stmt* stmt)
{
	return qlite_row_construct (QLITE_TYPE_ROW, stmt);
}

gpointer
qlite_row_get (QliteRow* self,
               GType t_type,
               GBoxedCopyFunc t_dup_func,
               GDestroyNotify t_destroy_func,
               QliteColumn* field)
{
	gpointer _tmp0_;
	gpointer result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (field != NULL, NULL);
	_tmp0_ = qlite_column_get (field, self, QLITE_COLUMN_DEFAULT_TABLE_NAME);
	result = _tmp0_;
	return result;
}

static gchar*
qlite_row_field_name (QliteRow* self,
                      const gchar* field,
                      const gchar* table)
{
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (field != NULL, NULL);
	if (table != NULL) {
		const gchar* _tmp0_;
		const gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp0_ = string_to_string (table);
		_tmp1_ = string_to_string (field);
		_tmp2_ = g_strconcat (_tmp0_, ".", _tmp1_, NULL);
		result = _tmp2_;
		return result;
	} else {
		gchar* _tmp3_;
		_tmp3_ = g_strdup (field);
		result = _tmp3_;
		return result;
	}
}

gchar*
qlite_row_get_text (QliteRow* self,
                    const gchar* field,
                    const gchar* table)
{
	GeeMap* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gboolean _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (field != NULL, NULL);
	_tmp0_ = self->priv->text_map;
	_tmp1_ = qlite_row_field_name (self, field, table);
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_map_has_key (_tmp0_, _tmp2_);
	_g_free0 (_tmp2_);
	if (_tmp3_) {
		GeeMap* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gpointer _tmp7_;
		gchar* _tmp8_;
		_tmp4_ = self->priv->text_map;
		_tmp5_ = qlite_row_field_name (self, field, table);
		_tmp6_ = _tmp5_;
		_tmp7_ = gee_map_get (_tmp4_, _tmp6_);
		_tmp8_ = (gchar*) _tmp7_;
		_g_free0 (_tmp6_);
		result = _tmp8_;
		return result;
	}
	result = NULL;
	return result;
}

glong
qlite_row_get_integer (QliteRow* self,
                       const gchar* field,
                       const gchar* table)
{
	GeeMap* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gpointer _tmp3_;
	glong _tmp4_;
	glong result;
	g_return_val_if_fail (self != NULL, -1L);
	g_return_val_if_fail (field != NULL, -1L);
	_tmp0_ = self->priv->int_map;
	_tmp1_ = qlite_row_field_name (self, field, table);
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_map_get (_tmp0_, _tmp2_);
	_tmp4_ = (glong) ((gintptr) _tmp3_);
	_g_free0 (_tmp2_);
	result = _tmp4_;
	return result;
}

gboolean
qlite_row_has_integer (QliteRow* self,
                       const gchar* field,
                       const gchar* table)
{
	GeeMap* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gboolean _tmp3_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (field != NULL, FALSE);
	_tmp0_ = self->priv->int_map;
	_tmp1_ = qlite_row_field_name (self, field, table);
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_map_has_key (_tmp0_, _tmp2_);
	_g_free0 (_tmp2_);
	result = _tmp3_;
	return result;
}

static gpointer
__double_dup0 (gpointer self)
{
	return self ? _double_dup (self) : NULL;
}

gdouble
qlite_row_get_real (QliteRow* self,
                    const gchar* field,
                    const gchar* table,
                    gdouble def)
{
	gdouble* _tmp0_ = NULL;
	GeeMap* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gpointer _tmp4_;
	gdouble* _tmp5_;
	gdouble* _tmp7_;
	gdouble* _tmp8_;
	gdouble _tmp9_;
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	g_return_val_if_fail (field != NULL, -1.0);
	_tmp1_ = self->priv->real_map;
	_tmp2_ = qlite_row_field_name (self, field, table);
	_tmp3_ = _tmp2_;
	_tmp4_ = gee_map_get (_tmp1_, _tmp3_);
	_tmp5_ = (gdouble*) _tmp4_;
	_g_free0 (_tmp3_);
	_tmp0_ = _tmp5_;
	if (_tmp0_ == NULL) {
		gdouble* _tmp6_;
		_tmp6_ = __double_dup0 (&def);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp6_;
	}
	_tmp7_ = _tmp0_;
	_tmp0_ = NULL;
	_tmp8_ = _tmp7_;
	_tmp9_ = *_tmp8_;
	_g_free0 (_tmp8_);
	result = _tmp9_;
	_g_free0 (_tmp0_);
	return result;
}

gboolean
qlite_row_has_real (QliteRow* self,
                    const gchar* field,
                    const gchar* table)
{
	gboolean _tmp0_ = FALSE;
	GeeMap* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (field != NULL, FALSE);
	_tmp1_ = self->priv->real_map;
	_tmp2_ = qlite_row_field_name (self, field, table);
	_tmp3_ = _tmp2_;
	_tmp4_ = gee_map_has_key (_tmp1_, _tmp3_);
	_g_free0 (_tmp3_);
	if (_tmp4_) {
		GeeMap* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		gpointer _tmp8_;
		gdouble* _tmp9_;
		_tmp5_ = self->priv->real_map;
		_tmp6_ = qlite_row_field_name (self, field, table);
		_tmp7_ = _tmp6_;
		_tmp8_ = gee_map_get (_tmp5_, _tmp7_);
		_tmp9_ = (gdouble*) _tmp8_;
		_tmp0_ = _tmp9_ != NULL;
		_g_free0 (_tmp9_);
		_g_free0 (_tmp7_);
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static gchar*
double_to_string (gdouble self)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint _tmp1__length1;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* result;
	_tmp0_ = g_new0 (gchar, G_ASCII_DTOSTR_BUF_SIZE);
	_tmp1_ = _tmp0_;
	_tmp1__length1 = G_ASCII_DTOSTR_BUF_SIZE;
	_tmp2_ = g_ascii_dtostr (_tmp1_, (gint) G_ASCII_DTOSTR_BUF_SIZE, self);
	_tmp3_ = g_strdup (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp1_ = (g_free (_tmp1_), NULL);
	result = _tmp4_;
	return result;
}

gchar*
qlite_row_to_string (QliteRow* self)
{
	gchar* ret = NULL;
	gchar* _tmp0_;
	const gchar* _tmp74_;
	gchar* _tmp75_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup ("{");
	ret = _tmp0_;
	{
		GeeIterator* _key_it = NULL;
		GeeMap* _tmp1_;
		GeeSet* _tmp2_;
		GeeSet* _tmp3_;
		GeeSet* _tmp4_;
		GeeIterator* _tmp5_;
		GeeIterator* _tmp6_;
		_tmp1_ = self->priv->text_map;
		_tmp2_ = gee_map_get_keys (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = _tmp3_;
		_tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_);
		_tmp6_ = _tmp5_;
		_g_object_unref0 (_tmp4_);
		_key_it = _tmp6_;
		while (TRUE) {
			GeeIterator* _tmp7_;
			gchar* key = NULL;
			GeeIterator* _tmp8_;
			gpointer _tmp9_;
			const gchar* _tmp10_;
			gint _tmp11_;
			gint _tmp12_;
			const gchar* _tmp15_;
			const gchar* _tmp16_;
			const gchar* _tmp17_;
			const gchar* _tmp18_;
			GeeMap* _tmp19_;
			const gchar* _tmp20_;
			gpointer _tmp21_;
			gchar* _tmp22_;
			const gchar* _tmp23_;
			gchar* _tmp24_;
			_tmp7_ = _key_it;
			if (!gee_iterator_next (_tmp7_)) {
				break;
			}
			_tmp8_ = _key_it;
			_tmp9_ = gee_iterator_get (_tmp8_);
			key = (gchar*) _tmp9_;
			_tmp10_ = ret;
			_tmp11_ = strlen (_tmp10_);
			_tmp12_ = _tmp11_;
			if (_tmp12_ > 1) {
				const gchar* _tmp13_;
				gchar* _tmp14_;
				_tmp13_ = ret;
				_tmp14_ = g_strconcat (_tmp13_, ", ", NULL);
				_g_free0 (ret);
				ret = _tmp14_;
			}
			_tmp15_ = ret;
			_tmp16_ = string_to_string (_tmp15_);
			_tmp17_ = key;
			_tmp18_ = string_to_string (_tmp17_);
			_tmp19_ = self->priv->text_map;
			_tmp20_ = key;
			_tmp21_ = gee_map_get (_tmp19_, _tmp20_);
			_tmp22_ = (gchar*) _tmp21_;
			_tmp23_ = string_to_string (_tmp22_);
			_tmp24_ = g_strconcat (_tmp16_, _tmp18_, ": \"", _tmp23_, "\"", NULL);
			_g_free0 (ret);
			ret = _tmp24_;
			_g_free0 (_tmp22_);
			_g_free0 (key);
		}
		_g_object_unref0 (_key_it);
	}
	{
		GeeIterator* _key_it = NULL;
		GeeMap* _tmp25_;
		GeeSet* _tmp26_;
		GeeSet* _tmp27_;
		GeeSet* _tmp28_;
		GeeIterator* _tmp29_;
		GeeIterator* _tmp30_;
		_tmp25_ = self->priv->int_map;
		_tmp26_ = gee_map_get_keys (_tmp25_);
		_tmp27_ = _tmp26_;
		_tmp28_ = _tmp27_;
		_tmp29_ = gee_iterable_iterator ((GeeIterable*) _tmp28_);
		_tmp30_ = _tmp29_;
		_g_object_unref0 (_tmp28_);
		_key_it = _tmp30_;
		while (TRUE) {
			GeeIterator* _tmp31_;
			gchar* key = NULL;
			GeeIterator* _tmp32_;
			gpointer _tmp33_;
			const gchar* _tmp34_;
			gint _tmp35_;
			gint _tmp36_;
			const gchar* _tmp39_;
			const gchar* _tmp40_;
			const gchar* _tmp41_;
			const gchar* _tmp42_;
			GeeMap* _tmp43_;
			const gchar* _tmp44_;
			gpointer _tmp45_;
			gchar* _tmp46_;
			gchar* _tmp47_;
			gchar* _tmp48_;
			_tmp31_ = _key_it;
			if (!gee_iterator_next (_tmp31_)) {
				break;
			}
			_tmp32_ = _key_it;
			_tmp33_ = gee_iterator_get (_tmp32_);
			key = (gchar*) _tmp33_;
			_tmp34_ = ret;
			_tmp35_ = strlen (_tmp34_);
			_tmp36_ = _tmp35_;
			if (_tmp36_ > 1) {
				const gchar* _tmp37_;
				gchar* _tmp38_;
				_tmp37_ = ret;
				_tmp38_ = g_strconcat (_tmp37_, ", ", NULL);
				_g_free0 (ret);
				ret = _tmp38_;
			}
			_tmp39_ = ret;
			_tmp40_ = string_to_string (_tmp39_);
			_tmp41_ = key;
			_tmp42_ = string_to_string (_tmp41_);
			_tmp43_ = self->priv->int_map;
			_tmp44_ = key;
			_tmp45_ = gee_map_get (_tmp43_, _tmp44_);
			_tmp46_ = g_strdup_printf ("%li", (glong) ((gintptr) _tmp45_));
			_tmp47_ = _tmp46_;
			_tmp48_ = g_strconcat (_tmp40_, _tmp42_, ": ", _tmp47_, NULL);
			_g_free0 (ret);
			ret = _tmp48_;
			_g_free0 (_tmp47_);
			_g_free0 (key);
		}
		_g_object_unref0 (_key_it);
	}
	{
		GeeIterator* _key_it = NULL;
		GeeMap* _tmp49_;
		GeeSet* _tmp50_;
		GeeSet* _tmp51_;
		GeeSet* _tmp52_;
		GeeIterator* _tmp53_;
		GeeIterator* _tmp54_;
		_tmp49_ = self->priv->real_map;
		_tmp50_ = gee_map_get_keys (_tmp49_);
		_tmp51_ = _tmp50_;
		_tmp52_ = _tmp51_;
		_tmp53_ = gee_iterable_iterator ((GeeIterable*) _tmp52_);
		_tmp54_ = _tmp53_;
		_g_object_unref0 (_tmp52_);
		_key_it = _tmp54_;
		while (TRUE) {
			GeeIterator* _tmp55_;
			gchar* key = NULL;
			GeeIterator* _tmp56_;
			gpointer _tmp57_;
			const gchar* _tmp58_;
			gint _tmp59_;
			gint _tmp60_;
			const gchar* _tmp63_;
			const gchar* _tmp64_;
			const gchar* _tmp65_;
			const gchar* _tmp66_;
			GeeMap* _tmp67_;
			const gchar* _tmp68_;
			gpointer _tmp69_;
			gdouble* _tmp70_;
			gchar* _tmp71_;
			gchar* _tmp72_;
			gchar* _tmp73_;
			_tmp55_ = _key_it;
			if (!gee_iterator_next (_tmp55_)) {
				break;
			}
			_tmp56_ = _key_it;
			_tmp57_ = gee_iterator_get (_tmp56_);
			key = (gchar*) _tmp57_;
			_tmp58_ = ret;
			_tmp59_ = strlen (_tmp58_);
			_tmp60_ = _tmp59_;
			if (_tmp60_ > 1) {
				const gchar* _tmp61_;
				gchar* _tmp62_;
				_tmp61_ = ret;
				_tmp62_ = g_strconcat (_tmp61_, ", ", NULL);
				_g_free0 (ret);
				ret = _tmp62_;
			}
			_tmp63_ = ret;
			_tmp64_ = string_to_string (_tmp63_);
			_tmp65_ = key;
			_tmp66_ = string_to_string (_tmp65_);
			_tmp67_ = self->priv->real_map;
			_tmp68_ = key;
			_tmp69_ = gee_map_get (_tmp67_, _tmp68_);
			_tmp70_ = (gdouble*) _tmp69_;
			_tmp71_ = double_to_string (*_tmp70_);
			_tmp72_ = _tmp71_;
			_tmp73_ = g_strconcat (_tmp64_, _tmp66_, ": ", _tmp72_, NULL);
			_g_free0 (ret);
			ret = _tmp73_;
			_g_free0 (_tmp72_);
			_g_free0 (_tmp70_);
			_g_free0 (key);
		}
		_g_object_unref0 (_key_it);
	}
	_tmp74_ = ret;
	_tmp75_ = g_strconcat (_tmp74_, "}", NULL);
	result = _tmp75_;
	_g_free0 (ret);
	return result;
}

static void
qlite_value_row_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
qlite_value_row_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		qlite_row_unref (value->data[0].v_pointer);
	}
}

static void
qlite_value_row_copy_value (const GValue* src_value,
                            GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = qlite_row_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
qlite_value_row_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
qlite_value_row_collect_value (GValue* value,
                               guint n_collect_values,
                               GTypeCValue* collect_values,
                               guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		QliteRow * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = qlite_row_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
qlite_value_row_lcopy_value (const GValue* value,
                             guint n_collect_values,
                             GTypeCValue* collect_values,
                             guint collect_flags)
{
	QliteRow ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = qlite_row_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
qlite_param_spec_row (const gchar* name,
                      const gchar* nick,
                      const gchar* blurb,
                      GType object_type,
                      GParamFlags flags)
{
	QliteParamSpecRow* spec;
	g_return_val_if_fail (g_type_is_a (object_type, QLITE_TYPE_ROW), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
qlite_value_get_row (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, QLITE_TYPE_ROW), NULL);
	return value->data[0].v_pointer;
}

void
qlite_value_set_row (GValue* value,
                     gpointer v_object)
{
	QliteRow * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, QLITE_TYPE_ROW));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, QLITE_TYPE_ROW));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		qlite_row_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		qlite_row_unref (old);
	}
}

void
qlite_value_take_row (GValue* value,
                      gpointer v_object)
{
	QliteRow * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, QLITE_TYPE_ROW));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, QLITE_TYPE_ROW));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		qlite_row_unref (old);
	}
}

static void
qlite_row_class_init (QliteRowClass * klass,
                      gpointer klass_data)
{
	qlite_row_parent_class = g_type_class_peek_parent (klass);
	((QliteRowClass *) klass)->finalize = qlite_row_finalize;
	g_type_class_adjust_private_offset (klass, &QliteRow_private_offset);
}

static void
qlite_row_instance_init (QliteRow * self,
                         gpointer klass)
{
	GeeHashMap* _tmp0_;
	GeeHashMap* _tmp1_;
	GeeHashMap* _tmp2_;
	self->priv = qlite_row_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->text_map = (GeeMap*) _tmp0_;
	_tmp1_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, G_TYPE_LONG, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->int_map = (GeeMap*) _tmp1_;
	_tmp2_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, G_TYPE_DOUBLE, (GBoxedCopyFunc) _double_dup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->real_map = (GeeMap*) _tmp2_;
	self->ref_count = 1;
}

static void
qlite_row_finalize (QliteRow * obj)
{
	QliteRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, QLITE_TYPE_ROW, QliteRow);
	g_signal_handlers_destroy (self);
	_g_object_unref0 (self->priv->text_map);
	_g_object_unref0 (self->priv->int_map);
	_g_object_unref0 (self->priv->real_map);
}

static GType
qlite_row_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { qlite_value_row_init, qlite_value_row_free_value, qlite_value_row_copy_value, qlite_value_row_peek_pointer, "p", qlite_value_row_collect_value, "p", qlite_value_row_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (QliteRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) qlite_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (QliteRow), 0, (GInstanceInitFunc) qlite_row_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType qlite_row_type_id;
	qlite_row_type_id = g_type_register_fundamental (g_type_fundamental_next (), "QliteRow", &g_define_type_info, &g_define_type_fundamental_info, 0);
	QliteRow_private_offset = g_type_add_instance_private (qlite_row_type_id, sizeof (QliteRowPrivate));
	return qlite_row_type_id;
}

GType
qlite_row_get_type (void)
{
	static volatile gsize qlite_row_type_id__once = 0;
	if (g_once_init_enter (&qlite_row_type_id__once)) {
		GType qlite_row_type_id;
		qlite_row_type_id = qlite_row_get_type_once ();
		g_once_init_leave (&qlite_row_type_id__once, qlite_row_type_id);
	}
	return qlite_row_type_id__once;
}

gpointer
qlite_row_ref (gpointer instance)
{
	QliteRow * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
qlite_row_unref (gpointer instance)
{
	QliteRow * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		QLITE_ROW_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static inline gpointer
qlite_row_iterator_get_instance_private (QliteRowIterator* self)
{
	return G_STRUCT_MEMBER_P (self, QliteRowIterator_private_offset);
}

static gpointer
_qlite_database_ref0 (gpointer self)
{
	return self ? qlite_database_ref (self) : NULL;
}

QliteRowIterator*
qlite_row_iterator_construct_from_query_builder (GType object_type,
                                                 QliteDatabase* db,
                                                 QliteQueryBuilder* query)
{
	QliteRowIterator* self = NULL;
	QliteDatabase* _tmp0_;
	sqlite3_stmt* _tmp1_;
	g_return_val_if_fail (db != NULL, NULL);
	g_return_val_if_fail (query != NULL, NULL);
	self = (QliteRowIterator*) g_type_create_instance (object_type);
	_tmp0_ = _qlite_database_ref0 (db);
	_qlite_database_unref0 (self->priv->db);
	self->priv->db = _tmp0_;
	_tmp1_ = qlite_statement_builder_prepare ((QliteStatementBuilder*) query);
	_sqlite3_finalize0 (self->priv->stmt);
	self->priv->stmt = _tmp1_;
	return self;
}

QliteRowIterator*
qlite_row_iterator_new_from_query_builder (QliteDatabase* db,
                                           QliteQueryBuilder* query)
{
	return qlite_row_iterator_construct_from_query_builder (QLITE_TYPE_ROW_ITERATOR, db, query);
}

QliteRowIterator*
qlite_row_iterator_construct (GType object_type,
                              QliteDatabase* db,
                              const gchar* sql,
                              gchar** args,
                              gint args_length1)
{
	QliteRowIterator* self = NULL;
	QliteDatabase* _tmp0_;
	sqlite3_stmt* _tmp1_;
	g_return_val_if_fail (db != NULL, NULL);
	g_return_val_if_fail (sql != NULL, NULL);
	self = (QliteRowIterator*) g_type_create_instance (object_type);
	_tmp0_ = _qlite_database_ref0 (db);
	_qlite_database_unref0 (self->priv->db);
	self->priv->db = _tmp0_;
	_tmp1_ = qlite_database_prepare (db, sql);
	_sqlite3_finalize0 (self->priv->stmt);
	self->priv->stmt = _tmp1_;
	if (args != NULL) {
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp2_ = FALSE;
				_tmp2_ = TRUE;
				while (TRUE) {
					sqlite3_stmt* _tmp4_;
					gchar* _tmp5_;
					gint _tmp6_;
					gint _tmp7_;
					GDestroyNotify _tmp8_;
					if (!_tmp2_) {
						gint _tmp3_;
						_tmp3_ = i;
						i = _tmp3_ + 1;
					}
					_tmp2_ = FALSE;
					if (!(i < args_length1)) {
						break;
					}
					_tmp4_ = self->priv->stmt;
					_tmp5_ = g_strdup (sql);
					_tmp6_ = strlen (sql);
					_tmp7_ = _tmp6_;
					_tmp8_ = g_free;
					sqlite3_bind_text (_tmp4_, i, _tmp5_, _tmp7_, _tmp8_);
				}
			}
		}
	}
	return self;
}

QliteRowIterator*
qlite_row_iterator_new (QliteDatabase* db,
                        const gchar* sql,
                        gchar** args,
                        gint args_length1)
{
	return qlite_row_iterator_construct (QLITE_TYPE_ROW_ITERATOR, db, sql, args, args_length1);
}

gboolean
qlite_row_iterator_next (QliteRowIterator* self)
{
	gint r = 0;
	sqlite3_stmt* _tmp0_;
	QliteDatabase* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	QliteDatabase* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->stmt;
	r = sqlite3_step (_tmp0_);
	if (r == SQLITE_ROW) {
		result = TRUE;
		return result;
	}
	if (r == SQLITE_DONE) {
		result = FALSE;
		return result;
	}
	_tmp1_ = self->priv->db;
	_tmp2_ = g_strdup_printf ("%i", qlite_database_errcode (_tmp1_));
	_tmp3_ = _tmp2_;
	_tmp4_ = self->priv->db;
	_tmp5_ = qlite_database_errmsg (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = string_to_string (_tmp6_);
	_tmp8_ = g_strconcat ("SQLite error: ", _tmp3_, " - ", _tmp7_, NULL);
	_tmp9_ = _tmp8_;
	g_warning ("row.vala:111: %s", _tmp9_);
	_g_free0 (_tmp9_);
	_g_free0 (_tmp6_);
	_g_free0 (_tmp3_);
	result = FALSE;
	return result;
}

QliteRow*
qlite_row_iterator_get (QliteRowIterator* self)
{
	sqlite3_stmt* _tmp0_;
	QliteRow* _tmp1_;
	QliteRow* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->stmt;
	_tmp1_ = qlite_row_new (_tmp0_);
	result = _tmp1_;
	return result;
}

QliteRow*
qlite_row_iterator_get_next (QliteRowIterator* self)
{
	QliteRow* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (qlite_row_iterator_next (self)) {
		QliteRow* _tmp0_;
		_tmp0_ = qlite_row_iterator_get (self);
		result = _tmp0_;
		return result;
	}
	result = NULL;
	return result;
}

static void
qlite_value_row_iterator_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
qlite_value_row_iterator_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		qlite_row_iterator_unref (value->data[0].v_pointer);
	}
}

static void
qlite_value_row_iterator_copy_value (const GValue* src_value,
                                     GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = qlite_row_iterator_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
qlite_value_row_iterator_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
qlite_value_row_iterator_collect_value (GValue* value,
                                        guint n_collect_values,
                                        GTypeCValue* collect_values,
                                        guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		QliteRowIterator * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = qlite_row_iterator_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
qlite_value_row_iterator_lcopy_value (const GValue* value,
                                      guint n_collect_values,
                                      GTypeCValue* collect_values,
                                      guint collect_flags)
{
	QliteRowIterator ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = qlite_row_iterator_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
qlite_param_spec_row_iterator (const gchar* name,
                               const gchar* nick,
                               const gchar* blurb,
                               GType object_type,
                               GParamFlags flags)
{
	QliteParamSpecRowIterator* spec;
	g_return_val_if_fail (g_type_is_a (object_type, QLITE_TYPE_ROW_ITERATOR), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
qlite_value_get_row_iterator (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, QLITE_TYPE_ROW_ITERATOR), NULL);
	return value->data[0].v_pointer;
}

void
qlite_value_set_row_iterator (GValue* value,
                              gpointer v_object)
{
	QliteRowIterator * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, QLITE_TYPE_ROW_ITERATOR));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, QLITE_TYPE_ROW_ITERATOR));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		qlite_row_iterator_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		qlite_row_iterator_unref (old);
	}
}

void
qlite_value_take_row_iterator (GValue* value,
                               gpointer v_object)
{
	QliteRowIterator * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, QLITE_TYPE_ROW_ITERATOR));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, QLITE_TYPE_ROW_ITERATOR));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		qlite_row_iterator_unref (old);
	}
}

static void
qlite_row_iterator_class_init (QliteRowIteratorClass * klass,
                               gpointer klass_data)
{
	qlite_row_iterator_parent_class = g_type_class_peek_parent (klass);
	((QliteRowIteratorClass *) klass)->finalize = qlite_row_iterator_finalize;
	g_type_class_adjust_private_offset (klass, &QliteRowIterator_private_offset);
}

static void
qlite_row_iterator_instance_init (QliteRowIterator * self,
                                  gpointer klass)
{
	self->priv = qlite_row_iterator_get_instance_private (self);
	self->ref_count = 1;
}

static void
qlite_row_iterator_finalize (QliteRowIterator * obj)
{
	QliteRowIterator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, QLITE_TYPE_ROW_ITERATOR, QliteRowIterator);
	g_signal_handlers_destroy (self);
	_qlite_database_unref0 (self->priv->db);
	_sqlite3_finalize0 (self->priv->stmt);
}

static GType
qlite_row_iterator_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { qlite_value_row_iterator_init, qlite_value_row_iterator_free_value, qlite_value_row_iterator_copy_value, qlite_value_row_iterator_peek_pointer, "p", qlite_value_row_iterator_collect_value, "p", qlite_value_row_iterator_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (QliteRowIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) qlite_row_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (QliteRowIterator), 0, (GInstanceInitFunc) qlite_row_iterator_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType qlite_row_iterator_type_id;
	qlite_row_iterator_type_id = g_type_register_fundamental (g_type_fundamental_next (), "QliteRowIterator", &g_define_type_info, &g_define_type_fundamental_info, 0);
	QliteRowIterator_private_offset = g_type_add_instance_private (qlite_row_iterator_type_id, sizeof (QliteRowIteratorPrivate));
	return qlite_row_iterator_type_id;
}

GType
qlite_row_iterator_get_type (void)
{
	static volatile gsize qlite_row_iterator_type_id__once = 0;
	if (g_once_init_enter (&qlite_row_iterator_type_id__once)) {
		GType qlite_row_iterator_type_id;
		qlite_row_iterator_type_id = qlite_row_iterator_get_type_once ();
		g_once_init_leave (&qlite_row_iterator_type_id__once, qlite_row_iterator_type_id);
	}
	return qlite_row_iterator_type_id__once;
}

gpointer
qlite_row_iterator_ref (gpointer instance)
{
	QliteRowIterator * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
qlite_row_iterator_unref (gpointer instance)
{
	QliteRowIterator * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		QLITE_ROW_ITERATOR_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static inline gpointer
qlite_row_option_get_instance_private (QliteRowOption* self)
{
	return G_STRUCT_MEMBER_P (self, QliteRowOption_private_offset);
}

QliteRowOption*
qlite_row_option_construct (GType object_type,
                            QliteRow* row)
{
	QliteRowOption* self = NULL;
	self = (QliteRowOption*) g_type_create_instance (object_type);
	qlite_row_option_set_inner (self, row);
	return self;
}

QliteRowOption*
qlite_row_option_new (QliteRow* row)
{
	return qlite_row_option_construct (QLITE_TYPE_ROW_OPTION, row);
}

gboolean
qlite_row_option_is_present (QliteRowOption* self)
{
	QliteRow* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_inner;
	result = _tmp0_ != NULL;
	return result;
}

gpointer
qlite_row_option_get (QliteRowOption* self,
                      GType t_type,
                      GBoxedCopyFunc t_dup_func,
                      GDestroyNotify t_destroy_func,
                      QliteColumn* field,
                      gconstpointer def)
{
	gboolean _tmp0_ = FALSE;
	QliteRow* _tmp1_;
	QliteRow* _tmp4_;
	gpointer _tmp5_;
	gpointer result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (field != NULL, NULL);
	_tmp1_ = self->priv->_inner;
	if (_tmp1_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		QliteRow* _tmp2_;
		_tmp2_ = self->priv->_inner;
		_tmp0_ = qlite_column_is_null (field, G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, QLITE_TYPE_ROW, QliteRow), QLITE_COLUMN_DEFAULT_TABLE_NAME);
	}
	if (_tmp0_) {
		gpointer _tmp3_;
		_tmp3_ = ((def != NULL) && (t_dup_func != NULL)) ? t_dup_func ((gpointer) def) : ((gpointer) def);
		result = _tmp3_;
		return result;
	}
	_tmp4_ = self->priv->_inner;
	_tmp5_ = qlite_column_get (field, G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, QLITE_TYPE_ROW, QliteRow), QLITE_COLUMN_DEFAULT_TABLE_NAME);
	result = _tmp5_;
	return result;
}

glong
qlite_row_option_get_integer (QliteRowOption* self,
                              const gchar* field,
                              glong def)
{
	gboolean _tmp0_ = FALSE;
	QliteRow* _tmp1_;
	QliteRow* _tmp3_;
	glong result;
	g_return_val_if_fail (self != NULL, -1L);
	g_return_val_if_fail (field != NULL, -1L);
	_tmp1_ = self->priv->_inner;
	if (_tmp1_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		QliteRow* _tmp2_;
		_tmp2_ = self->priv->_inner;
		_tmp0_ = !qlite_row_has_integer (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, QLITE_TYPE_ROW, QliteRow), field, NULL);
	}
	if (_tmp0_) {
		result = def;
		return result;
	}
	_tmp3_ = self->priv->_inner;
	result = qlite_row_get_integer (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, QLITE_TYPE_ROW, QliteRow), field, NULL);
	return result;
}

QliteRow*
qlite_row_option_get_inner (QliteRowOption* self)
{
	QliteRow* result;
	QliteRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_inner;
	result = _tmp0_;
	return result;
}

static gpointer
_qlite_row_ref0 (gpointer self)
{
	return self ? qlite_row_ref (self) : NULL;
}

static void
qlite_row_option_set_inner (QliteRowOption* self,
                            QliteRow* value)
{
	QliteRow* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _qlite_row_ref0 (value);
	_qlite_row_unref0 (self->priv->_inner);
	self->priv->_inner = _tmp0_;
}

static void
qlite_value_row_option_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
qlite_value_row_option_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		qlite_row_option_unref (value->data[0].v_pointer);
	}
}

static void
qlite_value_row_option_copy_value (const GValue* src_value,
                                   GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = qlite_row_option_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
qlite_value_row_option_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
qlite_value_row_option_collect_value (GValue* value,
                                      guint n_collect_values,
                                      GTypeCValue* collect_values,
                                      guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		QliteRowOption * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = qlite_row_option_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
qlite_value_row_option_lcopy_value (const GValue* value,
                                    guint n_collect_values,
                                    GTypeCValue* collect_values,
                                    guint collect_flags)
{
	QliteRowOption ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = qlite_row_option_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
qlite_param_spec_row_option (const gchar* name,
                             const gchar* nick,
                             const gchar* blurb,
                             GType object_type,
                             GParamFlags flags)
{
	QliteParamSpecRowOption* spec;
	g_return_val_if_fail (g_type_is_a (object_type, QLITE_TYPE_ROW_OPTION), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
qlite_value_get_row_option (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, QLITE_TYPE_ROW_OPTION), NULL);
	return value->data[0].v_pointer;
}

void
qlite_value_set_row_option (GValue* value,
                            gpointer v_object)
{
	QliteRowOption * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, QLITE_TYPE_ROW_OPTION));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, QLITE_TYPE_ROW_OPTION));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		qlite_row_option_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		qlite_row_option_unref (old);
	}
}

void
qlite_value_take_row_option (GValue* value,
                             gpointer v_object)
{
	QliteRowOption * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, QLITE_TYPE_ROW_OPTION));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, QLITE_TYPE_ROW_OPTION));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		qlite_row_option_unref (old);
	}
}

static void
qlite_row_option_class_init (QliteRowOptionClass * klass,
                             gpointer klass_data)
{
	qlite_row_option_parent_class = g_type_class_peek_parent (klass);
	((QliteRowOptionClass *) klass)->finalize = qlite_row_option_finalize;
	g_type_class_adjust_private_offset (klass, &QliteRowOption_private_offset);
}

static void
qlite_row_option_instance_init (QliteRowOption * self,
                                gpointer klass)
{
	self->priv = qlite_row_option_get_instance_private (self);
	self->ref_count = 1;
}

static void
qlite_row_option_finalize (QliteRowOption * obj)
{
	QliteRowOption * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, QLITE_TYPE_ROW_OPTION, QliteRowOption);
	g_signal_handlers_destroy (self);
	_qlite_row_unref0 (self->priv->_inner);
}

static GType
qlite_row_option_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { qlite_value_row_option_init, qlite_value_row_option_free_value, qlite_value_row_option_copy_value, qlite_value_row_option_peek_pointer, "p", qlite_value_row_option_collect_value, "p", qlite_value_row_option_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (QliteRowOptionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) qlite_row_option_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (QliteRowOption), 0, (GInstanceInitFunc) qlite_row_option_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType qlite_row_option_type_id;
	qlite_row_option_type_id = g_type_register_fundamental (g_type_fundamental_next (), "QliteRowOption", &g_define_type_info, &g_define_type_fundamental_info, 0);
	QliteRowOption_private_offset = g_type_add_instance_private (qlite_row_option_type_id, sizeof (QliteRowOptionPrivate));
	return qlite_row_option_type_id;
}

GType
qlite_row_option_get_type (void)
{
	static volatile gsize qlite_row_option_type_id__once = 0;
	if (g_once_init_enter (&qlite_row_option_type_id__once)) {
		GType qlite_row_option_type_id;
		qlite_row_option_type_id = qlite_row_option_get_type_once ();
		g_once_init_leave (&qlite_row_option_type_id__once, qlite_row_option_type_id);
	}
	return qlite_row_option_type_id__once;
}

gpointer
qlite_row_option_ref (gpointer instance)
{
	QliteRowOption * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
qlite_row_option_unref (gpointer instance)
{
	QliteRowOption * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		QLITE_ROW_OPTION_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

