Skip to Content.
Sympa Menu

freetds - Re: [freetds] Attempt to initiate a new Adaptive Server operation with results pending

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] Attempt to initiate a new Adaptive Server operation with results pending
  • Date: Tue, 10 Feb 2015 22:52:23 +0000

2015-02-10 9:59 GMT+00:00 LacaK <lacak AT zoznam.sk>:
> Dňa 10.2.2015 o 10:35 Frediano Ziglio napísal(a):
>
>> 2015-02-10 7:43 GMT+00:00 LacaK <lacak AT zoznam.sk>:
>>>>>>
>>>>>> Hi,
>>>>>> I have program which uses FreeTDS db-lib.dll
>>>>>> Now I have changed TDS version from 7.1 to 7.3 and I start receiving
>>>>>> "Attempt to initiate a new Adaptive Server operation with results
>>>>>> pending"
>>>>>> in some places.
>>>>>>
>>>>>> For example, when I send this two commands:
>>>>>> "IF @@TRANCOUNT>0 ROLLBACK"
>>>>>> followed by:
>>>>>> "BEGIN TRANSACTION"
>>>>>>
>>>>>> I get above mentioned error.
>>>>>>
>>>>>> I attach portion of logs for 7.1 and 7.3 version.
>>>>>>
>>>>>> As you can see in both cases is returned : more_results = 1 after "IF
>>>>>> @@TRANCOUNT>0 ROLLBACK"
>>>>>> (I do not understand why?)
>>>>>>
>>>>>> But in case 7.3 is error raised afterward (in 7.1 no error) Is it
>>>>>> expected ?
>>>>>> Can you give me some explanation what is going on ?
>>>>>>
>>>>>> Thanks
>>>>>> -Laco.
>>>>>> P.S. I resend this email to maillist, because first does not arrive
>>>>>> there
>>>>>> after 3 days
>>>>>>
>>>>> This patch fix the problem. Wrote a small test to reproduce. Testing
>>>>> right now.
>>>
>>>
>>> Hi Frediano,
>>> I can confirm, that your patch fixed the problem.
>>> Thank you very much.
>>>
>>> Only thing, that I do not fully understand is, why in same situation
>>> (with
>>> same TDS = 7.3):
>>> "IF @@TRANCOUNT>0 ROLLBACK" followed by "BEGIN TRANSACTION" does NOT
>>> work,
>>> but
>>> "ROLLBACK" followed by "BEGIN TRANSACTION" does work ?
>>>
>>> I attach logs from both situations.
>>>
>>> Thanks
>>> Bye
>>> -Laco.
>>>
>> Hi,
>> is it still failing? I wrote this change (you should already have a
>> snapshot now)
>> https://gitorious.org/freetds/freetds/commit/03600a47d3975f8cb43d9bc395ec7b9d39a1ec72.
>> It contains a test.
>
>
> No it is NOT failing, it works well.
> (As I wrote: "I can confirm, that your patch fixed the problem.")
>
>>
>> Basically the reply from server is in one case DONE, ENV_CHANGE, DONE
>> while in the other is ENV_CHANGE, DONE.
>
>
> I am only wondering, why:
> "IF @@TRANCOUNT>0 ROLLBACK"
> causes reply:
> DONE, ENV_CHANGE, DONE
>
> while
> "ROLLBACK"
> causes reply:
> ENV_CHANGE, DONE
>
>> Could be that FreeTDS expect
>> upper library to handle one DONE as a results.
>
>
> It seems so, but what kind of result it is ?
> It seems like "IF" formes one result and "ROLLBACK" second result.
>

Yes, could be. Try to do a set of IF and see if done is returned every time
:-)
I know that queries like SELECT @var = 123 produce a DONE while SET
@var = 123 don't. Also triggers attached to tables produce DONE
tokens.

> I am only trying understand why SQL Server replies as replies ;-)
>
> -Laco.
>

Frediano




Archive powered by MHonArc 2.6.24.

Top of Page