Re: Iteration syntax for UncommonSQL
Edi Weitz <[email protected]> 17 Jan 2003 12:20:10 +0100
| Newsgroups | gmane.lisp.uncommon-sql,gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
Nick Levine <[email protected]> writes: > Edi, > > Take a look at the end of section 5.2 in the same document: > > Finally, we have at our disposal all the same iteration constructs > that we had before (section 4.3). This time the iteration focus is > not a record (i.e. a tuple of attributes) but a tuple of > instances. For example, returning to the iteration examples we > used before: > > CL-USER 361 > (do-query ((my-aardvark) [select 'species-list > :where aardvark]) > (print my-aardvark)) > > #<db-instance SPECIES-LIST 574209404> > > CL-USER 362 > > > I have only tried this with Common SQL. Please let us know if you find > that UncommonSQL is different. That was how I hoped it would work. But it doesn't (CMUCL 18e-pre with USQL checked out from CVS in December): * (sql:select 'user :where [= [fname] "Edi"]) (#<USER {4816A08D}>) * (describe (car *)) #<USER {4816A08D}> is an instance of class #<View-Metaclass USER {48030F8D}>: The following slots have :INSTANCE allocation: EDITING-CONTEXT NIL VIEW-DATABASE #<MAISQL-POSTGRESQL:POSTGRESQL-DATABASE {4854FC25}> FULL-NAME "unbound" JACKPOT-DAYS NIL BULI-POINTS-PER-DAY #(0 0 0 0 0 ...) BULI-TOTO-PER-DAY #(0 0 0 0 0 ...) BULI-POINTS 0 MAX-MINUTES 60 BULI-MAIL-DIFF 4 WANT-BULI-MAIL 17 FAVORITES NIL PEUGEOT NIL DISTRICT "Hamburg" REGION "Nord" EMAIL "[email protected]" LNAME "Weitz" FNAME "Edi" USER-ID "dodod" * (sql:do-query ((my-user) [select 'user :where [= [fname] "Edi"]]) (print my-user)) Error in function "DEFMETHOD MAKE-QUERY NIL": No source tables supplied to select statement. Restarts: 0: [ABORT] Return to Top-Level. Debug (type H for help) ("DEFMETHOD MAKE-QUERY NIL" #<unused-arg> #<unused-arg> (USER :WHERE #<MAISQL-SYS::SQL-RELATIONAL-EXP (FNAME = 'Edi')>)) Source: (ERROR "No source tables supplied to select statement.") 0] :a * (sql:do-query ((my-user) (sql:select 'user :where [= [fname] "Edi"])) (print my-user)) Type-error in KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER: (#<USER {4819901D}>) is not of type (OR SIMPLE-BASE-STRING NULL (ALIEN:ALIEN (* (ALIEN:SIGNED 8)))) Restarts: 0: [ABORT] Return to Top-Level. Debug (type H for help) (MAISQL-POSTGRESQL::%PG-QUERY-RESULT-SET #<MAISQL-POSTGRESQL:POSTGRESQL-DATABASE {4854FC25}> (#<USER {4819901D}>)) Source: ; File: /usr/local/lisp/source/uncommonsql/dbms/postgresql/glue-cmucl.lisp (PQEXEC CONN-PTR QUERY-EXPRESSION) 0] Hmmm...