[freetds] select bug...

Lowden, James K LowdenJK at bernstein.com
Mon May 12 10:56:22 EDT 2003


> From: Spyros Ioakim [mailto:sioakim at atlas.ace-hellas.gr]
> Sent: May 11, 2003 4:45 PM
> 
> OK found the old post...
> I have compiled freetds with these options:
> ./configure --with-tdsver=7.0 --enable-msdblib --with-unixodbc
> --prefix=/usr/local/freetds/
> 
> I recompiled freetds with the nightly build I just downloaded 
> but still no luck.

Let me make sure I understand what you're seeing.  Using the latest build,
your query should return two rows, but using FreeTDS you get only one.  We
suspect an encoding problem, because your query includes a LIKE clause
against some literal Greek characters.  

The query is complex, but it's apparent that the Greek character comparison
is part of a large OR condition.  Using the latest snapshot, you get back
CompID 186.  Can you tell which criteria that meets, and how it's different
from the one that was excluded?  Is in fact "CntrctType LIKE 'pS%'" the
salient clause?  ['pS%' isn't right; that's how my mailer represented the
Greek letters.]

What's interesting, for some value of "interesting" is this chunk of your
log file (from the snapshot):

23:59:04.187889 tds_put_string converting 36 bytes of "Ó%' AND ToDate >=
'05/06/03') ) ) )
"
23:59:04.187906 tds_put_string wrote 72 bytes
Sending packet @ 23:59:04.187922
0000 01 01 00 60 00 00 01 00-20 00 4c 00 49 00 4b 00 |...`....  .L.I.K.|
0010 45 00 20 00 27 00 f0 00-d3 00 25 00 27 00 20 00 |E. .'.ð. Ó.%.'. .|
0020 41 00 4e 00 44 00 20 00-54 00 6f 00 44 00 61 00 |A.N.D. . T.o.D.a.|
0030 74 00 65 00 20 00 3e 00-3d 00 20 00 27 00 30 00 |t.e. .>. =. .'.0.|
0040 35 00 2f 00 30 00 36 00-2f 00 30 00 33 00 27 00 |5./.0.6. /.0.3.'.|
0050 29 00 20 00 29 00 20 00-29 00 20 00 29 00 0a 00 |). .). . ). .)...|

What I want to know, Spyro, is this:  Are the characters in line 0010
correct?  That is, are the Greek characters you're comparing to encoded as
=00f0 and =00d3 in UCS-2?  Because that's what we're asking the server to
find.  

I'm betting those are the wrong values.  Why?  

1.  You got the wrong answer.
2.  The log says we're converting from ISO-8859-1.  

I'm betting that if you look at the UCS-2 =00f0 character, find its
ISO-8859-1 equivalent, take that binary value, and look it up in the Greek
charset your client is actually using (whew!) *that* is the character you
meant to send. 

Tell me if we're on the right track, and then we can go on from there.
Also, could I see the output of locale(1) on the system in question?  

--jkl
-----------------------------------------
The information contained in this transmission may contain privileged and confidential information and is intended only for the use of the person(s) named above. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender immediately by reply e-mail and destroy all copies of the original message. Please note that we do not accept account orders and/or instructions by e-mail, and therefore will not be responsible for carrying out such orders and/or instructions.





More information about the FreeTDS mailing list