Обсуждение: help:steps needed to get the content of table from the database.. .

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

help:steps needed to get the content of table from the database.. .

От
"Smitha V. Babu"
Дата:
Hi all...
I am using libpq interface to create a C application which is taking the
needed data from
a database....

I created a database and added 3 tables to it named weather, cities and
teamdatabase.
I make the connection with database ...
After that i tried to execute the command SELECT * FROM weather by giving as
res = PQexec(conn,"SELECT * FROM weather");

what are the steps needed to get the content of table from the database...

can any one of you give me few guide lines....

Thanking in advance
With regards
smitha

*********************************************************************
Disclaimer: The information in this e-mail and any attachments is
confidential / privileged. It is intended solely for the addressee or
addressees. If you are not the addressee indicated in this message, you may
not copy or deliver this message to anyone. In such case, you should destroy
this message and kindly notify the sender by reply email. Please advise
immediately if you or your employer does not consent to Internet email for
messages of this kind.
*********************************************************************

Re: help:steps needed to get the content of table from the

От
"A.Bhuvaneswaran"
Дата:
> I created a database and added 3 tables to it named weather, cities and
> teamdatabase.
> I make the connection with database ...
> After that i tried to execute the command SELECT * FROM weather by giving as
> res = PQexec(conn,"SELECT * FROM weather");

Further you could use,
1) PQresultStatus(res)
2) PQntuples(res)
3) PQnfields(res)
4) PQgetvalue(res, n, n)

For details, please refer the below link:

http://www.postgresql.org/docs/view.php?version=7.3&idoc=1&file=programmer-client.html

Refer Asynchronous Query Processing in the above link for even more
specific details.

regards,
bhuvaneswaran


Re: help:steps needed to get the content of table from the

От
Tom Lane
Дата:
"A.Bhuvaneswaran" <bhuvan@symonds.net> writes:
> Further you could use,
> 1) PQresultStatus(res)
> 2) PQntuples(res)
> 3) PQnfields(res)
> 4) PQgetvalue(res, n, n)

> For details, please refer the below link:

Also look at the example programs that come with libpq.  In the source
distribution they are in src/test/examples/.  I am not sure whether they
are included in any binary RPMs though, or where the RPMs put them if
they do have 'em ...

            regards, tom lane