|
|
sybperl-l Archive
Up Prev Next
From: KERTEL - Maxime MARAIS <mmarais at kertel dot com>
Subject: [DBD::Sybase] Date fileds and syb_date_fmt
Date: Jun 1 2006 11:42AM
Hello,
On http://www.annocpan.org/~MEWP/DBD-Sybase-1.07/Sybase.pm I can read
DBD::Sybase returns dates as 'LONG' format. This is the default option.
It appears "SELECT getdate()" runs into a segmentation fault if
syb_date_fmt is not ran to change to some other format (ex. 'ISO') prior
to fetch data from sql requests containing date fields.
Example :
1 use DBI ;
2 my $user = "me";
3 my $pass = "secret";
4 my $conn = 'DBI:Sybase:server=my_server';
5 my $dbh = DBI->connect($conn, $user, $pass);
6 $sth = $dbh->prepare("SELECT getdate()");
7 $sth->execute();
8 #### $dbh->syb_date_fmt('LONG');
9 $sth = $dbh->prepare("SELECT getdate()");
10 $sth->execute();
11 my @rows = $sth->fetchrow_array;
12 print "$rows[0]\n";
- This script crashes line 11.
- Removing sharps line 8 keeps the script crash too.
- Replacing line 8 with $dbh->syb_date_fmt('ISO') runs fine. The script
now displays 2006-06-01 13:00:00.000
Any idea ?
--
Maxime MARAIS
Kertel.
|