[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Re: [ANN] New egg: Object-relation mapper Pandora

From: Peter Bex
Subject: Re: [Chicken-users] Re: [ANN] New egg: Object-relation mapper Pandora
Date: Thu, 20 Aug 2009 20:33:00 +0200
User-agent: Mutt/

On Thu, Aug 20, 2009 at 06:24:27PM +0200, Thomas Chust wrote:
> * A complete usage example has been added to the documentation.

In the example, the 'name' column in the 'Tags' table should be TEXT,
shouldn't it?

There's a problem in the 'match method with Postgres, in the presence of
link slots.  If I tweak the example a bit to work under postgres, I get
an error at  (pretty-print ((a-post 'in-reply-to*) 'count)) :

  Error: (collect-results) ERROR:  subquery in FROM must have an alias
  HINT:  For example, FROM (SELECT ...) [AS] foo.

I can fix it by hand by patching up the table clauses:

  #;48> (define r (a-post 'in-reply-to*))
  #;49> (r 'table-clauses)
  ((("(SELECT " "in_reply_to" " AS " "id" " FROM " "Posts" " WHERE " "(" "id" " 
= " ?  )" ")") 1) (("Posts")))
  #;50> (r 'set-table-clauses! '((("(SELECT " "in_reply_to" " AS " "id" " FROM 
" "Posts" " WHERE " "(" "id" " = " ? ")" ") AS _foo") 1) (("Posts"))))
  ((("(SELECT " "in_reply_to" " AS " "id" " FROM " "Posts" " WHERE " "(" "id" " 
= " ? ")" ") AS _foo") 1) (("Posts")))
  #;51> (r 'count)

But you need a sequence generator of some sort because otherwise you'll
get several times the same alias in a query.  I don't know how to do
that, off the top of my head.

"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth

Attachment: pgpPnZxyC03Ue.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]