caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] pg'ocaml and dumping sql statements
@ 2011-04-17 14:08 Joel Reymont
  2011-04-17 14:58 ` Guillaume Yziquel
  0 siblings, 1 reply; 2+ messages in thread
From: Joel Reymont @ 2011-04-17 14:08 UTC (permalink / raw)
  To: caml-list

Are there any provisions in PG'OCaml to dump SQL statements being executed?

	Thanks, Joel

--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] pg'ocaml and dumping sql statements
  2011-04-17 14:08 [Caml-list] pg'ocaml and dumping sql statements Joel Reymont
@ 2011-04-17 14:58 ` Guillaume Yziquel
  0 siblings, 0 replies; 2+ messages in thread
From: Guillaume Yziquel @ 2011-04-17 14:58 UTC (permalink / raw)
  To: Joel Reymont; +Cc: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-04-17 14:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-17 14:08 [Caml-list] pg'ocaml and dumping sql statements Joel Reymont
2011-04-17 14:58 ` Guillaume Yziquel

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).