[freetds] select bug...

Frediano Ziglio freddyz77 at tin.it
Tue May 6 08:03:12 EDT 2003


Il mar, 2003-05-06 alle 13:22, Spyros Ioakim ha scritto:
> Ok I'm attaching the freetds.log file.
> I used tsql to execute those two (I got one result for the first and
> none for the second just like with PHP. Remember SQL Server with
> Enterprise manager gave me 2 and 1 results respectively)
> I understand nothing of what the log says so if can please help me...
> 
> Thanks,
> Spyros
> 
> -----Original Message-----
> From: freetds-bounces at lists.ibiblio.org
> [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Spyros Ioakim
> Sent: Tuesday, May 06, 2003 2:04 PM
> To: freetds at lists.ibiblio.org
> Subject: [freetds] select bug...
> 
> 
> I have the following two queries:
> 
> SELECT Company.CompId FROM COMPANY, INSTALLS WHERE Company.CompId = 186
> and (NoDownloads is null OR NoDownloads=0) AND Installs.CompID =
> Company.CompID AND Installs.ProdId IN (SELECT ProdId FROM Products WHERE
> Products.Code LIKE 'N%3%') AND ( (Installs.InstDate >= '11/06/02') OR
> (Installs.CompId IN (SELECT Installs.CompId FROM Installs, Products
> WHERE Installs.ProdId = Products.ProdId AND ( (Products.Code LIKE
> 'N%3%') ) AND Installs.InstlId IN (SELECT InstlId FROM Cntrcts WHERE
> CntrctType LIKE 'πΣ%' AND ToDate >= '05/06/03') ) ) )
> 
> 
> SELECT Company.CompId FROM COMPANY, INSTALLS WHERE Company.CompId = 258
> and (NoDownloads is null OR NoDownloads=0) AND Installs.CompID =
> Company.CompID AND Installs.ProdId IN (SELECT ProdId FROM Products WHERE
> Products.Code LIKE 'N%3%') AND ( (Installs.InstDate >= '11/06/02') OR
> (Installs.CompId IN (SELECT Installs.CompId FROM Installs, Products
> WHERE Installs.ProdId = Products.ProdId AND ( (Products.Code LIKE
> 'N%3%') ) AND Installs.InstlId IN (SELECT InstlId FROM Cntrcts WHERE
> CntrctType LIKE 'πΣ%' AND ToDate >= '05/06/03') ) ) )
> 
> SQL Server reports 2 results for the first and 1 result for the seconds
> query.
> FreeTDS reports 1 result for the first and 0 results for the second
> query.

FreeTDS send query correctly and results from server are 1 row and 0
rows...

Results 1 

Received header @ 2003-05-06 14:17:55.388215
0000 04 01 00 2b 00 4a 01 00-                        |...+.J..|


Received packet @ 2003-05-06 14:17:55.388258
0000 81 01 00 00 00 08 00 38-06 43 00 6f 00 6d 00 70 |.......8 .C.o.m.p|
0010 00 49 00 64 00 d1 ba 00-00 00 fd 10 00 c1 00 01 |.I.d.Ѻ. ..ý..Á..|
0020 00 00 00               -                        |...|

Results 2

Received header @ 2003-05-06 14:18:03.389368
0000 04 01 00 26 00 4a 01 00-                        |...&.J..|


Received packet @ 2003-05-06 14:18:03.389430
0000 81 01 00 00 00 08 00 38-06 43 00 6f 00 6d 00 70 |.......8 .C.o.m.p|
0010 00 49 00 64 00 fd 10 00-c1 00 00 00 00 00       |.I.d.ý.. Á.....|

Probably FreeTDS set date encoding differently from Query Analyzer ..

Try this query

SELECT Company.CompId FROM COMPANY, INSTALLS WHERE Company.CompId = 186
and (NoDownloads is null OR NoDownloads=0) AND Installs.CompID =
Company.CompID AND Installs.ProdId IN (SELECT ProdId FROM Products WHERE
Products.Code LIKE 'N%3%') AND ( (Installs.InstDate >= '2002-11-06') OR
(Installs.CompId IN (SELECT Installs.CompId FROM Installs, Products
WHERE Installs.ProdId = Products.ProdId AND ( (Products.Code LIKE
'N%3%') ) AND Installs.InstlId IN (SELECT InstlId FROM Cntrcts WHERE
CntrctType LIKE 'πΣ%' AND ToDate >= '2003-05-06') ) ) )

(I changed date to iso format, supported and parsed correctly)

Should produce same results with SQL Analyzer and FreeTDS.

freddy77





More information about the FreeTDS mailing list