On Sun, 2009-07-19 at 13:31 +0200, Vivien Malerba wrote:
2009/7/19 Bas Driessen <bas driessen xobas com>
Hello,
Question regarding partial meta store update. I found that the following to update a single table does not appear to work:
g_print ("\nPartial metastore update for table '%s'...\n", TABLE_NAME);
GdaMetaContext mcontext = {"_tables", 1, NULL, NULL};
mcontext.column_names = g_new (gchar *, 1);
mcontext.column_names[0] = "table_name";
mcontext.column_values = g_new (GValue *, 1);
g_value_set_string ((mcontext.column_values[0] = gda_value_new (G_TYPE_STRING)), TABLE_NAME);
if (!gda_connection_update_meta_store (connection, &mcontext, &error))
return -1;
After this, my meta store is NOT updated.
This may depend on the actual value of TABLE_NAME, specifically if it is a mix of upper and lower case, or if it's a reserved keyword. The proper way is:
tmp = gda_sql_identifier_quote (TABLE_NAME, cnc, NULL, TRUE, FALSE); // or with the last argument being TRUE, see the doc
g_value_set_string ((mcontext.column_values[0] = gda_value_new (G_TYPE_STRING)), tmp);
g_free (tmp);
Note that this is brand new (just been sorted out) and will require the master or LIBGDA_4.0 branches up to date.
Thanks Vivien, but this unfortunately is not still not working. Let me explain my testing scenario and if I understand this the correct way.
-1 I have a database with a table called "groups"
-2 I run the gda_connection_update_meta_store to update the meta store.
-3 I look into the meta store with sqlite3 and execute "select * from _tables". I can see the "groups" table in that list.