convertion from mySQL (mysql_fetch_row)

Started by Masis, Alexander (US SSA)over 17 years ago2 messages
#1Masis, Alexander (US SSA)
alexander.masis@baesystems.com

People,
I am converting C++ code to Postgres.
Need help on how to deal with mysql_fetch_row, mysql_store_result
functions in Postgres? There should be some C/C++ code available for
these things, I hope.
Thanks,
Alex.

#2Merlin Moncure
mmoncure@gmail.com
In reply to: Masis, Alexander (US SSA) (#1)
Re: convertion from mySQL (mysql_fetch_row)

On Fri, Aug 22, 2008 at 2:20 PM, Masis, Alexander (US SSA)
<alexander.masis@baesystems.com> wrote:

People,
I am converting C++ code to Postgres.
Need help on how to deal with mysql_fetch_row, mysql_store_result
functions in Postgres? There should be some C/C++ code available for
these things, I hope.
Thanks,
Alex.

http://www.postgresql.org/docs/8.3/interactive/libpq.html
in particular,
http://www.postgresql.org/docs/8.3/interactive/libpq-exec.html#LIBPQ-EXEC-SELECT-INFO

The libpq API is slightly thicker than mysql, which essentially
returns char ** for MYSQL_ROW.

With pg, you have a lot of flexibility with how you send queries,
parameterized, asynchronous, prepared, etc. For starters though you
want to look at PQexec which maps to (iirc) mysql_real_query, more or
less.

libpq has very nice handling of binary data -- the protocol has
ability to send and receive blobs (and other things) without escaping
-- which is nice.

merlin