[Pljava-dev] VarLenTuple example code

From: schabi at logix-tt(dot)com (Markus Schaber)
To:
Subject: [Pljava-dev] VarLenTuple example code
Date: 2006-09-29 10:14:41
Message-ID: 451CF211.7000000@logix-tt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

Hi, Thomas,

Let's recall the 4 representations I enumerated:

A) the "canonical text representation"
B) the "canonical binary representation"
C) the "internal" representation
D) Java Objects.

Thomas Hallgren wrote:

> No. Just one SQLData implementation per type. The parameter to
> readSQL should be an SQLInput wrapping the exact bytes that you would
> expect to be the parameter to the receive function. The writeSQL will
> create the bytes that would otherwise be be created by the send
> function.

Ok, so then the writeSQL and readSQL are meant to convert between the
representations B and D.

>From the examples and some points of our discussion, I had the
impression they should convert between C and D.

> Normally when you create a type in PostgreSQL you'd create four
> functions in C. Now you create four methods in Java instead:
>
> input -> parse
> output -> toString
> receive -> readSQL
> send -> writeSQL

Yes. Those four functions, as I understand it, do the following
representation conversions:

input: A -> C
output: C -> A
receive: B -> C
send: C -> B

The java methods should do the following tasks:

parse: A -> D
toString: D -> A
readSQL: B -> A & C -> A
writeSQL: A -> B & A -> D

The whole thing only makes sense for me under the assumption that the
representations B and C are identical.

But having them different is the whole point of why explicit send/
receive functions were invented in PostgreSQL, IIRC.

They are not equal for all PostgreSQL numerical datatypes I checked in
source, those convert to network byte order in send(), and back to
platform in receive().

The same is for PostGIS, which uses a compatible extension of the
OpenGIS defined "Well Known Binary" standard format for B, and an
optimized format in platform endiannes that tends to change between
major releases for C.

Thanks,
Markus
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org

In response to

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Thomas Hallgren 2006-09-29 10:51:25 [Pljava-dev] VarLenTuple example code
Previous Message Thomas Hallgren 2006-09-28 16:07:06 [Pljava-dev] VarLenTuple example code