From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p3HExgMS016460 for ; Sun, 17 Apr 2011 16:59:42 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ar4JAFj/qk1V2gB5Zmdsb2JhbACmJA0LCQgVJYhvug8OhWMEkhM X-IronPort-AV: E=Sophos;i="4.64,227,1301868000"; d="scan'208";a="81238327" Received: from emailfrontal2.citycable.ch ([85.218.0.121]) by mail3-smtp-sop.national.inria.fr with SMTP; 17 Apr 2011 16:59:37 +0200 X-Alinto-smtpauth-localdomain: Yes Received: from seldon (unknown [85.218.93.111]) (Authenticated sender: guillaume.yziquel@citycable.ch) by emailfrontal2.citycable.ch (Postfix) with ESMTPA id 7AD3520C29D; Sun, 17 Apr 2011 16:59:35 +0200 (CEST) Received: from yziquel by seldon with local (Exim 4.72) (envelope-from ) id 1QBTQk-0000DU-Jq; Sun, 17 Apr 2011 16:58:30 +0200 Date: Sun, 17 Apr 2011 16:58:30 +0200 From: Guillaume Yziquel To: Joel Reymont Cc: caml-list Message-ID: <20110417145830.GL1159@localhost> References: <7BC64C7C-4F01-4869-B1DA-99C6AD7C0721@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <7BC64C7C-4F01-4869-B1DA-99C6AD7C0721@gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p3HExgMS016460 Subject: Re: [Caml-list] pg'ocaml and dumping sql statements 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