Re: [opendbx] Problem with Union All querys and MSSQL with Free TDS from windows
Brought to you by:
nose
From: Norbert S. <no...@li...> - 2011-07-13 04:48:11
|
Hi Guille > I was testing doing some tests with mssql from windows using tds and odbc, > and I found a bug very similar to what happened not long ago with sqlite. > > Executing the following queries: > > Create table test (c1 int NULL, c2 int NULL) > insert into test values(1, NULL) > insert into test values(NULL, 3) > select * from ((select t1.c1, null t3 from test t1 where t1.c1 is not null) > UNION ALL (select NULL t3, t2.c2 from test t2 where t2.c2 is not null)) > > > gives as result from sql server manager: > > 1 null > null 3 > > > results from opendbx + freetds on windows: > > 1 null > null *null* > > > using freetds I'm getting a null where a 3 was expected... > > Digging into my code, the problem seems to be the 'odbx_field_value' does > not give me the right result.. > > Can you confirm if I'm doing something wrong or not? I don't think you are doing something wrong. Could you please apply the attached patch to the OpenDBX source code (it's against OpenDBX 1.5 but that shouldn't matter much) and rebuild the mssql backend? The dblib documentation states to use dblen() to check if it's really a NULL value. If this doesn't help, it may be a but in FreeTDS. Norbert |