Re: Sequences and primary keys
Patrick May <[email protected]>
| Newsgroups | gmane.lisp.clsql.general |
|---|---|
| Message-ID | <[email protected]> |
On Mar 29, 2010, at 5:08 PM, Nathan Bird wrote: > 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. > > 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 Thanks, I'll take a look at it. I'm using PostgreSQL and the SERIAL type for the database column, so hopefully autoincrement ought to be straightforward. Regards, Patrick _______________________________________________ CLSQL mailing list [email protected] http://lists.b9.com/cgi-bin/mailman/listinfo/clsql
smime.p7s
(application/pkcs7-signature, 2.4 KB) - not displayed