caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Guillaume Yziquel <guillaume.yziquel@citycable.ch>
To: Joel Reymont <joelr1@gmail.com>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] pg'ocaml and dumping sql statements
Date: Sun, 17 Apr 2011 16:58:30 +0200	[thread overview]
Message-ID: <20110417145830.GL1159@localhost> (raw)
In-Reply-To: <7BC64C7C-4F01-4869-B1DA-99C6AD7C0721@gmail.com>

Le Sunday 17 Apr 2011 à 15:08:10 (+0100), Joel Reymont a écrit :
> Are there any provisions in PG'OCaml to dump SQL statements being executed?

I'd suggest Printf.printf in the send_message function.

PG'OCaml talks the PostgreSQL protocol directly. So with the help of the
protocol description:

http://developer.postgresql.org/pgdocs/postgres/protocol-message-formats.html

you should be able to look at the query directly. See the Query message.
A 'Q' char, some 32 bit integers in network byte order for the length of
the message, followed by the textual query message.

> Query (F)
> 
>     Byte1('Q')
> 
>         Identifies the message as a simple query.
>     Int32
> 
>         Length of message contents in bytes, including self.
>     String
> 
>         The query string itself.

If you're dealing with prepared statements, you'll find all the
protocol information on the page mentionned above.

> 	Thanks, Joel

-- 
     Guillaume Yziquel


      reply	other threads:[~2011-04-17 14:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-17 14:08 Joel Reymont
2011-04-17 14:58 ` Guillaume Yziquel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110417145830.GL1159@localhost \
    --to=guillaume.yziquel@citycable.ch \
    --cc=caml-list@inria.fr \
    --cc=joelr1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).