Hello:

I'm trying to read an array, using binary format code and my own 
implementation of the 3.0 protocol in C#, at this moment i have made 
test with arrays of int2 and float4,  seems that the server sends a 
header of 24 bytes before the data in the buffer, i need to know what 
these 24 bytes mean :), i think that:

	 00-03 -> ??
	 04-07 -> ??
	 08-11 -> typelem
	 12-15 -> ??
	 16-19 -> ??
	 20-23 -> typlen


Can anybody tell me what these 24 means or where to see it in the 
PostgreSQL documentation


Thanks in advance.


-- 
Best regards

Carlos Guzmï¿½n ï¿½lvarez
Vigo-Spain


Sun, 29 Jun 2003 21:34:33 +0200
Carlos Guzman Alvarez <carlosga@telefonica.net>
Question about array read using protocol 3.0 implementation in C#
Carlos Guzman Alvarez <carlosga@telefonica.net> writes:
> I'm trying to read an array, using binary format code and my own 
> implementation of the 3.0 protocol in C#, at this moment i have made 
> test with arrays of int2 and float4,  seems that the server sends a 
> header of 24 bytes before the data in the buffer, i need to know what 
> these 24 bytes mean :),

Use the source Luke ... array_send, in backend/utils/adt/arrayfuncs.c,
does this:

	/* Send the array header information */
	pq_sendint(&buf, ndim, 4);
	pq_sendint(&buf, v->flags, 4);
	pq_sendint(&buf, element_type, sizeof(Oid));
	for (i = 0; i < ndim; i++)
	{
		pq_sendint(&buf, ARR_DIMS(v)[i], 4);
		pq_sendint(&buf, ARR_LBOUND(v)[i], 4);
	}

I believe flags is always 0 at the moment; it might be a good idea
to punt if you see a nonzero there.

			regards, tom lane

Sun, 29 Jun 2003 18:29:18 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Question about array read using protocol 3.0 implementation in C#
Hello:


> Use the source Luke ... array_send, in backend/utils/adt/arrayfuncs.c,
> does this:
> 
> 	/* Send the array header information */
> 	pq_sendint(&buf, ndim, 4);
> 	pq_sendint(&buf, v->flags, 4);
> 	pq_sendint(&buf, element_type, sizeof(Oid));
> 	for (i = 0; i < ndim; i++)
> 	{
> 		pq_sendint(&buf, ARR_DIMS(v)[i], 4);
> 		pq_sendint(&buf, ARR_LBOUND(v)[i], 4);
> 	}

Thanks very much.


> I believe flags is always 0 at the moment; it might be a good idea
> to punt if you see a nonzero there.

I have added code for check it.




-- 
Best regards

Carlos Guzma'n A'lvarez
Vigo-Spain

- Miembro del Proyecto FirebirdSQL.
- Miembro honorario de la Fundacio'n FirebirdSQL.

http://www.firebirdsql.org


Mon, 30 Jun 2003 12:02:20 +0200
Carlos Guzman Alvarez <carlosga@telefonica.net>
Re: Question about array read using protocol 3.0 implementation
Hello:

Thanks another wuestion in this case about oidvector i'm reviewing
oidvectorsend() at backend/utils/adt/oid.c and seems that for this
datatype the server sends only array data, i'm rigth ??, i think yes but
i want to be sure ;) ( and i think the same can be applied to int2vector
?? )





-- 
Best regards

Carlos Guzmï¿½n ï¿½lvarez
Vigo-Spain




Mon, 30 Jun 2003 16:49:26 +0200
Carlos Guzman Alvarez <carlosga@telefonica.net>
Re: Question about array read using protocol 3.0 implementation
Carlos Guzman Alvarez <carlosga@telefonica.net> writes:
> Thanks another wuestion in this case about oidvector i'm reviewing
> oidvectorsend() at backend/utils/adt/oid.c and seems that for this
> datatype the server sends only array data, i'm rigth ??, i think yes but
> i want to be sure ;) ( and i think the same can be applied to int2vector
> ?? )

Right, the fixed-length array types are a whole 'nother critter.

			regards, tom lane

Mon, 30 Jun 2003 11:08:33 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Question about array read using protocol 3.0 implementation 
Hello:

> Right, the fixed-length array types are a whole 'nother critter.

Thanks


-- 
Best regards

Carlos Guzmï¿½n ï¿½lvarez
Vigo-Spain


Mon, 30 Jun 2003 17:11:21 +0200
Carlos Guzman Alvarez <carlosga@telefonica.net>
Re: Question about array read using protocol 3.0 implementation