Skip to content

Commit

Permalink
Set the same database as meta store. Refs midgardprojectgh-144
Browse files Browse the repository at this point in the history
  • Loading branch information
piotras committed Mar 7, 2012
1 parent bbc6f57 commit e1895fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/midgard_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,7 @@ __mysql_reconnect (MidgardConnection *mgd)

opened = gda_connection_open (mgd->priv->connection, NULL);

if (opened) {

if (opened) {
g_signal_emit (mgd, MIDGARD_CONNECTION_GET_CLASS (mgd)->signal_id_connected, 0);
g_debug ("Successfully reopened connection");
return TRUE;
Expand Down Expand Up @@ -565,7 +564,6 @@ __midgard_connection_open(MidgardConnection *mgd, gboolean init_schema, GError *
g_free(auth);

if(connection == NULL) {

MIDGARD_ERRNO_SET_STRING (mgd, MGD_ERR_NOT_CONNECTED,
" Database [%s]. %s", tmpstr, err->message);
if (err) {
Expand All @@ -585,6 +583,12 @@ __midgard_connection_open(MidgardConnection *mgd, gboolean init_schema, GError *
mgd->priv->parser = gda_sql_parser_new();
g_assert (mgd->priv->parser != NULL);

/* Set the same database as meta store */
GdaMetaStore *store;
store = GDA_META_STORE (g_object_new (GDA_TYPE_META_STORE, "cnc", connection, NULL));
g_object_set (G_OBJECT (connection), "meta-store", store, NULL);
g_object_unref (store);

mgd->priv->connection = connection;
midgard_core_connection_connect_error_callback (mgd);

Expand Down
2 changes: 0 additions & 2 deletions src/midgard_core_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -1068,8 +1068,6 @@ gboolean __table_exists(MidgardConnection *mgd, const gchar *tablename)
mcontext.column_values = g_new (GValue *, 1);
g_value_set_string ((mcontext.column_values[0] = gda_value_new (G_TYPE_STRING)), tablename);
GError *error = NULL;

_update_gda_meta_store_table (mgd->priv->connection, tablename, NULL);

GdaDataModel *dm_schema =
gda_connection_get_meta_store_data (mgd->priv->connection,
Expand Down

0 comments on commit e1895fd

Please sign in to comment.