[freetds] SQLRowCount failing after prepare and execute

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Mon Feb 16 08:20:11 EST 2004


> 
> Freddy,
> 
> might we be able to use that short on the DONEINPROC to help 
> us (remember the RAISERROR thing ?)
> 
> If you send me the complete output packet from a prepared 
> 
> "select * from #tmp where i=2 delete from #tmp"
> 
> and a prepared
> 
> "delete from #tmp select * from #tmp where i=2"
> 
> I might be able to find out some values :-)
> 
> Bill
> 
> 

Ok, this is the code

#include "common.h"

/* Test for SQLPrepare */

static char software_version[] = "$Id$";
static void *no_unused_var_warn[] = { software_version,
no_unused_var_warn };

int
main(int argc, char *argv[])
{
	Connect();

	Command(Statement, "create table #tmp (i int) insert into #tmp
values(1)");

	if (SQLPrepare(Statement, (SQLCHAR *) "delete from #tmp select *
from #tmp where i=2", SQL_NTS) != SQL_SUCCESS) {
		printf("Unable to prepare statement\n");
		exit(1);
	}

	if (SQLExecute(Statement) != SQL_SUCCESS) {
		printf("Wrong result executing statement\n");
		exit(1);
	}
	
	while(SQLMoreResults(Statement) == SQL_SUCCESS);

	Disconnect();

	printf("Done.\n");
	return 0;
}

Outputs attached

freddy77
-------------- next part --------------
A non-text attachment was scrubbed...
Name: out1.txt.gz
Type: application/x-gzip
Size: 1750 bytes
Desc: out1.txt.gz
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20040216/2677ee69/attachment.gz 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: out.txt.gz
Type: application/x-gzip
Size: 1735 bytes
Desc: out.txt.gz
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20040216/2677ee69/attachment-0001.gz 


More information about the FreeTDS mailing list