From b7c8698ca0e7b257b35b6a8fa6a925184683c1fd Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Tue, 1 Dec 2015 15:37:24 +0100 Subject: [PATCH] Started ZakFormGdaexProvider::load. --- src/form.c | 42 ++++++++++++++++++++++++++++++++++++++++-- src/form.h | 4 ++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/form.c b/src/form.c index 1a44fff..9f45c82 100644 --- a/src/form.c +++ b/src/form.c @@ -55,7 +55,8 @@ struct _ZakFormGdaexProvider typedef struct _ZakFormGdaexProviderPrivate ZakFormGdaexProviderPrivate; struct _ZakFormGdaexProviderPrivate { - gpointer nothing; + GdaEx *gdaex; + gchar *table; }; G_DEFINE_TYPE_WITH_CODE (ZakFormGdaexProvider, zak_form_gdaex_provider, G_TYPE_OBJECT, @@ -79,6 +80,9 @@ static void zak_form_gdaex_provider_init (ZakFormGdaexProvider *zak_form_gdaex_provider) { ZakFormGdaexProviderPrivate *priv = ZAK_FORM_GDAEX_PROVIDER_GET_PRIVATE (zak_form_gdaex_provider); + + priv->gdaex = NULL; + priv->table = NULL; } static void @@ -92,11 +96,13 @@ zak_form_iprovider_interface_init (ZakFormIProviderInterface *iface) /** * zak_form_gdaex_provider_new: + * @gdaex: + * @table: * * Returns: the newly created #ZakFormGdaexProvider object. */ ZakFormGdaexProvider -*zak_form_gdaex_provider_new () +*zak_form_gdaex_provider_new (GdaEx *gdaex, const gchar *table) { ZakFormGdaexProvider *zak_form_gdaex_provider; ZakFormGdaexProviderPrivate *priv; @@ -105,6 +111,9 @@ ZakFormGdaexProvider priv = ZAK_FORM_GDAEX_PROVIDER_GET_PRIVATE (zak_form_gdaex_provider); + priv->gdaex = gdaex; + priv->table = g_strdup (table); + return zak_form_gdaex_provider; } @@ -168,7 +177,36 @@ zak_form_gdaex_provider_finalize (GObject *gobject) static gboolean zak_form_gdaex_provider_load (ZakFormIProvider *provider, GPtrArray *elements) { + gboolean ret; + + guint i; + + GdaExSqlBuilder *sqlb; + + ZakFormGdaexProviderPrivate *priv = ZAK_FORM_GDAEX_PROVIDER_GET_PRIVATE (provider); + + g_return_val_if_fail (IS_GDAEX (priv->gdaex), FALSE); + + sqlb = gdaex_sql_builder_new (GDA_SQL_STATEMENT_SELECT); + + gdaex_sql_builder_from (sqlb, priv->table, NULL); + + /* first round to make sql statement */ + for (i = 0; i < elements->len; i++) + { + ZakFormElement *element = (ZakFormElement *)g_ptr_array_index (elements, i); + if (zak_form_element_get_to_load (element)) + { + + } + + if (zak_form_element_get_is_key (element)) + { + + } + } + return ret; } static gboolean diff --git a/src/form.h b/src/form.h index c02a724..36c2574 100644 --- a/src/form.h +++ b/src/form.h @@ -22,7 +22,7 @@ #include -#include +#include G_BEGIN_DECLS @@ -37,7 +37,7 @@ struct _ZakFormGdaexProviderClass }; -ZakFormGdaexProvider *zak_form_gdaex_provider_new (void); +ZakFormGdaexProvider *zak_form_gdaex_provider_new (GdaEx *gdaex, const gchar *table); G_END_DECLS -- 2.49.0