Skip to Content.
Sympa Menu

freetds - Re: [freetds] [0.95rc2] Unit Tests / Unicode

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] [0.95rc2] Unit Tests / Unicode
  • Date: Sat, 16 May 2015 06:12:18 +0100

2015-05-15 8:49 GMT+01:00 Sergio NNX <sfhacker AT hotmail.com>:
> CC long_error.o
> In file included from
> c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/
> sql.h:19:0,
> from common.h:24,
> from long_error.c:3:
> c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/sqltypes.h:87:29:
> erro
> r: conflicting types for 'TCHAR'
> In file included from
> c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/
> windef.h:239:0,
> from
> c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/
> windows.h:60,
> from
> c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/
> winsock2.h:40,
> from
> c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/
> ws2tcpip.h:41,
> from common.h:3,
> from long_error.c:3:
> c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/winnt.h:136:15:
> note:
> previous declaration of 'TCHAR' was here
> In file included from
> c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/
> sql.h:19:0,
> from common.h:24,
> from long_error.c:3:
> c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/sqltypes.h:111:29:
> err
> or: conflicting types for 'LPTSTR'
> In file included from
> c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/
> windef.h:239:0,
> from
> c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/
> windows.h:60,
> from
> c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/
> winsock2.h:40,
> from
> c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/
> ws2tcpip.h:41,
> from common.h:3,
> from long_error.c:3:
> c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/winnt.h:154:30:
> note:
> previous declaration of 'LPTSTR' was here
> make[1]: *** [long_error.o] Error 1
>

Hi Sergio,
Can you try this version?

Can you post DUMPs for rpc tests ? Use a temporary user you you are
afraid of security leaks of send privately to me.

Thanks,
Frediano

PS: Are you Italian ? What's your real name ?
#include "common.h"


/*
Demonstration of triggered assert when invoking this stored procedure
using FreeTDS odbc driver:

create procedure proc_longerror as
begin
    raiserror('reallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylong error', 16, 1)
end

*/

static void extract_error(SQLHANDLE handle, SQLSMALLINT type);

int
main(void)
{
	int i;
	char cmd[128 + 110*10];

	printf("SQLWCHAR size is: %d\n", (int) sizeof(SQLWCHAR));

	odbc_use_version3 = 1;
	odbc_connect();

	/* this test do not work with Sybase */
	if (!odbc_db_is_microsoft()) {
		odbc_disconnect();
		return 0;
	}

	strcpy(cmd, "create procedure #proc_longerror as\nbegin\nraiserror('");
	for (i = 0; i < 110; ++i)
		strcat(cmd, "reallylong");
	strcat(cmd, " error', 16, 1)\nend\n");
	odbc_command(cmd);

	CHKR2(SQLExecDirectW,
	      (odbc_stmt, odbc_get_sqlwchar(&odbc_buf, "{CALL #proc_longerror}"), SQL_NTS),
	      SQL_HANDLE_STMT, odbc_stmt, "E");

	extract_error(odbc_stmt, SQL_HANDLE_STMT);

	odbc_disconnect();
	return 0;
}

static void
extract_error(SQLHANDLE handle, SQLSMALLINT type)
{
	SQLINTEGER i = 0;
	SQLINTEGER native;
	SQLWCHAR state[7];
	SQLWCHAR text[256];
	SQLSMALLINT len;
	SQLRETURN ret;

	fprintf(stderr, "\n" "The driver reported the following diagnostics\n");

	do {
		ret = SQLGetDiagRecW(type, handle, ++i, state, &native, text, 256, &len);
		state[5] = 0;
		if (SQL_SUCCEEDED(ret))
			printf("%s:%ld:%ld:%s\n", odbc_get_sqlchar(&odbc_buf, state), (long) i,
			       (long) native, odbc_get_sqlchar(&odbc_buf, text));
	}
	while (ret == SQL_SUCCESS);
}




Archive powered by MHonArc 2.6.24.

Top of Page