[freetds] state of dbrpcsend()

liam at inodes.org liam at inodes.org
Tue Jun 8 22:59:29 EDT 2004


Hi,

I've been reading through the archive and in particular the threads
between Sasha Polyanovskyi and James Lowden. Is someone able to 
clearly describe what state dbrpcsend() is currently in? Is it working,
broken, somewhere in between?

I've been trying (in vain) to get both the stable (0.62.1) and CVS 
versions (0.63.dev.20040608) of the db-lib implementation of FreeTDS 
working with stored procedures. The unit tests work, but my stored 
procedures do not. I can however use regular SQL statements without 
any issue. I can call these stored procedures with 'tsql' without
any issue either.

My code is as follows:

int test_function(int lowest, int highest) {

	int retval;

	dbinit();
	dblogin();
	...
	dbrpcinit(proc, "sp_freetds_test", 0)
	dbrpcparam(proc, "@lowest", 0, SYBINT4, -1, -1, 
	           (BYTE *) &lowest);
	dbrpcparam(proc, "@highest", 0, SYBINT4, -1, -1, 
	           (BYTE *) &highest);
	dbrpcparam(proc, "@rc", DBRPCRETURN, SYBINT4, -1, -1,
	           (BYTE *) &retval);

	dbrpcsend(proc);
	...
}

The function fails at dbrpcsend(). The stored procedure looks as
follows:

ALTER PROC sp_freetds_test (@lowest INT, @highest INT)
AS
	...
	RETURN 0
GO

Doing a packet trace with a sniffer reveals that it appears that no
packets other than login are ever sent on the wire.

Unfortunately, it appears $TDSDUMP is broken in the CVS version but
in the stable version, I get:

12:55:00.656769 tds_process_end() state set to TDS_IDLE
12:55:00.656817 leaving tds_process_login_tokens() returning 1
12:55:00.685218 dbrpcinit() added rpcname "sp_freetds_test"
12:55:00.685356 dbrpcparam() added parameter "@lowest"
12:55:00.685405 dbrpcparam() added parameter "@highest"
12:55:00.685451 dbrpcparam() added parameter "@rc"
12:55:00.685500 dbrpcsend()
12:55:00.685957 in dbfreebuf()

Therefore, my questions are:

	- Am I calling the dblib API functions appropriately?
	- Is dbrpcsend() broken? 
	- Is the underlying FreeTDS API broken or just dblib? What's
	  the alternative;

Appreciate any input list members can provide.

Thanks.



More information about the FreeTDS mailing list