[libgda] meta-store: sync _routine_columns table schema
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] meta-store: sync _routine_columns table schema
- Date: Wed, 9 Jan 2019 00:48:29 +0000 (UTC)
commit 0c9eaf175dc4885608507f3f0ec51a3cc30b9656
Author: Daniel Espinosa Ortiz <esodan gmail com>
Date: Tue Jan 8 16:07:56 2019 -0600
meta-store: sync _routine_columns table schema
* Current schema information mandates 5 keys for _routine_columns
table
* Include providers updates on meta data generation routines
* Fixes on GdaConnection about meta data generation requests
* Fixes on PostgreSQL provider for meta data generation
libgda/gda-connection.c | 42 ++++++++----
libgda/gda-meta-store.c | 6 +-
libgda/gda-server-provider-impl.h | 2 +-
libgda/gda-server-provider.c | 87 +++++++++++++++++++++++-
libgda/information_schema.xml | 1 +
libgda/sqlite/gda-sqlite-meta.c | 3 +-
libgda/sqlite/gda-sqlite-meta.h | 2 +-
providers/firebird/gda-firebird-meta.c | 2 +-
providers/firebird/gda-firebird-meta.h | 2 +-
providers/jdbc/gda-jdbc-meta.c | 3 +-
providers/jdbc/gda-jdbc-meta.h | 2 +-
providers/reuseable/mysql/gda-mysql-meta.c | 4 +-
providers/reuseable/mysql/gda-mysql-meta.h | 6 +-
providers/reuseable/postgres/gda-postgres-meta.c | 18 +++--
providers/reuseable/postgres/gda-postgres-meta.h | 2 +-
providers/web/gda-web-meta.c | 4 +-
providers/web/gda-web-meta.h | 2 +-
tests/providers/meson.build | 2 +-
18 files changed, 151 insertions(+), 39 deletions(-)
---
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index ccf5b8c1c..25e358e4a 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -4367,13 +4367,18 @@ local_meta_update (GdaServerProvider *provider, GdaConnection *cnc, GdaMetaConte
&schema, G_TYPE_STRING,
&name, G_TYPE_STRING, NULL,
"specific_catalog", &catalog, "specific_schema", &schema,
"specific_name", &name, NULL);
- if (i < 0)
- return FALSE;
-
+
ASSERT_TABLE_NAME (tname, "parameters");
- retval = _gda_server_provider_meta_3arg (provider, cnc, store, context,
- GDA_SERVER_META_ROUTINE_PAR, catalog, schema, name,
error);
- WARN_META_UPDATE_FAILURE (retval, "routine_par");
+ if (i < 0) {
+ g_clear_error (error);
+ retval = _gda_server_provider_meta_0arg (provider, cnc, store, context,
+ GDA_SERVER_META__ROUTINE_PAR, error);
+ WARN_META_UPDATE_FAILURE (retval, "routine_par");
+ } else {
+ retval = _gda_server_provider_meta_3arg (provider, cnc, store, context,
+ GDA_SERVER_META_ROUTINE_PAR, catalog,
schema, name, error);
+ WARN_META_UPDATE_FAILURE (retval, "routine_par");
+ }
return retval;
case 'r':
@@ -4431,18 +4436,27 @@ local_meta_update (GdaServerProvider *provider, GdaConnection *cnc, GdaMetaConte
/* _routine_columns, params:
* -0- @specific_catalog, @specific_schema, @specific_name
*/
+ const GValue *col_name = NULL;
+ const GValue *ordinal = NULL;
i = check_parameters (context, error, 1,
&catalog, G_TYPE_STRING,
&schema, G_TYPE_STRING,
- &name, G_TYPE_STRING, NULL,
- "specific_catalog", &catalog, "specific_schema", &schema,
"specific_name", &name, NULL);
- if (i < 0)
- return FALSE;
-
+ &name, G_TYPE_STRING,
+ &col_name, G_TYPE_STRING,
+ &ordinal, G_TYPE_STRING, NULL,
+ "specific_catalog", &catalog, "specific_schema", &schema,
"specific_name", &name, "column_name", &col_name, "ordinal_position", &ordinal, NULL);
+
ASSERT_TABLE_NAME (tname, "routine_columns");
- retval = _gda_server_provider_meta_3arg (provider, cnc, store, context,
- GDA_SERVER_META_ROUTINE_COL, catalog,
schema, name, error);
- WARN_META_UPDATE_FAILURE (retval, "routine_col");
+ if (i < 0) {
+ g_clear_error (error);
+ retval = _gda_server_provider_meta_0arg (provider, cnc, store, context,
+ GDA_SERVER_META__ROUTINE_COL, error);
+ WARN_META_UPDATE_FAILURE (retval, "routine_col");
+ } else {
+ retval = _gda_server_provider_meta_5arg (provider, cnc, store, context,
+ GDA_SERVER_META_ROUTINE_COL,
catalog, schema, name, col_name, ordinal, error);
+ WARN_META_UPDATE_FAILURE (retval, "routine_col");
+ }
return retval;
}
break;
diff --git a/libgda/gda-meta-store.c b/libgda/gda-meta-store.c
index 88d128e67..b9db24a00 100644
--- a/libgda/gda-meta-store.c
+++ b/libgda/gda-meta-store.c
@@ -3587,13 +3587,13 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
g_print ("\n");
#endif
GError *suggest_reports_error = NULL;
+ gchar *s = gda_meta_context_stringify (&context);
+ g_message ("Modify Meta store, using Context: %s", s);
+ g_free (s);
g_signal_emit (store, gda_meta_store_signals[SUGGEST_UPDATE], 0,
&context,
&suggest_reports_error);
g_free (context.column_values);
if (suggest_reports_error) {
- g_print ("SUGGEST META UPDATE Returned FALSE: %s\n",
- suggest_reports_error &&
suggest_reports_error->message ?
- suggest_reports_error->message : "???");
retval = FALSE;
if (error && !(*error))
g_propagate_error (error, suggest_reports_error);
diff --git a/libgda/gda-server-provider-impl.h b/libgda/gda-server-provider-impl.h
index ae1f6b80d..baf29d25e 100644
--- a/libgda/gda-server-provider-impl.h
+++ b/libgda/gda-server-provider-impl.h
@@ -333,7 +333,7 @@ typedef struct {
/* _routine_columns */
gboolean (*_routine_col) (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta,
GdaMetaContext *ctx, GError **error);
gboolean (*routine_col) (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta,
GdaMetaContext *ctx, GError **error,
- const GValue *rout_catalog, const GValue *rout_schema, const GValue
*rout_name);
+ const GValue *rout_catalog, const GValue *rout_schema, const GValue
*rout_name, const GValue *col_name, const GValue *ordinal_position);
/* _parameters */
gboolean (*_routine_par) (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta,
GdaMetaContext *ctx, GError **error);
diff --git a/libgda/gda-server-provider.c b/libgda/gda-server-provider.c
index 9ce94d67e..ceaa797a9 100644
--- a/libgda/gda-server-provider.c
+++ b/libgda/gda-server-provider.c
@@ -2733,7 +2733,7 @@ typedef struct {
GdaMetaContext *ctx;
GdaServerProviderMetaType type;
guint nargs;
- const GValue *values[4]; /* 4 at most */
+ const GValue *values[5]; /* 5 at most */
} WorkerMetaData;
typedef gboolean (*Meta0Func) (GdaServerProvider *, GdaConnection *, GdaMetaStore *, GdaMetaContext *,
GError **);
@@ -2741,6 +2741,7 @@ typedef gboolean (*Meta1Func) (GdaServerProvider *, GdaConnection *, GdaMetaStor
typedef gboolean (*Meta2Func) (GdaServerProvider *, GdaConnection *, GdaMetaStore *, GdaMetaContext *,
GError **, const GValue *, const GValue *);
typedef gboolean (*Meta3Func) (GdaServerProvider *, GdaConnection *, GdaMetaStore *, GdaMetaContext *,
GError **, const GValue *, const GValue *, const GValue *);
typedef gboolean (*Meta4Func) (GdaServerProvider *, GdaConnection *, GdaMetaStore *, GdaMetaContext *,
GError **, const GValue *, const GValue *, const GValue *, const GValue *);
+typedef gboolean (*Meta5Func) (GdaServerProvider *, GdaConnection *, GdaMetaStore *, GdaMetaContext *,
GError **, const GValue *, const GValue *, const GValue *, const GValue *, const GValue *);
static gpointer
@@ -2811,6 +2812,18 @@ worker_meta (WorkerMetaData *data, GError **error)
}
break;
}
+ case 5: {/* function with 5 arguments */
+ Meta5Func func;
+ func = (Meta5Func) fset [data->type];
+ if (func)
+ retval = func (data->provider, data->cnc, data->meta, data->ctx, error, data->values
[0], data->values [1], data->values [2], data->values [3], data->values [4]);
+ else {
+ retval = FALSE;
+ g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
GDA_SERVER_PROVIDER_METHOD_NON_IMPLEMENTED_ERROR,
+ "%s", _("Not supported"));
+ }
+ break;
+ }
default:
g_assert_not_reached ();
}
@@ -2866,7 +2879,6 @@ get_meta_nb_values_args (GdaServerProviderMetaType type)
case GDA_SERVER_META_VIEW_COLS:
case GDA_SERVER_META_TRIGGERS:
case GDA_SERVER_META_ROUTINES:
- case GDA_SERVER_META_ROUTINE_COL:
case GDA_SERVER_META_ROUTINE_PAR:
return 3;
@@ -2877,6 +2889,9 @@ get_meta_nb_values_args (GdaServerProviderMetaType type)
case GDA_SERVER_META_INDEXES_TAB:
case GDA_SERVER_META_INDEX_COLS:
return 4;
+
+ case GDA_SERVER_META_ROUTINE_COL:
+ return 5;
default:
g_assert_not_reached ();
@@ -3232,6 +3247,74 @@ _gda_server_provider_meta_4arg (GdaServerProvider *provider, GdaConnection *cnc,
return meta_finalize_result (retval, error, &lerror);
}
+
+gboolean
+_gda_server_provider_meta_5arg (GdaServerProvider *provider, GdaConnection *cnc,
+ GdaMetaStore *meta, GdaMetaContext *ctx,
+ GdaServerProviderMetaType type, const GValue *value0, const GValue *value1,
+ const GValue *value2, const GValue *value3, const GValue *value4, GError
**error)
+{
+ gpointer retval = NULL;
+ GdaWorker *worker;
+ g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), FALSE);
+
+ g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (gda_connection_get_provider (cnc) == provider, FALSE);
+ g_return_val_if_fail (gda_connection_is_opened (cnc), FALSE);
+
+ /* check that function at index @type has 5 values arguments */
+ if (get_meta_nb_values_args (type) != 5) {
+ g_warning ("Internal error: function %s() is only for meta data with 5 values arguments",
__FUNCTION__);
+ goto out;
+ }
+ gda_lockable_lock ((GdaLockable*) cnc); /* CNC LOCK */
+
+ GdaServerProviderConnectionData *cdata;
+ cdata = gda_connection_internal_get_provider_data_error (cnc, NULL);
+ if (!cdata) {
+ gda_lockable_unlock ((GdaLockable*) cnc); /* CNC UNLOCK */
+ g_warning ("Internal error: connection reported as opened, yet no provider's data has been
setted");
+ goto out;
+ }
+
+ worker = gda_worker_ref (cdata->worker);
+
+ GMainContext *context;
+ context = gda_server_provider_get_real_main_context (cnc);
+
+ WorkerMetaData data;
+ data.worker = worker;
+ data.provider = provider;
+ data.cnc = cnc;
+ data.meta = meta;
+ data.ctx = ctx;
+ data.type = type;
+ data.nargs = 4;
+ data.values[0] = value0;
+ data.values[1] = value1;
+ data.values[2] = value2;
+ data.values[3] = value3;
+ data.values[4] = value4;
+
+ GError *lerror = NULL;
+ if (cnc)
+ gda_connection_increase_usage (cnc); /* USAGE ++ */
+ gda_worker_do_job (worker, context, 0, &retval, NULL,
+ (GdaWorkerFunc) worker_meta, (gpointer) &data, NULL, NULL, &lerror);
+ if (context)
+ g_main_context_unref (context);
+
+ if (cnc) {
+ gda_connection_decrease_usage (cnc); /* USAGE -- */
+ gda_lockable_unlock ((GdaLockable*) cnc); /* CNC UNLOCK */
+ }
+
+ gda_worker_unref (worker);
+
+ out:
+ return meta_finalize_result (retval, error, &lerror);
+}
+
/***********************************************************************************************************/
/*
diff --git a/libgda/information_schema.xml b/libgda/information_schema.xml
index 11383d044..27e56fc1d 100644
--- a/libgda/information_schema.xml
+++ b/libgda/information_schema.xml
@@ -21,6 +21,7 @@
<provider name="PostgreSQL">
<replace context="/FIELDS_A/@COLUMN_TYPE" expr="string" replace_with="varchar"/>
<replace context="/FIELDS_A/@COLUMN_TYPE" expr="gint" replace_with="int"/>
+ <replace context="/FIELDS_A/@COLUMN_TYPE" expr="gint64" replace_with="int"/>
</provider>
<provider name="MySQL">
<replace context="/FIELDS_A/@COLUMN_TYPE" expr="string" replace_with="varchar (30)"/>
diff --git a/libgda/sqlite/gda-sqlite-meta.c b/libgda/sqlite/gda-sqlite-meta.c
index 40463a8c0..c190a8c5d 100644
--- a/libgda/sqlite/gda-sqlite-meta.c
+++ b/libgda/sqlite/gda-sqlite-meta.c
@@ -2333,7 +2333,8 @@ gboolean
_gda_sqlite_meta_routine_col (G_GNUC_UNUSED GdaServerProvider *prov, G_GNUC_UNUSED GdaConnection *cnc,
G_GNUC_UNUSED GdaMetaStore *store, G_GNUC_UNUSED GdaMetaContext *context,
G_GNUC_UNUSED GError **error, G_GNUC_UNUSED const GValue *rout_catalog,
- G_GNUC_UNUSED const GValue *rout_schema, G_GNUC_UNUSED const GValue *rout_name)
+ G_GNUC_UNUSED const GValue *rout_schema, G_GNUC_UNUSED const GValue *rout_name,
+ G_GNUC_UNUSED const GValue *col_name, G_GNUC_UNUSED const GValue
*ordinal_position)
{
/* feature not available in SQLite */
return TRUE;
diff --git a/libgda/sqlite/gda-sqlite-meta.h b/libgda/sqlite/gda-sqlite-meta.h
index c33389a54..9f026da25 100644
--- a/libgda/sqlite/gda-sqlite-meta.h
+++ b/libgda/sqlite/gda-sqlite-meta.h
@@ -178,7 +178,7 @@ gboolean _gda_sqlite_meta__routine_col (GdaServerProvider *prov, GdaConnecti
gboolean _gda_sqlite_meta_routine_col (GdaServerProvider *prov, GdaConnection *cnc,
GdaMetaStore *store, GdaMetaContext *context, GError **error,
const GValue *rout_catalog, const GValue *rout_schema,
- const GValue *rout_name);
+ const GValue *rout_name, const GValue *col_name, const GValue
*ordinal_position);
/* _parameters */
gboolean _gda_sqlite_meta__routine_par (GdaServerProvider *prov, GdaConnection *cnc,
diff --git a/providers/firebird/gda-firebird-meta.c b/providers/firebird/gda-firebird-meta.c
index be19a1986..a31572fbb 100644
--- a/providers/firebird/gda-firebird-meta.c
+++ b/providers/firebird/gda-firebird-meta.c
@@ -1432,7 +1432,7 @@ gboolean
_gda_firebird_meta_routine_col (GdaServerProvider *prov, GdaConnection *cnc,
GdaMetaStore *store, GdaMetaContext *context, GError **error,
const GValue *rout_catalog, const GValue *rout_schema,
- const GValue *rout_name)
+ const GValue *rout_name, const GValue *col_name, const GValue *ordinal_position)
{
//WHERE_AM_I;
TO_IMPLEMENT;
diff --git a/providers/firebird/gda-firebird-meta.h b/providers/firebird/gda-firebird-meta.h
index f73daa2eb..ba3c92b27 100644
--- a/providers/firebird/gda-firebird-meta.h
+++ b/providers/firebird/gda-firebird-meta.h
@@ -178,7 +178,7 @@ gboolean _gda_firebird_meta__routine_col (GdaServerProvider *prov, GdaConnec
gboolean _gda_firebird_meta_routine_col (GdaServerProvider *prov, GdaConnection *cnc,
GdaMetaStore *store, GdaMetaContext *context, GError **error,
const GValue *rout_catalog, const GValue *rout_schema,
- const GValue *rout_name);
+ const GValue *rout_name, const GValue *col_name, const GValue
*ordinal_position);
/* _parameters */
gboolean _gda_firebird_meta__routine_par (GdaServerProvider *prov, GdaConnection *cnc,
diff --git a/providers/jdbc/gda-jdbc-meta.c b/providers/jdbc/gda-jdbc-meta.c
index b0f6fedf5..d25660d4e 100644
--- a/providers/jdbc/gda-jdbc-meta.c
+++ b/providers/jdbc/gda-jdbc-meta.c
@@ -814,7 +814,8 @@ gboolean
_gda_jdbc_meta_routine_col (G_GNUC_UNUSED GdaServerProvider *prov, G_GNUC_UNUSED GdaConnection *cnc,
G_GNUC_UNUSED GdaMetaStore *store, G_GNUC_UNUSED GdaMetaContext *context,
G_GNUC_UNUSED GError **error, G_GNUC_UNUSED const GValue *rout_catalog,
- G_GNUC_UNUSED const GValue *rout_schema, G_GNUC_UNUSED const GValue *rout_name)
+ G_GNUC_UNUSED const GValue *rout_schema, G_GNUC_UNUSED const GValue *rout_name,
+ G_GNUC_UNUSED const GValue *col_name, G_GNUC_UNUSED const GValue
*ordinal_position)
{
TO_IMPLEMENT;
return TRUE;
diff --git a/providers/jdbc/gda-jdbc-meta.h b/providers/jdbc/gda-jdbc-meta.h
index 003b73df1..f61e520fa 100644
--- a/providers/jdbc/gda-jdbc-meta.h
+++ b/providers/jdbc/gda-jdbc-meta.h
@@ -178,7 +178,7 @@ gboolean _gda_jdbc_meta__routine_col (GdaServerProvider *prov, GdaConnection
gboolean _gda_jdbc_meta_routine_col (GdaServerProvider *prov, GdaConnection *cnc,
GdaMetaStore *store, GdaMetaContext *context, GError **error,
const GValue *rout_catalog, const GValue *rout_schema,
- const GValue *rout_name);
+ const GValue *rout_name, const GValue *col_name, const GValue
*ordinal_position);
/* _parameters */
gboolean _gda_jdbc_meta__routine_par (GdaServerProvider *prov, GdaConnection *cnc,
diff --git a/providers/reuseable/mysql/gda-mysql-meta.c b/providers/reuseable/mysql/gda-mysql-meta.c
index 56aa49a96..338aea9a8 100644
--- a/providers/reuseable/mysql/gda-mysql-meta.c
+++ b/providers/reuseable/mysql/gda-mysql-meta.c
@@ -1761,7 +1761,9 @@ _gda_mysql_meta_routine_col (G_GNUC_UNUSED GdaServerProvider *prov,
G_GNUC_UNUSED GError **error,
G_GNUC_UNUSED const GValue *rout_catalog,
G_GNUC_UNUSED const GValue *rout_schema,
- G_GNUC_UNUSED const GValue *rout_name)
+ G_GNUC_UNUSED const GValue *rout_name,
+ G_GNUC_UNUSED const GValue *col_name,
+ G_GNUC_UNUSED const GValue *ordinal_position)
{
//TO_IMPLEMENT;
return TRUE;
diff --git a/providers/reuseable/mysql/gda-mysql-meta.h b/providers/reuseable/mysql/gda-mysql-meta.h
index 47038f589..e431a886e 100644
--- a/providers/reuseable/mysql/gda-mysql-meta.h
+++ b/providers/reuseable/mysql/gda-mysql-meta.h
@@ -361,8 +361,10 @@ _gda_mysql_meta_routine_col (GdaServerProvider *prov,
GdaMetaContext *context,
GError **error,
const GValue *rout_catalog,
- const GValue *rout_schema,
- const GValue *rout_name);
+ const GValue *rout_schema,
+ const GValue *rout_name,
+ const GValue *col_name,
+ const GValue *ordinal_position);
/* _parameters */
gboolean
diff --git a/providers/reuseable/postgres/gda-postgres-meta.c
b/providers/reuseable/postgres/gda-postgres-meta.c
index 87dd282f8..7f5750bd6 100644
--- a/providers/reuseable/postgres/gda-postgres-meta.c
+++ b/providers/reuseable/postgres/gda-postgres-meta.c
@@ -247,7 +247,7 @@ static gchar *internal_sql[] = {
"SELECT current_database(), ss.n_nspname, ((ss.proname || '_') || ss.p_oid),
NULLIF(ss.proargnames[(ss.x).n], ''), (ss.x).n, CASE WHEN t.typelem <> 0 AND t.typlen = -1 THEN 'array_spec'
ELSE coalesce (nt.nspname || '.', '') || t.typname END, CASE WHEN t.typelem <> 0 AND t.typlen = -1 THEN
'ROUC' || current_database() || '.' || ss.n_nspname || '.' || ((ss.proname || '_') || ss.p_oid) || '.' ||
(ss.x).n ELSE NULL END FROM pg_type t, pg_namespace nt, ( SELECT n.nspname AS n_nspname, p.proname, p.oid AS
p_oid, p.proargnames, p.proargmodes, information_schema._pg_expandarray(COALESCE(p.proallargtypes,
p.proargtypes::oid[])) AS x FROM pg_namespace n, pg_proc p WHERE n.oid = p.pronamespace AND
(pg_has_role(p.proowner, 'USAGE') OR has_function_privilege(p.oid, 'EXECUTE'))) ss WHERE t.oid = (ss.x).x AND
t.typnamespace = nt.oid AND (ss.proargmodes[(ss.x).n] = 'o' OR ss.proargmodes[(ss.x).n] = 'b') ORDER BY 1, 2,
3, 4, 5",
/* I_STMT_ROUTINE_COL */
- "SELECT current_database(), ss.n_nspname, ((ss.proname || '_') || ss.p_oid),
NULLIF(ss.proargnames[(ss.x).n], ''), (ss.x).n, CASE WHEN t.typelem <> 0 AND t.typlen = -1 THEN 'array_spec'
ELSE coalesce (nt.nspname || '.', '') || t.typname END, CASE WHEN t.typelem <> 0 AND t.typlen = -1 THEN
'ROUC' || current_database() || '.' || ss.n_nspname || '.' || ((ss.proname || '_') || ss.p_oid) || '.' ||
(ss.x).n ELSE NULL END FROM pg_type t, pg_namespace nt, ( SELECT n.nspname AS n_nspname, p.proname, p.oid AS
p_oid, p.proargnames, p.proargmodes, information_schema._pg_expandarray(COALESCE(p.proallargtypes,
p.proargtypes::oid[])) AS x FROM pg_namespace n, pg_proc p WHERE n.oid = p.pronamespace AND
(pg_has_role(p.proowner, 'USAGE') OR has_function_privilege(p.oid, 'EXECUTE'))) ss WHERE t.oid = (ss.x).x AND
t.typnamespace = nt.oid AND (ss.proargmodes[(ss.x).n] = 'o' OR ss.proargmodes[(ss.x).n] = 'b') AND
current_database() = ##cat::string AND ss.n_nspname = ##schema::string AND ((ss.pro
name ||
'_') || ss.p_oid) = ##name::string ORDER BY 1, 2, 3, 4, 5",
+ "SELECT current_database(), ss.n_nspname, ((ss.proname || '_') || ss.p_oid),
NULLIF(ss.proargnames[(ss.x).n], '') AS column_name, (ss.x).n AS ordinal_position, CASE WHEN t.typelem <> 0
AND t.typlen = -1 THEN 'array_spec' ELSE coalesce (nt.nspname || '.', '') || t.typname END, CASE WHEN
t.typelem <> 0 AND t.typlen = -1 THEN 'ROUC' || current_database() || '.' || ss.n_nspname || '.' ||
((ss.proname || '_') || ss.p_oid) || '.' || (ss.x).n ELSE NULL END FROM pg_type t, pg_namespace nt, ( SELECT
n.nspname AS n_nspname, p.proname, p.oid AS p_oid, p.proargnames, p.proargmodes,
information_schema._pg_expandarray(COALESCE(p.proallargtypes, p.proargtypes::oid[])) AS x FROM pg_namespace
n, pg_proc p WHERE n.oid = p.pronamespace AND (pg_has_role(p.proowner, 'USAGE') OR
has_function_privilege(p.oid, 'EXECUTE'))) ss WHERE t.oid = (ss.x).x AND t.typnamespace = nt.oid AND
(ss.proargmodes[(ss.x).n] = 'o' OR ss.proargmodes[(ss.x).n] = 'b') AND current_database() = ##cat::string AND
ss.n_nspn
ame = ##
schema::string AND ((ss.proname || '_') || ss.p_oid) = ##name::string AND column_name = ##name2::string AND
ordinal_position = ##name3::string ORDER BY 1, 2, 3, 4, 5",
/* I_STMT_INDEXES */
"SELECT current_database() AS index_catalog, nc2.nspname AS index_schema, c2.relname AS index_name,
current_database() AS table_catalog, nc.nspname AS table_schema, c.relname AS table_name, i.indisunique,
pg_get_indexdef (i.indexrelid, 0, false), NULL, NULL, o.rolname, pg_catalog.obj_description (c2.oid),
i.indexrelid FROM pg_catalog.pg_class c INNER JOIN pg_namespace nc ON (c.relnamespace = nc.oid),
pg_catalog.pg_class c2 INNER JOIN pg_namespace nc2 ON (c2.relnamespace = nc2.oid) LEFT JOIN pg_roles o ON
(o.oid=c2.relowner), pg_catalog.pg_index i WHERE c.oid = i.indrelid AND i.indexrelid = c2.oid AND NOT
i.indisprimary AND pg_catalog.pg_table_is_visible(c.oid) AND nc.nspname = ##schema::string AND c.relname =
##name::string ORDER BY c.relname",
@@ -301,10 +301,11 @@ _gda_postgres_provider_meta_init (GdaServerProvider *provider)
if (!provider)
g_object_unref (parser);
- i_set = gda_set_new_inline (5, "cat", G_TYPE_STRING, "",
+ i_set = gda_set_new_inline (6, "cat", G_TYPE_STRING, "",
"name", G_TYPE_STRING, "",
"schema", G_TYPE_STRING, "",
"name2", G_TYPE_STRING, "",
+ "name3", G_TYPE_STRING, "",
"oid", G_TYPE_UINT, 0);
}
@@ -1736,7 +1737,7 @@ _gda_postgres_meta__routines (G_GNUC_UNUSED GdaServerProvider *prov, GdaConnecti
gda_meta_store_set_reserved_keywords_func (store, _gda_postgres_reuseable_get_reserved_keywords_func
((GdaProviderReuseable*) rdata));
- retval = gda_meta_store_modify_with_context (store, context, model, error);
+ retval = gda_meta_store_modify (store, gda_meta_context_get_table (context), model, NULL, error,
NULL);
g_object_unref (model);
return retval;
@@ -1846,7 +1847,7 @@ _gda_postgres_meta__routine_col (G_GNUC_UNUSED GdaServerProvider *prov, GdaConne
if (retval) {
gda_meta_store_set_reserved_keywords_func (store,
_gda_postgres_reuseable_get_reserved_keywords_func
((GdaProviderReuseable*) rdata));
- retval = gda_meta_store_modify_with_context (store, context, proxy, error);
+ retval = gda_meta_store_modify (store, gda_meta_context_get_table (context), proxy, NULL,
error, NULL);
}
g_object_unref (model);
g_object_unref (proxy);
@@ -1858,7 +1859,7 @@ gboolean
_gda_postgres_meta_routine_col (G_GNUC_UNUSED GdaServerProvider *prov, GdaConnection *cnc,
GdaMetaStore *store, GdaMetaContext *context, GError **error,
const GValue *rout_catalog, const GValue *rout_schema,
- const GValue *rout_name)
+ const GValue *rout_name, const GValue *col_name, const GValue
*ordinal_position)
{
GdaDataModel *model, *proxy;
gint ordinal_pos, i, nrows;
@@ -1881,6 +1882,10 @@ _gda_postgres_meta_routine_col (G_GNUC_UNUSED GdaServerProvider *prov, GdaConnec
return FALSE;
if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), rout_name, error))
return FALSE;
+ if (! gda_holder_set_value (gda_set_get_holder (i_set, "name2"), col_name, error))
+ return FALSE;
+ if (! gda_holder_set_value (gda_set_get_holder (i_set, "name3"), col_name, error))
+ return FALSE;
model = gda_connection_statement_execute_select_full (cnc,
internal_stmt[I_STMT_ROUTINE_COL],
@@ -1915,6 +1920,9 @@ _gda_postgres_meta_routine_col (G_GNUC_UNUSED GdaServerProvider *prov, GdaConnec
if (!retval)
break;
}
+ gchar *s = gda_meta_context_stringify (context);
+ g_message ("Context used by _routine_col: %s", s);
+ g_free (s);
if (retval) {
gda_meta_store_set_reserved_keywords_func (store,
_gda_postgres_reuseable_get_reserved_keywords_func
diff --git a/providers/reuseable/postgres/gda-postgres-meta.h
b/providers/reuseable/postgres/gda-postgres-meta.h
index 848bed9d4..bfd7b1fc0 100644
--- a/providers/reuseable/postgres/gda-postgres-meta.h
+++ b/providers/reuseable/postgres/gda-postgres-meta.h
@@ -178,7 +178,7 @@ gboolean _gda_postgres_meta__routine_col (GdaServerProvider *prov, GdaConnec
gboolean _gda_postgres_meta_routine_col (GdaServerProvider *prov, GdaConnection *cnc,
GdaMetaStore *store, GdaMetaContext *context, GError **error,
const GValue *rout_catalog, const GValue *rout_schema,
- const GValue *rout_name);
+ const GValue *rout_name, const GValue *col_name, const GValue
*ordinal_position);
/* _parameters */
gboolean _gda_postgres_meta__routine_par (GdaServerProvider *prov, GdaConnection *cnc,
diff --git a/providers/web/gda-web-meta.c b/providers/web/gda-web-meta.c
index 579dfc252..7af2035f5 100644
--- a/providers/web/gda-web-meta.c
+++ b/providers/web/gda-web-meta.c
@@ -1306,7 +1306,7 @@ gboolean
_gda_web_meta_routine_col (G_GNUC_UNUSED GdaServerProvider *prov, GdaConnection *cnc,
GdaMetaStore *store, GdaMetaContext *context, GError **error,
const GValue *rout_catalog, const GValue *rout_schema,
- const GValue *rout_name)
+ const GValue *rout_name, const GValue *col_name, const GValue *ordinal_position)
{
WebConnectionData *cdata;
@@ -1320,7 +1320,7 @@ _gda_web_meta_routine_col (G_GNUC_UNUSED GdaServerProvider *prov, GdaConnection
return cdata->reuseable->operations->re_meta_funcs.routine_col (NULL, cnc, store,
context, error,
rout_catalog,
rout_schema,
- rout_name);
+ rout_name, col_name,
ordinal_position);
else
return TRUE;
}
diff --git a/providers/web/gda-web-meta.h b/providers/web/gda-web-meta.h
index 7494e589b..162e976a0 100644
--- a/providers/web/gda-web-meta.h
+++ b/providers/web/gda-web-meta.h
@@ -178,7 +178,7 @@ gboolean _gda_web_meta__routine_col (GdaServerProvider *prov, GdaConnection
gboolean _gda_web_meta_routine_col (GdaServerProvider *prov, GdaConnection *cnc,
GdaMetaStore *store, GdaMetaContext *context, GError **error,
const GValue *rout_catalog, const GValue *rout_schema,
- const GValue *rout_name);
+ const GValue *rout_name, const GValue *col_name, const GValue
*ordinal_position);
/* _parameters */
gboolean _gda_web_meta__routine_par (GdaServerProvider *prov, GdaConnection *cnc,
diff --git a/tests/providers/meson.build b/tests/providers/meson.build
index da3977227..64e5e2c80 100644
--- a/tests/providers/meson.build
+++ b/tests/providers/meson.build
@@ -74,7 +74,7 @@ tchkpg = executable('check_postgres',
install: false
)
test('ProviderPostgreSQL', tchkpg,
- timeout: 300,
+ timeout: 800,
env: [
'GDA_TOP_SRC_DIR='+meson.source_root(),
'GDA_TOP_BUILD_DIR='+meson.build_root()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]