Skip to Content.
Sympa Menu

freetds - Re: [freetds] blk_init fails by the even number times execution

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] blk_init fails by the even number times execution
  • Date: Fri, 9 Mar 2007 13:48:01 +0100

>
> 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.
>
> source
> | int main() {
> | CS_RETCODE ret = CS_SUCCEED;
> | int i = 0;
> |
> | ret = hoge_login("DB_SERVER", "DB_USERID", "DB_PASSWD",
> "hogexxx");
> | for (i=0; i < 10; i++) {
> | ret = hoge_blkin("hogexxx", data1[i]);
> | check(ret);
> | }
> |
> | ret = hoge_logout();
> | exit(ret);
> | }
> |
> | CS_RETCODE hoge_blkin(char *table, char *data) {
> | CS_DATAFMT meta ={""};
> | CS_INT length = 5;
> | CS_INT row = 0;
> |
> | if (CS_SUCCEED != ct_cancel(con, NULL, CS_CANCEL_ALL))
> return CS_FAIL;
> | if (CS_SUCCEED != blk_init(blk, CS_BLK_IN, table,
> CS_NULLTERM)) return CS_FAIL;
> |
> | meta.count = 1;
> | meta.datatype = CS_CHAR_TYPE;
> | meta.format = CS_FMT_PADBLANK;
> | meta.maxlength = 5;
> |
> | if (CS_SUCCEED != blk_bind(blk, (int)1, &meta, data,
> &length, NULL)) return CS_FAIL;
> | if (CS_SUCCEED != blk_rowxfer(blk)) return CS_FAIL;
> | if (CS_SUCCEED != blk_done(blk, CS_BLK_ALL, &row))
> return CS_FAIL;
> |
> | return CS_SUCCEED;
> | }
>

Seems ok.


> 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
> | token.c:514:tds_process_tokens() state is COMPLETED

This is not ok! libTDS should not change state to 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

Here cancel is not cancelling cause state is not "busy"

> | 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.|
> |

query for next bulk

> | util.c:119:Changing query state from PENDING to READING
> | net.c:446:Received header
> | 0000 04 01 00 11 00 37 01 00- |.....7..|
> |
> | net.c:542:Received packet
> | 0000 fd 10 00 f0 00 01 00 00-00 |........ .|
> |


but this is the result of previous bulk (1 row inserted)

> | 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
>

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page