Re: [gnome-db] what it this could make my program to fail



On 5/13/06, Juan Pablo <jpdborgna yahoo com ar> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list.

I have this code, and under some conditions it makes my program to end

str=g_strdup_printf(
       "select producto as codigo,(select nombre from productos where
id=producto) as descripcion ,sum(cantidad) as cantidad from detalles
where fecha>=(select fecha from cierres where turno=%d and caja=%d)
and fecha<=(select fecha from cierres where turno=%d and caja=%d)
group  by producto order by codigo",

gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(lookup_widget(widget,"desde"))),
    boa_fe.caja,

gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(lookup_widget(widget,"hasta"))),
    boa_fe.caja
    );

 cmd = gda_command_new (str, GDA_COMMAND_TYPE_SQL,
GDA_COMMAND_OPTION_STOP_ON_ERRORS);
 recset = gda_connection_execute_single_command (boa_fe.conn, cmd, NULL);
 g_free(str);

 gnome_db_grid_set_model (grid,recset);

 g_object_unref (G_OBJECT (recset));
 gda_command_free (cmd);


Im getting this warning:(fiscal:21716): GLib-GObject-WARNING **:
invalid uninstantiatable type `<invalid>' in cast to `GObject'

(fiscal:21716): GLib-GObject-CRITICAL **: g_object_unref: assertion
`G_IS_OBJECT (object)' failed


You did not test the return value of recset, it might be NULL. Try to
print and run the SQL using your DBMS console to see if it's OK.

Cheers,

Vivien



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