[freetds] Question on token.c

ZIGLIO Frediano Frediano.Ziglio at vodafone.com
Wed Oct 1 18:59:15 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
> 

Packet seem correct (only for TDS8, no TDS7) however sp_cursoropen have
5 parameters, not 4

freddy77


More information about the FreeTDS mailing list