[freetds] [SOLVED] blk_init fails by the even number times execution

MATSUMOTO, Tadashi pineroot at yahoo.co.jp
Sun Mar 11 23:50:52 EST 2007


Thank you! The problem is solved. 
It succeeded as follows. 

However, another problem occurred. Details E-mail separately. 
(It is not included in the following dump. )

| blk.c:232:blk_done()
| net.c:673:Sending packet
| 0000 07 01 00 1e 00 00 01 00-81 01 00 00 00 09 00 26 |........ .......&|
| 0010 04 03 63 00 6f 00 6c 00-d1 04 67 2b 00 00       |..c.o.l. ..g+..|
| 
| util.c:119:Changing query state from QUERYING to PENDING
| util.c:119:Changing query state from PENDING to READING
| net.c:446:Received header
| 0000 04 01 00 11 00 38 01 00-                        |.....8..|
| 
| net.c:542:Received packet
| 0000 fd 10 00 f0 00 01 00 00-00                      |........ .|
| 
| token.c:526:processing result tokens.  marker is  fd(DONE)
| token.c:2143:tds_process_end: more_results = 0
|                 was_cancelled = 0
|                 error = 0
|                 done_count_valid = 1
| token.c:2159:tds_process_end() state set to TDS_IDLE
| util.c:119:Changing query state from READING to IDLE
| token.c:2175:                rows_affected = 1
| util.c:119:Changing query state from IDLE to PENDING
| token.c:514:tds_process_tokens() state is COMPLETED
| ct.c:2053:ct_cancel()
| ct.c:2220:CS_CANCEL_ALL with connection
| ct.c:2222:ct_cancel() cancelling a command for a connection
| ct.c:2228:ct_cancel() command state SENT
| ct.c:214:setting command state from IDLE to IDLE
| blk.c:344:blk_init()
| util.c:119:Changing query state from IDLE to QUERYING
| mem.c:519:tds_free_all_results()
| write.c:134:tds_put_string converting 33 bytes of "select * from hogexxx where 0 = 1"
| write.c:162:tds_put_string wrote 66 bytes
| util.c:119:Changing query state from QUERYING to PENDING
| net.c:673:Sending packet
| 0000 01 01 00 4a 00 00 01 00-73 00 65 00 6c 00 65 00 |...J.... s.e.l.e.|
| 0010 63 00 74 00 20 00 2a 00-20 00 66 00 72 00 6f 00 |c.t. .*.  .f.r.o.|
| 0020 6d 00 20 00 68 00 6f 00-67 00 65 00 78 00 78 00 |m. .h.o. g.e.x.x.|
| 0030 78 00 20 00 77 00 68 00-65 00 72 00 65 00 20 00 |x. .w.h. e.r.e. .|
| 0040 30 00 20 00 3d 00 20 00-31 00                   |0. .=. . 1.|
| 
| util.c:119:Changing query state from PENDING to READING
| net.c:446:Received header
| 0000 04 01 00 21 00 38 01 00-                        |...!.8..|
| 
| net.c:542:Received packet
| 0000 81 01 00 00 00 09 00 26-04 03 63 00 6f 00 6c 00 |.......& ..c.o.l.|
| 0010 fd 10 00 c1 00 00 00 00-00                      |........ .|
| 
| token.c:526:processing result tokens.  marker is  81(TDS7_RESULT)
| mem.c:519:tds_free_all_results()
| token.c:1472:processing TDS7 result. set current_results to tds->res_info
| read.c:179:tds_get_string: reading 6 from wire to give 3 to client.
| token.c:1414:tds7_get_data_info:
|         colname = col (3 bytes)
|         type = 38 (integer-null)
|         server's type = 38 (integer-null)
|         column_varint_size = 1
|         column_size = 4 (4 on server)
| util.c:119:Changing query state from READING to PENDING
| util.c:119:Changing query state from PENDING to READING
| token.c:526:processing result tokens.  marker is  fd(DONE)
| token.c:2143:tds_process_end: more_results = 0
|                 was_cancelled = 0
|                 error = 0
|                 done_count_valid = 1
| token.c:2159:tds_process_end() state set to TDS_IDLE
| util.c:119:Changing query state from READING to IDLE
| token.c:2175:                rows_affected = 0
| util.c:119:Changing query state from IDLE to PENDING
| token.c:514:tds_process_tokens() state is COMPLETED


ZIGLIO, Frediano, VF-IT wrote:
>> Hello at beginning. 
>> PLEASE HELP.
>>
>> I want to execute blk_init two or more times as follows. 
>>
>> It fails when it is 0.64 though it is possible to execute in 
>> FreeTDS 0.63 without trouble. 
>> Besides, the following error messages are returned by the 
>> success only as for blk_init of 
>> first time, the 3rd times, and the 6th times. 
>>
>>  layer=2, no=5, len=84, msg=blk_init: blk layer: intl library 
>> error: Failed when processing results from server.
>>
>> Is there something insufficient in the procedure?
>>
>> Judging from examining it here, it is anxious that neither 
>> the transmission of the packet
>> nor the reception are done in ct_cancel and the reception is 
>> not done only by the transmission in blk_done. 
>>
>> The environment is ..
>> ・SUA on MS WindowsServer 2003 R2
>> ・MS SQLServer 2005
>> ・FreeTds 0.63/0.64
>>
>> My best regards. 
>>
> .....
>> dump
>> | blk.c:232:blk_done()
>> | net.c:673:Sending packet
>> | 0000 07 01 00 26 00 00 01 00-81 01 00 00 00 0b 00 af 
>> |...&.... ........|
>> | 0010 0a 00 11 04 00 12 00 03-63 00 6f 00 6c 00 d1 05 
>> |........ c.o.l...|
>> | 0020 00 31 31 31 31 31      -                        |.11111|
>> | 
>> | util.c:119:Changing query state from IDLE to PENDING
> 
> 
> Try this small patch
> 
> Index: src/ctlib/blk.c
> ===================================================================
> RCS file: /cvsroot/freetds/freetds/src/ctlib/blk.c,v
> retrieving revision 1.32
> diff -u -1 -0 -r1.32 blk.c
> --- src/ctlib/blk.c     20 Jul 2005 10:58:44 -0000      1.32
> +++ src/ctlib/blk.c     9 Mar 2007 13:10:10 -0000
> @@ -797,20 +797,21 @@
>         blkdesc->insert_stmt = query;
> 
>         /*
>          * In TDS 5 we get the column information as a result set from the "insert bulk" command.
>          * We're going to ignore it.
>          */
>         if (tds_process_simple_query(tds) != TDS_SUCCEED) {
>                 _ctclient_msg(blkdesc->con, "blk_rowxfer", 2, 5, 1, 140, "");
>                 return CS_FAIL;
>         }
> +       tds_set_state(tds, TDS_QUERYING);
> 
>         /*
>          * Work out the number of "variable" columns.  These are either nullable or of
>          * varying length type e.g. varchar.
>          */
>         blkdesc->var_cols = 0;
> 
>         if (IS_TDS50(tds)) {
>                 for (i = 0; i < blkdesc->bindinfo->num_cols; i++) {
> 
> 
> 
> It's illegal to switch from IDLE to PENDING so you have to go to QUERYING. This is also logically correct. You shouldn't expect data if you don't send a request. Also issuing a "insert bulk" means that you want to send data!


More information about the FreeTDS mailing list