[gnome-db] Examples



Hi,

I am learning gnome-db but I encountered this error:

----------------------------------------------------------------
GDA_Connection_open returns 0
Nombre d'enregistrements : 2

Gtk-WARNING **: invalid cast from (NULL) pointer to `GtkCList'

Gtk-CRITICAL **: file gtkclist.c: line 1286
(gtk_clist_column_titles_show): assertion `clist != NULL' failed.
-----------------------------------------------------------------

with the following source code :

-----------------------------------------------------------------

int main (int argc, char *argv[])
{
	GdaRecordset *gda_rs;
	GdaConnection *gda_cnc;
        GtkWidget* window;
        GtkWidget* grid;
	gulong gda_reccount = 0;
	gulong gda_flags = 0;
	
	gnome_db_init("test-db", "1.0", argc, argv);
	gda_cnc = gda_connection_new(gda_corba_get_orb());

	gda_connection_set_provider(gda_cnc,
				    "OAFIID:GNOME_GDA_Provider_Postgres_Connection");
	
	if(gda_connection_open(gda_cnc, "DATABASE=sps", "stephane", ""))
		die(gda_cnc);

	gda_rs = gda_connection_execute(gda_cnc, "SELECT \
                                        no_lot AS \"Numéro de Lot\" , \
		                        no_fab AS \"Numéro de fabrication\" \
                                        FROM numero",
					&gda_reccount, gda_flags);

	g_print("Nombre d'enregistrements : %u\n", (unsigned int)gda_reccount);

        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	
	gtk_signal_connect(GTK_OBJECT(window), "delete_event",
			   GTK_SIGNAL_FUNC(gtk_main_quit),
			   NULL);

	grid = gnome_db_grid_new(gda_rs);
	//gnome_db_grid_set_recordset (GNOME_DB_GRID (grid), gda_rs);
	gda_recordset_free(gda_rs);
	//gnome_db_grid_set_recordset (GNOME_DB_GRID (grid), gda_rs);
	//gnome_db_grid_show_column_titles(GNOME_DB_GRID(grid));
	gtk_container_add(GTK_CONTAINER(window), grid);

        gtk_widget_show_all(window);
        gtk_main();
	
        return 0;
}
-----------------------------------------------------------------

I don't find the fix with the docs so I need GDA and Gnome-DB examples,
where I can find these ? 

Thank

Stephane




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