Search Postgresql Archives

Re: CStringGetTextDatum and other conversions in server-side code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 happens to 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 2xint64 and 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's enough, but I may go for something bigger in future. Most likely the simplest solution will be to use string as an intermediate.

[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 routines into 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






-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux