Re: Attempt to initiate a new Adaptive Server operation with results pending

Frediano Ziglio <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <CAHt6W4f9qdq_iYCA7iKJoec-Y97w217QcaVhi+x_ymudppLRKw@mail.gmail.com>
Frediano


2015-02-09 13:54 GMT+00:00 LacaK <[email protected]>:
> 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
>

Can you try this patch ?


diff --git a/include/freetds/tds.h b/include/freetds/tds.h
index 4dd3d93..80574e9 100644
--- a/include/freetds/tds.h
+++ b/include/freetds/tds.h
@@ -215,7 +215,8 @@ enum tds_token_results
        TDS_TOKEN_RES_ROW,
        TDS_TOKEN_RES_COMPUTE,
        TDS_TOKEN_RES_PROC,
-       TDS_TOKEN_RES_MSG
+       TDS_TOKEN_RES_MSG,
+       TDS_TOKEN_RES_ENV,
 };

 #define TDS_TOKEN_FLAG(flag) TDS_RETURN_##flag = (1 <<
(TDS_TOKEN_RES_##flag*2)), TDS_STOPAT_##flag = (2 <<
(TDS_TOKEN_RES_##flag*2))
@@ -232,6 +233,7 @@ enum tds_token_flags
        TDS_TOKEN_FLAG(COMPUTE),
        TDS_TOKEN_FLAG(PROC),
        TDS_TOKEN_FLAG(MSG),
+       TDS_TOKEN_FLAG(ENV),
        TDS_TOKEN_RESULTS =
TDS_RETURN_ROWFMT|TDS_RETURN_COMPUTEFMT|TDS_RETURN_DONE|TDS_STOPAT_ROW|TDS_STOPAT_COMPUTE|TDS_RETURN_PROC,
        TDS_TOKEN_TRAILING =
TDS_STOPAT_ROWFMT|TDS_STOPAT_COMPUTEFMT|TDS_STOPAT_ROW|TDS_STOPAT_COMPUTE|TDS_STOPAT_MSG|TDS_STOPAT_OTHERS
 };
diff --git a/src/tds/token.c b/src/tds/token.c
index e4561dd..1b4c8c5 100644
--- a/src/tds/token.c
+++ b/src/tds/token.c
@@ -826,6 +826,10 @@ tds_process_tokens(TDSSOCKET *tds, TDS_INT
*result_type, int *done_flags, unsign
                        SET_RETURN(TDS_MSG_RESULT, MSG);
                        rc = tds_process_default_tokens(tds, marker);
                        break;
+               case TDS_ENVCHANGE_TOKEN:
+                       SET_RETURN(TDS_MSG_RESULT, ENV);
+                       rc = tds_process_default_tokens(tds, marker);
+                       break;
                default:
                        SET_RETURN(TDS_OTHERS_RESULT, OTHERS);
                        rc = tds_process_default_tokens(tds, marker);



Frediano
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.