Skip to Content.
Sympa Menu

freetds - Problem binding numeric columns to SYBCHAR type

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Jonathon Padfield <jpadfield AT hotkey.net.au>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Problem binding numeric columns to SYBCHAR type
  • Date: Tue, 05 Sep 2000 16:37:37 +1100



Ok, basic setup is DBD::Sybase & freetds (fairly recent snapshot)
connecting to an MSSQL DB, with TDS 7.0

I modded util.c on line 385, just after a successful opening of the
logfile, with the addition of 'setvbuf(dumpfile, NULL, _IONBF, 0);' to
unbuffer writes to the dumpfile. Not sure how portable this is, but its
good on linux 2.2, and solaris.

But my real problem is when ct_bind gets called. Sybase's dbdimp.c
call's ct_bind with a format of CS_FMT_UNUSED for most CHAR types,
numerics and datetimes. In ct.c, when binding, the length is decremented
by one to remove null's for PHP compatability I believe. This is
probably fine when handling character types, but it happens to cut the 4
off the figure 1234 for instance when binding numeric types to SYBCHAR
type. I added a simple 'if (! is_numeric_type(currcol->column_type))'
before the 'len--;' on line 438 of ct.c

This seems to fix the problem. Being new to the code though, is this
likely to cause unforseen, and unwanted consequences?

Regards,
Jonathon Padfield



  • Problem binding numeric columns to SYBCHAR type, Jonathon Padfield, 09/05/2000

Archive powered by MHonArc 2.6.24.

Top of Page