[Dbix-class] Autoincrement and triggers

Nathan Gray kolibrie at graystudios.org
Wed Nov 29 16:30:03 GMT 2006


I am interested in understanding autoincrement under DBIx::Class.  It
appears that it works out-of-the-box for databases which implement
autoincrement columns.  For databases using sequences in place of
autoincrement, it appears that a trigger must be added to the
database.

  http://search.cpan.org/~bricas/DBIx-Class-0.07003/lib/DBIx/Class/Manual/FAQ.pod#Inserting_and_updating_data

For databases which use sequences, there are several possible ways to
access the sequence.

  - set up a trigger in the database
  - fetch the value from the sequence, then use that value in the
    insert statement
  - call the sequence in the insert statement

DBIx::Class::PK::Auto relies on the first solution.

I have not found an implementation for either of the other solutions.

I am wondering if that is because:

  - triggers are the way to go
  - no one has needed/wanted to do it without triggers
  - no one has gotten around to it, but it's a good idea

I did find one post discussing PK::Sequence, but it appears to be
suffering Warnock's dilemma.

  http://lists.rawmode.org/pipermail/dbix-class/2006-August/002093.html

-kolibrie

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20061129/94f4c4d4/attachment.pgp


More information about the Dbix-class mailing list