On Thu, 2008-12-11 at 16:05 +0100, Jens Teich wrote: > Phil schrieb: > > Hi > > > > I am looking for an example of how to create a s-sql query on the fly. I > > am sure I saw something like that along the line on some website but I > > cant find it again. > > Are you looking for things like that: > > (defun element (&key guid guid-parent type-id type-not-equal) > (let ((sql-guid (if guid > (postmodern:sql (:= 'guid guid)) > (postmodern:sql t))) > (sql-guid-parent (if guid-parent > (postmodern:sql > (:= 'struct-guid-parent-node guid-parent)) > (postmodern:sql t))) > (sql-type-id (if type-id > (postmodern:sql (:= 'type-id type-id)) > (postmodern:sql t))) > (sql-type-not-equal (if type-not-equal > (postmodern:sql > (:not (:= 'type-id type-not-equal))) > (postmodern:sql t)))) > (postmodern:query (:order-by > (:select 'guid 'name 'type-id 'name-css > :from 'projekt-elemente > :where (:and > (:raw sql-guid) > (:raw sql-guid-parent) > (:raw sql-type-id) > (:raw sql-type-not-equal) > (:= 'lang-id *lang*))) > 'struct-sort-order)))) > > Jens > Thanx Jens that gives me some insight into a couple of things, but I dont know the amount of statements I will have in the where that is why I have to build the query dynamically.
The example Maciej gave completes the puzzle. Phil _______________________________________________ postmodern-devel mailing list [email protected] http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel
