Introduce GOVERNANCE document and empty RESOLUTIONS file.
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / ADO / CursorUtils.pm
1 package # hide from PAUSE
2     DBIx::Class::Storage::DBI::ADO::CursorUtils;
3
4 use strict;
5 use warnings;
6 use base 'Exporter';
7
8 our @EXPORT_OK = qw/_normalize_guids _strip_trailing_binary_nulls/;
9
10 sub _strip_trailing_binary_nulls {
11   my ($select, $col_infos, $data, $storage) = @_;
12
13   foreach my $select_idx (0..$#$select) {
14
15     next unless defined $data->[$select_idx];
16
17     my $data_type = $col_infos->{$select->[$select_idx]}{data_type}
18       or next;
19
20     $data->[$select_idx] =~ s/\0+\z//
21       if $storage->_is_binary_type($data_type);
22   }
23 }
24
25 sub _normalize_guids {
26   my ($select, $col_infos, $data, $storage) = @_;
27
28   foreach my $select_idx (0..$#$select) {
29
30     next unless defined $data->[$select_idx];
31
32     my $data_type = $col_infos->{$select->[$select_idx]}{data_type}
33       or next;
34
35     $data->[$select_idx] =~ s/\A \{ (.+) \} \z/$1/xs
36       if $storage->_is_guid_type($data_type);
37   }
38 }
39
40 1;
41
42 # vim:sts=2 sw=2: