| GNOME Data Access manual |
|---|
First of all you have to initialise the gda library, i.e. to call the gda_init () function.
gda_init ("TestGDA", "0.1", argc, argv);
After initialising you can work as usual or make a function with the whole stuff, calling gda_main_run(). Note that if you use this way you will need to call gda_main_quit() in order to finish the program.
void
do_stuff ()
{
GdaClient *client;
GdaConnection *connection;
list_providers ();
list_datasources ();
client = gda_client_new ();
g_print ("CONNECTING\n");
connection = gda_client_open_connection (client, "calvaris", NULL, NULL,
GDA_CONNECTION_OPTIONS_READ_ONLY);
g_print ("CONNECTED\n");
execute_some_queries (connection);
g_print ("ERRORS PROVED!\n");
process_accounts(connection);
gda_client_close_all_connections (client);
g_object_unref(G_OBJECT(client));
play_with_parameters();
gda_main_quit();
}
int
main (int argc, char **argv)
{
g_print ("STARTING\n");
gda_init ("TestGDA", "0.1", argc, argv);
save_ds ();
gda_main_run ((GdaInitFunc) do_stuff, (gpointer) NULL);
/* do_stuff(); */
g_print("ENDING\n");
}