update-instance-from-records

Igor Plekhov <[email protected]>
Newsgroups gmane.lisp.clsql.devel
Message-ID <20050809042850.GV4802@tcp>
I want to select some record from a database by a key.  I try to use
the update-instance-from-records function.  But it is not work.

(clsql:def-view-class aa ()
  ((id
    :db-kind :key
    :initarg :id
    :type integer)
   (name
    :initarg :name
    :type (string 10)))
  (:base-table aa))

(clsql:create-view-from-class 'aa)

(clsql:insert-records :into 'aa
                      :values '(1 "qwerty"))

(defparameter *q* (make-instance 'aa :id 1))

(clsql:update-instance-from-records *q*)

Here I get the error:
No matching method for the generic function
#<STANDARD-GENERIC-FUNCTION CLSQL-SYS:DATABASE-TYPE (2) {581BDB61}>, when called with arguments (NIL).
   [Condition of type PCL::NO-APPLICABLE-METHOD-ERROR]

Backtrace:
  0: ("DEFMETHOD NO-APPLICABLE-METHOD (T)" #<#1=unused-arg> #<#1#> #<STANDARD-GENERIC-FUNCTION CLSQL-SYS:DATABASE-TYPE (2) {581BDB61}> (NIL))
  1: ((METHOD CLSQL-SYS::UPDATE-SLOT-FROM-DB NIL (CLSQL-SYS:STANDARD-DB-OBJECT T T)) #<#1=unavailable-arg> #<unused-arg> #<AA {58DEFCCD}> #<#1#> ...)
  2: ((METHOD CLSQL-SYS::GET-SLOT-VALUES-FROM-VIEW NIL (T T T)) #<#1=unused-arg> #<#1#> #<AA {58DEFCCD}> (#<VIEW-CLASS-EFFECTIVE-SLOT-DEFINITION NAME {58CF551D}> #<VIEW-CLASS-EFFECTIVE-SLOT-DEFINITION ID {58CF4C95}>) ...)


If *q* is selected from the database firstly then
update-instance-from-records works without problems.

Why doesn't it work in the first case ?


I use cl-sql_3.2.1-2 with cl-sql-postgresql-socket_3.1.2-1 from Debian.


-- 
Registered Linux User #124759
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.