[Dbix-class] might_have support added, relationships refactored, happy birthday

David Kamholz davekam at pobox.com
Tue Aug 2 23:30:39 CEST 2005


Quoting Matt S Trout <dbix-class at trout.me.uk>:

> I'm aware that lots of you really, really need sequences but going  
> back to
> IANADBA I don't actually have anything except MySQL and SQLite  
> handy to test
> against.
>

The Class::DBI code for sequences is really simple:

$self->_prepopulate_id if $self->_undefined_primary;

$self->_attribute_store($primary_columns[0] => $self->_next_in_sequence)
         if $self->sequence;

return $self->sql_Nextval($self->sequence)->select_val;

__PACKAGE__->set_sql(Nextval => <<'');
SELECT NEXTVAL ('%s')

I don't have access to my laptop at the moment to put a failing test  
together.
Actually, I'm not really sure how to go about checking for the  
presence of
postgres and creating a test database -- I'll see how CDBI tests
sequences. But
I can very easily run a test on my own setup with postgres. In fact, if
I get a
chance tonight I'll just do the sequence code myself. As for auto- 
detection,
that's kind of tricky - - it's going to vary somewhat from database to
database. It shoudn't be too big of a burden to specify the sequence  
manually.
But I'll see if there isn't some intelligent way to detect it  
(probably can't
go in core, though).

Dave




More information about the Dbix-class mailing list