X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FADO%2FMS_Jet%2FCursor.pm;h=89ab579f4ace982786f67fd512a0375768a5d20b;hb=HEAD;hp=4fc6d02b67fc538b8172d094ce0ff80f1538cc58;hpb=726c8f65ef37b47aad62e29a306f64528a00f65d;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI/ADO/MS_Jet/Cursor.pm b/lib/DBIx/Class/Storage/DBI/ADO/MS_Jet/Cursor.pm index 4fc6d02..89ab579 100644 --- a/lib/DBIx/Class/Storage/DBI/ADO/MS_Jet/Cursor.pm +++ b/lib/DBIx/Class/Storage/DBI/ADO/MS_Jet/Cursor.pm @@ -5,6 +5,10 @@ use warnings; use base 'DBIx::Class::Storage::DBI::Cursor'; use mro 'c3'; +use DBIx::Class::Storage::DBI::ADO::CursorUtils '_normalize_guids'; +use DBIx::Class::ResultSource::FromSpec::Util 'fromspec_columns_info'; +use namespace::clean; + =head1 NAME DBIx::Class::Storage::DBI::ADO::MS_Jet::Cursor - GUID Support for MS Access over @@ -32,76 +36,49 @@ for the inner cursor class. =cut -sub _dbh_next { - my ($storage, $dbh, $self) = @_; - - my $next = $self->next::can; - - my @row = $next->(@_); - - my $col_info = $storage->_resolve_column_info($self->args->[0]); - - my $select = $self->args->[1]; +sub next { + my $self = shift; - for my $select_idx (0..$#$select) { - my $selected = $select->[$select_idx]; + my @row = $self->next::method(@_); - next if ref $selected; - - my $data_type = $col_info->{$selected}{data_type}; - - if ($storage->_is_guid_type($data_type)) { - my $returned = $row[$select_idx]; - - $row[$select_idx] = substr($returned, 1, 36) - if substr($returned, 0, 1) eq '{'; - } - } + _normalize_guids( + $self->args->[1], + $self->{_colinfos} ||= fromspec_columns_info($self->args->[0]), + \@row, + $self->storage + ); return @row; } -sub _dbh_all { - my ($storage, $dbh, $self) = @_; - - my $next = $self->next::can; - - my @rows = $next->(@_); +sub all { + my $self = shift; - my $col_info = $storage->_resolve_column_info($self->args->[0]); + my @rows = $self->next::method(@_); - my $select = $self->args->[1]; - - for my $row (@rows) { - for my $select_idx (0..$#$select) { - my $selected = $select->[$select_idx]; - - next if ref $selected; - - my $data_type = $col_info->{$selected}{data_type}; - - if ($storage->_is_guid_type($data_type)) { - my $returned = $row->[$select_idx]; - - $row->[$select_idx] = substr($returned, 1, 36) - if substr($returned, 0, 1) eq '{'; - } - } - } + _normalize_guids( + $self->args->[1], + $self->{_colinfos} ||= fromspec_columns_info($self->args->[0]), + $_, + $self->storage + ) for @rows; return @rows; } -1; - -=head1 AUTHOR +=head1 FURTHER QUESTIONS? -See L and L. +Check the list of L. -=head1 LICENSE +=head1 COPYRIGHT AND LICENSE -You may distribute this code under the same terms as Perl itself. +This module is free software L +by the L. You can +redistribute it and/or modify it under the same terms as the +L. =cut +1; + # vim:sts=2 sw=2: