Re: convertion from mySQL (mysql_fetch_row)

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Masis, Alexander (US SSA)" <alexander(dot)masis(at)baesystems(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: convertion from mySQL (mysql_fetch_row)
Date: 2008-08-22 19:23:19
Message-ID: b42b73150808221223h6c633f15o45ffd9a598844656@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 22, 2008 at 2:20 PM, Masis, Alexander (US SSA)
<alexander(dot)masis(at)baesystems(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2008-08-22 19:25:08 Re: CREATE CAST too strict?
Previous Message Bruce Momjian 2008-08-22 18:47:14 Re: [HACKERS] Userset logging