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

From Michael Fuhr
Subject Re: [C API] Is there a nice way to get table/column name on some error ?
Date
Msg-id 20060106040158.GA81499@winnie.fuhr.org
Whole thread Raw
In response to Re: [C API] Is there a nice way to get table/column  (JiangWei <jw.pgsql@sduept.com>)
Responses Re: [C API] Is there a nice way to get table/column  ("Jeroen T. Vermeulen" <jtv@xs4all.nl>)
List 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


pgsql-interfaces by date:

Previous
From: JiangWei
Date:
Subject: Re: [C API] Is there a nice way to get table/column
Next
From: "Jeroen T. Vermeulen"
Date:
Subject: Re: [C API] Is there a nice way to get table/column