Обсуждение: PG_DIAG_STATEMENT_POSITION Where is it defined?

Поиск
Список
Период
Сортировка

PG_DIAG_STATEMENT_POSITION Where is it defined?

От
Tony Caduto
Дата:
I have been searching through the cvs web browser for about 1/2 hour and
can't find where PG_DIAG_STATEMENT_POSITION
is defined.

I need to know the integer value of the constant(pascal talk)/Symbol (c
talk) so I can add it to my Delphi client library.

Thanks in advance

--
Tony


Re: PG_DIAG_STATEMENT_POSITION Where is it defined?

От
Martijn van Oosterhout
Дата:
On Wed, May 17, 2006 at 03:28:45PM -0500, Tony Caduto wrote:
> I have been searching through the cvs web browser for about 1/2 hour and
> can't find where PG_DIAG_STATEMENT_POSITION
> is defined.
>
> I need to know the integer value of the constant(pascal talk)/Symbol (c

rgrep is your friend, or TAGS if you've set it up.

src/include/postgres_ext.h

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

Re: PG_DIAG_STATEMENT_POSITION Where is it defined?

От
Tony Caduto
Дата:
Martijn van Oosterhout wrote:
> src/include/postgres_ext.h
>
>
>
I did  use grep but I am confused by what it showed,

according to the docs:
http://www.postgresql.org/docs/8.1/static/libpq-exec.html
 it should be a integer not 'P'

Those symbols are used by PQresultErrorField which expects a integer value.

Thanks,

--
Tony


Re: PG_DIAG_STATEMENT_POSITION Where is it defined?

От
Tony Caduto
Дата:
Tony Caduto wrote:
> Martijn van Oosterhout wrote:
>> src/include/postgres_ext.h
>>
>>
> I did  use grep but I am confused by what it showed,
>
> according to the docs:
> http://www.postgresql.org/docs/8.1/static/libpq-exec.html
> it should be a integer not 'P'
>
> Those symbols are used by PQresultErrorField which expects a integer
> value.
>
> Thanks,
>
I got it working, in Pascal you have to pass P as ord('P')

PQresultErrorField(fstatement,ord('P'));

It's one of those cryptic ways you can use a char as a integer in C :-)

--
Tony


Re: PG_DIAG_STATEMENT_POSITION Where is it defined?

От
Martijn van Oosterhout
Дата:
On Wed, May 17, 2006 at 03:58:21PM -0500, Tony Caduto wrote:
> Tony Caduto wrote:
> >http://www.postgresql.org/docs/8.1/static/libpq-exec.html
> >it should be a integer not 'P'
> >
> I got it working, in Pascal you have to pass P as ord('P')
>
> PQresultErrorField(fstatement,ord('P'));
>
> It's one of those cryptic ways you can use a char as a integer in C :-)

Hardly cryptic, it's a fairly common tactic if you need an integer to
represent something and you don't particularly care what integer, but
the character can be more meaningful. A char *is* an integer, just only
one byte, not four.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения