Skip to Content.
Sympa Menu

freetds - RE: re-use of dbprocess structure (was: Re: [freetds] stateofdbrpcsend())

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Joseph Geiser" <joe AT mail.paravisions.com>
  • To: "'FreeTDS Development Group'" <freetds AT lists.ibiblio.org>
  • Subject: RE: re-use of dbprocess structure (was: Re: [freetds] stateofdbrpcsend())
  • Date: Thu, 15 Jul 2004 07:57:46 -0400

> Thanks. I don't know if you prefer to extend rpc.c unittests or just
> write a new one.
> Some hint:
> - no parameters
> - all input
> - some output
> - mix named parameters with unnamed ones
> - test data (input parameters and output parameters)
> - test result code from procedure
> - different data types

Since I am working in this area, I would suggest one more test be added to
the list. Here's an example:

Test: Returned resultset from cursor derived in the SP...

Example:

[SP in the DB]

CREATE PROCEDURE [mt_testhash]
@hashin varchar(20),
@hashdata CURSOR VARYING OUTPUT
AS

set transaction isolation level read uncommitted
set nocount on

set @hashdata= CURSOR FOR
select client_id, prod_id, track_id from hash_master where
external_hash=@hashin

open @hashdata

return 0


[Code from TSQL, or other similar code to this]

declare @cid cursor,
@returncode int,
@r_cid int,
@r_pid int,
@r_tid varchar(20)

exec mt_testhash @hashin='1h88f0', @hashdata=@cid OUTPUT

fetch next from @cid into @r_cid, @r_pid, @r_tid

print 'Results from the called Stored Procedure'
print ' '

while @@fetch_status=0
begin
print 'Client ID Returned is ' + cast(@r_cid as char(10))
print 'Product ID Returned is ' + cast(@r_pid as char(10))
print 'Track ID Returned is ' + cast(@r_tid as char(10))
print 'Return Code from the SP is ' + cast(@returncode as char(10))
fetch next from @cid into @r_cid, @r_pid, @r_tid
end
close @cid
deallocate @cid


[Expected Results]

Results from the called Stored Procedure

Client ID Returned is 88888
Product ID Returned is 10001
Track ID Returned is test_track_v2
Return Code from the SP is 0

Just my US$0.02 worth... If you'd like, I'd be happy to test a final beta
with some SPs we're using here, which span the gammut in variety.

Best Regards,
Joe Geiser



Archive powered by MHonArc 2.6.24.

Top of Page