Thread: Special characters and units

Special characters and units

From
Stefan Stern
Date:
Hi all,

I'm running PHP and PostgreSQL on a webserver to present data on the www.

I got a dataset that consists of measured values, each with a different
unit (micro, kilo,).

1. Where is the best place to store the units? In the identifier of each
column?

2. Some units are "micro gramms". Is there a way to store the special
character 'micro' (ASCII 181 / HEX B5) in the database or do I have to
use 10E-6 instead?

Thanks for any suggestions.

Regards,
Stefan Stern



Re: Special characters and units

From
"Shridhar Daithankar"
Date:
On 18 Sep 2002 at 16:17, Stefan Stern wrote:
> I'm running PHP and PostgreSQL on a webserver to present data on the www.
>
> I got a dataset that consists of measured values, each with a different
> unit (micro, kilo,).
>
> 1. Where is the best place to store the units? In the identifier of each
> column?

Or type of unit. I don't mean the multiplier.. You just have to put someplace
in database that id 3 is Kg and id 4 is meters.

> 2. Some units are "micro gramms". Is there a way to store the special
> character 'micro' (ASCII 181 / HEX B5) in the database or do I have to
> use 10E-6 instead?

That is the best way to do it IMO. Store units as I said above. And get them in
exponential format.

If you wish to take some trouble, you can inspect the mantissa by taking log,
find the nearest prefix on either side, appropriately scale the number and
return.. May be in a PL/PgSQL function. Just an usability issue IMO..

HTH..

Bye
 Shridhar

--
learning curve, n.:    An astonishing new theory, discovered by management
consultants    in the 1970's, asserting that the more you do something the    quicker
you can do it.