[gnome-db] More fun with apps
- From: will lashell net
- To: gnome-db-list gnome org
- Subject: [gnome-db] More fun with apps
- Date: Tue, 4 Sep 2001 18:40:28 -0700
Hrmm okay so here is a piece of code i'm using:
static void
refresh_clist( GtkWidget *widget, gpointer data )
{
gulong reccount, blah;
/* char *foo[3]; */
GdaRecordset *rs;
GdaConnection *conn;
GdaCommand *cmd;
conn = gda_connection_new( gda_corba_get_orb() );
gda_connection_set_provider( conn, "OAFIID:GNOME_GDA_Provider_MySQL_ConnectionFactory");
if( gda_connection_open ( conn, "HOST=dev.ofsloans.com;DATABASE=message;PORT=3306", NULL, NULL) )
{
GList *errors;
GList *node;
GdaError *error;
errors = gda_connection_get_errors(conn);
for (node = g_list_first(errors); node; node = g_list_next(node))
{
error = (GdaError *) node->data;
g_print("%s\n", gda_error_description( error) );
}
gda_error_list_free(errors);
}
else
{
rs = gda_recordset_new();
cmd = gda_command_new ();
gda_command_set_connection (cmd, conn);
gda_command_set_text (cmd, "SELECT * FROM message where recipient = 'wlashell' order by date DESC");
rs = gda_command_execute (cmd, &reccount, blah);
gtk_clist_clear( GTK_CLIST( msg_list ) );
printf( "query successful\n" );
while( ! gda_recordset_eof( GDA_RECORDSET(rs) ) )
{
/* foo[0] = row_data[4];
foo[1] = row_data[2];
foo[2] = row_data[5];
gtk_clist_append( GTK_CLIST( msg_list ), foo); */
gda_recordset_move_next( rs );
}
}
}
which compiles just fine. but.. we get a segfault when it tries to
execute.
I ran a backtrace and this is what I ended up with:
0x407b6dd3 in strlen () from /lib/i686/libc.so.6
(gdb) bt
#0 0x407b6dd3 in strlen () from /lib/i686/libc.so.6
#1 0x40460251 in GDA_Connection_open () from /usr/lib/libgda-client.so.0
#2 0x40466174 in gda_connection_open () from /usr/lib/libgda-client.so.0
#3 0x0804950c in refresh_clist (widget=0x80a9e40, data=0x0)
at ofs-messages.c:40
#4 0x401dbe4b in gtk_marshal_NONE__NONE (object=0x80a9e40,
func=0x80494c4 <refresh_clist>, func_data=0x0, args=0xbfffed50)
at gtkmarshal.c:312
#5 0x4020b56a in gtk_handlers_run (handlers=0x80578e8, signal=0xbfffecf0,
object=0x80a9e40, params=0xbfffed50, after=0) at gtksignal.c:1917
#6 0x4020a9bb in gtk_signal_real_emit (object=0x80a9e40, signal_id=68,
params=0xbfffed50) at gtksignal.c:1477
#7 0x40208a30 in gtk_signal_emit (object=0x80a9e40, signal_id=68)
at gtksignal.c:552
#8 0x4017958c in gtk_button_clicked (button=0x80a9e40) at gtkbutton.c:336
#9 0x4017ab02 in gtk_real_button_released (button=0x80a9e40)
at gtkbutton.c:861
#10 0x401dbe4b in gtk_marshal_NONE__NONE (object=0x80a9e40,
func=0x4017aa5c <gtk_real_button_released>, func_data=0x0,
args=0xbffff0e0)
at gtkmarshal.c:312
#11 0x4020a867 in gtk_signal_real_emit (object=0x80a9e40, signal_id=67,
params=0xbffff0e0) at gtksignal.c:1440
#12 0x40208a30 in gtk_signal_emit (object=0x80a9e40, signal_id=67)
<SNIP SNIP>
Any ideas what I'm doing wrong, or what is going on.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]