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