You're missing the database specific facilities for this - which generally 
materializes as an 'auto_increment' data type (Sybase derivatives, mysql) 
modifier or the concept of a 'sequence' (oracle, db2, postgres(I think)) which 
you create and can query from with the nextval/curval functions. 

David

-----Original Message-----
From: Wes Cravens [mailto:[email protected]] 
Sent: Wednesday, January 20, 2010 1:59 PM
To: [email protected]
Subject: [Dbix-class] Strict sequence primary key

In an effort to create strictly sequential (Incrementing Integer no 
gaps) primary keys my method has traditionally been:

BEGIN;
LOCK table;
SELECT MAX(id) FROM table;
INSERT INTO table...;
COMMIT;

I'm relatively new to DBIC and have not really seen a way to do this 
unless I create a wrapper to handle it.

Is there something I am missing?

Thanks,

Wes

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to