You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by Massimo Manghi <mx...@apache.org> on 2012/08/13 13:04:30 UTC

testing the DIO connector class for Oracle

I'm fixing a problem with method makeDBFieldValue in the concrete DBMS
class implementations. 

this method was introduced as a tool to provide a uniform way to handle
date, time and timestamp database fields when building SQL queries with
Tcl. One of the cases handled by this method is when you want to have a
time reference expressed in seconds (Unix epoch) to be compared, for
instance, with the output of [clock seconds]. 

The "SECS" case of the method was wrong in Sqlite and Mysql as the
number of seconds value was built creating a sort of serial number by
concatenating the datetime as <year><month><day><hr><min><sec>. This
clearly is a number which bumps up by 40 units every minute at least
(much more when for example the minutes hand completes a lap) making the
comparison with [clock seconds] useless, but also making delta times
computed with it not comparable with real seconds durations. This is the
case of class Session which uses this method to determine when a session
has to be refreshed or removed from the database.  This bug had so far
no noticeable side effect in Session because a session lifetime is
usually several hours while the discrepancy becomes relevant when
comparing time intervals of the order of minutes.

I fixed and commited the classes Sqlite and Mysql and I'm going to fix
also Postgresql. I could also fix the Oracle class. Oracle has no native
way to return the Unix timestamp in SQL queries. A workaround exists but
I don't have an Oracle installation to test it, so I please any Oracle
user to volunteer for a test (I can provide simple scripts for testing
it with the Session package)

 -- Massimo
 


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


Re: testing the DIO connector class for Oracle

Posted by Ronnie Brunner <ro...@netcetera.com>.

> Are you sure something like this will not work on Oracle?
> 
> SELECT (SYSDATE - TO_DATE('01/01/1970 00:00:00', 'MM-DD-YYYY HH24:MI:SS'))
> *
> 24 * 60 * 60 FROM DUAL

Connected to:
Oracle Database 11g Release 11.2.0.2.0 - 64bit Production

SQL> SELECT (SYSDATE - TO_DATE('01/01/1970 00:00:00', 'MM-DD-YYYY HH24:MI:SS')) * 24 * 60 * 60 SECS FROM DUAL;

      SECS
----------
1345051561

SQL> 

hth
Ronnie
-- 
Ronnie Brunner | ronnie.brunner@netcetera.com | T +41-44-247 79 79 |
Netcetera AG | 8040 Zürich | Switzerland | http://netcetera.com |

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


Re: testing the DIO connector class for Oracle

Posted by Massimo Manghi <mx...@apache.org>.
On Wed, 2012-08-15 at 10:18 -0500, Jeff Lawson wrote:
> Are you sure something like this will not work on Oracle?
> 
> 
> SELECT (SYSDATE - TO_DATE('01/01/1970 00:00:00', 'MM-DD-YYYY
> HH24:MI:SS')) * 
> 24 * 60 * 60 FROM DUAL
> 

Actually I have no idea but I think it should be alright. Yesterday I
stole from a developer forum this expression (adapted to appear in Tcl
code) 

($field_name - to_date('1970-01-01')) * 86400 

which looks pretty much the same, apart the Tcl variable 'field_name'.

 -- Massimo




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


Re: testing the DIO connector class for Oracle

Posted by Jeff Lawson <je...@bovine.net>.
Are you sure something like this will not work on Oracle?

SELECT (SYSDATE - TO_DATE('01/01/1970 00:00:00', 'MM-DD-YYYY HH24:MI:SS'))
*
24 * 60 * 60 FROM DUAL


On Mon, Aug 13, 2012 at 6:04 AM, Massimo Manghi <mx...@apache.org> wrote:

>
> I fixed and commited the classes Sqlite and Mysql and I'm going to fix
> also Postgresql. I could also fix the Oracle class. Oracle has no native
> way to return the Unix timestamp in SQL queries. A workaround exists but
> I don't have an Oracle installation to test it, so I please any Oracle
> user to volunteer for a test (I can provide simple scripts for testing
> it with the Session package)
>
>