all the text types are simply a 32bit length and an array of
characters. you need to be aware of the encoding, and null is just
another character.
[dmb>] Yes, I can see that. What I need is a function that will convert to and from whatever the actual encoding
happensto be into Unicode, period. I can handle UTF8/16/32 as long as I know which.
single and double real/floats are stored in standard x86 IEEE floating point.
[dmb>] Apart from the x86/x64 oddity that seems easy enough (I'm using x64).
the date and time types are all fixed lengths, mostly a long int or two.
[dmb>] Again, I just need a function to convert to and from one single date/time format that covers everything. I use
2xint64and no TZ. It covers year 9999 down to milliseconds and then some.
numeric in postgres is a bit tricky. its a decimal number stored in
base 10000 as a series of short integers, and can represent. does your
language even have a decimal or BCD or something numeric type?
[dmb>] Of course. I have decimal which is also 2xint64: it equates to about 28 digits. For business purposes I think
that'senough, but I may go for something bigger in future. Most likely the simplest solution will be to use string as
anintermediate.
[dmb>] The point is that none of my code is in C, so I can't get Postgres macros or data types and my conversion
routinesinto the same scope. That's why I'm looking for basic routines that support basic C data types as the go
between,so I don't have to write too much C code.
Regards
David M Bennett FACS
Andl - A New Database Language - andl.org