diff options
author | James Moger <james.moger@gmail.com> | 2011-08-03 22:01:42 -0400 |
---|---|---|
committer | James Moger <james.moger@gmail.com> | 2011-08-03 22:01:42 -0400 |
commit | 538ba78ac1dc2e9670380329ad989c9df0ab546b (patch) | |
tree | 505694283fe116a274f0b388953e329333263847 /docs/03_natural_syntax.mkd | |
download | iciql-538ba78ac1dc2e9670380329ad989c9df0ab546b.tar.gz iciql-538ba78ac1dc2e9670380329ad989c9df0ab546b.zip |
Initial commit of iciql.
Diffstat (limited to 'docs/03_natural_syntax.mkd')
-rw-r--r-- | docs/03_natural_syntax.mkd | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/docs/03_natural_syntax.mkd b/docs/03_natural_syntax.mkd new file mode 100644 index 0000000..a91c5b8 --- /dev/null +++ b/docs/03_natural_syntax.mkd @@ -0,0 +1,23 @@ +## Natural Syntax
+
+**work-in-progress**
+
+The original JaQu source offers partial support for Java expressions in *where* clauses.
+
+This works by decompiling a Java expression, at runtime, to an SQL condition. The expression is written as an anonymous inner class implementation of the `com.iciql.Filter` interface.
+A proof-of-concept decompiler is included, but is incomplete.
+
+The proposed syntax is:
+%BEGINCODE%
+long count = db.from(co).
+ where(new Filter() { public boolean where() {
+ return co.id == x
+ && co.name.equals(name)
+ && co.value == new BigDecimal("1")
+ && co.amount == 1L
+ && co.birthday.before(new java.util.Date())
+ && co.created.before(java.sql.Timestamp.valueOf("2005-05-05 05:05:05"))
+ && co.time.before(java.sql.Time.valueOf("23:23:23"));
+ }
+ }).selectCount();
+%ENDCODE%
\ No newline at end of file |