Skip to Content.
Sympa Menu

freetds - [freetds] rpc unit test

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "'TDS Development Group'" <freetds AT lists.ibiblio.org>
  • Subject: [freetds] rpc unit test
  • Date: Fri, 22 Nov 2002 17:53:22 -0500

Frediano,

I added src/dblib/unittest/rpc.c (taking my own advice to stop numbering
them). It is an rpc reimplementation of t0022.c. It works using
Microsoft's libaries on NT to SQL Server 7.0.

dynamic1.c doesn't retrieve a value from the output parameter of a stored
procedure, so it's not a very good model for me. I'll look at it again, to
see if I can figure out what to do with dbrpcsend.

I learned a few things today.

1. dbrpcinit() may be called several times before dbrpcsend. That means
the "SQL batch" that dbrpcsend transmits to the server may consist of
several stored procedures to execute. It also means my data structure has
to change, as does dbrpcinit(), of course.

2. Microsoft defines an option "DBRPCRESET" for dbrpcinit(), defined as:

"Cancels a single stored procedure or a batch of stored procedures.
If rpcname is specified, that new stored procedure is initialized after the
cancellation is complete."

3. Microsoft defines yet another way to retrieve stored procedure output
results, using a cursor. Details attached.

Regards,

--jkl


[doc]
The dbrpcinit function has an option parameter: DBRPCCURSOR. Use DBRPCCURSOR
to specify the initialization of an input-parameter list for a subsequent
cursor-open operation on a stored procedure. When you use DBRPCCURSOR, you
must set the rpcname parameter to NULL.

No pending remote procedure calls (RPCs) can exist when you call dbrpcinit
with an option of DBRPCCURSOR. The dbrpcinit function returns FAIL if
pending RPCs have been initiated.

You can call the dbrpcparam function to set the value for each stored
procedure parameter that was used in the process of opening a cursor. Stored
procedure parameters are no longer required to be constants, and they can be
passed as follows.

To open a cursor on a stored procedure that passes program variables as
parameters:

Call the dbrpcinit function once to initialize a new stored
procedure. Set the rpcname parameter to NULL, and set the option parameter
to DBRPCCURSOR.

Call the dbrpcparam function once per parameter to set the value of
each parameter of the stored procedure.

Call the dbcursoropen function to open the cursor, and in the stmt
parameter, specify only the stored procedure name.

Call the remaining cursor functions as you ordinarily would.
[end doc]




The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the
original message. Please note that we do not accept account orders and/or
instructions by e-mail, and therefore will not be responsible for carrying
out such orders and/or instructions.






Archive powered by MHonArc 2.6.24.

Top of Page