audit drivers for case issues (RT#75805)
authorRafael Kitover <rkitover@cpan.org>
Wed, 28 Mar 2012 00:16:08 +0000 (20:16 -0400)
committerRafael Kitover <rkitover@cpan.org>
Wed, 28 Mar 2012 16:36:03 +0000 (12:36 -0400)
commit116431d67fe62da10229791aef6cc0d5a87802d9
tree3656f1fd7434834609ebf57d0f0092ec5ce46bae
parent18eb280f9b71785a12c105299f813358faa47143
audit drivers for case issues (RT#75805)

Add missing ->_lc calls to MSSQL driver in _table_pk_info and
_table_fk_info, and rework use of column name in queries in
_columns_info_for based on the value of _preserve_case. This fixes the
RT in question, as tested with the DDL provided by the reporter.

Fix collation detection in MSSQL driver when in a database other than
master by changing 'sys.databases' to '[$db].sys.databases' and doing a
"use [$db]" beforehand (with a warning silencing fixup for ADO.)

Check for collisions of columns like 'Foo' and 'fOO' in preserve_case=0
mode in ::DBI::_columns_info_for and throw an exception if detected.

UNRELATED CLEANUP: Remove warning fixups for _table_comment and
_column_comment from Access and MSSQL ADO drivers as we now check for
the existance of the comment tables.

Add missing ->_lc call in Pg _table_uniq_info, which was only for very
old versions of DBD::Pg anyway.

In _columns_info_for in the SQL Anywhere driver, fold the column names in
queries to lower case, as SQL Anywhere is case preserving, but not case
sensitive.

In _columns_info_for in the SQLite driver, map the column names from the
table_info pragma to the ->_lc versions.

Fold column names to lowercase in the mysql driver's _columns_info_for
as MySQL is case preserving but not case sensitive for column names.
Changes
lib/DBIx/Class/Schema/Loader/DBI.pm
lib/DBIx/Class/Schema/Loader/DBI/ADO/MS_Jet.pm
lib/DBIx/Class/Schema/Loader/DBI/ADO/Microsoft_SQL_Server.pm
lib/DBIx/Class/Schema/Loader/DBI/Informix.pm
lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm
lib/DBIx/Class/Schema/Loader/DBI/Pg.pm
lib/DBIx/Class/Schema/Loader/DBI/SQLAnywhere.pm
lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm
lib/DBIx/Class/Schema/Loader/DBI/mysql.pm