From: Rafael Kitover Date: Sat, 7 Apr 2012 18:22:29 +0000 (-0400) Subject: set correct size for n(var)?char columns for ASE X-Git-Tag: 0.07022~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e17ad40aef83aaa623d02c61dc0ee10d33f472aa;p=dbsrgits%2FDBIx-Class-Schema-Loader.git set correct size for n(var)?char columns for ASE Based on @@ncharsize. --- diff --git a/Changes b/Changes index 2d0cff6..38c7c32 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Perl extension DBIx::Class::Schema::Loader + - set correct size for nchar/nvarchar columns for Sybase ASE, + depending on @@ncharsize + 0.07021 2012-04-04 23:47:34 - use ::Schema::connect instead of ::Schema::connection in make_schema_at (RT#74175) diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm b/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm index 88def8c..fce5f1a 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm @@ -399,6 +399,7 @@ EOF if ($sth->fetchrow_array) { $res->{is_auto_increment} = 1; } + $sth->finish; if ($data_type && $data_type =~ /^timestamp\z/i) { $res->{inflate_datetime} = 0; @@ -449,6 +450,11 @@ EOF if ($data_type =~ /^(?:unichar|univarchar)\z/i) { $res->{size} /= 2; } + elsif ($data_type =~ /^n(?:var)?char\z/i) { + my ($nchar_size) = $self->dbh->selectrow_array('SELECT @@ncharsize'); + + $res->{size} /= $nchar_size; + } } } diff --git a/t/10_06sybase_common.t b/t/10_06sybase_common.t index afce0d0..fe110f6 100644 --- a/t/10_06sybase_common.t +++ b/t/10_06sybase_common.t @@ -261,6 +261,8 @@ EOF [ $dsn, $user, $password ], ); + SybaseMultiSchema->storage->disconnect; + diag join "\n", @warns if @warns; is @warns, 0;