db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Georg Kallidis" <georg.kalli...@cedis.fu-berlin.de>
Subject Antwort: Re: [jira] [Commented] (TORQUE-355) Implement millisecond support for MySQL timestamps
Date Tue, 12 Mar 2019 13:34:05 GMT
Hi Greg,

as far as I can see, datetime is already mapped to sql type timestamp and 
timestamp does exist in xsd (and mssql and mysql, 

Postgresql has timestamp with precision and zone, but this has yet to be 
added to Torque templates platform.

But how to change/handle the mapping for one database (platform) and not 
the others? May may just as simple as evaluating a parameter? If scale is 
provided it is added and in another database this will be ignored?

But how to achieve this dynamically (scale from 0 to 6)? Just one regex, 
or not? But may be caring about setting a default value (keeping the 
precision) may not really worth the effort, as for (later in the Java 
classes) it's sufficient to get the schema->sql mapping correct + the Java 
type mapping.

(I am still investigating..). Thanks for your comment!

Best regards, Georg

Von:    Greg Monroe <monroe@nc.rr.com>
An:     torque-dev@db.apache.org
Datum:  11.03.2019 20:34
Betreff:        Re: [jira] [Commented] (TORQUE-355) Implement millisecond 
support for MySQL timestamps

Having done some of the datetime stuff way back, I'm curious how you 
will handle mapping this in the other supported database servers.

For example, I know that MSSQL supports a similar DATETIME format.  I 
think Oracle only goes to the second.  AFAIK Postgresql and Derby  
currently don't have a DateTime.

Also, should the dtd (non-strict?) will have to be updated with the new 
column type?

On 3/11/2019 12:21 PM, Georg Kallidis (JIRA) wrote:
>      [ 

> Georg Kallidis commented on TORQUE-355:
> ---------------------------------------
> 1) schema->sql
> If setting in schema.xml
> {code:java}
> <column
> name="datetime"
> required="true"
> type="TIMESTAMP"
> size="6"
> />
> {code}
> the sql is already set correctly
> {code:java}
> datetime DATETIME(6) NOT NULL{code}
> Note: I am not sure, if _scale_ should not be the proper attribute, but 
changing this nothing happens - it's not used in mapping..
> But setting the _default_ for a column to a value, is not quite as easy 
(in schema.xml).
> At least _*two patterns*_ are applied in this case in the mapping in
> {code:java}
> for _default_ values
> 1. extracting for any default (DEFAULT_DATE_FORMAT)
> {code:java}
> {code}
> 2. setting platform specific
> {code:java}
> Changing the latter e.g. in
> {code:java}
> org.apache.torque.templates.platform.PlatformMysqlImpl
> {code}
>   might not be sufficient. Depending on the size different patterns 
should be applied as the DEFAULT_DATE_FORMAT might not be parsable.-> add 
a size parameter to both mappers ?
>   2) schema -> java
> TODO  ... ?
> 3) Last not least
> As far as I can see java 1.8 is now standard in Torque trunk - may be 
all Date interfaces should be migrated to DateTime using java.time ?
>> Implement millisecond support for MySQL timestamps
>> --------------------------------------------------
>>                  Key: TORQUE-355
>>                  URL: https://issues.apache.org/jira/browse/TORQUE-355
>>              Project: Torque
>>           Issue Type: Improvement
>>           Components: Runtime, Templates, Test Project
>>     Affects Versions: 4.0
>>          Environment: MySQL
>>             Reporter: Thomas Vandahl
>>             Priority: Major
>> MySQL 5.6.4 and up expands fractional seconds support for TIME, 
DATETIME, and TIMESTAMP values, with up to microseconds (6 digits) 
precision. This needs to be supported.
>> See https://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html
> --
> This message was sent by Atlassian JIRA
> (v7.6.3#76005)
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org

Sent from my Android device with K-9 Mail. Please excuse my brevity.

View raw message