Massive rewrite of bind handling, and overall simplification of ::Storage::DBI
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / ADO / Microsoft_SQL_Server.pm
index 7c053af..7e08098 100644 (file)
@@ -57,22 +57,25 @@ currently supported, datetimes are truncated at the second.
 
 =cut
 
+__PACKAGE__->datetime_parser_type (
+  'DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server::DateTime::Format'
+);
+
 sub _rebless {
   my $self = shift;
   $self->_identity_method('@@identity');
 }
 
-sub source_bind_attributes {
-  my $self = shift;
-  my ($source) = @_;
-
-  my $bind_attributes = $self->next::method(@_);
+# work around a bug in the ADO driver - use the max VARCHAR size for all
+# binds that do not specify one via bind_attributes_by_data_type()
+sub _dbi_attrs_for_bind {
+  my $attrs = shift->next::method(@_);
 
-  foreach my $column ($source->columns) {
-    $bind_attributes->{$column}{ado_size} ||= 8000; # max VARCHAR
+  for (@$attrs) {
+    $_->{ado_size} ||= 8000 if $_;
   }
 
-  return $bind_attributes;
+  $attrs;
 }
 
 sub bind_attribute_by_data_type {
@@ -142,10 +145,6 @@ sub _mssql_max_data_type_representation_size_in_bytes {
   }
 }
 
-sub datetime_parser_type {
-  'DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server::DateTime::Format'
-}
-
 package # hide from PAUSE
   DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server::DateTime::Format;