From: Laurenz Albe <laurenz.albe@cybertec.at>
To: a <372660931@qq.com>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: How can I retrieve double or int data type for libpq
Date: Wed, 13 Jun 2018 06:29:51 +0200
Message-ID: <1528864191.2657.11.camel@cybertec.at> (raw)
In-Reply-To: <tencent_70C980697DC61B1F0AA54018@qq.com>
References: <tencent_70C980697DC61B1F0AA54018@qq.com>
a wrote:
> I wanna use C library to connect pgsql server and I got 2 questions:
This is all well documented in
https://www.postgresql.org/docs/current/static/libpq.html> 1, If I can fetch a row's data instead of using PQgetvalue?
PGgetvalue *is* the way to fetch the row's data.
There is no call to fetch *all* columns at once, but that is
not necessary.
> 2, PQgetvalue will return all data as text, I would have to convert them into the
> relative data type, is there a way of getting data by its original format?
You will get the data in binary form if you specify a resultFormat of 1
with PQexecParams.
Note, however, that they will be in the native binary format of the *server*.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: laurenz.albe@cybertec.at, 372660931@qq.com
Subject: Re: How can I retrieve double or int data type for libpq
In-Reply-To: <1528864191.2657.11.camel@cybertec.at>
References: <tencent_70C980697DC61B1F0AA54018@qq.com> <1528864191.2657.11.camel@cybertec.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox