Building Database Access


; *retrieve* = things to get from database
; *restrict* = restrictions on the query

;   Main function: ASK
(defun ask (question)
  (let (*retrieve* *restrict*)
    (parse question)
    (querydb 'orderdb
      (cons 'and *restrict*)
      (cons 'list (nreverse *retrieve*)))))

;   Quote something
(defun kwote (x) (if (constantp x) x
                       (list 'quote x)))

;   make a database access call
(defun dbaccess (field)
  (list 'getdb (kwote field)))

;   add a restriction to the query
(defun addrestrict (r) (push r *restrict*))

Contents    Page-10    Prev    Next    Page+10    Index