mirror of
https://github.com/gitblit/iciql.git
synced 2024-09-02 05:58:33 +02:00
23 lines
948 B
Markdown
23 lines
948 B
Markdown
![]() |
## 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%
|