Re: [gnome-db] gda_postgres_make_error function with sqlstate support
- From: Vivien Malerba <vmalerba gmail com>
- To: Juan Manuel Mouriz <jmouriz gmail com>
- Cc: gnome-db-list gnome org
- Subject: Re: [gnome-db] gda_postgres_make_error function with sqlstate support
- Date: Tue, 26 Jul 2005 17:00:21 +0200
On 7/26/05, Juan Manuel Mouriz <jmouriz gmail com> wrote:
> Hi,
>
> This is a version of libgda/providers/postgres/utils.c
> gda_postgres_make_error function with sqlstate support:
>
> GdaError *
> gda_postgres_make_error (PGconn *pconn, PGresult *pg_res)
> {
> GdaError *error;
> gchar *sqlstate;
>
> error = gda_error_new ();
> if (pconn != NULL) {
> gchar *message;
>
> if (pg_res != NULL) {
> message = PQresultErrorMessage (pg_res);
> sqlstate = PQresultErrorField (pg_res,
> PG_DIAG_SQLSTATE);
> } else {
> message = PQerrorMessage (pconn);
> sqlstate = _("Not available");
> }
>
> gda_error_set_description (error, message);
> gda_error_set_sqlstate (error, sqlstate);
> } else {
> gda_error_set_description (error, _("NO DESCRIPTION"));
> gda_error_set_sqlstate (error, _("Not available"));
> }
>
> gda_error_set_number (error, -1);
> gda_error_set_source (error, "gda-postgres");
>
> return error;
> }
>
> Can we replace the current gda_postgres_make_error with this more
> useful function?.
As a matter of fact I've just started to work on this particular area
and so far I have:
-> renamed GdaError to GdaConnectionEvent because I want to use this
object not only to report errors but warnings and notifications as
well
Here is what I plan to do:
-> use the GdaConnectionEvent object to improve feedback from the providers
-> improve the GdaConnection API by adding a GError argument to the
function calls
I'll modify the gda_postgres_make_error() to add your modifications.
Vivien
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]