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.