Morgan Delagrange wrote:
> 
> Hi Marius,
> 
> Since their syntax is so different, I'm thinking about
> creating separate getDate, getTime and getTimestamp
> tags.  I like the idea of distinct functionality
> having a distinct tag, and it would also remove the
> need for passing in the field name of the JDBC type.
> What do you think?

It sounds pretty good. This will leave only the optional
"format" and "locale" attributes. Along these lines we
should add two more tags then: getFloat and getInt.

getFloat would deal with the REAL, FLOAT and DOUBLE types,
all treated as Double. getInt would deal with TINYINT,
SMALLINT, INTEGER and BIGINT, all treated as Long.
We could make the "format" attribute required for these
two tags since it is the only reason to use them.

The "format" attribute should not be required for getDate,
and getTime though. Some databases don't have date and time 
types, only timestamp (MS SQL Server). In these cases, 
unless you specifically ask for date or time, you always
get a timestamp. Just by using getDate or getTime tag
you can extract the corresponding parts.

getTimestamp should require the "format" attribute.

I could create all these tags based on the code I
wrote so far. Let me know if I should do it.

Cheers,
Marius

> 
> - Morgan
> 
> --- Marius Scurtescu <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I started using the new version and it works fine.
> >
> > It was a good idea to consolidate all the setter and
> > getter methods, but this came with a minor drawback:
> > since everything is treated as a String no specific
> > formatting can be used.
> >
> > In order to deal with the formatting I added a few
> > more attributes to the getColumn tag. These
> > attributes
> > are:
> > - type, a JDBC type
> > - format, a formatting pattern or style
> > - locale, the locale
> >
> > If you use the "type" attribute only it will affect
> > the DATE, TIME and TIMESTAMP columns. The three
> > corresponding Java classes have different "toString"
> > methods and you can control what will be displayed.
> >
> > The "format" will take a value dependent on the
> > type.
> > For numeric types it can be either a pattern as
> > accepted by the DecimalFormat constructor or
> > a style: "CURRENCY", "PERCENT" or "NUMBER".
> > For date types it can be either a pattern as
> > accepted by SimpleDateFormat or a style: "FULL",
> > "LONG", "MEDIUM" or "SHORT". For TIMESTAMP it
> > also can be a comma separated list of two styles,
> > one for date and one for time.
> >
> > The locale can have one to three components as
> > accepted by the Locale constructor: language,
> > country and variant. They are separated by "_".
> >
> > Examaples:
> > <jdbc:getColumn name="Start" type="DATE"
> > format="FULL"/>
> > <jdbc:getColumn name="End" type="TIME"/>
> > <jdbc:getColumn name="Next" type="TIMESTAMP"
> > format="SHORT,MEDIUM" locale="ro_RO"/>
> > <jdbc:getColumn name="Now" type="TIMESTAMP"
> > format="LONG"/>
> > <jdbc:getColumn name="Amount" type="CURRENCY"
> > locale="de_DE"/>
> >
> > Since I have no commit rights I will email the
> > changes I made to Morgan. I tested them today
> > and so far they are OK.
> >
> > Cheers,
> > Marius
> >
> >
> > Morgan Delagrange wrote:
> > >
> > > --- Marius Scurtescu <[EMAIL PROTECTED]>
> > wrote:
> > > > Hi Morgan,
> > > >
> > > > I will try the new version either today or
> > tomorrow.
> > > > The original version did not work out of the box
> > > > for me and I had to make a few, small,
> > modifications
> > > > and recompile.
> > > >
> > > > From the top of my head, the changes I made
> > were:
> > > > - added a String version to a setter method to
> > make
> > > > it work with JRun (this was confirmed to be a
> > JRun
> > > > problem but the fix is so simple that it is
> > worth
> > > > doing)
> > >
> > > Sure, I didn't get a chance to create String
> > setter
> > > methods for all the tags.  If you want to fix it,
> > feel
> > > free!
> > >
> > > > - added a "name" attribute to the getter methods
> > so
> > > > you can retrieve fields by name as well
> > > > - added validation code to the getter TEI class
> > to
> > > > check that
> > > > only one of "position" or "name" attributes is
> > used
> > >
> > > Yeah, I changed my mind about that; it sounds like
> > a
> > > good idea now.  If you want to tackle it, please
> > do.
> > >
> > > Thanks, Marius!
> > >
> > > - Morgan
> > >
> > > P.S. WTF is up with all these "Undelivered Mail
> > > Returned to Sender" emails we've been getting from
> > the
> > > list this week?  Who is this?
> > >
> > > <[EMAIL PROTECTED]>: Name service
> > error
> > > for domain
> > >     localhost.suninternet.com: Host not found
> > >
> > > =====
> > > Morgan Delagrange
> > > Britannica.com
> > >
> > > __________________________________________________
> > > Get personalized email addresses from Yahoo! Mail
> > - only $35
> > > a year!  http://personal.mail.yahoo.com/
> >
> > --
> > ------------------
> > Marius Scurtescu, Software Engineer
> > Tel: (604) 899-2835 Fax: (604) 899-2899
> > mailto:[EMAIL PROTECTED]
> > Multiactive Software Inc. http://www.multiactive.com
> > ------------------
> > Attract and retain customers with Multiactive
> > Software --
> > proud winners of PC WEEK's "Best of COMDEX" award.
> > ------------------
> 
> =====
> Morgan Delagrange
> Britannica.com
> 
> __________________________________________________
> Get personalized email addresses from Yahoo! Mail - only $35
> a year!  http://personal.mail.yahoo.com/

-- 
------------------
Marius Scurtescu, Software Engineer
Tel: (604) 899-2835 Fax: (604) 899-2899
mailto:[EMAIL PROTECTED]
Multiactive Software Inc. http://www.multiactive.com
------------------
Attract and retain customers with Multiactive Software --
proud winners of PC WEEK's "Best of COMDEX" award.
------------------

Reply via email to