Skip to Content.
Sympa Menu

freetds - Re: [freetds] dbbind failure on unknown bindtype

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Paul Thurston <pthurston AT netegrate.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] dbbind failure on unknown bindtype
  • Date: Tue, 28 Dec 2010 22:47:07 -0800

Here's the call sequence (on SQL Server 2008)

int iColType = dbcoltype(dproc, iColumn + 1);
// The value is returned as iColType = 56

RETCODE errCode = dbbind(dbproc, iColumn + 1, iColType, iColType, iColSize,
(BYTE*) csBuffer);
//error message: Unknown bind type passed to DB-Library


Note: As an alternative call sequence, I've also tried
RETCODE errCode = dbbind(dbproc, iColumn + 1, NTBSTRINGBIND, iColType,
iColSize, (BYTE*) csBuffer);
Absolutely nothing occurs to the pointer csBuffer in this version of the call.

Stepping into the code, I see that the passed into v0.83 call to dbbind does
assign the passed in pointer value to colInfo->vaddr field.
However, no call to dbconvert is actually performed in this version of the
code.

>From the point view of the passed in (BYTE*)csBuffer, dbbind(...) is a
>no-operation.

Finally, I notice that tsql works just fine connecting to the server. Running
logs on both tsql and dblib, I see the same datatypes returned, type 56, for
the field in question.
In SQL, the field is defined as an INT NOT NULL;



From: freetds-bounces AT lists.ibiblio.org
[mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of James K. Lowden
Sent: Wednesday, December 29, 2010 1:11 AM
To: FreeTDS Development Group
Subject: Re: [freetds] dbbind failure on unknown bindtype


Paul Thurston wrote:

> The standard call to dbbind (...) fails on the current build.

>

> Stepping thru the code, the issue is on line 2085 of dblib.c

>

> Reading an integer from SQL Server 2007, the function call

> _db_get_server_type(int bindtype) is unable to map type code = 56.

>

> Is there a patch for this?



I'm not sure I understand what you think the problem is. What arguments are
you passing to dbbind(), and what is the datatype of the column you're
binding?



_db_get_server_type() takes a bindtype parameter, a value between 0 and 19.
56 is not a choice. Cf. lines 448-466 in sybdb .h.



If you pass an invalid bindtype argument (a/k/a vartype in Sybase's

documentation) to dbbind() it should fail with SYBEBTYP. If the column
datatype cannot be converted to the host variable type -- i.e. cannot be
bound -- it should fail with SYBEABMT.



If you meant SQL Server 2008, perhaps there's a new datatype that
dbwillconvert needs to cope with.



HTH.



--jkl

_______________________________________________

FreeTDS mailing list

FreeTDS AT lists.ibiblio.org<mailto:FreeTDS AT lists.ibiblio.org>

http://lists.ibiblio.org/mailman/listinfo/freetds




Archive powered by MHonArc 2.6.24.

Top of Page