Skip to Content.
Sympa Menu

freetds - Re: [freetds] Prepared statement + date fields

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Prepared statement + date fields
  • Date: Fri, 02 Jun 2006 12:55:40 +0200

Il giorno ven, 02/06/2006 alle 09.58 +0200, KERTEL - Maxime MARAIS ha
scritto:
> Frediano Ziglio a écrit :
> > Il giorno gio, 01/06/2006 alle 13.05 +0200, KERTEL - Maxime MARAIS ha
> > scritto:
> >> 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 =
> >> ?").
> >>
> >
> > ...
> >
> > Hi,
> > why don't you use DBD::OBDC even on Linux?
>
> Hello,
>
> I do not use OBDC as I can't find free open source driver for MS-SQL
> uneder Linux (except FreeTDS). Other solutions exist (like ODBC to ODBC
> bridges) but I prefer using as few components as possible.
>
> Finaly, I modified my code and do not use placeholders anymore, even if
> this can be less secure or require more string manipulation in order to
> escape user input and prevent miscallaneous code execution.
>
>
> > Placeholders should work
> > correctly on 0.64 using Ctlib (that is DBD::Sybase) while they works
> > well on 0.63 ODBC. If you want to use 0.63 consider patch at
> > http://freetds.sourceforge.net/ while I would suggest 0.64 (even if
> > still rc).
>
> Could you tell me more about using ODBC + Ctlib? I would like to have a
> look to this solution for future usages.
>
> Thanks.
>

Mmmm... well... FreeTDS provide mainly replacement for 3 libraries:
- DBLib
- CTLib
- ODBC
You can use whatever library you want to access to your mssql instance.
DBD::Sybase use CTLib while DBD::ODBC obviously use ODBC. I don't know
which distribution you are using however I think you will easy find a
ODBC DM (driver manager) like unixODBC or iODBC for your distro. I would
suggest unixODBC cause is very similar to MS DM and works very fine with
DBD::ODBC. So the choice is not ODBC + CTLib but ODBC or CTLib in this
case. As you can see from
http://freetds.sourceforge.net/out/test/test117.html current CVS HEAD
(and I can confirm even 0.64) pass all DBD::ODBC tests.
If you are using RedHat/SUSE/Fedora you can install unixODBC and
unixODBC-devel packages and that compile freetds with "rpmbuild
--rebuild freetds-0.64RC2.tar.gz" and get a
freetds-odbc.0.64RC2.i386.rpm package ready to be installed.

Au revoir
freddy77






Archive powered by MHonArc 2.6.24.

Top of Page