Skip to Content.
Sympa Menu

freetds - Re: [freetds] Assertin failed: unknown bindtype with unknown varlen

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: LacaK <lacak AT zoznam.sk>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Assertin failed: unknown bindtype with unknown varlen
  • Date: Tue, 07 Apr 2015 06:55:40 +0200

I don't know... dbgetnull is a function which is declared only on our
public headers but is exported by our library. I would prefer if
dbgetnull does not throw an exception for invalid types/varlen

I do not know also ;-)

But my patch (attached also in previous email) patches dbconvert() as there is not handled correctly situation when converting from :
srctype=SQLBINARY, srclen=0
to:
desttype=SQLBINARY, destlen > 0
If this patch will be applied then I do not need touch dbgetnull()

I will be happy if this will be fixed before new release of FreeTDS ;-)
Thanks
-Laco.
P.S. Sorry for previous empty email :-)

Frediano

Hi,
I get this error "unknown bindtype with unknown varlen" when calling
dbconvert() in dblib.
This is my situation:
I have table with VARBINARY column with value which is empty not null
(dbdatlen() = 0)
Then I call dbconvert with srctype=SQLBINARY, srclen=0,
desttype=SQLBINARY, destlen > 0 and I get above mentioned assertion.

Looking into dbconvert there is in the begining (note condition:
srclen==0):

if (src == NULL || srclen == 0) {
int bind = dbbindtype(desttype);
int size = tds_get_size_by_type(desttype);

if (SYBCHAR == desttype) {
if (destlen > 0) {
size = destlen;
bind = CHARBIND;
} else {
size = 1;
bind = NTBSTRINGBIND;
}
}

dbgetnull(dbproc, bind, size, dest); // <--- HERE OCCURS
ASSERTION
return size;
}

Next look into dbgetnull():

/*
* For variable-length types, nonpositive varlen indicates
* buffer is "big enough" but also not to pad.
* Apply terminator (if applicable) and go home.
*/
if (varlen <= 0) {
switch (bindtype) {
case STRINGBIND:
case NTBSTRINGBIND:
varaddr[pnullrep->len] = '\0';
/* fall thru */
case CHARBIND:
case VARYCHARBIND:
+ case BINARYBIND: // <--- MISSING HERE ?
+ case VARYBINBIND: // <--- MISSING HERE ?
break;

As BINARYBIND is not handled ATM default is executed:
default:
assert(!"unknown bindtype with unknown varlen");

Can you please fix it ?
Thanks
-Laco.
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds

_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds

_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds

--- dblib.c.orig Fri Mar 27 07:13:04 2015
+++ dblib.c Wed Apr 01 10:01:10 2015
@@ -2245,6 +2245,8 @@
size = 1;
bind = NTBSTRINGBIND;
}
+ } else if (SYBBINARY == desttype) {
+ size = destlen;
}

dbgetnull(dbproc, bind, size, dest);



Archive powered by MHonArc 2.6.24.

Top of Page