Re: [gnome-db] libgda: problem with plugin_get_dsn_spec function.



On Thu, 2005-06-23 at 23:06 +1000, Bas Driessen wrote:
Hello Vivien,

Haven't updated my libgda sources for a couple of weeks and am having problems getting my projects to work with the latest libgda cvs sources. A couple of weeks ago you put the following code in libgda/libgda/gda-config.c in function gda_config_get_provider_list:


                        if (plugin_get_dsn_spec != NULL)
                                info->dsn_spec = plugin_get_dsn_spec ();
                        else
                                info->dsn_spec = NULL;

This compiles fine, but at run-time my application falls over (segmentation violation) the 2nd line in the snippet above. If I set info->dsn_spec = NULL there, all appears to work fine. So my question is, what does that line do?

In my case it calls the function plugin_get_dsn_spec in providers/mysql/libmain.c There all processes OK, but it falls over the "return specs" line.

Any ideas?


Did look further into this problem. I have attached a small c application, based on the example (which is missing btw) c code in the manual. This application crashes (segm. violation) on the line:

gda_config_get_provider_list ()

The trace goes back to the area outlined in the previous e-mail. I would like to know if more people are having problems with this. I am using Fedora Core 4 (GCC 4.0)

To compile this small app, type:

gcc libgda_crash.c -o libgda_crash `pkg-config --cflags --libs libgda-2.0`

Use the latest CVS source, make sure that your PKG_CONFIG_PATH is set to the lib/pkgconfig directory where libgda is installed. Also set LD_LIBRARY_PATH to the lib directory where the libgda libs are located, so you can run this.

This proofs that the crash is not related to my projects. Will try to locate the problem, but if somebody has some ideas of what is happening, please let me know.

Thanks,
Bas.

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


void
list_providers (void)
{
  GList *prov_list;
  GList *node;
  GdaProviderInfo *info;

  prov_list = gda_config_get_provider_list ();

  for (node = g_list_first (prov_list); node != NULL;
       node = g_list_next (node))
    {
      info = (GdaProviderInfo *) node->data;

      g_print ("ID: %s\n", info->id);

    }

  gda_config_free_provider_list (prov_list);

}

void
list_datasources (void)
{
  GList *ds_list;
  GList *node;
  GdaDataSourceInfo *info;

  ds_list = gda_config_get_data_source_list ();

  g_print ("\n");
  for (node = g_list_first (ds_list); node != NULL; node = g_list_next (node))
    {
      info = (GdaDataSourceInfo *) node->data;

      g_print
	("NAME: %s PROVIDER: %s CNC: %s DESC: %s USER: %s PASSWORD: %s\n",
	 info->name, info->provider, info->cnc_string, info->description,
	 info->username, info->password);

    }
  g_print ("\n");

  gda_config_free_data_source_list (ds_list);

}

void
do_stuff ()
{
  GdaClient *client;
  GdaConnection *connection;

  printf("start step 1\n");
  list_providers ();
  printf("end step 1\n");

  printf("start step 2\n");
  list_datasources ();
  printf("end step 2\n");

  gda_main_quit ();
}


int
main (int argc, char **argv)
{

  g_print ("STARTING\n");
  gda_init ("TestGDA", "0.1", argc, argv);

  /* do_stuff(); */
  gda_main_run ((GdaInitFunc) do_stuff, (gpointer) NULL);

  g_print ("ENDING\n");

}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]