89ab579f4ace982786f67fd512a0375768a5d20b
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / ADO / MS_Jet / Cursor.pm
1 package DBIx::Class::Storage::DBI::ADO::MS_Jet::Cursor;
2
3 use strict;
4 use warnings;
5 use base 'DBIx::Class::Storage::DBI::Cursor';
6 use mro 'c3';
7
8 use DBIx::Class::Storage::DBI::ADO::CursorUtils '_normalize_guids';
9 use DBIx::Class::ResultSource::FromSpec::Util 'fromspec_columns_info';
10 use namespace::clean;
11
12 =head1 NAME
13
14 DBIx::Class::Storage::DBI::ADO::MS_Jet::Cursor - GUID Support for MS Access over
15 ADO
16
17 =head1 DESCRIPTION
18
19 This class is for normalizing GUIDs retrieved from Microsoft Access over ADO.
20
21 You probably don't want to be here, see
22 L<DBIx::Class::Storage::DBI::ACCESS> for information on the Microsoft
23 Access driver.
24
25 Unfortunately when using L<DBD::ADO>, GUIDs come back wrapped in braces, the
26 purpose of this class is to remove them.
27 L<DBIx::Class::Storage::DBI::ADO::MS_Jet> sets
28 L<cursor_class|DBIx::Class::Storage::DBI/cursor_class> to this class by default.
29 It is overridable via your
30 L<connect_info|DBIx::Class::Storage::DBI/connect_info>.
31
32 You can use L<DBIx::Class::Cursor::Cached> safely with this class and not lose
33 the GUID normalizing functionality,
34 L<::Cursor::Cached|DBIx::Class::Cursor::Cached> uses the underlying class data
35 for the inner cursor class.
36
37 =cut
38
39 sub next {
40   my $self = shift;
41
42   my @row = $self->next::method(@_);
43
44   _normalize_guids(
45     $self->args->[1],
46     $self->{_colinfos} ||= fromspec_columns_info($self->args->[0]),
47     \@row,
48     $self->storage
49   );
50
51   return @row;
52 }
53
54 sub all {
55   my $self = shift;
56
57   my @rows = $self->next::method(@_);
58
59   _normalize_guids(
60     $self->args->[1],
61     $self->{_colinfos} ||= fromspec_columns_info($self->args->[0]),
62     $_,
63     $self->storage
64   ) for @rows;
65
66   return @rows;
67 }
68
69 =head1 FURTHER QUESTIONS?
70
71 Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
72
73 =head1 COPYRIGHT AND LICENSE
74
75 This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
76 by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
77 redistribute it and/or modify it under the same terms as the
78 L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.
79
80 =cut
81
82 1;
83
84 # vim:sts=2 sw=2: