Re: [C API] Is there a nice way to get table/column name on some error ?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: JiangWei <jw(dot)pgsql(at)sduept(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [C API] Is there a nice way to get table/column name on some error ?
Date: 2006-01-06 04:01:58
Message-ID: 20060106040158.GA81499@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

[Please post in plain text, not HTML.]

On Fri, Jan 06, 2006 at 10:15:19AM +0800, JiangWei wrote:
> > With libpq you can call PQerrorMessage(), PQresultErrorMessage(),
> > or PQresultErrorField() to get a string that should identify the
> > offending column, function, table, etc. Will that work for your
> > purpose?
>
> No. I want to throw a exception with the column name, like this :
> if (sqlstate == undefined_column)
> throw UnknownProperty(column_name);

I'm not aware of a way to get just the column name, so if nobody
else posts a way then you might have to parse the error message
(admittedly a pain, especially if you have to deal with different
languages).

--
Michael Fuhr

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Jeroen T. Vermeulen 2006-01-06 04:19:56 Re: [C API] Is there a nice way to get table/column
Previous Message JiangWei 2006-01-06 02:15:19 Re: [C API] Is there a nice way to get table/column