aboutsummaryrefslogtreecommitdiffstats
path: root/src/site/usage.mkd
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-10-22 20:40:52 -0400
committerJames Moger <james.moger@gitblit.com>2014-10-22 22:29:05 -0400
commit1e4fc9cc867b925d82410f5ab3d5091987d60c4a (patch)
tree5ccb73a6da0d805354259f17264e4d3972b38332 /src/site/usage.mkd
parent18bc0518a7b5f7e97dc54413120cb108d934b0a2 (diff)
downloadiciql-1e4fc9cc867b925d82410f5ab3d5091987d60c4a.tar.gz
iciql-1e4fc9cc867b925d82410f5ab3d5091987d60c4a.zip
Implement execution tests of nested conditions and documentation
Diffstat (limited to 'src/site/usage.mkd')
-rw-r--r--src/site/usage.mkd40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/site/usage.mkd b/src/site/usage.mkd
index b1f4c48..8b54dce 100644
--- a/src/site/usage.mkd
+++ b/src/site/usage.mkd
@@ -69,6 +69,44 @@ List<Product> allProducts = db.buildObjects(Product.class, rs);
JdbcUtils.closeSilently(rs, true);
---JAVA---
+### Compound Conditions
+
+It is possible to specify type-safe compound where clauses using nested `And` and `Or` statements.
+
+---JAVA---
+final Customer model = new Customer();
+
+List<Customer> regionals =
+ db.from(model).where(model.customerId).isNotNull()
+ .and(model.region).isNotNull()
+ .and(new Or<Customer>(db, model) {{
+ or(model.region).is("LA");
+ or(model.region).is("CA");
+ }});
+
+List<Customer> regionalType1s =
+ db.from(model).where(new And<Customer>(db, model) {{
+ and(model.type).is(1);
+ and(new Or<Customer>(db, model) {{
+ or(model.region).is("CA");
+ or(model.region).is("LA");
+ }});
+ }});
+
+---JAVA---
+
+### Finding Matches for a List of Values
+
+You can use SQL's *IN* WHERE clause with the `oneOf` or `noneOf` conditions.
+
+---JAVA---
+final Customer model = new Customer();
+
+List<Customer> regionals = db.from(model).where(model.region).oneOf("CA", "LA");
+List<Customer> others = db.from(model).where(model.region).noneOf("CA", "LA");
+
+---JAVA---
+
### Read-only Views
View model classes can inherit their field definitions from a parent table model class.
@@ -232,4 +270,4 @@ for (int i = 0; i < 5; i++) {
---JAVA---
</td></tr>
-</table> \ No newline at end of file
+</table>