Re: How to get OID return value(pls help me)

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: How to get OID return value(pls help me)
Дата
Msg-id 20051222063110.GA63701@winnie.fuhr.org
обсуждение исходный текст
Ответ на How to get OID return value(pls help me)  ("sandhya" <sandhyar@amiindia.co.in>)
Список pgsql-admin
On Thu, Dec 22, 2005 at 11:05:22AM +0530, sandhya wrote:
> My table consists of oid and varchar datatypes.
> I want to get the oid type from the table and i need to pass it to
> a function which accepts only the oid data type.

What function is that?  What does it do with the oid?

> But my problem is the return value of the datatype i am getting from
> the query result is char*.

You don't mention what language and interface you're using but it
sounds like C and libpq.

> Is there any function in postgresql which gives the return value of
> the executed query as OID type.

You could rely on the knowledge that Oid is

typedef unsigned int Oid;

and use strtoul() to convert the char * to an unsigned int.  Another
way, if you're using 7.4 or later, would be to issue the query with
PQexecParams() and request binary results.  I think you'll have to
deal with byte order issues in that case.

This is off-topic for pgsql-admin; pgsql-interfaces or pgsql-general
would be more appropriate.

--
Michael Fuhr

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

Предыдущее
От: "sandhya"
Дата:
Сообщение: How to get OID return value(pls help me)
Следующее
От: "Dan Austin"
Дата:
Сообщение: Pgstat.tmp file activity