1 package DBIx::Class::Storage::DBI::SQLAnywhere::Cursor;
5 use base 'DBIx::Class::Storage::DBI::Cursor';
10 DBIx::Class::Storage::DBI::SQLAnywhere::Cursor - GUID Support for SQL Anywhere
11 over L<DBD::SQLAnywhere>
15 This class is for normalizing GUIDs retrieved from SQL Anywhere via
18 You probably don't want to be here, see
19 L<DBIx::Class::Storage::DBI::SQLAnywhere> for information on the SQL Anywhere
22 Unfortunately when using L<DBD::SQLAnywhere>, GUIDs come back in binary, the
23 purpose of this class is to transform them to text.
24 L<DBIx::Class::Storage::DBI::SQLAnywhere> sets
25 L<cursor_class|DBIx::Class::Storage::DBI/cursor_class> to this class by default.
26 It is overridable via your
27 L<connect_info|DBIx::Class::Storage::DBI/connect_info>.
29 You can use L<DBIx::Class::Cursor::Cached> safely with this class and not lose
30 the GUID normalizing functionality,
31 L<::Cursor::Cached|DBIx::Class::Cursor::Cached> uses the underlying class data
32 for the inner cursor class.
37 my ($storage, $dbh, $self) = @_;
39 my $next = $self->next::can;
41 my @row = $next->(@_);
43 my $col_info = $storage->_resolve_column_info($self->args->[0]);
45 my $select = $self->args->[1];
47 for my $select_idx (0..$#$select) {
48 my $selected = $select->[$select_idx];
50 next if ref $selected;
52 my $data_type = $col_info->{$selected}{data_type};
54 if ($storage->_is_guid_type($data_type)) {
55 my $returned = $row[$select_idx];
57 if (length $returned == 16) {
58 $row[$select_idx] = $storage->_uuid_to_str($returned);
67 my ($storage, $dbh, $self) = @_;
69 my $next = $self->next::can;
71 my @rows = $next->(@_);
73 my $col_info = $storage->_resolve_column_info($self->args->[0]);
75 my $select = $self->args->[1];
78 for my $select_idx (0..$#$select) {
79 my $selected = $select->[$select_idx];
81 next if ref $selected;
83 my $data_type = $col_info->{$selected}{data_type};
85 if ($storage->_is_guid_type($data_type)) {
86 my $returned = $row->[$select_idx];
88 if (length $returned == 16) {
89 $row->[$select_idx] = $storage->_uuid_to_str($returned);
102 See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>.
106 You may distribute this code under the same terms as Perl itself.