DBD::ODBC and Unicode

Michiel Beijen <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <CABD0r128zArqZv+v9dekLiUBfGxOdFrCOGL6ZnvGABJMcXJVQQ@mail.gmail.com>
Hi,

I ran into this issue with DBD::ODBC;

I read Martin asked about feedback on the 1.46_1 devel release. I
tested my code against both versions 1.43 and 1.46_1 an the results
are the same.

Basically, if I do
  SELECT example FROM foo WHERE example LIKE 'string%';

this is OK as long as long as 'string' is ascii. But whenever 'string'
is unicode, it does not return rows, when it should.
if I use bind variables, this problem goes away. DBD::mysql,
DBD::Oracle and DBD::Pg do not have this problem.

An alternative which I found worked is using N:
  SELECT example FROM foo WHERE example LIKE N'string%';

but as I said, using the statement WITHOUT the N works on the other
three DBD drivers I mentioned.

Is this a bug in DBD::ODBC or expected behaviour?

Test code is here: https://gist.github.com/mbeijen/7560268
Result is here: https://gist.github.com/mbeijen/5a497e05e0739ef93ce9

--
Mike
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.