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: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Assertin failed: unknown bindtype with unknown varlen
  • Date: Tue, 7 Apr 2015 13:58:38 +0100

2015-04-07 12:52 GMT+01:00 LacaK <lacak AT zoznam.sk>:
>
>> I think we could add some checks to t0019 test.
>
>
> Yes good idea! may be add line:
> TEST((SYBBINARY, "", 0, SYBBINARY, 8), "len=8 00 00 00 00 00 00 00 00 2A
> 2A");
>
>>
>> I was wondering if your patch cover all cases. Probably would be
>> better to test for bind == BINARYBIND (which catches all binaries like
>> VARBINARY or IMAGE).
>
>
> May be. I used it as there was already: if (SYBCHAR == desttype)
> Do you think, that this condition should be changed as well: if (bind ==
> NTBSTRINGBIND) ?
> I leave decision up to you.
> For me are okay both alternatives.
>
>
>>> I will be happy if this will be fixed before new release of FreeTDS ;-)
>>
>> Added as a TODO in https://trello.com/b/bk0UZNRJ/freetds-todo-list.
>
>
> Thanks
> -Laco.
>

How does it sound this patch?

https://github.com/freddy77/freetds/commit/40968645d10ea32455806a1068c4f63ab0fb6f5e

Is it ok the signed off line ?

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.




Archive powered by MHonArc 2.6.24.

Top of Page