Обсуждение: Spanish format on date and numbers

Поиск
Список
Период
Сортировка

Spanish format on date and numbers

От
"Oscar Serrano"
Дата:

Hi:
I'm from Spain. I've exported some tables from MS Access to Postgres. You
know, in Spain, a number like this: 1,234.56 me write it like this:
1.234,56
i.e., the thousand separator is the "." and the decimal separator is the ","
 
I'm going to use Perl (DBI) to get the data from the databases.
Is there anyway so DBI or postgress gives me the data in the spanish format?
 
I wouldn't like to use somethink like this:
$result=~s/\./,/g;
to convert all "." to "," and vice-versa.
 
Thank you very much
 
______________________________
 
Oscar Serrano
 
 

Re: [INTERFACES] Spanish format on date and numbers

От
"Patrick Welche"
Дата:
Oscar Serrano wrote:
> 
> I'm from Spain. I've exported some tables from MS Access to Postgres.  You
> know, in Spain, a number like this: 1,234.56 me write it like this: 1.234,56
> i.e., the thousand separator is the "." and the decimal separator is the ","

I have never tried, but when building postgresql from source,
configure --enable-locale
might be the answer? (cf. Oleg's page http://www.sai.msu.su/~megera/postgres/)

Cheers,

Patrick


RE: [INTERFACES] Spanish format on date and numbers

От
"Oscar Serrano"
Дата:
----- Original Message -----
From: Patrick Welche <prlw1@newn.cam.ac.uk>
To: Oscar Serrano <oserra@fondos.net>
Cc: <pgsql-interfaces@postgreSQL.org>
Sent: Friday, November 26, 1999 8:00 PM
Subject: Re: [INTERFACES] Spanish format on date and numbers


> Oscar Serrano wrote:
> >
> > I'm from Spain. I've exported some tables from MS Access to Postgres.
You
> > know, in Spain, a number like this: 1,234.56 me write it like this:
1.234,56
> > i.e., the thousand separator is the "." and the decimal separator is the
","
>
> I have never tried, but when building postgresql from source,
> configure --enable-locale
> might be the answer? (cf. Oleg's page
http://www.sai.msu.su/~megera/postgres/)
>
> Cheers,
>

Hi again :-)
Reading some web sites, it seems that, yes, I must use the --enable-locale
at configuration time.
And it seems that I must first define and export the variables LANG, LC_ALL,
LC_CTYPE (and probably LC_COLLATE).
The LANG variable seems to must be: LANG="es_ES", for spanish configuration.
The LC_CTYPE must be something like this: LC_CTYPE="ISO8859-1". But, what is
the ISO for spain?

So, if I define this variables and use the --enable-locale, the psql will
return the numbers and dates in the spanish format?
I can't believe it.

Where are the files that defines how is the spanish format? You know, I'm
installing postgres in a ISP in USA, so very probably, the dedicated server
where I'm installing it, hasn't this files. I think I will need to modify
them, or to upload the spanish definition files.

Thank you very much.


> Patrick
>
> ************
>



Re: [INTERFACES] Spanish format on date and numbers

От
"Patrick Welche"
Дата:
Oscar Serrano wrote:

> And it seems that I must first define and export the variables LANG, LC_ALL,
> LC_CTYPE (and probably LC_COLLATE).
> The LANG variable seems to must be: LANG="es_ES", for spanish configuration.
> The LC_CTYPE must be something like this: LC_CTYPE="ISO8859-1". But, what is
> the ISO for spain?

Vague memory tells me it's ISO8859-2. I use LC_CTYPE=iso_8859_1, as in my
/usr/share/locale directory (this is under NetBSD) I have

% ls /usr/share/locale
de         es         iso_8859_1 nl         pl         sl
el         fr         ko         no         ru         sv
% ls /usr/share/locale/iso_8859_1
LC_CTYPE

I don't know where I would find nor how to write an appropriate LC_CTYPE
file - never needed to, and never tried --enable-locale - I just set LC_CTYPE
for nice keyboard sequences.

> So, if I define this variables and use the --enable-locale, the psql will
> return the numbers and dates in the spanish format?
> I can't believe it.

There's only one way to find out!

Good luck,

Patrick


datetime, JDBC, and MS Access

От
"Oscar Serrano"
Дата:
Hi:
Probably someone of you can tellme what am I doing wrong:

I create a table in psql, with an unique column of the type "date" wich name
is "columdate".
Then, via JDBC, I try to put the content of that column in a Java Date
object. OK, no problem. I write this:

Date mydate=rs.getDate("columndate");

Now I can operate with mydate normaly.

But the PROBLEM is when in psql, the column "columndate" is of the type
"datetime". In that case, the java sentence puts null to mydate.

Why as "date" works and as "datetime" it doesn't work?

If also tried this:
Timestamp mydate=rs.getTimestamp("columndate");

but it doesn't work.

I would define de column as "date" the problem is solved, but, you know, the
tables are created exporting them from MS Access via ODBC, and when exported
so, postgresql converts to "datetime" all columns that in MS Access were of
the type "Date/Hour".

I could get my problem solved if some of you knows how to tell Access to
export "Date/Hour" types to postgresql "date" in side of  "datetime".

Thank you very much.