Problem binding numeric columns to SYBCHAR type
Jonathon Padfield
jpadfield at hotkey.net.au
Tue Sep 5 01:37:37 EDT 2000
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
More information about the FreeTDS
mailing list