Extract couple more stateless functions from DBIHacks (like 497d0451)
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / ADO / MS_Jet.pm
index 438db4e..fbcd0ea 100644 (file)
@@ -2,12 +2,16 @@ package DBIx::Class::Storage::DBI::ADO::MS_Jet;
 
 use strict;
 use warnings;
+
 use base qw/
   DBIx::Class::Storage::DBI::ADO
   DBIx::Class::Storage::DBI::ACCESS
 /;
 use mro 'c3';
-use DBIx::Class::Storage::DBI::ADO::MS_Jet::Cursor ();
+
+use DBIx::Class::Storage::DBI::ADO::CursorUtils '_normalize_guids';
+use DBIx::Class::ResultSource::FromSpec::Util 'fromspec_columns_info';
+use namespace::clean;
 
 __PACKAGE__->cursor_class('DBIx::Class::Storage::DBI::ADO::MS_Jet::Cursor');
 
@@ -103,22 +107,9 @@ sub select_single {
   return @row unless
     $self->cursor_class->isa('DBIx::Class::Storage::DBI::ADO::MS_Jet::Cursor');
 
-  my $col_info = $self->_resolve_column_info($ident);
-
-  for my $select_idx (0..$#$select) {
-    my $selected = $select->[$select_idx];
-
-    next if ref $selected;
-
-    my $data_type = $col_info->{$selected}{data_type};
-
-    if ($self->_is_guid_type($data_type)) {
-      my $returned = $row[$select_idx];
+  my $col_infos = fromspec_columns_info($ident);
 
-      $row[$select_idx] = substr($returned, 1, 36)
-        if substr($returned, 0, 1) eq '{';
-    }
-  }
+  _normalize_guids($select, $col_infos, \@row, $self);
 
   return @row;
 }
@@ -153,15 +144,19 @@ sub format_datetime {
   return $datetime_parser->format_datetime(shift);
 }
 
-1;
-
-=head1 AUTHOR
+=head1 FURTHER QUESTIONS?
 
-See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>.
+Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
 
-=head1 LICENSE
+=head1 COPYRIGHT AND LICENSE
 
-You may distribute this code under the same terms as Perl itself.
+This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
+by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
+redistribute it and/or modify it under the same terms as the
+L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.
 
 =cut
+
+1;
+
 # vim:sts=2 sw=2: