Re: [gnome-db] Meta Store issue with MySQL.

Bas Driessen <[email protected]>
Newsgroups gmane.comp.gnome.db
Organization Xobas Software
Message-ID <[email protected]>
On Thu, 2009-07-30 at 16:17 +0200, Vivien Malerba wrote:

> 
> 
> 
> 2009/7/30 Bas Driessen <[email protected]>
> 
>         
>         > 2009/7/30 Bas Driessen <[email protected]>
>         >
>         >>  Hello,
>         >>
>         >> My database is in MySQL. When I run the following command
>         to rebuild the
>         >> MetaStore (which lives in a sqlite3 database):
>         >>
>         >> gda_connection_update_meta_store(connection, NULL, &error)
>         >>
>         >> I get the following error/warning:
>         >>
>         >> ** (process:22406): WARNING **: (+5): Wrong Holder value
>         type, expected
>         >> type 'boolean' when value's type is 'string' (Provider
>         ThreadWrapper)
>         >>
>         >>
>         >> and the MySQL table information is not in the MetaStore. In
>         fact if I
>         >> do:
>         >>
>         >> select * from _tables;
>         >>
>         >> nothing shows up.
>         >>
>         >> Anyone else having this problem?
>         >>
>         >
>         > The reason for this error is that a SELECT statement
>         internally run by the
>         > MySQL provider to get meta data returned a column of type
>         string instead
>         > to
>         > a boolean. To solve this, the correction consists in
>         locating the faulty
>         > SELECT, and use
>         gda_connection_statement_execute_select_full() with an
>         > array
>         > of expected types for the columns instead of
>         > gda_connection_statement_execute_select(). This is already
>         done at several
>         > places in gda-mysql-meta.c.
>         >
>         > If you want to try to correct it, and if you are in the
>         master branch, you
>         > can use the definitions in
>         > libgda/providers-support/gda-meta-column-types.h
>         > (which is dynamically generated).
>         >
>         > Otherwise, I'd need to have more information to correct the
>         problem
>         > myself.
>         
>         
>         
>         OK, I will try to locate and correct the issue in libgda. Just
>         wanted to
>         have confirmed first that this is an issue in libgda and not
>         in my setup.
>         
> 
> To help you, you can uncomment the line 2324 of the gda-meta-store.c
> file, so you'll get debug info about all the results the provider is
> returning for the meta store.
> 


Thanks Vivien ... I tried, but it is difficult to get a handle on the
flow of code etc. Therefore, I created a small reproducible. Probably
faster to get to the core of this issue :)

Steps in the little program below as follows:

-1 Open connection to MySQL. My data source is called "mystock".
-2 Open a data store in sqlite format.
-3 Rebuild the complete store. This will fail. Even if there are no base
tables, there should always be something in the _tables for instance.
There is nothing there, which probably makes sense as a rollback is
triggered if there is a problem.

To check the result:

sqlite3 /tmp/mysql_meta.db

select * from _tables;

Nothing returned.

Can you please test if this is failing in your environment too? The code
is as follows:

==============
#include <libgda/libgda.h>

int
main (int argc, char *argv[])
{
        GdaConnection* connection;
        GError* error = NULL;
        GdaMetaStore *store;

        gda_init();
        error = NULL;

        /* open connection */
        printf("Start.\n");
        printf("Open connection.\n");
        connection = gda_connection_open_from_dsn ("mystock", NULL,
GDA_CONNECTION_OPTIONS_NONE, &error);
        if (!connection)
        {
                fprintf (stderr, "%s\n", error->message);
                return -1;
        }

        /* Open Meta Store */
        printf("Open Meta Store.\n");
        store = gda_meta_store_new_with_file("/tmp/mysql_meta.db");
        g_object_set(G_OBJECT(connection), "meta-store", store, NULL);
        if (!store)
        {
                printf("Can not open store.\n");
                return -1;
        }

        /* Build Complete store */
        printf("Build complete store.\n");
        if (!gda_connection_update_meta_store(connection, NULL, &error))
        {
                fprintf (stderr, "%s\n", error->message);
                return -1;
        }

        /* The End */
        printf("End.\n");
        return 0;
}

==============

Thanks,
Bas.

_______________________________________________
gnome-db-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnome-db-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.