![]() | ![]() | GNOME Data Access manual | ![]() |
---|
You can manage errors with <LINK>GdaError</LINK> class and obtain them with function <LINK><EMPHASIS>gda_connection_get_errors() </EMPHASIS></LINK> so let's see them and an example:
Here you see the functions to manage errors:
<ITEMIZEDLIST> <LISTITEM><LINK>gda_error_get_description()</LINK>
</LISTITEM> <LISTITEM><LINK>gda_error_get_number()</LINK>
</LISTITEM> <LISTITEM><LINK>gda_error_get_source()</LINK>
</LISTITEM> <LISTITEM><LINK>gda_error_get_sqlstate()</LINK>
</LISTITEM> </ITEMIZEDLIST>Here you can see an example of using this:
<PROGRAMLISTINGCO> <AREASPEC> <AREA></AREA> <AREA></AREA> </AREASPEC>gboolean get_errors (GdaConnection *connection) { GList *list; GList *node; GdaError *error; list = (GList *) gda_connection_get_errors (connection); for (node = g_list_first (list); node != NULL; node = g_list_next (node)) { error = (GdaError *) node->data; g_print ("Error no: %d\t", gda_error_get_number (error)); g_print ("desc: %s\t", gda_error_get_description (error)); g_print ("source: %s\t", gda_error_get_source (error)); g_print ("sqlstate: %s\n", gda_error_get_sqlstate (error)); } }<CALLOUTLIST> <CALLOUT> <PARA> Obtains errors list. </PARA> </CALLOUT> <CALLOUT> <PARA> Loop for getting error information. </PARA> </CALLOUT> </CALLOUTLIST> </PROGRAMLISTINGCO>
<< Transactions and batch processes | Full example >> |