[freetds] Question on token.c

Thompson, Bill D (London) bill_d_thompson at ml.com
Wed Oct 1 17:34:11 EDT 2003


Thanks Freddy,

On another issue, I'm trying to get cursors working, but I'm banging my head
up against a brick wall!

I know how the stored procedure works thru query analyzer, and I'm
constructing an RPC TDS packet  which is right as far as I can see, but the
server keeps rejecting it.

have you (or anyone else) the wherewithal to sniff a packet from an odbc
driver when a cursor is initiated ?

here's how sp_cursoropen works...

declare @cursor integer
exec sp_cursoropen @cursor output, N'select * from authors', 4, 1 
select @cursor 

we have 4 parameters 
1 a output integer  - the returned cursor handle
2 the query as Ntext
3 a input/output integer - scroll type 4 = forward_only
4 a input/output integer - 1 = read-only

The packet I construct is as follows:

Sending packet @ 16:35:33.169738
0000 03 01 00 78 00 00 01 00-0d 00 73 00 70 00 5f 00 |...x.... ..s.p._.|
0010 63 00 75 00 72 00 73 00-6f 00 72 00 6f 00 70 00 |c.u.r.s. o.r.o.p.|
0020 65 00 6e 00 00 00 00 01-26 04 00 00 00 00 00 00 |e.n..... &.......|
0030 63 2a 00 00 00 09 04 d0-00 34 2a 00 00 00 73 00 |c*...... .4*...s.|
0040 65 00 6c 00 65 00 63 00-74 00 20 00 2a 00 20 00 |e.l.e.c. t. .*. .|
0050 66 00 72 00 6f 00 6d 00-20 00 61 00 75 00 74 00 |f.r.o.m.  .a.u.t.|
0060 68 00 6f 00 72 00 73 00-00 01 26 04 04 00 00 00 |h.o.r.s. ..&.....|
0070 00 01 26 04 01 00 00 00-                        |..&.....|


16:35:33.171386 ct_results()
Received header @ 16:35:33.172279
0000 04 01 00 11 02 72 01 00-                        |.....r..|


Received packet @ 16:35:33.173028
0000 fd 02 01 00 00 00 00 00-00                      |........ .|

TIA,

Bill


> -----Original Message-----
> From:	ZIGLIO Frediano [SMTP:Frediano.Ziglio at vodafone.com]
> Sent:	01 October 2003 14:49
> To:	FreeTDS Development Group
> Subject:	RE: [freetds] Question on token.c
> 
> > 
> > Hi,
> > 
> > I'm trying to integrate some changes of mine into the latest 
> > source code.
> > 
> > One of my new ct-library functions needs to call 
> > tds_process_end(), but I notice that this function has been 
> > made internal to token.c and cannot be referenced directly 
> > from the other API's
> > 
> > What's the thinking behind this ?
> > 
> > looks like the only "exposed" result and/or data processing 
> > functions are :
> > 
> > tds_process_result_tokens
> > tds_process_row_tokens
> > tds_process_trailing_tokens
> > tds_process_simple_query
> > tds_do_until_done
> > 
> > All of these are iterative, and may process more tokens than 
> > I want to....
> > 
> > Thanks,
> > 
> 
> Thinking is be clean. Few and clean entries. I don't know any reason to
> public tds_process_end. IMHO there should be only three public
> functions:
> 
>   tds_process_result_tokens
>   tds_process_row_tokens
>   tds_process_simple_query
> 
> Perhaps changing the way
> tds_process_result_tokens/tds_process_row_tokens return data (returning
> DONE as a result) should solve your problem.
> 
> freddy77
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds



More information about the FreeTDS mailing list