db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Monroe <mon...@nc.rr.com>
Subject Re: [jira] [Commented] (TORQUE-355) Implement millisecond support for MySQL timestamps
Date Mon, 11 Mar 2019 19:31:14 GMT
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:
>      [ https://issues.apache.org/jira/browse/TORQUE-355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16789733#comment-16789733
]
>
> 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}
> org.apache.torque.templates.transformer.sql.SQLModelTransformer.getDdlSql(Column, ControllerState){code}
> for _default_ values
>
> 1. extracting for any default (DEFAULT_DATE_FORMAT)
> {code:java}
> org.apache.torque.templates.transformer.om.OMColumnTransformer.getDefaultValueAsDate(String)
> {code}
>   
>
> 2. setting platform specific
>
>   
> {code:java}
> org.apache.torque.templates.platform.Platform.getTimestampString(Date){code}
>   
>
> 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.
Mime
  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message