| Class-DBI-Loader-Informix documentation | Contained in the Class-DBI-Loader-Informix distribution. |
Class::DBI::Loader::Informix - Class::DBI::Loader Informix Implementation.
use Class::DBI::Loader;
my $loader = Class::DBI::Loader->new(
dsn => 'dbi:Informix:stores',
user => 'informix',
password => '',
namespace => 'Stores',
);
my $class = $loader->find_class('customer');
my $obj = $class->retrieve(1);
Class::DBI::Loader provides a mechanism of automatically setting up the Class::DBI sub-classes on demand.
This module provides the Informix specific methods required by Class::DBI::Loader::Generic. The complete documentation can be found in Class::DBI
This has only tested with IDS 9.40.UC2E1 and 10.UC5 and could well be using specific features of those databases. If reporting a bug please specify the server version that use are using.
All bug reports and patches should be made via RT at:
bug-Class-DBI-Loader-Informix@rt.cpan.org
That way I'm less likely to ignore them.
Jonathan Stowe <jns@gellyfish.com>
This library is free software - it comes with no warranty whatsoever.
Copyright (c) 2006 Jonathan Stowe
This module can be distributed under the same terms as Perl itself.
| Class-DBI-Loader-Informix documentation | Contained in the Class-DBI-Loader-Informix distribution. |
package Class::DBI::Loader::Informix; use strict; require Class::DBI::Informix; require Class::DBI::Loader::Generic; use base qw(Class::DBI::Loader::Generic); use vars qw($VERSION); use DBI; use Carp; $VERSION = '1.4';
sub _db_class { return 'Class::DBI::Informix'; } sub _tables { my ($self) = @_; my $dbh = DBI->connect( @{ $self->{_datasource} } ) or croak($DBI::errstr); my @tables = map { /([^.]+$)/ and $1 } ($dbh->func('user','_tables')); return @tables; } sub _relationships { my ($self) = @_; foreach my $table ( $self->tables() ) { my $dbh = $self->find_class($table)->db_Main(); my $sth = $dbh->prepare(<<SQL); SELECT f.colname, d.tabname FROM systables a, sysconstraints b, sysreferences c, systables d, sysindexes e, syscolumns f WHERE b.constrtype = 'R' AND a.tabid = b.tabid AND b.constrid = c.constrid AND c.ptabid = d.tabid AND a.tabname = ? AND b.idxname = e.idxname AND e.part1 = f.colno AND e.tabid = f.tabid SQL $sth->execute($table); for my $fk ( @{$sth->fetchall_arrayref()} ) { eval { $self->_has_a_many($table, $fk->[0], $fk->[1]); }; warn qq/\# has_a_many failed "$@"\n\n/ if $@ && $self->debug; } } }
1;