morgon has asked for the wisdom of the Perl Monks concerning the following question:
I am about to finally ditch DBIx::Class, as I spend far too much time figuring out how to make it do what I want it to do (my IQ is simply not up to it), but does by any chance someone know how to generate primary keys from a sequence in DBIx::Class?
I have tried this approach:
But when I then try this:__PACKAGE__->add_columns( id => { data_type => 'integer', size + => 16, sequence => "stream_seq" }, ...
I get an error (sequence STREAM_SEQ_CURRVAL is not yet defined in this session).my $s = $schema->resultset('Stream')->new({}); $s->insert;
The problem seems to be that PK::Auto seems to expect a trigger that populates the primary key column but I would prefer a solution where I don't define a trigger but rather have DBIx::Class generate an insert-statement that uses the sequence directly - is that possible (and if so how)?
And please don't point me to CPAN-modules you have not used yourself...
Many thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBIx::Class and Oracle sequences
by Your Mother (Archbishop) on May 11, 2009 at 22:23 UTC | |
by c8h10n4o2 (Initiate) on Aug 24, 2009 at 20:11 UTC | |
by Anonymous Monk on Aug 24, 2009 at 19:15 UTC | |
by c8h10n4o2 (Initiate) on Aug 24, 2009 at 19:18 UTC | |
|
Re: DBIx::Class and Oracle sequences
by afoken (Chancellor) on May 11, 2009 at 20:20 UTC | |
by Anonymous Monk on May 11, 2009 at 21:11 UTC |