Re: [SQL] Getting datatype before SELECT

Поиск
Список
Период
Сортировка
От darcy@druid.net (D'Arcy J.M. Cain)
Тема Re: [SQL] Getting datatype before SELECT
Дата
Msg-id m0zOujg-00006FC@druid.net
обсуждение исходный текст
Ответ на Re: [SQL] Getting datatype before SELECT  (Glenn Sullivan <glenn.sullivan@nmr.varian.com>)
Список pgsql-sql
Thus spake Glenn Sullivan
> The value I get returned from PQftype() for a varchar is 1043
> and for an int is 23.
> I am uncomfortable just testing for these values.  I could
> not find in the documentation, what the return values of
> PQftype() are.  Can anyone point me to that information?

Here's a Python script to generate #defines for a C header.  I'm sure
you can figure out how to convert it for your needs.

#! /usr/local/bin/python
import string

# change this if you have it somewhere else
for l in open("/usr/local/pgsql/src/include/catalog/pg_type.h").readlines():
    tokens = string.split(l)
    if len(tokens) == 0 or tokens[0] != "#define": continue
    if tokens[1] in ('CASHOID', 'INT2OID', 'INT4OID', 'OIDOID', 'FLOAT4OID', 'FLOAT8OID'):
        print l,

--
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.

В списке pgsql-sql по дате отправления:

Предыдущее
От: Glenn Sullivan
Дата:
Сообщение: Re: [SQL] Getting datatype before SELECT
Следующее
От: phansen
Дата:
Сообщение: grouping a ordered list