diff options
author | James Moger <james.moger@gitblit.com> | 2014-10-22 20:40:52 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-10-22 22:29:05 -0400 |
commit | 1e4fc9cc867b925d82410f5ab3d5091987d60c4a (patch) | |
tree | 5ccb73a6da0d805354259f17264e4d3972b38332 /src/site | |
parent | 18bc0518a7b5f7e97dc54413120cb108d934b0a2 (diff) | |
download | iciql-1e4fc9cc867b925d82410f5ab3d5091987d60c4a.tar.gz iciql-1e4fc9cc867b925d82410f5ab3d5091987d60c4a.zip |
Implement execution tests of nested conditions and documentation
Diffstat (limited to 'src/site')
-rw-r--r-- | src/site/model_classes.mkd | 4 | ||||
-rw-r--r-- | src/site/usage.mkd | 40 |
2 files changed, 41 insertions, 3 deletions
diff --git a/src/site/model_classes.mkd b/src/site/model_classes.mkd index ea91bb0..cb21dcd 100644 --- a/src/site/model_classes.mkd +++ b/src/site/model_classes.mkd @@ -67,7 +67,7 @@ can be used for all iciql expressions <td>INT<br/><em>EnumType.ORDINAL</em><br/><i>can only <b>declare and explicitly reference</b> one instance of <u>each enum type</u> per model<br/>multiple instances of an enum type within a model is allowed if not using where/set/on/and/or/groupBy/orderBy(enum)</i></td></tr>
<tr><td>java.lang.Enum implements<br/><em>com.iciql.Iciql.EnumId.enumId()</em></td><td> </td>
-<td>INT<br/><em>EnumType.ENUMID</em><br/><i>can only <b>declare and explicitly reference</b> one instance of <u>each enum type</u> per model<br/>multiple instances of an enum type within a model is allowed if not using where/set/on/and/or/groupBy/orderBy(enum)</i></td></tr>
+<td><i>variable</i><br/><em>EnumType.ENUMID</em><br/><i>can only <b>declare and explicitly reference</b> one instance of <u>each enum type</u> per model<br/>multiple instances of an enum type within a model is allowed if not using where/set/on/and/or/groupBy/orderBy(enum)</i></td></tr>
<tr><td colspan="3"><b>Partially Supported Types</b><br/>
can not be directly referenced in an expression</td></tr>
@@ -383,4 +383,4 @@ public class Product { public Product() {
}
}
----JAVA---
\ No newline at end of file +---JAVA---
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>
|