SQLite plugin inestable

This commit is contained in:
Juan Ferrer Toribio 2014-07-22 12:10:13 +02:00
parent bd9ea66567
commit 6c900d351e
3 changed files with 47 additions and 4 deletions

View File

@ -108,9 +108,11 @@ void db_iterator_move_next (DbIterator * self);
void db_iterator_move_to (DbIterator * self, DbIteratorMove move); void db_iterator_move_to (DbIterator * self, DbIteratorMove move);
void db_iterator_refresh (DbIterator * self); void db_iterator_refresh (DbIterator * self);
const GvnParamSpec * db_iterator_get_spec (DbIterator * self, gint column); const GvnParamSpec * db_iterator_get_spec (DbIterator * self, gint column);
const GValue * db_iterator_get_value (DbIterator * self, gint column);
gint db_iterator_get_column_index (DbIterator * self, const gchar * name); gint db_iterator_get_column_index (DbIterator * self, const gchar * name);
gboolean db_iterator_set_value (DbIterator * self, gint column, const GValue * value, GError ** err); const GValue * db_iterator_get_value (DbIterator * self, const gchar * column_name);
gboolean db_iterator_set_value (DbIterator * self, const gchar * column_name, const GValue * value, GError ** err);
const GValue * db_iterator_get_value_by_index (DbIterator * self, gint column);
gboolean db_iterator_set_value_by_index (DbIterator * self, gint column, const GValue * value, GError ** err);
void db_iterator_delete (DbIterator * self); void db_iterator_delete (DbIterator * self);
void db_iterator_insert (DbIterator * self); void db_iterator_insert (DbIterator * self);
void db_iterator_add_param (DbIterator * self, DbParam * param); void db_iterator_add_param (DbIterator * self, DbParam * param);

View File

@ -82,7 +82,7 @@ static const GValue * db_param_get_value (DbParam * self)
static gboolean db_param_request_value (DbParam * self, const GValue * value, GError ** err) static gboolean db_param_request_value (DbParam * self, const GValue * value, GError ** err)
{ {
return db_iterator_set_value (self->iterator, self->column_index, value, err); return db_iterator_set_value_by_index (self->iterator, self->column_index, value, err);
} }
static void db_param_on_master_value_changed (GvnParam * master, const GValue * value, DbParam * self) static void db_param_on_master_value_changed (GvnParam * master, const GValue * value, DbParam * self)
@ -148,7 +148,7 @@ static void db_param_on_iterator_iter_changed (DbIterator * iterator, DbParam *
if (db_iterator_get_row (self->iterator) != -1 && self->column_index != -1) if (db_iterator_get_row (self->iterator) != -1 && self->column_index != -1)
{ {
const GValue * value = db_iterator_get_value (self->iterator, self->column_index); const GValue * value = db_iterator_get_value_by_index (self->iterator, self->column_index);
db_param_put_value (self, value); db_param_put_value (self, value);
} }
else else

View File

@ -86,6 +86,47 @@ void gvn_param_set_value (GvnParam * self, const GValue * value)
gvn_param_request_value (self, value, NULL); gvn_param_request_value (self, value, NULL);
} }
gboolean gvn_param_get_boolean (GvnParam * self)
{
if (!gvn_value_is_null (self->value))
return g_value_get_boolean (self->value);
return FALSE;
}
gint gvn_param_get_int (GvnParam * self)
{
if (!gvn_value_is_null (self->value))
return g_value_get_int (self->value);
return 0;
}
glong gvn_param_get_long (GvnParam * self)
{
if (!gvn_value_is_null (self->value))
return g_value_get_long (self->value);
return 0L;
}
gdouble gvn_param_get_double (GvnParam * self)
{
if (!gvn_value_is_null (self->value))
return g_value_get_double (self->value);
return 0.0;
}
const gchar * gvn_param_get_string (GvnParam * self)
{
if (!gvn_value_is_null (self->value))
return g_value_get_string (self->value);
return NULL;
}
/** /**
* gvn_param_get_master: * gvn_param_get_master:
* @self: a #GvnParam where be took the value * @self: a #GvnParam where be took the value