[prev] [thread] [next] [lurker] [Date index for 2005/02/22]
Author: richardc Date: 2005-02-22 09:55:01 +0000 (Tue, 22 Feb 2005) New Revision: 1939 Modified: trunk/Email-Store/lib/Email/Store/DBI.pm Log: subclass columns to fudge in support for Pg Modified: trunk/Email-Store/lib/Email/Store/DBI.pm =================================================================== --- trunk/Email-Store/lib/Email/Store/DBI.pm 2005-02-22 08:04:52 UTC (rev 1938) +++ trunk/Email-Store/lib/Email/Store/DBI.pm 2005-02-22 09:55:01 UTC (rev 1939) @@ -1,9 +1,26 @@ package Email::Store::DBI; +use strict; +use warnings; use base 'Class::DBI'; require Class::DBI::DATA::Schema; -sub import { - my ($self, @params) = @_; +sub columns { + my $self = shift; + + if (@_ && $self->__driver eq 'Pg') { + #warn "do that sequence thing white boy"; + if ($_[0] eq 'Primary' or $_[0] eq 'All') { + # Class::DBI::Pg does this properly, as part of its + # set_up_table call, but that requires the table to exist + # at compile time. For the general case we can guess + $self->sequence( $self->table . "_" . $_[1] . "_seq" ); + } + } + $self->SUPER::columns( @_ ); +} + +sub import { + my ($self, @params) = @_; if (@params) { $self->set_db(Main => @params); $self->translate(mysql => $self->__driver);
Generated at 11:00 on 22 Feb 2005 by mariachi 0.52