Re: Auto-increment on primary key
Nathan Bird <[email protected]> Tue, 04 May 2010 09:44:45 -0400
| Newsgroups | gmane.lisp.clsql.general |
|---|---|
| Message-ID | <[email protected]> |
On 5/3/2010 10:52 PM, Warren Lynn wrote: > I am using MySQL and have an issue with the auto-increment on primary > key. To illustrate it, suppose I have a data class like the following: > ... > And after I run the following: > > (setf db-record (make-instance 'xyz :content "my content")) > (clsql:update-records-from-instance db-record) > > The xyz-id slot in db-record is still unbound. I expect the slot to be > set to the newly assigned id, as to me it makes no sense that after > updating the database, the db-record instance is still disconnected > from the actual record in the database. > > Can anyone show me the right way to do it, or the above is the best > CLSQL can do so I need to hack out my own code. Thank you very much. Hmm, that is indeed what the desired/expected behavior tends to be, and the code *almost* does this if you are on mysql. I have a development branch up there[1] that while all the unit tests pass I've not yet gotten to play with it on a larger scale. If you wouldn't mind pulling it and giving it a try, it should fix your problem here and maybe you can help green-light it for wider inclusion. :-) Let me know what you find, Nathan [1]: git clone git://git.b9.com/clsql.git && cd clsql && git checkout -b development origin/development -- Nathan Bird [email protected] http://www.acceleration.net/ Custom Programming, Design, Hosting, and Broadband.