freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] Attempt to initiate a new Adaptive Server operation with results pending
- From: LacaK <lacak AT zoznam.sk>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] Attempt to initiate a new Adaptive Server operation with results pending
- Date: Wed, 11 Feb 2015 08:38:18 +0100
Dňa 10.2.2015 o 23:52 Frediano Ziglio napísal(a):
I am only wondering, why: "IF @@TRANCOUNT>0 ROLLBACK" causes reply: DONE, ENV_CHANGE, DONE while "ROLLBACK" causes reply: ENV_CHANGE, DONEYes, could be. Try to do a set of IF and see if done is returned every timeCould 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.
:-)
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.
Yes it seems, so, that: "if @id=1 set @id=2;" produces 2 times DONE
To be right, it seems, that every statement in batch generates DONE.
(see tds73_set.txt, where are 3 set statements)
Which is okay for me, as far as "_dbresults" (in dblib.c) processes all these DONE tokens internally in loop.
(and do not require upper level library to hande it by call dbresults() for each individual command in batch)
There is also comment in source code:
/* A done token signifies the end of a logical command.
* There are three possibilities:
* 1. Simple command with no result set, i.e. update, delete, insert
* 2. Command with result set but no rows
* 3. Command with result set and rows
*/
Thanks again for fixing case DONE, ENV_CHANGE, DONE
-Laco.
dblib.c:1333:dbcmd(04CF1190, declare @id int; set @id=1; if @id=1 set @id=2;
if @id=2 set @id=3; if @id=3 set @id=4;)
dblib.c:1339:dbcmd() bufsz = 407
dblib.c:5833:dbfreebuf(04CF1190)
dblib.c:1387:dbsqlexec(04CF1190)
dblib.c:6807:dbsqlsend(04CF1190)
mem.c:645:tds_free_all_results()
util.c:146:Changed query state from IDLE to QUERYING
util.c:146:Changed query state from QUERYING to PENDING
packet.c:743:Sending packet
0000 01 01 00 cc 00 00 01 00-16 00 00 00 12 00 00 00 |........ ........|
0010 02 00 01 00 00 00 57 00-00 00 01 00 00 00 64 00 |......W. ......d.|
0020 65 00 63 00 6c 00 61 00-72 00 65 00 20 00 40 00 |e.c.l.a. r.e. .@.|
0030 69 00 64 00 20 00 69 00-6e 00 74 00 3b 00 20 00 |i.d. .i. n.t.;. .|
0040 73 00 65 00 74 00 20 00-40 00 69 00 64 00 3d 00 |s.e.t. . @.i.d.=.|
0050 31 00 3b 00 20 00 69 00-66 00 20 00 40 00 69 00 |1.;. .i. f. .@.i.|
0060 64 00 3d 00 31 00 20 00-73 00 65 00 74 00 20 00 |d.=.1. . s.e.t. .|
0070 40 00 69 00 64 00 3d 00-32 00 3b 00 20 00 69 00 |@.i.d.=. 2.;. .i.|
0080 66 00 20 00 40 00 69 00-64 00 3d 00 32 00 20 00 |f. .@.i. d.=.2. .|
0090 73 00 65 00 74 00 20 00-40 00 69 00 64 00 3d 00 |s.e.t. . @.i.d.=.|
00a0 33 00 3b 00 20 00 69 00-66 00 20 00 40 00 69 00 |3.;. .i. f. .@.i.|
00b0 64 00 3d 00 33 00 20 00-73 00 65 00 74 00 20 00 |d.=.3. . s.e.t. .|
00c0 40 00 69 00 64 00 3d 00-34 00 3b 00 |@.i.d.=. 4.;.|
dblib.c:4613:dbsqlok(04CF1190)
dblib.c:4642:dbsqlok() not done, calling tds_process_tokens()
token.c:549:tds_process_tokens(04CF1358, 0166F198, 0166F1A0, 0x6914)
util.c:146:Changed query state from PENDING to READING
packet.c:642:Received packet
0000 04 01 00 63 00 57 01 00-fd 11 00 c1 00 01 00 00 |...c.W.. ........|
0010 00 00 00 00 00 fd 01 00-c0 00 00 00 00 00 00 00 |........ ........|
0020 00 00 fd 11 00 c1 00 01-00 00 00 00 00 00 00 fd |........ ........|
0030 01 00 c0 00 00 00 00 00-00 00 00 00 fd 11 00 c1 |........ ........|
0040 00 01 00 00 00 00 00 00-00 fd 01 00 c0 00 00 00 |........ ........|
0050 00 00 00 00 00 00 fd 10-00 c1 00 01 00 00 00 00 |........ ........|
0060 00 00 00 - |...|
token.c:564:processing result tokens. marker is fd(DONE)
token.c:2022:tds_process_end: more_results = 1
was_cancelled = 0
error = 0
done_count_valid = 1
token.c:2039: rows_affected = 1
util.c:146:Changed query state from READING to PENDING
dblib.c:4675:dbsqlok() end status is SUCCEED
dblib.c:4686:dbsqlok() end status was success
dblib.c:1683:dbresults(04CF1190)
dblib.c:1688:dbresults: dbresults_state is 5 (_DB_RES_SUCCEED)
dblib.c:1673:dbresults returning 1 (SUCCEED)
dblib.c:4070:dbcmdrow(04CF1190)
dblib.c:2790:dbcount(04CF1190)
dblib.c:2770:dbiscount(04CF1190)
dblib.c:2026:dbnextrow(04CF1190)
dblib.c:2038:dbnextrow() dbresults_state = 3 (_DB_RES_NEXT_RESULT)
dblib.c:2043:leaving dbnextrow() returning -2 (NO_MORE_ROWS)
dblib.c:1683:dbresults(04CF1190)
dblib.c:1688:dbresults: dbresults_state is 3 (_DB_RES_NEXT_RESULT)
token.c:549:tds_process_tokens(04CF1358, 0166F1AC, 0166F1B0, 0x6914)
util.c:146:Changed query state from PENDING to READING
token.c:564:processing result tokens. marker is fd(DONE)
token.c:2022:tds_process_end: more_results = 1
was_cancelled = 0
error = 0
done_count_valid = 0
token.c:2039: rows_affected = 0
util.c:146:Changed query state from READING to PENDING
dblib.c:1709:dbresults() tds_process_tokens returned 0 (TDS_SUCCESS),
result_type TDS_DONE_RESULT
dblib.c:1736:dbresults(): dbresults_state is 3 (_DB_RES_NEXT_RESULT)
token.c:549:tds_process_tokens(04CF1358, 0166F1AC, 0166F1B0, 0x6914)
util.c:146:Changed query state from PENDING to READING
token.c:564:processing result tokens. marker is fd(DONE)
token.c:2022:tds_process_end: more_results = 1
was_cancelled = 0
error = 0
done_count_valid = 1
token.c:2039: rows_affected = 1
util.c:146:Changed query state from READING to PENDING
dblib.c:1709:dbresults() tds_process_tokens returned 0 (TDS_SUCCESS),
result_type TDS_DONE_RESULT
dblib.c:1736:dbresults(): dbresults_state is 3 (_DB_RES_NEXT_RESULT)
token.c:549:tds_process_tokens(04CF1358, 0166F1AC, 0166F1B0, 0x6914)
util.c:146:Changed query state from PENDING to READING
token.c:564:processing result tokens. marker is fd(DONE)
token.c:2022:tds_process_end: more_results = 1
was_cancelled = 0
error = 0
done_count_valid = 0
token.c:2039: rows_affected = 0
util.c:146:Changed query state from READING to PENDING
dblib.c:1709:dbresults() tds_process_tokens returned 0 (TDS_SUCCESS),
result_type TDS_DONE_RESULT
dblib.c:1736:dbresults(): dbresults_state is 3 (_DB_RES_NEXT_RESULT)
token.c:549:tds_process_tokens(04CF1358, 0166F1AC, 0166F1B0, 0x6914)
util.c:146:Changed query state from PENDING to READING
token.c:564:processing result tokens. marker is fd(DONE)
token.c:2022:tds_process_end: more_results = 1
was_cancelled = 0
error = 0
done_count_valid = 1
token.c:2039: rows_affected = 1
util.c:146:Changed query state from READING to PENDING
dblib.c:1709:dbresults() tds_process_tokens returned 0 (TDS_SUCCESS),
result_type TDS_DONE_RESULT
dblib.c:1736:dbresults(): dbresults_state is 3 (_DB_RES_NEXT_RESULT)
token.c:549:tds_process_tokens(04CF1358, 0166F1AC, 0166F1B0, 0x6914)
util.c:146:Changed query state from PENDING to READING
token.c:564:processing result tokens. marker is fd(DONE)
token.c:2022:tds_process_end: more_results = 1
was_cancelled = 0
error = 0
done_count_valid = 0
token.c:2039: rows_affected = 0
util.c:146:Changed query state from READING to PENDING
dblib.c:1709:dbresults() tds_process_tokens returned 0 (TDS_SUCCESS),
result_type TDS_DONE_RESULT
dblib.c:1736:dbresults(): dbresults_state is 3 (_DB_RES_NEXT_RESULT)
token.c:549:tds_process_tokens(04CF1358, 0166F1AC, 0166F1B0, 0x6914)
util.c:146:Changed query state from PENDING to READING
token.c:564:processing result tokens. marker is fd(DONE)
token.c:2022:tds_process_end: more_results = 0
was_cancelled = 0
error = 0
done_count_valid = 1
token.c:2039: rows_affected = 1
token.c:2042:tds_process_end() state set to TDS_IDLE
util.c:146:Changed query state from READING to IDLE
util.c:86:logic error: cannot change query state from IDLE to PENDING
util.c:146:Changed query state from IDLE to PENDING
dblib.c:1709:dbresults() tds_process_tokens returned 0 (TDS_SUCCESS),
result_type TDS_DONE_RESULT
dblib.c:1736:dbresults(): dbresults_state is 3 (_DB_RES_NEXT_RESULT)
token.c:549:tds_process_tokens(04CF1358, 0166F1AC, 0166F1B0, 0x6914)
token.c:552:tds_process_tokens() state is COMPLETED
dblib.c:1709:dbresults() tds_process_tokens returned 1 (TDS_NO_MORE_RESULTS),
result_type TDS_DONE_RESULT
dblib.c:1673:dbresults returning 2 (NO_MORE_RESULTS)
dblib.c:1333:dbcmd(04D51190, declare @id int; set @id=1; set @id=2; set
@id=3;)
dblib.c:1339:dbcmd() bufsz = 407
dblib.c:5833:dbfreebuf(04D51190)
dblib.c:1387:dbsqlexec(04D51190)
dblib.c:6807:dbsqlsend(04D51190)
mem.c:645:tds_free_all_results()
util.c:146:Changed query state from IDLE to QUERYING
util.c:146:Changed query state from QUERYING to PENDING
packet.c:743:Sending packet
0000 01 01 00 80 00 00 01 00-16 00 00 00 12 00 00 00 |........ ........|
0010 02 00 01 00 00 00 5e 00-00 00 01 00 00 00 64 00 |......^. ......d.|
0020 65 00 63 00 6c 00 61 00-72 00 65 00 20 00 40 00 |e.c.l.a. r.e. .@.|
0030 69 00 64 00 20 00 69 00-6e 00 74 00 3b 00 20 00 |i.d. .i. n.t.;. .|
0040 73 00 65 00 74 00 20 00-40 00 69 00 64 00 3d 00 |s.e.t. . @.i.d.=.|
0050 31 00 3b 00 20 00 73 00-65 00 74 00 20 00 40 00 |1.;. .s. e.t. .@.|
0060 69 00 64 00 3d 00 32 00-3b 00 20 00 73 00 65 00 |i.d.=.2. ;. .s.e.|
0070 74 00 20 00 40 00 69 00-64 00 3d 00 33 00 3b 00 |t. .@.i. d.=.3.;.|
dblib.c:4613:dbsqlok(04D51190)
dblib.c:4642:dbsqlok() not done, calling tds_process_tokens()
token.c:549:tds_process_tokens(04D51358, 0166F198, 0166F1A0, 0x6914)
util.c:146:Changed query state from PENDING to READING
packet.c:642:Received packet
0000 04 01 00 2f 00 5e 01 00-fd 11 00 c1 00 01 00 00 |.../.^.. ........|
0010 00 00 00 00 00 fd 11 00-c1 00 01 00 00 00 00 00 |........ ........|
0020 00 00 fd 10 00 c1 00 01-00 00 00 00 00 00 00 |........ .......|
token.c:564:processing result tokens. marker is fd(DONE)
token.c:2022:tds_process_end: more_results = 1
was_cancelled = 0
error = 0
done_count_valid = 1
token.c:2039: rows_affected = 1
util.c:146:Changed query state from READING to PENDING
dblib.c:4675:dbsqlok() end status is SUCCEED
dblib.c:4686:dbsqlok() end status was success
dblib.c:1683:dbresults(04D51190)
dblib.c:1688:dbresults: dbresults_state is 5 (_DB_RES_SUCCEED)
dblib.c:1673:dbresults returning 1 (SUCCEED)
dblib.c:4070:dbcmdrow(04D51190)
dblib.c:2790:dbcount(04D51190)
dblib.c:2770:dbiscount(04D51190)
dblib.c:2026:dbnextrow(04D51190)
dblib.c:2038:dbnextrow() dbresults_state = 3 (_DB_RES_NEXT_RESULT)
dblib.c:2043:leaving dbnextrow() returning -2 (NO_MORE_ROWS)
dblib.c:1683:dbresults(04D51190)
dblib.c:1688:dbresults: dbresults_state is 3 (_DB_RES_NEXT_RESULT)
token.c:549:tds_process_tokens(04D51358, 0166F1AC, 0166F1B0, 0x6914)
util.c:146:Changed query state from PENDING to READING
token.c:564:processing result tokens. marker is fd(DONE)
token.c:2022:tds_process_end: more_results = 1
was_cancelled = 0
error = 0
done_count_valid = 1
token.c:2039: rows_affected = 1
util.c:146:Changed query state from READING to PENDING
dblib.c:1709:dbresults() tds_process_tokens returned 0 (TDS_SUCCESS),
result_type TDS_DONE_RESULT
dblib.c:1736:dbresults(): dbresults_state is 3 (_DB_RES_NEXT_RESULT)
token.c:549:tds_process_tokens(04D51358, 0166F1AC, 0166F1B0, 0x6914)
util.c:146:Changed query state from PENDING to READING
token.c:564:processing result tokens. marker is fd(DONE)
token.c:2022:tds_process_end: more_results = 0
was_cancelled = 0
error = 0
done_count_valid = 1
token.c:2039: rows_affected = 1
token.c:2042:tds_process_end() state set to TDS_IDLE
util.c:146:Changed query state from READING to IDLE
util.c:86:logic error: cannot change query state from IDLE to PENDING
util.c:146:Changed query state from IDLE to PENDING
dblib.c:1709:dbresults() tds_process_tokens returned 0 (TDS_SUCCESS),
result_type TDS_DONE_RESULT
dblib.c:1736:dbresults(): dbresults_state is 3 (_DB_RES_NEXT_RESULT)
token.c:549:tds_process_tokens(04D51358, 0166F1AC, 0166F1B0, 0x6914)
token.c:552:tds_process_tokens() state is COMPLETED
dblib.c:1709:dbresults() tds_process_tokens returned 1 (TDS_NO_MORE_RESULTS),
result_type TDS_DONE_RESULT
dblib.c:1673:dbresults returning 2 (NO_MORE_RESULTS)
-
[freetds] Attempt to initiate a new Adaptive Server operation with results pending,
LacaK, 02/06/2015
-
[freetds] Attempt to initiate a new Adaptive Server operation with results pending,
LacaK, 02/09/2015
- Re: [freetds] Attempt to initiate a new Adaptive Server operation with results pending, Frediano Ziglio, 02/09/2015
-
Re: [freetds] Attempt to initiate a new Adaptive Server operation with results pending,
Frediano Ziglio, 02/09/2015
-
Re: [freetds] Attempt to initiate a new Adaptive Server operation with results pending,
Frediano Ziglio, 02/09/2015
-
Re: [freetds] Attempt to initiate a new Adaptive Server operation with results pending,
LacaK, 02/10/2015
-
Re: [freetds] Attempt to initiate a new Adaptive Server operation with results pending,
Frediano Ziglio, 02/10/2015
-
Re: [freetds] Attempt to initiate a new Adaptive Server operation with results pending,
LacaK, 02/10/2015
- Re: [freetds] Attempt to initiate a new Adaptive Server operation with results pending, Frediano Ziglio, 02/10/2015
- Re: [freetds] Attempt to initiate a new Adaptive Server operation with results pending, LacaK, 02/11/2015
-
Re: [freetds] Attempt to initiate a new Adaptive Server operation with results pending,
LacaK, 02/10/2015
-
Re: [freetds] Attempt to initiate a new Adaptive Server operation with results pending,
Frediano Ziglio, 02/10/2015
-
Re: [freetds] Attempt to initiate a new Adaptive Server operation with results pending,
LacaK, 02/10/2015
-
Re: [freetds] Attempt to initiate a new Adaptive Server operation with results pending,
Frediano Ziglio, 02/09/2015
-
[freetds] Attempt to initiate a new Adaptive Server operation with results pending,
LacaK, 02/09/2015
Archive powered by MHonArc 2.6.24.