cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <>
Subject Re: How to do formatting of dates and times with SQLProcessor
Date Sat, 04 Dec 1999 07:34:03 GMT
On Fri, 3 Dec 1999, Stefano Mazzocchi wrote:

> Steve Muench wrote:
> > Can't you just rely on the database to format
> > the date in the format you want and keep the
> > <query> tags simpler?
> > 
> >   SELECT TO_CHAR(hiredate,'Month DD, YYYY) as hiredate
> >     FROM EMP
> >       :
> > 
> > Databases have pretty evolved number/date formatting
> > routines that handle all the NLS/locale issues already.
> Excuse the stupid question: are these SQL-portable?

Those particular functions aren't SQL-portable, but similar functions do
exist for most databases. However, since I at least often use one database
for development and another for deployment, and want to be able to switch
database servers at the drop of a hat, I'd like to at least offer the
option of doing column formatting in a database independent fashion. If
you, like Steve, want to do your formatting in the SQL, then go to town,
nobody's stopping you. :)

I think I like the syntax proposed by Ed Ward best so far:

        <column name="date1" format-type="date" format="yyyy-MM-dd">

because it also allows to reformatting of other data types (e.g. floats,
currencies), it could allow more arbitrary mappings of column names to
element names (though I personally wouldn't recommend it), and it would be
a great place to be able to flag a text column as containing XML data so
that a tree could be created instead of a text node.

> > Seems like a problem that you could push down a layer
> > and keep the model simpler in the "page"...
> You're totally right if the standard uses them, otherwise, Donald is
> right to have than handy and provide a new portable layer.
> Who's right?

Let's both be right. People who want simple XML can put the complexity in
the SQL, and people who want simple SQL can put the complexity in the XML.

- donald

View raw message