Skip to Content.
Sympa Menu

freetds - Re: placeholders in TDS 7.0?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Eric Deutsch" <edeutsch AT systemsbiology.org>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: placeholders in TDS 7.0?
  • Date: Mon, 25 Mar 2002 15:59:23 -0800



Hi Brian, you caught me in a lie: my "latest CVS" was a couple weeks
old. I just pulled down the latest from CVS and compiled and tested.
It still seems that the following patch is missing from CVS:

Index: src/odbc/Makefile.am
===================================================================
RCS file: /cvsroot/freetds/freetds/src/odbc/Makefile.am,v
retrieving revision 1.3
diff -u -w -r1.3 Makefile.am
--- src/odbc/Makefile.am 20 Feb 2002 21:14:38 -0000 1.3
+++ src/odbc/Makefile.am 25 Feb 2002 20:14:42 -0000
@@ -4,8 +4,11 @@
lib_LTLIBRARIES = libtdsodbc.la
##EXTRA_LTLIBRARIES = libtdsodbc.la
libtdsodbc_la_SOURCES= odbc.c connectparams.c
-libtdsodbc_la_LIBADD= $(patsubst %, $(TDSDIR)/%, \
- $(patsubst %.c, %.lo, $(TDSSOURCES)))
-lglib
+if UNIXODBC
+libtdsodbc_la_LIBADD= $(patsubst %, $(TDSDIR)/%, $(patsubst %.c, %.lo,
$(TDSSOURCES))) -lglib -lodbcinst
+else
+libtdsodbc_la_LIBADD= $(patsubst %, $(TDSDIR)/%, $(patsubst %.c, %.lo,
$(TDSSOURCES))) -lglib
+endif
INCLUDES = -I$(top_srcdir)/include `glib-config --cflags
glib` -I$(ODBC_INC)

## Need blank statement to avoid compiling odbc.c


However, after patching src/odbc/Makefile.am like this, I get somewhat
better results. Now, when I do test queries, I'm getting something back
but there are several problems still. The two most obvious:

1) The last column in any resultset is always filled with NULL (or
empty?) values regardless of what it's supposed to return.

2) Columns defined as NOT NULL seem to be working mostly, but columns
defined as allowing NULL, come back with strange column types and
garbled data.

I'm willing to help test on this if you let me know what you need.

Many thanks,
Eric


> From: Brian Bruns [mailto:camber AT ais.org]
>
> Eric,
>
> which version of freetds are you using, I checked in some fixes just a
> couple of days ago.
>
> Brian
>
> On Mon, 25 Mar 2002, Eric Deutsch wrote:
>
> >
> > Has anyone out there actually gotten DBD::ODBC to work with FreeTDS?
I
> > got it all compiled and configured without too much trouble, but
with a
> > perl snippet like this:
> >
> > $dbh = DBI->connect ($dsn, $user_name, $password, \%attr )
> > or bail_out ("Cannot connect to database");
> > my $sql="SELECT \@\@SERVERNAME AS 'Servername',\@\@VERSION AS
> 'Version'";
> > $sth = $dbh->prepare ($sql) or bail_out ("Cannot prepare query");
> > $sth->execute () or bail_out ("Cannot execute query");
> >
> > print join(" | ",@{$sth->{NAME}}),"\n";
> > my (@result) = $sth->fetchrow_array() || bail_out("No records in
> set!");
> > print join(" | ",@result),"\n";
> >
> > I get:
> >
> > query = SELECT @@SERVERNAME AS 'Servername',@@VERSION AS 'Version'
> > SERVERNAME | VERSION
> > No records in set!
> > Error ()
> > Segmentation fault (core dumped)
> >
> > So, the connection works. The execute works. I do get the column
names
> > back as desired (although they're forced to caps which is curious).
But
> > the result returns empty record set. And then the program appears
to
> seg
> > fault after that. More testing indicates that the finish() and the
> > disconnect() execute okay, but upon exiting perl, I get the seg
fault.
> > If I run the same program with DBD::Sybase, I get:
> >
> > Servername | Version
> > MSSQL01 | Microsoft SQL Server 2000 - 8.00.194 (Intel X86)
> > Aug 6 2000 00:57:48
> > Copyright (c) 1988-2000 Microsoft Corporation
> > Standard Edition on Windows NT 5.0 (Build 2195: Service Pack 2)
> >
> > In general, I use DBD::Sybase for a lot of stuff, it's just the
> DBD::ODBC
> > that's new to me.
> >
> > So the question I have: has anyone gotten a similar configuration to
> work
> > at all? i.e.
> > Red Hat 7.2 +
> > Perl 5.6.0 +
> > DBI 1.18 +
> > DBD::ODBC 0.30 +
> > unixODBC 2.0.7 +
> > FreeTDS 0.53 latest CVS +
> > MS SQL Server 2000 no SP
> >
> > I cannot seem to even get basic stuff to work.
> >
> > thanks!
> > Eric
> >
> >
> >
> > On Sun, 24 Mar 2002, Brian Bruns wrote:
> >
> > >
> > > The message is true, placeholders are only supported under TDS 5.0
> (and
> > > even then support is flakey). For placeholders with TDS 7.0, I'd
> > > recommend trying out DBD::ODBC which supports a bind column type
> option.
> > >
> > > Brian
> > >
> > > On Fri, 22 Mar 2002 wsheldah AT lexmark.com wrote:
> > >
> > > >
> > > >
> > > > Hi,
> > > >
> > > > I'm using freeTDS to access MS SQL Server 2000 from a perl
module
> running on an
> > > > intel linux box, via DBD::Sybase. freeTDS was compiled to use
TDS
> 7.0.
> > > >
> > > > The problem is when I execute a simple query that has a
placeholder,
> like
> > > > "select name from mytable where id=?" in perl, I get the
following
> error
> > > > message:
> > > > "Dynamic placeholders only supported under TDS 5.0"
> > > >
> > > > Are they truly not supported under TDS 7.0, or should the test
be
> changed to
> > > > check for TDS versions less than TDS 5.0 instead of only equal
to
> TDS 5.0? Any
> > > > specific patches available, and if not, would this be safe for
me to
> patch
> > > > directly? Thanks again,
> > > >
> > > > Wes Sheldahl
> > > >
> > > >
> > > >
> > > > ---
> > > > You are currently subscribed to freetds as: [camber AT ais.org]
> > > > To unsubscribe, forward this message to leave-freetds-
> 127899P AT franklin.oit.unc.edu
> > > >
> > >
> > >
> > > ---
> > > You are currently subscribed to freetds as:
> [edeutsch AT systemsbiology.org]
> > > To unsubscribe, forward this message to leave-freetds-
> 127899P AT franklin.oit.unc.edu
> > >
> >
> >
>
>
> ---
> You are currently subscribed to freetds as:
[edeutsch AT systemsbiology.org]
> To unsubscribe, forward this message to leave-freetds-
> 127899P AT franklin.oit.unc.edu




Archive powered by MHonArc 2.6.24.

Top of Page