From: Rafael Kitover Date: Thu, 17 Dec 2009 17:09:55 +0000 (+0000) Subject: more types for ADO fix, and documentation X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=48012f358b2a3af7c193f170ce39ea59fcdc7173;p=dbsrgits%2FDBIx-Class-Historic.git more types for ADO fix, and documentation --- diff --git a/lib/DBIx/Class/Storage/DBI/ADO/Microsoft_SQL_Server.pm b/lib/DBIx/Class/Storage/DBI/ADO/Microsoft_SQL_Server.pm index 3014c34..e291656 100644 --- a/lib/DBIx/Class/Storage/DBI/ADO/Microsoft_SQL_Server.pm +++ b/lib/DBIx/Class/Storage/DBI/ADO/Microsoft_SQL_Server.pm @@ -30,6 +30,8 @@ sub source_bind_attributes { sub bind_attribute_by_data_type { my ($self, $data_type) = @_; + ($data_type = lc($data_type)) =~ s/\s+.*//; + my $max_size = $self->_mssql_max_data_type_representation_size_in_bytes->{$data_type}; @@ -47,6 +49,7 @@ sub _mssql_max_data_type_representation_size_in_bytes { my $blob_max = $self->_get_dbh->{LongReadLen} || 32768; return +{ +# MSSQL types char => 8000, varchar => 8000, binary => 8000, @@ -60,6 +63,7 @@ sub _mssql_max_data_type_representation_size_in_bytes { bigint => 100, bit => 100, decimal => 100, + integer => 100, int => 100, money => 100, float => 100, @@ -75,6 +79,18 @@ sub _mssql_max_data_type_representation_size_in_bytes { smalldatetime => 100, time => 100, timestamp => 100, + cursor => 100, + hierarchyid => 100, + sql_variant => 100, + table => 100, + xml => $blob_max, # ??? + +# some non-MSSQL types + serial => 100, + bigserial => 100, + varchar2 => 8000, + blob => $blob_max, + clob => $blob_max, } } @@ -94,10 +110,29 @@ This subclass supports MSSQL server connections via L. The MSSQL specific functionality is provided by L. +=head2 CAVEATS + +=head3 identities + C<_identity_method> is set to C<@@identity>, as C doesn't work with L. See L for caveats regarding this. +=head3 truncation bug + +There is a bug with MSSQL ADO providers where data gets truncated based on the +size on the bind sizes in the first prepare: + +L + +The C workaround is used (see L) with the +approximate maximum size of the data_type of the bound column, or 8000 (maximum +VARCHAR size) if the data_type is not available. + +This code is incomplete and may be buggy. Particularly, C is not +supported yet. The data_type list for other DBs is also incomplete. Please +report problems (and send patches.) + =head1 AUTHOR See L.