[jira] [Commented] (TORQUE-355) Implement millisecond support for MySQL timestamps

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (TORQUE-355) Implement millisecond support for MySQL timestamps

Rick Hillegas (Jira)

    [ 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [jira] [Commented] (TORQUE-355) Implement millisecond support for MySQL timestamps

Greg Monroe-3
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: [hidden email]
> For additional commands, e-mail: [hidden email]
>

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Reply | Threaded
Open this post in threaded view
|

Antwort: Re: [jira] [Commented] (TORQUE-355) Implement millisecond support for MySQL timestamps

Georg Kallidis-2
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,
org.apache.torque.templates.typemapping.SchemaType)?

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 <[hidden email]>
An:     [hidden email]
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:
>      [
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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.


smime.p7s (14K) Download Attachment
tv
Reply | Threaded
Open this post in threaded view
|

Re: Antwort: Re: [jira] [Commented] (TORQUE-355) Implement millisecond support for MySQL timestamps

tv
Hi Georg,

On 12.03.19 14:34, Georg Kallidis wrote:
> Postgresql has timestamp with precision and zone, but this has yet to be
> added to Torque templates platform.

Just for the record: HSQLDB added zone awareness somewhere between 2.3
and 2.4.1 which causes the Torque tests to fail.

Bye, Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]