Skip to content

Latest commit

 

History

History
57 lines (41 loc) · 1.69 KB

dynamic-queries.textile

File metadata and controls

57 lines (41 loc) · 1.69 KB
layout title
manual
Dynamically varying Queries

Dynamic Queries

It is often necessary to create queries with a from clause that varies

depending on values known only at runtime.

The method inhibitWhen(b: Boolean) available on org.squeryl.Queryable[A]
is meant to be called in a from clause, it will turn a Table[A] or (sub) Query[A]
into a Queryable[Option[A]] and remove the queryable from the query
*and all expression containing this queryable.

Example :

Notice the Option[] in the result type of the query, and how the Author
table disapears from the generated SQL base on the input of inhibitWhen :