[Dbix-class] trouble with oracle sequence

Matt S Trout dbix-class at trout.me.uk
Fri May 25 17:01:39 GMT 2007


On Fri, May 25, 2007 at 10:57:44AM -0400, Rom Bre wrote:
> On 5/24/07, Matt S Trout <dbix-class at trout.me.uk> wrote:
> >
> >On Thu, May 24, 2007 at 02:50:47PM -0400, Rom Bre wrote:
> >> I'm getting the following error after attempting to insert into a table
> >> where i have setup an oracle sequence:
> >>
> >> DBIx::Class::ResultSet::create(): Can't get last insert id
> >>
> >>
> >> This is happening because dbic is attempting to do a SELECT
> >> STORE_CART_SEQ.CURRVAL FROM DUAL, without a preceding NEXTVAL.
> >>
> >>
> >> Here's the create statement:
> >>
> >> $c->model('StoreDB::Cart')->create({ session_id => $session_id });
> >>
> >>
> >> I'm under the assumption that the NEXTVAL will be handled
> >> automatically and that I don't need to specify anything in the create
> >
> >PK::Auto expects you have a trigger that does the NEXTVAL and populates
> >the
> >id during INSERT (ala e.g. postgres' SERIAL data type)
> >
> >I think you might be looking for PK::Sequence
> 
> Can you point me in the direction of PK::Sequence?  I'm unable to find
> anything in CPAN or when googling.  Unless what you mean is that I should
> create my own custom dbic component.

It's dev release only atm.

The canonical approach for the 07 series is just to add the trigger.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Dbix-class mailing list