db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <Fisc...@seitenbau.net>
Subject Re: accuracy of TIME columns
Date Tue, 28 Dec 2004 09:37:56 GMT




Hi

Well, I didn't want to bother non-Oracle people with oracle details. So the
thing is that Oracle's DATE format has seconds accuracy, and there is no
TIME type. So the DB should be able to save and retrieve even DATE fields
with seconds precision, no problem there.

My next thought was that maybe something in Torque looks at the types. So I
set TIME=TIME in db.props, ran the runtime tests to generate the object
model(of course the test failed because the table could not be created),
created the table manually and ran the test class manually. But still only
day accuracy.

So looking into Torque and Village code, it seems to me that for TIME
colums, Torque uses a java.util.Date object. Then, village looks at the
type of the object, says  "well, it's java.util.Date, lets format it with
day accuracy", and the insert is done with day accuracy. But if this is the
case, all other DBs should have the same problem, and as I do not have an
easy possibility to check that, It would be very helpful if someone did
that for me.

  Thanks in advance,

   Thomas


"Henning P. Schmiedehausen" <hps@intermeta.de> schrieb am 28.12.2004
10:11:21:

> Thomas Fischer <Fischer@seitenbau.net> writes:
>
> >Hi,
>
> >I am currently checking a bug report
> >(http://nagoya.apache.org/scarab/issues/id/TRQS263). I am investigating
the
> >accuracy of TIME columns. The problem is that saving a TIME value and
> >retrieving it again from an Oracle DB only has day accuracy, not second
> >accuracy as one would expect from the SQL type TIME.
>
> Sounds like the mapping of the TIME type in db.props is wrong. And from
> db-torque-
> TORQUE_3_1_BRANCH/src/generator/src/templates/sql/base/oracle/db.props:
>
> --- cut ---
> DATE = DATE
> TIME = DATE
> TIMESTAMP = DATE
> --- cut ---
>
> the reason for this is clear. All TIME types are mapped to DATE, which
> _has_ only "day resolution". No magic here. :-)
>
> >While stepping through the code, I have come to the conclusion that this
> >problem might not be a oracle problem, but might also occur in other
> >databases. To check this, I have just committed a test case to CVS
branch
> >TORQUE_3_1_BRANCH. Can anyone whoe does _NOT_ use oracle please check
this
> >out and run the runtime-tests? At some point, there should be output
like
>
> This is even easier:
>
> src/generator/src/templates/sql/base/axion/db.props:TIME = time
> src/generator/src/templates/sql/base/cloudscape/db.props:TIME = TIME
> src/generator/src/templates/sql/base/db2400/db.props:TIME = TIME
> src/generator/src/templates/sql/base/db2/db.props:TIME = TIME
> src/generator/src/templates/sql/base/hypersonic/db.props:TIME = time
> src/generator/src/templates/sql/base/interbase/db.props:TIME =
> src/generator/src/templates/sql/base/msaccess/db.props:TIME = time
> src/generator/src/templates/sql/base/mssql/db.props:TIME = DATETIME
> src/generator/src/templates/sql/base/mysql/db.props:TIME = TIME
> src/generator/src/templates/sql/base/oracle/db.props:TIME = DATE
> src/generator/src/templates/sql/base/postgresql/db.props:TIME = time
> src/generator/src/templates/sql/base/sapdb/db.props:TIME = TIME
> src/generator/src/templates/sql/base/sybase/db.props:TIME = TIMESTAMP
>
> => all but Oracle should work. Why does the Oracle mapping has TIME =
> DATE? I don't know.
>
>    Regards
>       Henning
>
>
> --
> Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
> hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/
>
> RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for
hire
>    Linux, Java, perl, Solaris -- Consulting, Training, Development
>
> What is more important to you...
>    [ ] Product Security
> or [ ] Quality of Sales and Marketing Support
>               -- actual question from a Microsoft customer survey
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message