1 package DBIx::Class::Storage::DBI::SQLAnywhere::Cursor;
5 use base 'DBIx::Class::Storage::DBI::Cursor';
8 use DBIx::Class::ResultSource::FromSpec::Util 'fromspec_columns_info';
13 DBIx::Class::Storage::DBI::SQLAnywhere::Cursor - GUID Support for SQL Anywhere
14 over L<DBD::SQLAnywhere>
18 This class is for normalizing GUIDs retrieved from SQL Anywhere via
21 You probably don't want to be here, see
22 L<DBIx::Class::Storage::DBI::SQLAnywhere> for information on the SQL Anywhere
25 Unfortunately when using L<DBD::SQLAnywhere>, GUIDs come back in binary, the
26 purpose of this class is to transform them to text.
27 L<DBIx::Class::Storage::DBI::SQLAnywhere> 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>.
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.
39 my $unpack_guids = sub {
40 my ($select, $col_infos, $data, $storage) = @_;
42 for my $select_idx (0..$#$select) {
44 defined $data->[$select_idx]
46 length($data->[$select_idx]) == 16
49 my $selected = $select->[$select_idx];
51 my $data_type = $col_infos->{$select->[$select_idx]}{data_type}
54 $data->[$select_idx] = $storage->_uuid_to_str($data->[$select_idx])
55 if $storage->_is_guid_type($data_type);
63 my @row = $self->next::method(@_);
67 $self->{_colinfos} ||= fromspec_columns_info($self->args->[0]),
78 my @rows = $self->next::method(@_);
82 $self->{_colinfos} ||= fromspec_columns_info($self->args->[0]),
91 =head1 FURTHER QUESTIONS?
93 Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
95 =head1 COPYRIGHT AND LICENSE
97 This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
98 by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
99 redistribute it and/or modify it under the same terms as the
100 L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.