From 03f7cb9f66d52a4b6d54e8c4f1b8d230b1190b13 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Wed, 3 Jan 2018 16:17:56 +0100 Subject: [PATCH] Use of right functions to manipulate GdaMetacontext. --- src/gdaex.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/gdaex.c b/src/gdaex.c index 5cd2419..3fa6f0a 100644 --- a/src/gdaex.c +++ b/src/gdaex.c @@ -3798,15 +3798,21 @@ GdaDataModel GError *error; - GdaMetaContext mcontext = {"_tables", 0, NULL, NULL}; + GdaMetaContext *mcontext; GdaExPrivate *priv = GDAEX_GET_PRIVATE (gdaex); dm = NULL; + if (update_meta_store) { - gdaex_meta_store_udpate (gdaex, &mcontext); + mcontext = gda_meta_context_new (); + + gda_meta_context_set_table (mcontext, "_tables"); + gdaex_meta_store_udpate (gdaex, mcontext); + + gda_meta_context_free (mcontext); } error = NULL; @@ -3833,7 +3839,7 @@ GdaDataModel GError *error; GValue *gval; - GdaMetaContext mcontext = {"_columns", 1, NULL, NULL}; + GdaMetaContext *mcontext; GdaExPrivate *priv = GDAEX_GET_PRIVATE (gdaex); @@ -3841,14 +3847,18 @@ GdaDataModel if (update_meta_store) { - mcontext.column_names = g_new (gchar *, 1); - mcontext.column_names[0] = "table_name"; - mcontext.column_values = g_new (GValue *, 1); - mcontext.column_values[0] = gda_value_new (G_TYPE_STRING); - g_value_take_string (mcontext.column_values[0], - gda_sql_identifier_quote (table_name, priv->gda_conn, NULL, FALSE, FALSE)); + mcontext = gda_meta_context_new (); + + gda_meta_context_set_table (mcontext, "_columns"); - gdaex_meta_store_udpate (gdaex, &mcontext); + gval = gda_value_new (G_TYPE_STRING); + g_value_set_string (gval, table_name); + gda_meta_context_set_column (mcontext, "table_name", gval, priv->gda_conn); + + gdaex_meta_store_udpate (gdaex, mcontext); + + gda_value_free (gval); + gda_meta_context_free (mcontext); } gval = gda_value_new (G_TYPE_STRING); @@ -3868,6 +3878,8 @@ GdaDataModel error != NULL && error->message != NULL ? error->message : _("no detail.")); } + gda_value_free (gval); + return dm; } -- 2.49.0