Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Date Times on Server
Tue, Nov 21 2006 1:27 AMPermanent Link

"Clive"
Hi,

We have a table with a 2 columns a time and a date they have the defaults of
CURRENT_DATE and CURRENT_TIME,
We also 2 other date and time columns that are populated from the
application itself.

What we want is the local time the application is run, and the time in our
country as well which I thought would be taken care of by have 2 columns
with defaults of CURRENT_DATE and CURRENT_TIME. However it appears that the
DBISAM server picks up the date and time from the client machine when
setting the values of CURRENT_DATE and CURRENT_TIME.

The help manual states the following, but I dont think this is working.

" All default values for fields in a table are populated server-side, which
means that any CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP, or
CURRENT_GUID (new) default value expressions will be populated by the
database server and not the client engine as it was previously. "


Thanks
Clive.

Tue, Nov 21 2006 1:12 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Clive,

<< The help manual states the following, but I dont think this is working.

" All default values for fields in a table are populated server-side, which
means that any CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP, or
CURRENT_GUID (new) default value expressions will be populated by the
database server and not the client engine as it was previously. " >>

The manual is wrong for navigational inserts and I'll make sure it is
corrected.  For SQL inserts, the above is correct.

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Nov 21 2006 2:04 PMPermanent Link

"Clive"
Sorry I dont understand the difference?. How do I insert the server date
time and the client date time into the same table row?.

so if from the client I did

insert into table(adate,atime) values(CURRENT_DATE, CURRENT_TIME)  this
would pick up the server dates?



"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message
news:96C0FE3D-8255-429C-BF33-D652F163599D@news.elevatesoft.com...
> Clive,
>
> << The help manual states the following, but I dont think this is working.
>
> " All default values for fields in a table are populated server-side,
> which means that any CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP, or
> CURRENT_GUID (new) default value expressions will be populated by the
> database server and not the client engine as it was previously. " >>
>
> The manual is wrong for navigational inserts and I'll make sure it is
> corrected.  For SQL inserts, the above is correct.
>
> --
> Tim Young
> Elevate Software
> www.elevatesoft.com
>

Tue, Nov 21 2006 3:50 PMPermanent Link

Jason Lee

> Sorry I dont understand the difference?. How do I insert the server date
> time and the client date time into the same table row?.

Table.FieldByName('ADATE').AsDateTime := Date;
Directly sets the field's value to your workstation's date not using SQL
but *navigational*



> so if from the client I did
> insert into table(adate,atime) values(CURRENT_DATE, CURRENT_TIME)  this
> would pick up the server dates?

The SQL statement is executed on the server as it is. CURRENT_DATE and
CURRENT_TIME will use the server's values for these.

To use the workstation's values you would dynamically create the
necessary bits of the SQL statement, something like this:
Query.SQL.Add('insert into .... values ( ');
Query.SQL.Add(QuotedStr(FormatDateTime('yyyy-mm-dd', Date))  + ' , ')
Query.SQL.Add(QuotedStr(FormatDateTime('HH:NN:SS', Now)) + ' )') ;
etc.


Regards
--
Jason Lee
Wed, Nov 22 2006 2:12 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Clive,

<< Sorry I dont understand the difference?. How do I insert the server date
time and the client date time into the same table row?. >>

SQL INSERTS always use the server-side date/time values when using
CURRENT_DATE, CURRENT_TIME, etc. To use the client date/time also, just
specify it as a constant or parameter in the INSERT as Jason suggested.  The
two can be mixed in the same INSERT statement.

<< so if from the client I did

insert into table(adate,atime) values(CURRENT_DATE, CURRENT_TIME)  this
would pick up the server dates? >>

Correct.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image