freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: KERTEL - Maxime MARAIS <mmarais AT kertel.com>
- To: freetds AT lists.ibiblio.org
- Subject: [freetds] Prepared statement + date fields
- Date: Thu, 01 Jun 2006 13:05:54 +0200
Hello,
Programming Perl scripts connecting to MS-SQL Databases and able to be
ran on both Linux and Windows plateforms (using [DBD::Sybase+FreeTDS] on
Linux and [DBD::ODBC+MSSQL driver] on Windows), I try to use
$dbh->prepare($sql) and $sth->execute($values) statements.
My scripts work fine on Windows plateform but I am unable to run them on
Linux because of a segmentation fault fired when executing
$dbh->prepare($sql). It seems FreeTDS does not support the placeholder
functionality when ODBC does (ie. "SELECT * FROM MyTable WHERE MyData = ?").
Example :
#!/usr/bin/perl -w
use DBI;
my $name = "user";
my $pass = "pass";
my $conn = 'DBI:Sybase:server=myserver';
my $dbh = DBI->connect($conn, $name, $pass);
print "W0 - Preparing\n";
my $sth = $dbh->prepare("SELECT ISDATE(?)");
#### Note I use a parameter ('?') in the sql query.
print "W0 - Executing\n";
$sth->execute('1970-01-01');
This scripts displays :
W0 - Preparing
ct_send(CS_DESCRIBE_INPUT) returned 0 at
/usr/local/lib/perl/5.8.7/DBD/Sybase.pm line 133.
Segmentation fault.
I am also facing another problem. When executing "SELECT getdate()", $sth-->fetchrow_array also hangs up with a segmentation fault. I have to replace "SELECT getdate()" with "SELECT CONVERT(varchar, getdate())" in order to get $sth-->fetchrow_array work.
Could you please confirm placeholder are not supported ? Could you also
tell me if such a fonctionnality is planned to be supported in the future ? Could you tell me more about date fields ?
Thanks forward.
--
Maxime MARAIS
Kertel.
-
[freetds] Prepared statement + date fields,
KERTEL - Maxime MARAIS, 06/01/2006
-
Re: [freetds] Prepared statement + date fields,
Frediano Ziglio, 06/02/2006
-
Re: [freetds] Prepared statement + date fields,
KERTEL - Maxime MARAIS, 06/02/2006
- Re: [freetds] Prepared statement + date fields, Frediano Ziglio, 06/02/2006
- Re: [freetds] Prepared statement + date fields, James K. Lowden, 06/02/2006
- Re: [freetds] Prepared statement + date fields, James K. Lowden, 06/02/2006
-
Re: [freetds] Prepared statement + date fields,
KERTEL - Maxime MARAIS, 06/02/2006
- <Possible follow-up(s)>
- Re: [freetds] Prepared statement + date fields, michael . peppler, 06/02/2006
-
Re: [freetds] Prepared statement + date fields,
Bort, Paul, 06/02/2006
- Re: [freetds] Prepared statement + date fields, KERTEL - Maxime MARAIS, 06/02/2006
- Re: [freetds] Prepared statement + date fields, James K. Lowden, 06/02/2006
- Re: [freetds] Prepared statement + date fields, Bort, Paul, 06/05/2006
-
Re: [freetds] Prepared statement + date fields,
Frediano Ziglio, 06/02/2006
Archive powered by MHonArc 2.6.24.