Skip to Content.
Sympa Menu

freetds - Re: [freetds] rpc strategy

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: freetds AT lists.ibiblio.org
  • Subject: Re: [freetds] rpc strategy
  • Date: 23 Nov 2002 10:36:23 +0100

Il sab, 2002-11-23 alle 07:28, James K. Lowden ha scritto:
> Hello everyone,
>
> Frediano told me rpc is "quite done" in libtds, but I think we're speaking
> of different things that might overlap somewhat. I've been reading about
> the dblib rpc fuctions, trying to mate them to the TDS documentation, and
> AFAICT, what I'm trying to do is quite different from "dynamic SQL". What
> I'm doing has no placeholders.
>

Yesterday tds_submit_rpc was just empty. Today it should work on TDS7+.
The reason is that call to dynamic and RPC are very similar, so a bit of
cut&paste is sufficient.

> This message is an outline of what I think is needed. Please chime in to
> keep me on track.
>
> What I have done so far is define the data structures to hold what the
> client application passes to db-lib. I'm now wrestling with dbrpcsend(),
> which dereferences all those captured values and sends the appropriate
> packets to the server.
>
> I propose a 1:1 mapping of TDS token to libtds function, passing a data
> structure/parameters sufficient to construct the packet. In fact, I'd
> like to divide libtds along those very lines: a "token layer" to be called
> by the client APIs, one per token, and a "wire layer" of internal
> functions to support the token layer.
>
> Toward that end, I see flow control like this:
>
> 1. dbrpcinit
> 2. dbrpcparam
> [repeat 2 as for each param]
> [repeat 1, 2 for each proc]
> 3. dbrpcsend
> ^^-dblib-^^
> vv--tds--vv
> 4. TDS_DBRPC (sends proc name)
> 5. TDS_PARAMFMT (sends param types)
> 6. TDS_PARAMS (sends param data)
> 7. TDS_DONE_[MORE|FINAL]
> [repeat 4..7 for each proc]
> [return status to dbrpcsend]
> ^^--tds--^^

RPC in mssql and Sybase are quite different... The best thing to to is
to send RPC request calling a unique function (is what do now
tds_submit_rpc)

Params can be stored in a TDSPARAMINFO (there are functions for
allocating and adding a column at a time, so you can add a column at
time and finally allocate row, fill it and call tds_submit_rpc, this is
why I indicate dynamic1 as an example).


> vv-dblib-vv
> 8. dbsqlok (waits for first result set)
>
> Thenceforward, process results as usual, including output parameters.
>
> There's no TDS_DBRPC definition in tds.h, leading me to think I'm the
> first guy to work on this. If I'm going down the wrong path, though, I'd
> sure appreciate a map.
>

>From the Sybase manuals there are some way do do a RPC:
- use header 3 (same method of mssql, perhaps this work even on tds4.2 and
tds5, not tested)
- use TDS_RPC (old and deprecated)
- use TDS_DBRPC (TDS5)

freddy77






Archive powered by MHonArc 2.6.24.

Top of Page