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: Tue, 9 Apr 2002 10:28:59 -0700 (PDT)



Hi Brian, sorry for the delay. I have just downloaded the latest from CVS
and built it. The "last column is empty" problem is indeed fixed! Thanks
very much! I expanded my tests and find the following issues:

1) A SELECT that includes a column of type REAL or FLOAT returns those
columns as the empty string in perl

2) A SELECT that includes a column of type NUMERIC causes a fatal error at
the first row of data:
(SQL-IM002)(DBD: st_fetch/SQLFetch (long truncated) err=1)

3) A SELECT that includes a column of type DATETIME causes a core dump at
the first row of data.

There's also a curious thing with the numerical column types that get
returned via the perl DBI. When I use DBD::Sybase, I get the following:
0 (test_id): 4 --> int
1 (intfield): 4 --> int
2 (charfield): 1 --> varchar
3 (numfield): 2 --> numeric
4 (floatfield): 6 --> float
5 (realfield): 7 --> real
6 (datefield): 11 --> date
7 (textfield): -1 --> text

where the format is:
column_index (column_name): column_type --> my_mapped_column_type
The column_name is the contents of $sth->{NAME}. The column_type is the
contents of $sth->{TYPE}. The map of type number to type name is my own
based on empirical evidence (and mostly supported in the array near line
178 of Sybase.pm

When I query with DBD::ODBC, I get
0 (TEST_ID): 4 --> int
1 (INTFIELD): 4 --> int
2 (CHARFIELD): 12 --> 12
3 (NUMFIELD): 14289 --> 14289
4 (FLOATFIELD): 8 --> 8
5 (REALFIELD): 6 --> float
6 (DATEFIELD): 9 --> 9
7 (TEXTFIELD): -1 --> text
Segmentation fault (core dumped)

Several of the types are clearly different and some bogus. This may be
realted to the problem perhaps? The core dump occurs because a DATETIME
column is in there.

The fact that column 2 is type "12" is probably good, actually. According
to Sybase.pm, varchar should be 12. However, whenever I use DBD::Sybase,
a varchar returns type 1 (type CHAR or NCHAR according to Sybase.pm).
This may be a bug in how FreeTDS reports the column type for VARCHAR to
DBD::Sybase??

4) When a column of type TEXT is returned, if the last character is
non-alphanumeric (e.g. "?" or "*") an additional strange character is
appended at the end.

If you are able to fix these when you have a chance, I'd really appreciate
it!

many thanks!
Eric



On Thu, 4 Apr 2002, Brian Bruns wrote:

> On Mon, 25 Mar 2002, Eric Deutsch wrote:
>
> > 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.
>
> Eric, I (believe I've) found this problem. Humorously, I found it in
> another ODBC driver I wrote (MDB Tools) that borrows heavily from this
> one. Wanna give it a shot and let me know if the situation improves?
>
> Brian
>
>
> ---
> You are currently subscribed to freetds as: [edeutsch AT systemsbiology.org]
> To unsubscribe, forward this message to $subst('Email.Unsub')
>

--
----------------------------------------------------------------------
Eric Deutsch email: edeutsch AT systemsbiology.org
Institute for Systems Biology Voice: (206) 732-1397
1441 N 34th St FAX: (206) 732-1260
Seattle, WA 98103-8904 http://www.systemsbiology.org/





Archive powered by MHonArc 2.6.24.

Top of Page