Re: Extended Query using the Frontend/Backend Protocol 3.0

From: Raimon Fernandez <coder(at)montx(dot)com>
To: John DeSoi <desoi(at)pgedit(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Extended Query using the Frontend/Backend Protocol 3.0
Date: 2009-12-18 09:16:27
Message-ID: 0AADF4A5-E795-4F2D-AA2B-A4E1A4BD9D93@montx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-interfaces


On 18/12/2009, at 2:26, John DeSoi wrote:

>
> On Dec 17, 2009, at 11:13 AM, Raimon Fernandez wrote:
>
>> I'm trying to integrate the extended query protocol with my libraries.
>>
>> I'm sending a simple SELECT to validate the method, but I'm getting an Invalid Message Format.
>
> I did not add up your byte count, but maybe this will help:
>
>
> (write-byte p stream)
> (write-int32 (+ int32-length (length name) 1 (length sql-string) 1 int16-length (* int32-length param-count)) stream)
> (write-cstring name stream)
> (write-cstring sql-string stream)
> (write-int16 param-count stream)

I'm doing as you say:

mystatement => 11
select * from mytable; => 22

> (write-byte p stream)
50 => P

> (write-int32 (+ int32-length (length name) 1 (length sql-string) 1 int16-length (* int32-length param-count)) stream)

4 + 11 + 1 + 22 + 1 + 2 + 0 (param count=0) => 41

00 00 00 29 => length

> (write-cstring name stream)

6D7973746174656D656E74 00 => mystatement + null

> (write-cstring sql-string stream)

73656C656374202A2066726F6D206D797461626C653B 00 => select * from mytable; + null

> (write-int16 param-count stream)

00 00 => number of parameters, zero

any idea ???????

thanks,

regards,

r.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Durumdara 2009-12-18 12:30:46 Charset Win1250 on Windows and Ubuntu
Previous Message Craig Ringer 2009-12-18 07:57:41 Re: order of trigger firing relative to column/table constraints

Browse pgsql-interfaces by date

  From Date Subject
Next Message Raimon Fernandez 2009-12-18 21:44:10 Extended Query, flush or sync ?
Previous Message John DeSoi 2009-12-18 01:26:21 Re: Extended Query using the Frontend/Backend Protocol 3.0