From: Rafael Kitover Date: Wed, 7 Apr 2010 11:06:34 +0000 (-0400) Subject: fix MSSQL collation detection on freetds tds version 8.0 X-Git-Tag: 0.06001~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class-Schema-Loader.git;a=commitdiff_plain;h=103e90da192c77bc8904f4855c19489d4be7bf56 fix MSSQL collation detection on freetds tds version 8.0 --- diff --git a/Changes b/Changes index d3545d7..da58fa4 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ Revision history for Perl extension DBIx::Class::Schema::Loader + - fix MSSQL collation detection on freetds tds version 8.0 + 0.06000 2010-04-06 01:12:25 - better type info for MySQL - initial MySQL data type tests (jhannah) diff --git a/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm b/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm index 52f325a..7a019d9 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm @@ -37,15 +37,11 @@ We attempt to detect the database collation at startup, and set the column lowercasing behavior accordingly, as lower-cased column names do not work on case-sensitive databases. -If you are using FreeTDS with C set to C<8.0> the collation -detection may fail, and Loader will default to case-insensitive mode. C C<7.0> will work fine. - -If this happens set: +To manually set or unset case-sensitive mode, put: case_sensitive_collation => 1 -in your Loader options to override it. +in your Loader options. =cut @@ -73,7 +69,7 @@ sub _setup { # more on collations here: http://msdn.microsoft.com/en-us/library/ms143515.aspx my ($collation_name) = eval { $dbh->selectrow_array('SELECT collation_name FROM sys.databases WHERE name = DB_NAME()') } - || eval { $dbh->selectrow_array("SELECT databasepropertyex(DB_NAME(), 'Collation')") }; + || eval { $dbh->selectrow_array("SELECT CAST(databasepropertyex(DB_NAME(), 'Collation') AS VARCHAR)") }; if (not $collation_name) { warn <<'EOF';