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