pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedMore stupid questions: prettyprinting of ints??
2+ messages / 1 participants
[nested] [flat]
* More stupid questions: prettyprinting of ints??
@ 2000-11-20 14:45 Bruno Boettcher <bboett@erm1.u-strasbg.fr>
0 siblings, 1 reply; 2+ messages in thread
From: Bruno Boettcher @ 2000-11-20 14:45 UTC (permalink / raw)
To: pgsql-sql
hello,
the thing i am making is a bookkepping program. This program handles
multiple currencies, each currency is formatted a bit differently on
from the other.
I do store the amounts as int's in the DB...
In another table i have sample format strings that could be used to
format them...
but if there is an inbuild functionality to format currencies, i will
gladly take it....
on the other hand is it possible to make substring operations in
postgres (some examples somewhere)?
What would be the best way to implement this thing?
--
ciao bboett
==============================================================
bboett@earthling.net
http://inforezo.u-strasbg.fr/~bboett http://erm1.u-strasbg.fr/~bboett
===============================================================
the total amount of intelligence on earth is constant.
human population is growing....
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: More stupid questions: prettyprinting of ints??
@ 2000-11-20 15:08 Bruno Boettcher <bboett@erm1.u-strasbg.fr>
parent: Bruno Boettcher <bboett@erm1.u-strasbg.fr>
0 siblings, 0 replies; 2+ messages in thread
From: Bruno Boettcher @ 2000-11-20 15:08 UTC (permalink / raw)
To: pgsql-sql
yeah forgot another thing....
i want also to write a SQL trigger to parse incoming fields for
preprocessing before DB insertion....
in perl i would do a thing like that:
$format = "9999.999.999,99"; #took out of DB...
#inserting a number into the db....
$theval =~ s/\.//g;
if($theval =~/\S+,\d{2}/)
{
$theval =~ s/,//g;
$theval *= 100;
}
#extracting a number from the db....
$f= $#format;
$i= $#theval;
$res = "";
while($i>=0)
{
if($format[$f] neq "9")
{
$res = $format[$f].$res
$f--;
}#if($format[$f] neq "9")
$res = $theval[$i].$res ;
$i--;
$f--;
}#while($i>=0)
any chance i could this get out of the frontend into the DB? (as sayd
want to write more frontends so the less is in the frontend and the more
in the DB...)
--
ciao bboett
==============================================================
bboett@earthling.net
http://inforezo.u-strasbg.fr/~bboett http://erm1.u-strasbg.fr/~bboett
===============================================================
the total amount of intelligence on earth is constant.
human population is growing....
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-11-20 15:08 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-11-20 14:45 More stupid questions: prettyprinting of ints?? Bruno Boettcher <bboett@erm1.u-strasbg.fr>
2000-11-20 15:08 ` Bruno Boettcher <bboett@erm1.u-strasbg.fr>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox