Re: Extended Query using the Frontend/Backend Protocol 3.0 - Mailing list pgsql-general

From Raimon Fernandez
Subject Re: Extended Query using the Frontend/Backend Protocol 3.0
Date
Msg-id 0AADF4A5-E795-4F2D-AA2B-A4E1A4BD9D93@montx.com
Whole thread Raw
In response to Re: Extended Query using the Frontend/Backend Protocol 3.0  (John DeSoi <desoi@pgedit.com>)
Responses Extended Query, flush or sync ?
List pgsql-general
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.





pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: order of trigger firing relative to column/table constraints
Next
From: Durumdara
Date:
Subject: Charset Win1250 on Windows and Ubuntu