support for unicode Firebird data types
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / DBI / ODBC / Firebird.pm
CommitLineData
4cbddf8d 1package DBIx::Class::Schema::Loader::DBI::ODBC::Firebird;
2
3use strict;
4use warnings;
5use base qw/
6 DBIx::Class::Schema::Loader::DBI::ODBC
7 DBIx::Class::Schema::Loader::DBI::InterBase
8/;
9use Carp::Clan qw/^DBIx::Class/;
942bd5e0 10use mro 'c3';
4cbddf8d 11
4295c4b4 12our $VERSION = '0.07010';
4cbddf8d 13
14=head1 NAME
15
16DBIx::Class::Schema::Loader::DBI::ODBC::Firebird - ODBC wrapper for
17L<DBIx::Class::Schema::Loader::DBI::InterBase>
18
19=head1 DESCRIPTION
20
21Proxy for L<DBIx::Class::Schema::Loader::DBI::InterBase> when using L<DBD::ODBC>.
22
23See L<DBIx::Class::Schema::Loader::Base> for usage information.
24
23024b3f 25=cut
26
27# Some (current) versions of the ODBC driver have a bug where ->type_info breaks
28# with "data truncated". This "fixes" it, but some type names are truncated.
5111e5d0 29sub _dbh_type_info_type_name {
23024b3f 30 my ($self, $type_num) = @_;
31
32 my $dbh = $self->schema->storage->dbh;
33
34 local $dbh->{LongReadLen} = 100_000;
35 local $dbh->{LongTruncOk} = 1;
36
5111e5d0 37 my $type_info = $dbh->type_info($type_num);
38
39 return undef if not $type_info;
40
41 my $type_name = $type_info->{TYPE_NAME};
42
43 # fix up truncated type names
44 if ($type_name eq "VARCHAR(x) CHARACTER SET UNICODE_\0") {
45 return 'VARCHAR(x) CHARACTER SET UNICODE_FSS';
46 }
47 elsif ($type_name eq "BLOB SUB_TYPE TEXT CHARACTER SET \0") {
48 return 'BLOB SUB_TYPE TEXT CHARACTER SET UNICODE_FSS';
49 }
50
51 return $type_name;
23024b3f 52}
53
4cbddf8d 54=head1 SEE ALSO
55
56L<DBIx::Class::Schema::Loader::DBI::InterBase>,
57L<DBIx::Class::Schema::Loader>, L<DBIx::Class::Schema::Loader::Base>,
58L<DBIx::Class::Schema::Loader::DBI>
59
60=head1 AUTHOR
61
62See L<DBIx::Class::Schema::Loader/AUTHOR> and L<DBIx::Class::Schema::Loader/CONTRIBUTORS>.
63
64=head1 LICENSE
65
66This library is free software; you can redistribute it and/or modify it under
67the same terms as Perl itself.
68
69=cut
70
711;