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