libgda r3323 - in trunk: . libgda samples/MetaStore
- From: vivien svn gnome org
- To: svn-commits-list gnome org
- Subject: libgda r3323 - in trunk: . libgda samples/MetaStore
- Date: Sun, 15 Feb 2009 20:32:03 +0000 (UTC)
Author: vivien
Date: Sun Feb 15 20:32:03 2009
New Revision: 3323
URL: http://svn.gnome.org/viewvc/libgda?rev=3323&view=rev
Log:
2009-02-15 Vivien Malerba <malerba gnome-db org>
* samples/MetaStore/example.c: corrected the usage of
gda_connection_get_meta_store_data()
* libgda/gda-connection.c: when using gda_connection_get_meta_store_data()
with GDA_CONNECTION_META_FIELDS, accept the filter composed of
"name" (table name) and "field_name" as mentionned in the doc
Modified:
trunk/ChangeLog
trunk/libgda/gda-connection.c
trunk/samples/MetaStore/example.c
Modified: trunk/libgda/gda-connection.c
==============================================================================
--- trunk/libgda/gda-connection.c (original)
+++ trunk/libgda/gda-connection.c Sun Feb 15 20:32:03 2009
@@ -3209,6 +3209,10 @@
gchar **name_array = g_new (gchar *, 1);
name_array[0] = "name";
+ gchar **name_col_array = g_new (gchar *, 2);
+ name_col_array[0] = "name";
+ name_col_array[1] = "field_name";
+
h = g_hash_table_new (meta_key_hash, meta_key_equal);
/* GDA_CONNECTION_META_NAMESPACES */
@@ -3298,6 +3302,16 @@
g_error ("Could not parse internal statement: %s\n", sql);
g_hash_table_insert (h, key, stmt);
+ key = g_new0 (MetaKey, 1);
+ key->meta_type = GDA_CONNECTION_META_FIELDS;
+ key->nb_filters = 2;
+ key->filters = name_col_array;
+ sql = "SELECT c.column_name, c.data_type, c.gtype, c.numeric_precision, c.numeric_scale, c.is_nullable AS 'Nullable', c.column_default, c.extra FROM _columns as c NATURAL JOIN _tables as t WHERE t.table_short_name=##name::string AND c.column_name = ##field_name::string";
+ stmt = gda_sql_parser_parse_string (parser, sql, NULL, NULL);
+ if (!stmt)
+ g_error ("Could not parse internal statement: %s\n", sql);
+ g_hash_table_insert (h, key, stmt);
+
return h;
}
Modified: trunk/samples/MetaStore/example.c
==============================================================================
--- trunk/samples/MetaStore/example.c (original)
+++ trunk/samples/MetaStore/example.c Sun Feb 15 20:32:03 2009
@@ -53,8 +53,7 @@
g_print ("Initial metastore state\n");
g_value_set_string ((value = gda_value_new (G_TYPE_STRING)), TABLE_NAME);
data = gda_connection_get_meta_store_data (connection, GDA_CONNECTION_META_FIELDS, &error, 1,
- "name", value,
- NULL);
+ "name", value);
if (!data)
return -1;
list_table_columns (data);
@@ -75,8 +74,7 @@
/* Query the same information about the TABLE_NAME table's columns
* this time there should be some information */
data = gda_connection_get_meta_store_data (connection, GDA_CONNECTION_META_FIELDS, &error, 1,
- "name", value,
- NULL);
+ "name", value);
if (!data)
return -1;
list_table_columns (data);
@@ -96,8 +94,7 @@
gda_value_free (value);
g_value_set_string ((value = gda_value_new (G_TYPE_STRING)), "products");
data = gda_connection_get_meta_store_data (connection, GDA_CONNECTION_META_FIELDS, &error, 1,
- "name", value,
- NULL);
+ "name", value);
if (!data)
return -1;
list_table_columns (data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]