|
|
sybperl-l Archive
Up Prev Next
From: Michael Peppler <mpeppler at MBAY dot NET>
Subject: Re: Turning on DateTime use in sybperl 2.09
Date: Feb 12 1998 5:54PM
Guillaume Mallet wrote:
>
> I tried what you suggested, naturally it worked, so all is fine. Then I
> removed the "$dbh->{UseDateTime} = TRUE;" line from my script, yet it didn't
> yield any error although my next line is as follows : $date =
> $dbh->newdate('Jan 1 1998');
That's a feature :-)
The UseDateTime attribute is looked at when retrieving data
from the database, for example when doing a select getdate(), if
UseDateTime is TRUE then corresponding perl scalar will be a DateTime
object instead of a string:
$dbh->dbcmd("select getdate()");
$dbh->dbsqlexec; $dbh->dbresults;
($date) = $dbh->dbnextrow;
# $date is now a Sybase::DBlib::DateTime object, if UseDateTime is
# true.
This is where there is a serious performance hit, as these objects
have to be created for each row that is retrieved.
However, the newdate() call can always be called, and will
generate a new DateTime object irrespective of the UseDateTime
attribute's setting.
Hope this clarifies the situation...
Michael
--
Michael Peppler -||- Data Migrations Inc.
mpeppler@datamig.com -||- http://www.mbay.net/~mpeppler
|