Re: Sequences and primary keys
Nathan Bird <[email protected]>
| Newsgroups | gmane.lisp.clsql.general |
|---|---|
| Message-ID | <[email protected]> |
On 3/29/2010 3:40 PM, Patrick May wrote: > I'm working against a database that uses sequences to automatically generate primary keys for some tables. How can I refresh my view object with the primary key after evaluating update-records-from-instance? I can't just query for the max id, because another row might have been inserted in the meantime. > > Thanks, > > Patrick > CLSQL currently has no generic system for doing this. On :mysql backends you can declare the view-class column as :auto-increment and it will work. Elsewhere I've defined (defmethod update-records-from-instance :after ...) methods that do the query and updates the object-- what that query will be is different for every backend. I have a branch trying to abstract the auto-increment functionality across the different backends since all of them provide something similar along these lines but with different syntax in each case. If you want to look at that and try to develop it further it is in the auto-increment branch http://git.b9.com/?p=clsql.git;a=shortlog;h=refs/heads/auto-increment -- Nathan Bird [email protected] http://www.acceleration.net/ Custom Programming, Design, Hosting, and Broadband.