Re: [0.95rc2] Unit Tests / Unicode

Frediano Ziglio <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <CAHt6W4cq3_g8k_RjCcUsuiEeGELpcR9C0jP_1whsUM-Bubr8WQ@mail.gmail.com>
2015-05-15 8:49 GMT+01:00 Sergio NNX <[email protected]>:
>   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 ?

_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
long_error.c (text/x-csrc, 2.5 KB)
#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);
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.