Re: Newbie troubles with the tutorial
Russ Tyndall <[email protected]> Thu, 02 Aug 2012 16:49:40 -0400
| Newsgroups | gmane.lisp.clsql.general |
|---|---|
| Message-ID | <[email protected]> |
Your (clsql:select 'employee) call has returned to you a list
containing rows. Each row is a list containing all the objects queried
from the database; each row is actually only a single object (because
you selected a single class). To eliminate the extra single item lists
you can pass :flatp to clsql:select.
To access your results you can access the values of appropriate results
(either by slot-value or each slots accessor function).
Eg: (last-name (first results)) or (last-name (first (first results))),
if you dont use flatp, should return to you the last name of the first
result employee.
Cheers, hope this helps,
Russ Tyndall
PS: for more information on CLOS (the common lisp object system), please
see practical common lisp:
http://www.gigamonkeys.com/book/object-reorientation-generic-functions.html
http://www.gigamonkeys.com/book/object-reorientation-classes.html
On 8/2/2012 3:14 PM, Michael Zuhause wrote:
> Hello,
>
> I ran the tutorial coming with clsql and a mysql database.
>
> The database is updated nicely and the company table has one line and
> the employees are Lenin and Stalin as expected.
>
> However, when I try to read the data,I don't get the it as expected:
>
> (clsql:select 'employee)
> => ((#<EMPLOYEE {24CB47F1}>) (#<EMPLOYEE {24CB4A29}>))
> *
> *(clsql:select 'company)
> => ((#<COMPANY {24442F39}>))
>
> I am fairly new to CL as well, so how can I get the actual data from
> the query?
>
> Michael
>
>
>
>
>
>
> _______________________________________________
> CLSQL mailing list
> [email protected]
> http://lists.b9.com/cgi-bin/mailman/listinfo/clsql
_______________________________________________
CLSQL mailing list
[email protected]
http://lists.b9.com/cgi-bin/mailman/listinfo/clsql