1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Managing errors</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
<link rel="start" href="index.html" title="GNOME Data Access manual">
<link rel="up" href="index.html" title="GNOME Data Access manual">
<link rel="prev" href="ch06.html" title="Transactions and batch processes">
<link rel="next" href="main_example.html" title="Full example">
<meta name="generator" content="GTK-Doc V1.10 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="introduction.html" title="Introduction">
<link rel="chapter" href="architecture.html" title="libgda architecture">
<link rel="chapter" href="installation.html" title="Installation">
<link rel="chapter" href="connecting.html" title="Beginning">
<link rel="chapter" href="processing-queries.html" title="Processing queries">
<link rel="chapter" href="ch06.html" title="Transactions and batch processes">
<link rel="chapter" href="managing-errors.html" title="Managing errors">
<link rel="chapter" href="main_example.html" title="Full example">
<link rel="chapter" href="migration.html" title="Some formulae for migration from old version">
<link rel="chapter" href="libgda-api.html" title="Client API Reference">
<link rel="chapter" href="libgda-providers.html" title="GDA Providers">
<link rel="chapter" href="libgda-xql.html" title="XML Queries">
<link rel="chapter" href="libgda-reports.html" title="GDA Report Engine">
<link rel="appendix" href="fdl.html" title="Appendix A. GNU Free Documentation License">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="ch06.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td> </td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GNOME Data Access manual</th>
<td><a accesskey="n" href="main_example.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="chapter" lang="en">
<div class="titlepage"><div><div><h2 class="title">
<a name="managing-errors"></a>Managing errors</h2></div></div></div>
<p>
You can manage errors with <a class="link" href="libgda-GdaError.html" title="GdaError">GdaError</a> class and obtain them with
function <a class="link" href="libgda-GdaConnection.html#gda-connection-get-errors" title="gda_connection_get_errors ()"><span class="emphasis"><em>gda_connection_get_errors()
</em></span></a> so let's see them and an example:
</p>
<p>
Here you see the functions to manage errors:
</p>
<div class="itemizedlist"><ul type="disc">
<li><p>
<a class="link" href="libgda-GdaError.html#gda-error-get-description" title="gda_error_get_description ()">gda_error_get_description()</a></p></li>
<li><p>
<a class="link" href="libgda-GdaError.html#gda-error-get-number" title="gda_error_get_number ()">gda_error_get_number()</a></p></li>
<li><p>
<a class="link" href="libgda-GdaError.html#gda-error-get-source" title="gda_error_get_source ()">gda_error_get_source()</a></p></li>
<li><p>
<a class="link" href="libgda-GdaError.html#gda-error-get-sqlstate" title="gda_error_get_sqlstate ()">gda_error_get_sqlstate()</a></p></li>
</ul></div>
<p>
Here you can see an example of using this:
</p>
<div class="programlistingco">
<pre class="programlisting">
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));
}
}
</pre>
<div class="calloutlist"><table border="0" summary="Callout list">
<tr>
<td width="5%" valign="top" align="left"><p><img src="images/callouts/1.png" alt="1" border="0"></p></td>
<td valign="top" align="left"><p>
Obtains errors list.
</p></td>
</tr>
<tr>
<td width="5%" valign="top" align="left"><p><img src="images/callouts/2.png" alt="2" border="0"></p></td>
<td valign="top" align="left"><p>
Loop for getting error information.
</p></td>
</tr>
</table></div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.10</div>
</body>
</html>
|