Re: Invalid Cursor State By SELECT after INSERT
Frediano Ziglio <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <1216844606.7399.6.camel@freddy> |
... omissis ... > token.c:316:looking for login token, got fd(DONE) > token.c:108:tds_process_default_tokens() marker is fd(DONE) > token.c:2274:tds_process_end: more_results = 0 > was_cancelled = 0 > error = 0 > done_count_valid = 0 > token.c:2290:tds_process_end() state set to TDS_IDLE > token.c:2305: rows_affected = 0 > token.c:393:leaving tds_process_login_tokens() returning 1 > mem.c:563:tds_free_all_results() > util.c:162:Changed query state from IDLE to QUERYING > write.c:136:tds_put_string converting 19 bytes of "set textsize 64512 " > write.c:164:tds_put_string wrote 38 bytes > util.c:162:Changed query state from QUERYING to PENDING > net.c:769:Sending packet > 0000 01 01 00 2e 00 00 00 00-73 00 65 00 74 00 20 00 |........ s.e.t. > .| > 0010 74 00 65 00 78 00 74 00-73 00 69 00 7a 00 65 00 |t.e.x.t. > s.i.z.e.| > 0020 20 00 36 00 34 00 35 00-31 00 32 00 20 00 | .6.4.5. 1.2. .| > > token.c:495:tds_process_tokens(0xa0a8f30, 0xbf961480, 0xbf96147c, > 0x100) > util.c:162:Changed query state from PENDING to READING > net.c:663:Received packet > 0000 04 01 00 11 00 37 01 00-fd 00 00 be 00 00 00 00 |.....7.. > ........| > 0010 00 - |.| > > token.c:510:processing result tokens. marker is fd(DONE) > token.c:2274:tds_process_end: more_results = 0 > was_cancelled = 0 > error = 0 > done_count_valid = 0 > token.c:2290:tds_process_end() state set to TDS_IDLE > util.c:162:Changed query state from READING to IDLE > token.c:2305: rows_affected = 0 > util.c:110:logic error: cannot change query state from IDLE to PENDING > token.c:495:tds_process_tokens(0xa0a8f30, 0xbf961480, 0xbf96147c, > 0x100) > token.c:498:tds_process_tokens() state is COMPLETED > odbc.c:4841:SQLGetFunctions: fFunction is 999 > odbc.c:5756:SQLGetInfo(0xa0a8c20, 77, 0xbf96174c, 20, (nil)) > odbc.c:5010:_SQLGetInfo(0xa0a8c20, 77, 0xbf96174c, 20, (nil) > odbc.c:5756:SQLGetInfo(0xa0a8c20, 10000, 0xbf96174c, 5, (nil)) > odbc.c:5010:_SQLGetInfo(0xa0a8c20, 10000, 0xbf96174c, 5, (nil) > odbc.c:1552:SQLAllocStmt(0xa01cf78, 0xa0dad98) > odbc.c:1451:_SQLAllocStmt(0xa01cf78, 0xa0dad98) > odbc.c:4169:SQLGetStmtAttr(0xa0a8e38, 10010, 0xbf9648cc, 4, (nil)) > odbc.c:4001:_SQLGetStmtAttr(0xa0a8e38, 10010, 0xbf9648cc, 4, (nil)) > odbc.c:4169:SQLGetStmtAttr(0xa0a8e38, 10011, 0xbf9648cc, 4, (nil)) > odbc.c:4001:_SQLGetStmtAttr(0xa0a8e38, 10011, 0xbf9648cc, 4, (nil)) > odbc.c:4169:SQLGetStmtAttr(0xa0a8e38, 10012, 0xbf9648cc, 4, (nil)) > odbc.c:4001:_SQLGetStmtAttr(0xa0a8e38, 10012, 0xbf9648cc, 4, (nil)) > odbc.c:4169:SQLGetStmtAttr(0xa0a8e38, 10013, 0xbf9648cc, 4, (nil)) > odbc.c:4001:_SQLGetStmtAttr(0xa0a8e38, 10013, 0xbf9648cc, 4, (nil)) > odbc.c:4214:SQLPrepare(0xa0a8e38, INSERT INTO FaxJob (FaxDeptID, > FaxSendToNo, FSID, FaxResultID, FaxSendTries,recip_id,SendImmediate, > FaxEmployeeID, FaxCreate) VALUES( -26084249, '4123880569', > 5,0,0,0,0,0,'2008-7-23 14:11:48'), 192) > odbc.c:4278:Creating prepared statement > mem.c:563:tds_free_all_results() > util.c:162:Changed query state from IDLE to QUERYING > util.c:162:Changed query state from QUERYING to PENDING > net.c:769:Sending packet > 0000 03 01 01 bc 00 00 01 00-ff ff 0b 00 00 00 00 01 |........ > ........| > 0010 26 04 00 00 00 63 00 00-00 00 09 04 d0 00 34 ff |&....c.. > ......4.| > 0020 ff ff ff 00 00 63 80 01-00 00 09 04 d0 00 34 80 |.....c.. > ......4.| > 0030 01 00 00 49 00 4e 00 53-00 45 00 52 00 54 00 20 |...I.N.S .E.R.T. > | > 0040 00 49 00 4e 00 54 00 4f-00 20 00 46 00 61 00 78 |.I.N.T.O . > .F.a.x| > 0050 00 4a 00 6f 00 62 00 20-00 28 00 46 00 61 00 78 |.J.o.b. > .(.F.a.x| > 0060 00 44 00 65 00 70 00 74-00 49 00 44 00 2c 00 20 |.D.e.p.t .I.D.,. > | > 0070 00 46 00 61 00 78 00 53-00 65 00 6e 00 64 00 54 |.F.a.x.S > .e.n.d.T| > 0080 00 6f 00 4e 00 6f 00 2c-00 20 00 46 00 53 00 49 |.o.N.o., . > .F.S.I| > 0090 00 44 00 2c 00 20 00 46-00 61 00 78 00 52 00 65 |.D.,. .F > .a.x.R.e| > 00a0 00 73 00 75 00 6c 00 74-00 49 00 44 00 2c 00 20 |.s.u.l.t .I.D.,. > | > 00b0 00 46 00 61 00 78 00 53-00 65 00 6e 00 64 00 54 |.F.a.x.S > .e.n.d.T| > 00c0 00 72 00 69 00 65 00 73-00 2c 00 72 00 65 00 63 |.r.i.e.s > .,.r.e.c| > 00d0 00 69 00 70 00 5f 00 69-00 64 00 2c 00 53 00 65 |.i.p._.i > .d.,.S.e| > 00e0 00 6e 00 64 00 49 00 6d-00 6d 00 65 00 64 00 69 |.n.d.I.m > .m.e.d.i| > 00f0 00 61 00 74 00 65 00 2c-00 20 00 46 00 61 00 78 |.a.t.e., . > .F.a.x| > 0100 00 45 00 6d 00 70 00 6c-00 6f 00 79 00 65 00 65 |.E.m.p.l > .o.y.e.e| > 0110 00 49 00 44 00 2c 00 20-00 46 00 61 00 78 00 43 |.I.D.,. > .F.a.x.C| > 0120 00 72 00 65 00 61 00 74-00 65 00 29 00 20 00 56 |.r.e.a.t .e.). > .V| > 0130 00 41 00 4c 00 55 00 45-00 53 00 28 00 20 00 2d |.A.L.U.E .S.(. > .-| > 0140 00 32 00 36 00 30 00 38-00 34 00 32 00 34 00 39 |.2.6.0.8 > .4.2.4.9| > 0150 00 2c 00 20 00 27 00 34-00 31 00 32 00 33 00 38 |.,. .'.4 > .1.2.3.8| > 0160 00 38 00 30 00 35 00 36-00 39 00 27 00 2c 00 20 |.8.0.5.6 .9.'.,. > | > 0170 00 35 00 2c 00 30 00 2c-00 30 00 2c 00 30 00 2c |.5.,.0., > .0.,.0.,| > 0180 00 30 00 2c 00 30 00 2c-00 27 00 32 00 30 00 30 |.0.,.0., > .'.2.0.0| > 0190 00 38 00 2d 00 37 00 2d-00 32 00 33 00 20 00 31 |.8.-.7.- .2.3. > .1| > 01a0 00 34 00 3a 00 31 00 31-00 3a 00 34 00 38 00 27 |.4.:.1.1 > .:.4.8.'| > 01b0 00 29 00 00 00 26 04 04-01 00 00 00 |.)...&.. ....| > > token.c:495:tds_process_tokens(0xa01d558, 0xbf9647d0, 0xbf9647cc, > 0x104) > util.c:162:Changed query state from PENDING to READING > net.c:663:Received packet > 0000 04 01 00 2f 00 33 01 00-ff 11 00 c3 00 00 00 00 |.../.3.. > ........| > 0010 00 79 00 00 00 00 ac 0d-00 00 01 38 00 00 00 26 |.y...... > ...8...&| > 0020 04 04 02 00 00 00 fe 00-00 e0 00 00 00 00 00 |........ .......| > > token.c:510:processing result tokens. marker is ff(DONEINPROC) > token.c:2274:tds_process_end: more_results = 1 > was_cancelled = 0 > error = 0 > done_count_valid = 1 > token.c:2305: rows_affected = 0 > token.c:510:processing result tokens. marker is 79(RETURNSTATUS) > token.c:510:processing result tokens. marker is ac(PARAM) > token.c:567:processing parameters for sp 11 > token.c:569:calling tds_process_param_result > token.c:1198:tds_process_param_result(0xa01d558, 0xbf964780) > token.c:1582:tds_get_data_info(0xa01d558, 0xa0969d0, 1) [for > parameter]token.c:1645:processing result. type = 38(integer-null), > varint_size 1 > token.c:1666:processing result. column_size 4 > token.c:1984:tds_get_data: type 38, varint size 1 > token.c:2048:tds_get_data(): wire column size is 4 > log.c:481:type integer-null has value 2 > token.c:573:1 hidden return parameters > token.c:510:processing result tokens. marker is fe(DONEPROC) > token.c:2274:tds_process_end: more_results = 0 > was_cancelled = 0 > error = 0 > done_count_valid = 0 > token.c:2290:tds_process_end() state set to TDS_IDLE > util.c:162:Changed query state from READING to IDLE > token.c:2305: rows_affected = 0 > util.c:110:logic error: cannot change query state from IDLE to PENDING > token.c:495:tds_process_tokens(0xa01d558, 0xbf9647d0, 0xbf9647cc, > 0x104) > token.c:498:tds_process_tokens() state is COMPLETED > odbc.c:3296:SQLExecute(0xa0a8e38) > odbc.c:3021:_SQLExecute(0xa0a8e38) > odbc.c:3026:_SQLExecute() starting with state 0 > odbc.c:3134:End prepare, execute > query.c:1631:tds_submit_execute() > mem.c:563:tds_free_all_results() > util.c:162:Changed query state from IDLE to QUERYING > util.c:162:Changed query state from QUERYING to PENDING > net.c:769:Sending packet > 0000 03 01 00 29 00 00 01 00-0a 00 73 00 70 00 5f 00 |...).... > ..s.p._.| > 0010 65 00 78 00 65 00 63 00-75 00 74 00 65 00 00 00 |e.x.e.c. > u.t.e...| > 0020 00 00 26 04 04 02 00 00-00 |..&..... .| > > token.c:495:tds_process_tokens(0xa01d558, 0xbf9647b8, 0xbf9647b4, > 0x6914) > util.c:162:Changed query state from PENDING to READING > net.c:663:Received packet > 0000 04 01 00 1f 00 33 01 00-ff 11 00 c3 00 01 00 00 |.....3.. > ........| > 0010 00 79 00 00 00 00 fe 00-00 e0 00 01 00 00 00 |.y...... .......| > > token.c:510:processing result tokens. marker is ff(DONEINPROC) > token.c:2274:tds_process_end: more_results = 1 > was_cancelled = 0 > error = 0 > done_count_valid = 1 > token.c:2305: rows_affected = 1 > util.c:162:Changed query state from READING to PENDING > odbc.c:3328:odbc_process_tokens: tds_process_tokens returned 1 > odbc.c:3329: result_type=4054, TDS_DONE_COUNT=10, TDS_DONE_ERROR=0 > odbc.c:3393:odbc_process_tokens: processed TDS_DONEINPROC_RESULT > odbc.c:3175:_SQLExecute: odbc_process_tokens returned result_type 4054 > token.c:495:tds_process_tokens(0xa01d558, 0xbf9647b8, 0xbf9647b4, > 0x6914) > util.c:162:Changed query state from PENDING to READING > token.c:510:processing result tokens. marker is 79(RETURNSTATUS) > token.c:510:processing result tokens. marker is fe(DONEPROC) > token.c:2274:tds_process_end: more_results = 0 > was_cancelled = 0 > error = 0 > done_count_valid = 0 > token.c:2290:tds_process_end() state set to TDS_IDLE > util.c:162:Changed query state from READING to IDLE > token.c:2305: rows_affected = 1 > util.c:110:logic error: cannot change query state from IDLE to PENDING > odbc.c:3328:odbc_process_tokens: tds_process_tokens returned 1 > odbc.c:3329: result_type=4053, TDS_DONE_COUNT=0, TDS_DONE_ERROR=0 > odbc.c:3369:odbc_process_tokens: row_count=1 > odbc.c:3175:_SQLExecute: odbc_process_tokens returned result_type 4053 > odbc.c:1552:SQLAllocStmt(0xa0a8c20, 0xa0dc9b0) > odbc.c:1451:_SQLAllocStmt(0xa0a8c20, 0xa0dc9b0) > odbc.c:4169:SQLGetStmtAttr(0xa0aaa70, 10010, 0xbf9647dc, 4, (nil)) > odbc.c:4001:_SQLGetStmtAttr(0xa0aaa70, 10010, 0xbf9647dc, 4, (nil)) > odbc.c:4169:SQLGetStmtAttr(0xa0aaa70, 10011, 0xbf9647dc, 4, (nil)) > odbc.c:4001:_SQLGetStmtAttr(0xa0aaa70, 10011, 0xbf9647dc, 4, (nil)) > odbc.c:4169:SQLGetStmtAttr(0xa0aaa70, 10012, 0xbf9647dc, 4, (nil)) > odbc.c:4001:_SQLGetStmtAttr(0xa0aaa70, 10012, 0xbf9647dc, 4, (nil)) > odbc.c:4169:SQLGetStmtAttr(0xa0aaa70, 10013, 0xbf9647dc, 4, (nil)) > odbc.c:4001:_SQLGetStmtAttr(0xa0aaa70, 10013, 0xbf9647dc, 4, (nil)) > odbc.c:4214:SQLPrepare(0xa0aaa70, SELECT FaxJob.FaxJobID FROM FaxJob > WHERE( FaxJob.FaxDeptID = -26084249), 71) > odbc.c:4278:Creating prepared statement > mem.c:563:tds_free_all_results() > util.c:162:Changed query state from IDLE to QUERYING > util.c:162:Changed query state from QUERYING to PENDING > net.c:769:Sending packet > 0000 03 01 00 ca 00 00 01 00-ff ff 0b 00 00 00 00 01 |........ > ........| > 0010 26 04 00 00 00 63 00 00-00 00 09 04 d0 00 34 ff |&....c.. > ......4.| > 0020 ff ff ff 00 00 63 8e 00-00 00 09 04 d0 00 34 8e |.....c.. > ......4.| > 0030 00 00 00 53 00 45 00 4c-00 45 00 43 00 54 00 20 |...S.E.L .E.C.T. > | > 0040 00 46 00 61 00 78 00 4a-00 6f 00 62 00 2e 00 46 |.F.a.x.J > .o.b...F| > 0050 00 61 00 78 00 4a 00 6f-00 62 00 49 00 44 00 20 |.a.x.J.o .b.I.D. > | > 0060 00 46 00 52 00 4f 00 4d-00 20 00 46 00 61 00 78 |.F.R.O.M . > .F.a.x| > 0070 00 4a 00 6f 00 62 00 20-00 57 00 48 00 45 00 52 |.J.o.b. > .W.H.E.R| > 0080 00 45 00 28 00 20 00 46-00 61 00 78 00 4a 00 6f |.E.(. .F > .a.x.J.o| > 0090 00 62 00 2e 00 46 00 61-00 78 00 44 00 65 00 70 |.b...F.a > .x.D.e.p| > 00a0 00 74 00 49 00 44 00 20-00 3d 00 20 00 2d 00 32 |.t.I.D. .=. > .-.2| > 00b0 00 36 00 30 00 38 00 34-00 32 00 34 00 39 00 29 |.6.0.8.4 > .2.4.9.)| > 00c0 00 00 00 26 04 04 01 00-00 00 |...&.... ..| > this is the select (prepared) > token.c:495:tds_process_tokens(0xa0a8f30, 0xbf9646e0, 0xbf9646dc, > 0x104) > util.c:162:Changed query state from PENDING to READING > net.c:663:Received packet > 0000 04 01 00 48 00 37 01 00-81 01 00 00 00 10 00 38 |...H.7.. > .......8| > 0010 08 46 00 61 00 78 00 4a-00 6f 00 62 00 49 00 44 |.F.a.x.J > .o.b.I.D| > 0020 00 ff 01 00 c1 00 00 00-00 00 79 00 00 00 00 ac |........ > ..y.....| > 0030 0d 00 00 01 38 00 00 00-26 04 04 01 00 00 00 fe |....8... > &.......| > 0040 00 00 e0 00 00 00 00 00- |........| > id 1 > token.c:510:processing result tokens. marker is 81(TDS7_RESULT) > token.c:1526:processing TDS7 result metadata. > mem.c:563:tds_free_all_results() > token.c:1550:set current_results (1 column) to tds->res_info > token.c:1561:setting up column 0 > token.c:1496:tds7_get_data_info: > colname = FaxJobID (8 bytes) > type = 56 (int) > server's type = 56 (int) > column_varint_size = 0 > column_size = 4 (4 on server) > util.c:162:Changed query state from READING to PENDING > token.c:495:tds_process_tokens(0xa0a8f30, 0xbf9646e0, 0xbf9646dc, > 0x104) > util.c:162:Changed query state from PENDING to READING > token.c:510:processing result tokens. marker is ff(DONEINPROC) > token.c:2274:tds_process_end: more_results = 1 > was_cancelled = 0 > error = 0 > done_count_valid = 0 > token.c:2305: rows_affected = 0 > token.c:510:processing result tokens. marker is 79(RETURNSTATUS) > token.c:510:processing result tokens. marker is ac(PARAM) > token.c:567:processing parameters for sp 11 > token.c:569:calling tds_process_param_result > token.c:1198:tds_process_param_result(0xa0a8f30, 0xbf964690) > token.c:1582:tds_get_data_info(0xa0a8f30, 0xa0de630, 1) [for > parameter]token.c:1645:processing result. type = 38(integer-null), > varint_size 1 > token.c:1666:processing result. column_size 4 > token.c:1984:tds_get_data: type 38, varint size 1 > token.c:2048:tds_get_data(): wire column size is 4 > log.c:481:type integer-null has value 1 > token.c:573:1 hidden return parameters > token.c:510:processing result tokens. marker is fe(DONEPROC) > token.c:2274:tds_process_end: more_results = 0 > was_cancelled = 0 > error = 0 > done_count_valid = 0 > token.c:2290:tds_process_end() state set to TDS_IDLE > util.c:162:Changed query state from READING to IDLE > token.c:2305: rows_affected = 0 > util.c:110:logic error: cannot change query state from IDLE to PENDING > token.c:495:tds_process_tokens(0xa0a8f30, 0xbf9646e0, 0xbf9646dc, > 0x104) > token.c:498:tds_process_tokens() state is COMPLETED > odbc.c:3296:SQLExecute(0xa0aaa70) > odbc.c:3021:_SQLExecute(0xa0aaa70) > odbc.c:3026:_SQLExecute() starting with state 0 > odbc.c:3134:End prepare, execute > query.c:1631:tds_submit_execute() > mem.c:563:tds_free_all_results() > util.c:162:Changed query state from IDLE to QUERYING > util.c:162:Changed query state from QUERYING to PENDING > net.c:769:Sending packet > 0000 03 01 00 29 00 00 01 00-0a 00 73 00 70 00 5f 00 |...).... > ..s.p._.| > 0010 65 00 78 00 65 00 63 00-75 00 74 00 65 00 00 00 |e.x.e.c. > u.t.e...| > 0020 00 00 26 04 04 01 00 00-00 |..&..... .| > select (executed prepared id 1) > token.c:495:tds_process_tokens(0xa0a8f30, 0xbf9646c8, 0xbf9646c4, > 0x6914) > util.c:162:Changed query state from PENDING to READING > net.c:663:Received packet > 0000 04 01 00 3d 00 37 01 00-81 01 00 00 00 10 00 38 |...=.7.. > .......8| > 0010 08 46 00 61 00 78 00 4a-00 6f 00 62 00 49 00 44 |.F.a.x.J > .o.b.I.D| > 0020 00 d1 57 00 00 00 ff 11-00 c1 00 01 00 00 00 79 |..W..... > .......y| > 0030 00 00 00 00 fe 00 00 e0-00 01 00 00 00 |........ .....| > > token.c:510:processing result tokens. marker is 81(TDS7_RESULT) > token.c:1526:processing TDS7 result metadata. > mem.c:563:tds_free_all_results() > token.c:1550:set current_results (1 column) to tds->res_info > token.c:1561:setting up column 0 > token.c:1496:tds7_get_data_info: > colname = FaxJobID (8 bytes) > type = 56 (int) > server's type = 56 (int) > column_varint_size = 0 > column_size = 4 (4 on server) > util.c:162:Changed query state from READING to PENDING > odbc.c:3328:odbc_process_tokens: tds_process_tokens returned 1 > odbc.c:3329: result_type=4049, TDS_DONE_COUNT=10, TDS_DONE_ERROR=0 > odbc.c:3399:odbc_process_tokens: returning result_type 4049 > odbc.c:3175:_SQLExecute: odbc_process_tokens returned result_type 4049 > token.c:495:tds_process_tokens(0xa0a8f30, 0xbf9646c8, 0xbf9646c4, > 0x6914) > util.c:162:Changed query state from PENDING to READING > token.c:510:processing result tokens. marker is d1(ROW) > token.c:621:tds_process_tokens::SET_RETURN stopping on current token > util.c:162:Changed query state from READING to PENDING > odbc.c:3328:odbc_process_tokens: tds_process_tokens returned 1 > odbc.c:3329: result_type=4040, TDS_DONE_COUNT=10, TDS_DONE_ERROR=0 > odbc.c:3399:odbc_process_tokens: returning result_type 4040 > odbc.c:3175:_SQLExecute: odbc_process_tokens returned result_type 4040 SQLExecute finished > odbc.c:4190:SQLNumResultCols(0xa0aaa70, 0xbf964878) > odbc.c:1751:SQLDescribeCol(0xa0aaa70, 1, 0x1863e8, 41, 0xbf964874, > 0xbf96486c, 0xbf964860, 0xbf964868, 0xbf964864) > odbc.c:1552:SQLAllocStmt(0xa0a8c20, 0xa0dea40) > odbc.c:1451:_SQLAllocStmt(0xa0a8c20, 0xa0dea40) > odbc.c:4169:SQLGetStmtAttr(0xa096b60, 10010, 0xbf964768, 4, (nil)) > odbc.c:4001:_SQLGetStmtAttr(0xa096b60, 10010, 0xbf964768, 4, (nil)) > odbc.c:4169:SQLGetStmtAttr(0xa096b60, 10011, 0xbf964768, 4, (nil)) > odbc.c:4001:_SQLGetStmtAttr(0xa096b60, 10011, 0xbf964768, 4, (nil)) > odbc.c:4169:SQLGetStmtAttr(0xa096b60, 10012, 0xbf964768, 4, (nil)) > odbc.c:4001:_SQLGetStmtAttr(0xa096b60, 10012, 0xbf964768, 4, (nil)) > odbc.c:4169:SQLGetStmtAttr(0xa096b60, 10013, 0xbf964768, 4, (nil)) > odbc.c:4001:_SQLGetStmtAttr(0xa096b60, 10013, 0xbf964768, 4, (nil)) > odbc.c:870:SQLPrimaryKeys(0xa096b60, (nil), 0, (nil), 0, 0x121be8, 6) > odbc.c:3021:_SQLExecute(0xa096b60) > odbc.c:3026:_SQLExecute() starting with state 2 this is the problem! here you call SQLExecute but you forgot to read row returned by select! So state is 2 (PENDING) which means that is expected you read data. This is probably an INSERT after a SELECT, not a SELECT after INSERT. Get the row after select and problem will disappear. Or you can use cursors settings. > ... omissis ... freddy77