[libgda] Misc corrections
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Misc corrections
- Date: Sun, 3 Jun 2012 16:03:28 +0000 (UTC)
commit 96c05d9f78a150d7b1d3850e9f4c126b4b039139
Author: Vivien Malerba <malerba gnome-db org>
Date: Sun Jun 3 18:00:21 2012 +0200
Misc corrections
libgda/gda-connection.c | 28 ++++++++++++++++++----------
libgda/gda-quark-list.c | 8 ++++++--
providers/reuseable/mysql/gda-mysql-meta.c | 10 +++++-----
tests/providers/prov-test-common.c | 10 +++++-----
4 files changed, 34 insertions(+), 22 deletions(-)
---
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index 6e6e767..be5ec42 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -4330,7 +4330,7 @@ meta_context_stringify (GdaMetaContext *context)
g_free (str);
}
if (i == 0)
- g_string_append (string, "---");
+ g_string_append (string, "no constraint in context");
str = string->str;
g_string_free (string, FALSE);
return str;
@@ -4658,22 +4658,30 @@ local_meta_update (GdaServerProvider *provider, GdaConnection *cnc, GdaMetaConte
return retval;
}
else {
- /* _element_types, params:
+ /* _element_types, params:
+ * - none
* -0- @specific_name
*/
i = check_parameters (context, error, 1,
&name, G_TYPE_STRING, NULL,
"specific_name", &name, NULL);
- if (i < 0)
- return FALSE;
-
ASSERT_TABLE_NAME (tname, "element_types");
- if (!PROV_CLASS (provider)->meta_funcs.el_types) {
- WARN_METHOD_NOT_IMPLEMENTED (provider, "el_types");
- break;
+ if (i < 0) {
+ if (!PROV_CLASS (provider)->meta_funcs._el_types) {
+ WARN_METHOD_NOT_IMPLEMENTED (provider, "_el_types");
+ break;
+ }
+ retval = PROV_CLASS (provider)->meta_funcs._el_types (provider, cnc, store, context, error);
+ WARN_META_UPDATE_FAILURE (retval, "_el_types");
+ }
+ else {
+ if (!PROV_CLASS (provider)->meta_funcs.el_types) {
+ WARN_METHOD_NOT_IMPLEMENTED (provider, "el_types");
+ break;
+ }
+ retval = PROV_CLASS (provider)->meta_funcs.el_types (provider, cnc, store, context, error, name);
+ WARN_META_UPDATE_FAILURE (retval, "el_types");
}
- retval = PROV_CLASS (provider)->meta_funcs.el_types (provider, cnc, store, context, error, name);
- WARN_META_UPDATE_FAILURE (retval, "el_types");
return retval;
}
break;
diff --git a/libgda/gda-quark-list.c b/libgda/gda-quark-list.c
index 433dd29..6a5d4a8 100644
--- a/libgda/gda-quark-list.c
+++ b/libgda/gda-quark-list.c
@@ -526,8 +526,12 @@ gda_quark_list_foreach (GdaQuarkList *qlist, GHFunc func, gpointer user_data)
if (qlist->hash_table)
g_hash_table_foreach (qlist->hash_table, func, user_data);
- if (qlist->hash_protected)
- g_hash_table_foreach (qlist->hash_protected, (GHFunc) p_foreach, user_data);
+ if (qlist->hash_protected) {
+ PFuncData pdata;
+ pdata.user_data = user_data;
+ pdata.func = func;
+ g_hash_table_foreach (qlist->hash_protected, (GHFunc) p_foreach, &pdata);
+ }
}
static void
diff --git a/providers/reuseable/mysql/gda-mysql-meta.c b/providers/reuseable/mysql/gda-mysql-meta.c
index 5ca23b9..0ef1f62 100644
--- a/providers/reuseable/mysql/gda-mysql-meta.c
+++ b/providers/reuseable/mysql/gda-mysql-meta.c
@@ -105,10 +105,10 @@ static gchar *internal_sql[] = {
/* I_STMT_BTYPES */
/* I_STMT_SCHEMAS */
- "SELECT " CATALOG_NAME " AS catalog_name, schema_name, NULL, CASE WHEN schema_name = 'information_schema' OR schema_name = 'mysql' THEN TRUE ELSE FALSE END AS schema_internal FROM INFORMATION_SCHEMA.schemata",
+ "SELECT " CATALOG_NAME " AS catalog_name, schema_name, NULL, CASE WHEN schema_name = 'information_schema' OR schema_name = 'mysql' THEN TRUE ELSE FALSE END AS schema_internal, NULL FROM INFORMATION_SCHEMA.schemata",
/* I_STMT_SCHEMAS_ALL */
- "SELECT " CATALOG_NAME " AS catalog_name, schema_name, NULL, CASE WHEN schema_name = 'information_schema' OR schema_name = 'mysql' THEN TRUE ELSE FALSE END AS schema_internal FROM INFORMATION_SCHEMA.schemata",
+ "SELECT " CATALOG_NAME " AS catalog_name, schema_name, NULL, CASE WHEN schema_name = 'information_schema' OR schema_name = 'mysql' THEN TRUE ELSE FALSE END AS schema_internal, NULL FROM INFORMATION_SCHEMA.schemata",
/* I_STMT_SCHEMA_NAMED */
"SELECT " CATALOG_NAME " AS catalog_name, schema_name, NULL, CASE WHEN schema_name = 'information_schema' OR schema_name = 'mysql' THEN TRUE ELSE FALSE END AS schema_internal FROM INFORMATION_SCHEMA.schemata WHERE schema_name = ##name::string",
@@ -132,7 +132,7 @@ static gchar *internal_sql[] = {
"SELECT " CATALOG_NAME " AS table_catalog, table_schema, table_name, view_definition, check_option, is_updatable FROM INFORMATION_SCHEMA.views WHERE table_schema = BINARY ##schema::string AND table_name = BINARY ##name::string UNION SELECT " CATALOG_NAME " AS table_catalog, table_schema, table_name, NULL, NULL, FALSE FROM INFORMATION_SCHEMA.tables WHERE table_schema='information_schema' AND table_type LIKE '%VIEW%' AND table_schema = BINARY ##schema::string AND table_name = BINARY ##name::string",
/* I_STMT_COLUMNS_OF_TABLE */
- "SELECT " CATALOG_NAME " AS table_catalog, table_schema, table_name, column_name, ordinal_position, column_default, CASE is_nullable WHEN 'YES' THEN TRUE ELSE FALSE END AS is_nullable, data_type, NULL, 'gchararray', character_maximum_length,character_octet_length, numeric_precision, numeric_scale, 0, character_set_name, character_set_name, character_set_name, collation_name, collation_name, collation_name, CASE WHEN extra = 'auto_increment' then '" GDA_EXTRA_AUTO_INCREMENT "' ELSE extra END, 1, column_comment FROM INFORMATION_SCHEMA.columns WHERE table_schema = BINARY ##schema::string AND table_name = BINARY ##name::string",
+ "SELECT " CATALOG_NAME " AS table_catalog, table_schema, table_name, column_name, ordinal_position, column_default, CASE is_nullable WHEN 'YES' THEN TRUE ELSE FALSE END AS is_nullable, data_type, NULL, 'gchararray', character_maximum_length,character_octet_length, numeric_precision, numeric_scale, 0, character_set_name, character_set_name, character_set_name, collation_name, collation_name, collation_name, CASE WHEN extra = 'auto_increment' then '" GDA_EXTRA_AUTO_INCREMENT "' ELSE extra END, IF(FIND_IN_SET('insert', privileges) != 0 OR FIND_IN_SET('update', privileges) != 0, TRUE, FALSE) AS is_updatable, column_comment FROM INFORMATION_SCHEMA.columns WHERE table_schema = BINARY ##schema::string AND table_name = BINARY ##name::string",
/* I_STMT_COLUMNS_ALL */
"SELECT " CATALOG_NAME " AS table_catalog, table_schema, table_name, column_name, ordinal_position, column_default, CASE is_nullable WHEN 'YES' THEN TRUE ELSE FALSE END AS is_nullable, data_type, NULL, 'gchararray', character_maximum_length, character_octet_length, numeric_precision, numeric_scale, 0, character_set_name, character_set_name, character_set_name, collation_name, collation_name, collation_name, CASE WHEN extra = 'auto_increment' then '" GDA_EXTRA_AUTO_INCREMENT "' ELSE extra END, IF(FIND_IN_SET('insert', privileges) != 0 OR FIND_IN_SET('update', privileges) != 0, TRUE, FALSE) AS is_updatable, column_comment FROM INFORMATION_SCHEMA.columns",
@@ -1385,7 +1385,7 @@ _gda_mysql_meta__constraints_ref (G_GNUC_UNUSED GdaServerProvider *prov,
return retval;
}
else {
- TO_IMPLEMENT;
+ // TO_IMPLEMENT;
return TRUE;
}
}
@@ -1441,7 +1441,7 @@ _gda_mysql_meta_constraints_ref (G_GNUC_UNUSED GdaServerProvider *prov,
return retval;
}
else {
- TO_IMPLEMENT;
+ // TO_IMPLEMENT;
return TRUE;
}
}
diff --git a/tests/providers/prov-test-common.c b/tests/providers/prov-test-common.c
index 80d0303..442e117 100644
--- a/tests/providers/prov-test-common.c
+++ b/tests/providers/prov-test-common.c
@@ -201,15 +201,15 @@ prov_test_common_check_meta ()
"_key_column_usage", "__declared_fk", "_check_column_usage",
"_view_column_usage", "_domain_constraints", "_parameters",
"_routine_columns", "_table_indexes", "_index_column_usage",
- ""};
- for (i = 0; g_strcmp0 (meta_tables[i],"") != 0; i++) {
+ NULL};
+ for (i = 0; meta_tables[i]; i++) {
gda_meta_context_set_table (ctx, meta_tables[i]);
#ifdef CHECK_EXTRA_INFO
g_print ("Updating the meta store for table '%s'\n", meta_tables[i]);
#endif
if (! gda_connection_update_meta_store (cnc, ctx, &gerror)) {
#ifdef CHECK_EXTRA_INFO
- g_warning ("Can't update meta store ( on table %s): %s\n",
+ g_warning ("Can't update meta store (on table %s): %s\n",
meta_tables[i], gerror && gerror->message ? gerror->message : "???");
#endif
g_error_free (gerror);
@@ -427,8 +427,8 @@ prov_test_common_check_meta_identifiers (gboolean case_sensitive, gboolean updat
GDA_SERVER_OPERATION_ADD_COLUMN, NULL, &error);
g_assert (operation);
gda_server_operation_set_value_at_path (operation, table_name, "/COLUMN_DEF_P/TABLE_NAME", NULL);
- gda_server_operation_set_value_at (operation, field_name, "/COLUMN_DEF_P/COLUMN_NAME", NULL);
- gda_server_operation_set_value_at (operation, "int", "/COLUMN_DEF_P/COLUMN_TYPE", NULL);
+ gda_server_operation_set_value_at (operation, field_name, NULL, "/COLUMN_DEF_P/COLUMN_NAME", NULL);
+ gda_server_operation_set_value_at (operation, "int", NULL, "/COLUMN_DEF_P/COLUMN_TYPE", NULL);
if (! gda_server_provider_perform_operation (provider, cnc, operation, &error)) {
#ifdef CHECK_EXTRA_INFO
g_warning ("perform_operation(ADD_COLUMN) failed: %s\n", error && error->message ?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]