Subject: | unicode table names not decoded in table_info_all call |
Hi,
Attached a script I wrote for DBI and testing unicode in various DBDs.
It shows that when you create a unicode table name and call
table_info_all you cannot find the table by name comparison and yet it
does exist. If the names returned by table_info_all are decoded as UTF-8
you can find the table. So that suggests DBD::SQLite is not decoding
table names. The same probably applies to unicode column names but
although there is a test to check you can use them and find them there
is no additional code to test if they are decoded as UTF-8 you can find
them.
BTW, some tests DBD::SQLite fails no one really expects it to pass like
unicode parameter name markers so please ignore that test - the script
was written for discovery not to demonstrate any particular bugs.
Output when run on Windows (hence the unicode data out is displayed
wrong so ignore that) is:
martin@bragi:~/svn/dbi/trunk/ex$ perl unicode_test.pl dbi:SQLite:db=test.db
# Driver DBD::SQLite-1.29
# Using DBMS_NAME 'SQLite'
# Using DBMS_VER '3.6.22'
# Using DRIVER_NAME undef
# Using DRIVER_VER undef
# SQL_IDENTIFIER_CASE undef
# LANG = en_GB.UTF-8
# create table "fred" ( "a" varchar(20))
ok 1 - table for unicode data
ok 2 - insert unicode data into table
ok 3 - unicode data out = unicode data in, no where
ok 4 - length of output data the same
ok 5 - db length of unicode data correct
ok 6 - select unicode data via parameterised where
ok 7 - select unicode data via inline where
# create table "fred" ( "a" varchar(20),"b" blob)
ok 8 - table for unicode data
ok 9 - insert unicode data and blob into table
ok 10 - unicode data out = unicode data in, no where with blob
ok 11 - utf8 flag not set on blob data
ok 12 - retrieved blob = inserted blob
# create table "fred" ( "a" int)
ok 13 - test table for unicode parameter markers
DBD::SQLite::st bind_param failed: Unknown named parameter: fredÔé¼ at
unicode_t
est.pl line 429.
not ok 14 - bind parameter with unicode parameter marker
# Failed test 'bind parameter with unicode parameter marker'
# at unicode_test.pl line 431.
# died: DBD::SQLite::st bind_param failed: Unknown named parameter:
fred€ a
t unicode_test.pl line 429.
# create table "fred" ( "dave─Ç" int)
ok 15 - unicode column name supported
not ok 16 - unicode column found in unqualified column_info
# Failed test 'unicode column found in unqualified column_info'
# at unicode_test.pl line 306.
not ok 17 - unicode column found by qualified column_info
# Failed test 'unicode column found by qualified column_info'
# at unicode_test.pl line 311.
# create table "fred Ç" ( "a" int)
ok 18 - unicode table name supported
not ok 19 - unicode table found in unqualified table_info
# Failed test 'unicode table found in unqualified table_info'
# at unicode_test.pl line 269.
not ok 20 - Table not found initially but when table name decoded it was
found as fred Ç
THAT TEST ABOVE^
# Failed test 'Table not found initially but when table name decoded
it was found as fred Ç'
# at unicode_test.pl line 275.
# Did not find tables with utf8 on
not ok 21 - unicode table found by qualified table_info
# Failed test 'unicode table found by qualified table_info'
# at unicode_test.pl line 287.
ok 22 # skip table not found
1..22
# Looks like you failed 6 tests of 22.
martin@bragi:~/svn/dbi/trunk/ex$
I tried it with 1.33 too - same result.
Martin
--
Martin J. Evans
Wetherby, UK