Consider this:
(clsql:def-view-class person ()
((pid :db-kind :key
:db-constraints :not-null
:type integer)
(uid
:type integer)
(firstname :type (string 250))
(lastname :type (string 250))
(email :type (string 250))))
(defvar p1 (make-instance 'person :firstname "wer" :lastname
"bush" :email ····@r" :uid 1 :pid 2))
Now,
CL-USER> p1
#<PERSON {B387C41}>
CL-USER> (slot-value p1 'firstname)
[Condition of type UNBOUND-SLOT]
The slot FIRSTNAME is unbound in the object #<PERSON {A6A7001}>.
Sorry to ask, but shouldn't make-instance bind the slot firstname to
the value "wer" ?
Must be some top-notch-stupid error, but I just dont get it.
thanx
On 3 Aug., 02:21, Ralf Mattes <····@mh-freiburg.de> wrote:
> On Thu, 02 Aug 2007 16:50:23 -0700, google.bo wrote:
> > Consider this:
> > (clsql:def-view-class person ()
> > ((pid :db-kind :key
> > :db-constraints :not-null
> > :type integer)
> > (uid
> > :type integer)
> > (firstname :type (string 250))
> > (lastname :type (string 250))
> > (email :type (string 250))))
>
> > (defvar p1 (make-instance 'person :firstname "wer" :lastname
> > "bush" :email ····@r" :uid 1 :pid 2))
>
> > Now,
> > CL-USER> p1
> > #<PERSON {B387C41}>
> > CL-USER> (slot-value p1 'firstname)
> > [Condition of type UNBOUND-SLOT]
> > The slot FIRSTNAME is unbound in the object #<PERSON {A6A7001}>.
>
> > Sorry to ask, but shouldn't make-instance bind the slot firstname to
> > the value "wer" ?
> > Must be some top-notch-stupid error, but I just dont get it.
>
> Maybe add an ':initarg :firstname' to the 'firstname slot options?
Right
I read, I typed, I banged my head very hard (multiple times) on my
tabel
Oh hell, THAT obvious, I just thought the accessor would be defined
automatic.
However, the example in the clsql user guide has it, too.
So rtfm
>
> Cheers, Ralf Mattes
Thanx very much indeed