aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2016-04-07 14:31:16 -0400
committerJames Moger <james.moger@gitblit.com>2016-04-07 14:31:16 -0400
commit4d6ad0e9c2f20369bf8766777f3d51f759c2df08 (patch)
treefdda2c797c719fc38e6905ba8ab08ad20e6386d5
parent6c8336cbb19fd5ba18459dbabb434cf094ccf209 (diff)
downloadiciql-4d6ad0e9c2f20369bf8766777f3d51f759c2df08.tar.gz
iciql-4d6ad0e9c2f20369bf8766777f3d51f759c2df08.zip
Fixes #24: Add where(String) method to improve interop
-rw-r--r--CHANGELOG.md4
-rw-r--r--src/main/java/com/iciql/Query.java10
-rw-r--r--src/test/java/com/iciql/test/ModelsTest.java8
3 files changed, 22 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5ce2d54..03aaca7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
+### [2.1.1] - 2016-04-07
+#### Added
+- Add explicit `where(String)` method to help with non-Java language interop
+
### [2.1.0] - 2016-04-06
#### Added
- Add methods to select counts of a group by field (*SELECT field, COUNT(*) FROM table [WHERE conditions] GROUP BY field*)
diff --git a/src/main/java/com/iciql/Query.java b/src/main/java/com/iciql/Query.java
index 20d5520..d1528e8 100644
--- a/src/main/java/com/iciql/Query.java
+++ b/src/main/java/com/iciql/Query.java
@@ -663,6 +663,16 @@ public class Query<T> {
return new QueryWhere<T>(this);
}
+ /**
+ * Begin an string field condition clause explicitly defined for interop clarity.
+ *
+ * @param x the mapped string to query
+ * @return a query condition to continue building the condition
+ */
+ public QueryCondition<T, String> where(String x) {
+ return new QueryCondition<T, String>(this, x);
+ }
+
public QueryWhere<T> where(String fragment, List<?> args) {
return this.where(fragment, args.toArray());
}
diff --git a/src/test/java/com/iciql/test/ModelsTest.java b/src/test/java/com/iciql/test/ModelsTest.java
index 96a6e4a..9fef979 100644
--- a/src/test/java/com/iciql/test/ModelsTest.java
+++ b/src/test/java/com/iciql/test/ModelsTest.java
@@ -218,4 +218,12 @@ public class ModelsTest {
assertEquals("[Condiments=5, Beverages=2, Produce=1, Meat/Poultry=1]", categories.toString());
}
+ @Test
+ public void testWhereByString() {
+ Product products = new Product();
+
+ List<Product> seafoodProducts = db.from(products).where(products.category).is("Seafood").select();
+ assertEquals(1, seafoodProducts.size());
+ }
+
}