From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e686c2c95beefb1c X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Jano Newsgroups: comp.lang.ada Subject: Re: Inserting Calendar.Time in a database Date: Fri, 6 Aug 2004 08:31:35 +0200 Message-ID: References: X-Trace: news.uni-berlin.de FEwXh9MANRUBDB3Ll2V7/g2WKgGckclivjz8ZqeTuek5GDJnU= X-Newsreader: MicroPlanet Gravity v2.50 Xref: g2news1.google.com comp.lang.ada:2593 Date: 2004-08-06T08:31:35+02:00 List-Id: Martin Dowie dice... > Dmitry A. Kazakov wrote: > >> I need to insert some timestamps (type Ada.Calendar.Time) in a > >> database accessed via ODBC using gnade+gnat 3.15p. > >> > >> I've looked for timestamp support in the gnade sources without much > >> luck, I've specially checked the embedded sql support and I haven't > >> found nothing for this purpose. > >> > >> I'm completely clueless about the ODBC client packages so if someone > >> has done this before (with gesql or directly), a quick pointer for > >> the things to look at would be great. > > > > The problem is that Ada.Calendar.Time is a political time, while > > persistent time stamps should be UTC or any other absolute time. I > > know no OS-independent solution for that. > > Ada.Calendar.Time_Zones might be of use to you. You could store > the value as a string (Ada.Calendar.Formatting). I hadn't thought of time zones and you both are probably right in your concern, but for now this is a secondary worry. This is for local and non-critical use. I simply want to have a timestamp in the database starting from an Ada time type... Currently I'm doing something similar to the Martin suggestion: instead of storing a formatted string, I'm storing the seconds elapsed since an arbitrary epoch. This is a bit clumsy since I can't work with dates if I want to keep the queries indexed. I think I'll move to a two-column-with-trigger-on- insertion setup if no better solution is found. Thanks!