Jeff Urlwin writes:
 > Dale,
 > 
 > There was a discussion and patch on this a while ago.  Honestly, I don't
 > remember the specifics but it was determined that a literal should be
 > surrounded by " instead of ', but this, I can see, is definitely a
 > problem...
 > 
 > I, unfortunately, don't remember why we did this...and I can't seem to find
 > the discussion.  I can, I think, change it to allow for either:
 >      "abd"
 >      or
 >      'abd'
 >      or
 >      ' this "is a test" '
 >      or
 >      " 'this is a test' "
 > (i.e. if you start with a " then it must finish on a " and if you start with
 > a ' you must finish with a ')

That's what Sybase does/allows, *unless* the quoted_identifier option
is set, in which case only single quotes are allowed to quote
literals.

FWIW.

Michael


 > > -----Original Message-----
 > > From: Dale Couch [mailto:[EMAIL PROTECTED]]
 > > Sent: Monday, January 28, 2002 8:37 AM
 > > To: [EMAIL PROTECTED]
 > > Cc: [EMAIL PROTECTED]
 > > Subject: DBD::ODBC, Datetime strings and placeholders
 > >
 > >
 > > I am having problems with the latest DBD::ODBC v0.32 or possibly
 > > DBI 1.201.
 > >
 > > If I try to use a string datetime value as demonstrated below, something
 > > seems to get confused about place holders and dates.  The errors are
 > > different based upon where you put the string datetime value.
 > >
 > > A DBI trace of the code below shows that the SQL statement gets converted
 > > from
 > >
 > > SELECT DATEDIFF(s,'1970-01-01 00:00:00.001',GETDATE()) 'seconds_since'
 > >
 > > to the following
 > >
 > > SELECT DATEDIFF(s,'1970-01-01 00??.001',GETDATE()) 'seconds_since'
 > >
 > > I am not sure where to attempt to make a patch, suggested locations/fixes
 > > would be appreciated.
 > >
 > > Standard version stuff:
 > > perl: v5.6.1 built for MSWin32-x86-multi-thread (ActiveState v631)
 > > DBI: 1.201
 > > DBD::ODBC: 0.32
 > >
 > > Sample Code (fill in your DB and user info as needed to test, no
 > > specific DB
 > > required, Syntax is valid on MS SQL 2000 server):
 > >
 > > #!perl -w
 > > use strict;
 > > use DBI;
 > > use DBD::ODBC;
 > >
 > > my $sServerName = "";
 > > my $sDBName = "";
 > > my $sUserName = "";
 > > my $sPassword = "";
 > >
 > > my $oConnection = DBI->connect("dbi:ODBC:driver={SQL
 > > Server};Server=$sServerName;database=$sDBName;uid=$sUserName;pwd=$
 > > sPassword;");
 > > $oConnection->{PrintError} = 1;
 > >
 > > my $qQuery = $oConnection->prepare(q{SELECT DATEDIFF(s,'1970-01-01
 > > 00:00:00.001',GETDATE()) 'seconds_since'});
 > > $qQuery->execute();
 > > my $aRow = $qQuery->fetchrow_arrayref();
 > > if ($aRow) {
 > >    print $aRow->[0];
 > > } else {
 > >    print "No Results";
 > > }
 > > $qQuery->finish();
 > > $oConnection->disconnect();
 > >
 > > Thanks
 > >
 > > Dale
 > >
 > > _________________________________________________________________
 > > Send and receive Hotmail on your mobile device: http://mobile.msn.com
 > >
 > >
 > 

-- 
Michael Peppler - Data Migrations Inc. - http://www.mbay.net/~mpeppler
[EMAIL PROTECTED] - [EMAIL PROTECTED]
International Sybase User Group - http://www.isug.com

Reply via email to