| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server::Cursor; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 2 |  |  | 2 |  | 1025 | use strict; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 55 |  | 
| 4 | 2 |  |  | 2 |  | 9 | use warnings; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 52 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 2 |  |  | 2 |  | 9 | use base 'DBIx::Class::Storage::DBI::Cursor'; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 197 |  | 
| 7 | 2 |  |  | 2 |  | 12 | use mro 'c3'; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 10 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 2 |  |  | 2 |  | 48 | use DBIx::Class::Storage::DBI::ADO::CursorUtils qw/_normalize_guids _strip_trailing_binary_nulls/; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 91 |  | 
| 10 | 2 |  |  | 2 |  | 11 | use DBIx::Class::ResultSource::FromSpec::Util 'fromspec_columns_info'; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 74 |  | 
| 11 | 2 |  |  | 2 |  | 12 | use namespace::clean; | 
|  | 2 |  |  |  |  | 6 |  | 
|  | 2 |  |  |  |  | 12 |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | =head1 NAME | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server::Cursor - Remove trailing | 
| 16 |  |  |  |  |  |  | NULLs in binary data and normalize GUIDs for MSSQL over ADO | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | This class is for removing trailing Cs from binary data and removing braces | 
| 21 |  |  |  |  |  |  | from GUIDs retrieved from Microsoft SQL Server over ADO. | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | You probably don't want to be here, see | 
| 24 |  |  |  |  |  |  | L for information on the | 
| 25 |  |  |  |  |  |  | Microsoft SQL Server driver for ADO and L for | 
| 26 |  |  |  |  |  |  | the Microsoft SQL Server driver base class. | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | Unfortunately when using L, binary data comes back padded with | 
| 29 |  |  |  |  |  |  | trailing Cs and GUIDs come back wrapped in braces, the purpose of this | 
| 30 |  |  |  |  |  |  | class is to remove the Cs and braces. | 
| 31 |  |  |  |  |  |  | L sets | 
| 32 |  |  |  |  |  |  | L to this class by | 
| 33 |  |  |  |  |  |  | default. It is overridable via your | 
| 34 |  |  |  |  |  |  | L. | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | You can use L safely with this class and not lose | 
| 37 |  |  |  |  |  |  | the binary data normalizing functionality, | 
| 38 |  |  |  |  |  |  | L<::Cursor::Cached|DBIx::Class::Cursor::Cached> uses the underlying class data | 
| 39 |  |  |  |  |  |  | for the inner cursor class. | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | =cut | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | sub next { | 
| 44 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 45 |  |  |  |  |  |  |  | 
| 46 | 0 |  |  |  |  |  | my @row = $self->next::method(@_); | 
| 47 |  |  |  |  |  |  |  | 
| 48 | 0 |  | 0 |  |  |  | $self->{_colinfos} ||= fromspec_columns_info($self->args->[0]); | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | _normalize_guids( | 
| 51 |  |  |  |  |  |  | $self->args->[1], | 
| 52 |  |  |  |  |  |  | $self->{_colinfos}, | 
| 53 | 0 |  |  |  |  |  | \@row, | 
| 54 |  |  |  |  |  |  | $self->storage | 
| 55 |  |  |  |  |  |  | ); | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | _strip_trailing_binary_nulls( | 
| 58 |  |  |  |  |  |  | $self->args->[1], | 
| 59 |  |  |  |  |  |  | $self->{_colinfos}, | 
| 60 | 0 |  |  |  |  |  | \@row, | 
| 61 |  |  |  |  |  |  | $self->storage | 
| 62 |  |  |  |  |  |  | ); | 
| 63 |  |  |  |  |  |  |  | 
| 64 | 0 |  |  |  |  |  | return @row; | 
| 65 |  |  |  |  |  |  | } | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | sub all { | 
| 68 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 69 |  |  |  |  |  |  |  | 
| 70 | 0 |  |  |  |  |  | my @rows = $self->next::method(@_); | 
| 71 |  |  |  |  |  |  |  | 
| 72 | 0 |  | 0 |  |  |  | $self->{_colinfos} ||= fromspec_columns_info($self->args->[0]); | 
| 73 |  |  |  |  |  |  |  | 
| 74 | 0 |  |  |  |  |  | for (@rows) { | 
| 75 |  |  |  |  |  |  | _normalize_guids( | 
| 76 |  |  |  |  |  |  | $self->args->[1], | 
| 77 |  |  |  |  |  |  | $self->{_colinfos}, | 
| 78 | 0 |  |  |  |  |  | $_, | 
| 79 |  |  |  |  |  |  | $self->storage | 
| 80 |  |  |  |  |  |  | ); | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | _strip_trailing_binary_nulls( | 
| 83 |  |  |  |  |  |  | $self->args->[1], | 
| 84 |  |  |  |  |  |  | $self->{_colinfos}, | 
| 85 | 0 |  |  |  |  |  | $_, | 
| 86 |  |  |  |  |  |  | $self->storage | 
| 87 |  |  |  |  |  |  | ); | 
| 88 |  |  |  |  |  |  | } | 
| 89 |  |  |  |  |  |  |  | 
| 90 | 0 |  |  |  |  |  | return @rows; | 
| 91 |  |  |  |  |  |  | } | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | =head1 FURTHER QUESTIONS? | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  | Check the list of L. | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | This module is free software L | 
| 100 |  |  |  |  |  |  | by the L. You can | 
| 101 |  |  |  |  |  |  | redistribute it and/or modify it under the same terms as the | 
| 102 |  |  |  |  |  |  | L. | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  | =cut | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  | 1; | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  | # vim:sts=2 sw=2: |