Auto-increment on primary key

Warren Lynn <[email protected]> Mon, 3 May 2010 22:52:03 -0400
Newsgroups gmane.lisp.clsql.general
Message-ID <[email protected]>
Hi,


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:

(clsql:def-view-class xyz ()
  ((xyz-id
    :db-kind :key
    :db-constraints (:not-null :auto-increment)
    :type integer
    :initarg :xyz-id)
   (content
    :type string
    :accessor xyz-content
    :initarg :content
    )))

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.

Warren.

_______________________________________________
CLSQL mailing list
[email protected]
http://lists.b9.com/cgi-bin/mailman/listinfo/clsql