Next: qcons output, Previous: qcons strings, Up: Query Construction [Contents][Index]
This section describes the tree construction procedures, most of which are still (at this time, 2005-02-24) considered experimental. You should take this as an invitation to experiment and share your observations w/ the Guile-PG maintainer so that we can refine them nicely for the 1.0 release.
Return a tree made by mapping proc over list ls,
with elements separated by commas. Optional third arg parens?
non-#f includes surrounding parentheses. The rest of the args
are more lists, whose CARs are passed as additional args
to proc.
Return a where clause tree for condition.
Return a group-by clause tree for expressions (a list).
Return a having clause tree for conditions (a list).
Return a order-by clause tree for orderings (a list).
Each element of orderings has the form: (ORDFUNC EXPR).
If ordfunc is the symbol < or the keyword #:ASC,
it is taken as ASC. Likewise, > or #:DESC is taken
as DESC.
Return a select-cols clause tree for cols (a list). Each element of cols can take one of several forms:
titleA symbol, a column name possibly qualified with the table name.
For example, foo.bar means table foo, column bar.
(title . expr)title is a string to be used to name the output for the column described by prefix-style expression expr.
exprA prefix-style expression. The name of the output column described by expr is usually expr’s outermost function or operator.
Return a from clause tree for items (a list). Each element of items, a from-item, can take one of several forms:
table-nameA symbol.
(alias . table-name)A pair of symbols.
(jtype [jcondition] left-from right-from)This is a join clause,
where jtype is a keyword, one of #:join,
#:left-join, #:right-join, #:full-join;
and left-from and right-from are each a single
from-item to be handled recursively.
If jtype is #:join, jcondition must be omitted.
Otherwise, it is one of:
#:natural(#:using col1 col2...)(#:on pexp)Return a select/from/col combination clause tree for
froms and cols (both lists). In addition to the
constituent processing done by make-SELECT/COLS-tree
and make-FROM-tree on cols and froms,
respectively, prefix a SELECT token. If froms is
#f, it is omitted.
Return a select tail tree for plist, a list of alternating keywords and related expressions. These subsequences are recognized:
#:from xPass x to make-FROM-tree.
#:where xPass x to make-WHERE-tree.
#:group-by xPass x to make-GROUP-BY-tree.
#:having xPass x to make-HAVING-tree.
#:order-by xPass x to make-ORDER-BY-tree.
#:limit n#:offset nArrange for the tree to include LIMIT n
and/or OFFSET n. n is an integer.
If an expression (x or n) is #f, omit the associated
clause completely from the returned tree.
Return a select tree of composition for cols/subs and tail.
If composition is #t, cols/subs is passed directly to
make-SELECT/COLS-tree. Otherwise, it should be one of:
#:union #:intersect #:except #:union-all #:intersect-all #:except-all
cols/subs is a list of sublists taken as arguments to
parse+make-SELECT-tree (applied recursively to each sublist),
and finally combined by composition.
tail is passed directly to parse+make-SELECT/tail-tree.
Next: qcons output, Previous: qcons strings, Up: Query Construction [Contents][Index]