fix mro issues under 5.8
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / DBObject / Informix.pm
CommitLineData
c4a69b87 1package DBIx::Class::Schema::Loader::DBObject::Informix;
2
3use strict;
4use warnings;
5use base 'DBIx::Class::Schema::Loader::DBObject';
383bd2a8 6use mro 'c3';
c4a69b87 7use namespace::clean;
8
9=head1 NAME
10
11DBIx::Class::Schema::Loader::DBObject::Informix - Class for Database Objects for
12Informix Such as Tables and Views in L<DBIx::Class::Schema::Loader>
13
14=head1 DESCRIPTION
15
16This is a subclass of L<DBIx::Class::Schema::Loader::DBObject> that adds
17support for fully qualified objects in Informix including both L</database>
18and L<schema|DBIx::Class::Schema::Loader::DBObject/schema> of the form:
19
20 database:owner.object_name
21
22=head1 METHODS
23
24=head2 database
25
26The database name this object belongs to.
27
28Returns undef if
29L<ignore_schema|DBIx::Class::Schema::Loader::DBObject/ignore_schema> is set.
30
31=cut
32
33__PACKAGE__->mk_group_accessors(simple => qw/
34 _database
35/);
36
37sub new {
38 my $class = shift;
39
40 my $self = $class->next::method(@_);
41
42 $self->{_database} = delete $self->{database};
43
44 return $self;
45}
46
47sub database {
48 my $self = shift;
49
50 return $self->_database(@_) unless $self->ignore_schema;
51
52 return undef;
53}
54
55=head1 sql_name
56
57Returns the properly quoted full identifier with L</database>,
58L<schema|DBIx::Class::Schema::Loader::DBObject/schema> and
59L<name|DBIx::Class::Schema::Loader::DBObject/name>.
60
61=cut
62
63sub sql_name {
64 my $self = shift;
65
66 my $name_sep = $self->loader->name_sep;
67
68 if ($self->database) {
69 return $self->_quote($self->database)
70 . ':'
71 . $self->_quote($self->schema)
72 . $name_sep
73 . $self->_quote($self->name);
74 }
75
76 return $self->next::method(@_);
77}
78
79sub dbic_name {
80 my $self = shift;
81
82 my $name_sep = $self->loader->name_sep;
83
84 if ($self->loader->qualify_objects && $self->_database) {
85 if ($self->_database =~ /\W/
86 || $self->_schema =~ /\W/ || $self->name =~ /\W/) {
87
88 return \ $self->sql_name;
89 }
90
91 return $self->_database . ':' . $self->_schema . $name_sep . $self->name;
92 }
93
94 return $self->next::method(@_);
95}
96
97=head1 SEE ALSO
98
99L<DBIx::Class::Schema::Loader::Table::Informix>,
100L<DBIx::Class::Schema::Loader::DBObject>,
101L<DBIx::Class::Schema::Loader::Table>, L<DBIx::Class::Schema::Loader>,
102L<DBIx::Class::Schema::Loader::Base>
103
104=head1 AUTHOR
105
106See L<DBIx::Class::Schema::Loader/AUTHOR> and L<DBIx::Class::Schema::Loader/CONTRIBUTORS>.
107
108=head1 LICENSE
109
110This library is free software; you can redistribute it and/or modify it under
111the same terms as Perl itself.
112
113=cut
114
1151;
116# vim:et sts=4 sw=4 tw=0: