提交 b1a3cf48 authored 作者: Thomas Mueller's avatar Thomas Mueller

JaQu improvements

上级 71aa57a5
...@@ -43,16 +43,15 @@ A Java Runtime Environment (JRE) version 1.4 or higher is required to run this d ...@@ -43,16 +43,15 @@ A Java Runtime Environment (JRE) version 1.4 or higher is required to run this d
To build the database executables, the following software stack was used. To build the database executables, the following software stack was used.
Newer version or compatible software works too. Newer version or compatible software works too.
</p> </p>
<ul> <ul><li>Windows XP
<li>Windows XP </li><li>Sun JDK Version 1.4 and 1.6
</li><li>Sun JDK Version 1.4 and 1.6 </li><li>Eclipse Version 3.3
</li><li>Eclipse Version 3.3 </li><li>Eclipse Plugins: Subclipse 1.2.4, EclEmma Java Code Coverage 1.3.0, Eclipse Checkstyle Plug-in 4.4.0
</li><li>Eclipse Plugins: Subclipse 1.2.4, EclEmma Java Code Coverage 1.3.0, Eclipse Checkstyle Plug-in 4.4.0 </li><li>Mozilla Firefox 3.0
</li><li>Mozilla Firefox 3.0 </li><li>OpenOffice 3.0
</li><li>OpenOffice 3.0 </li><li>NSIS 2.38 (Nullsoft Scriptable Install System)
</li><li>NSIS 2.38 (Nullsoft Scriptable Install System) </li><li>Maven 2.0.7
</li><li>Maven 2.0.7 </li><li>YourKit Java Profiler
</li><li>YourKit Java Profiler
</li></ul> </li></ul>
<br /><a name="building"></a> <br /><a name="building"></a>
...@@ -142,14 +141,14 @@ If you like to provide patches, please consider the following guidelines to simp ...@@ -142,14 +141,14 @@ If you like to provide patches, please consider the following guidelines to simp
<ul><li>Only use Java 1.4 features (not use Java 1.5 or 1.6) (see Environment). <ul><li>Only use Java 1.4 features (not use Java 1.5 or 1.6) (see Environment).
</li><li>Follow the coding style used in the project, use Checkstyle (see above) to check the coding style. </li><li>Follow the coding style used in the project, use Checkstyle (see above) to check the coding style.
</li><li>Please provide test cases and integrate them into the test suite. </li><li>Please provide test cases and integrate them into the test suite.
For Java level tests, see src/test/org/h2/test/TestAll.java. For Java level tests, see src/test/org/h2/test/TestAll.java.
For SQL level tests, see src/test/org/h2/test/test.in.txt or testSimple.in.txt For SQL level tests, see src/test/org/h2/test/test.in.txt or testSimple.in.txt
</li><li>The test cases should cover at least 90% of the changed/new code; use a code coverage tool to verify that (see above). </li><li>The test cases should cover at least 90% of the changed/new code; use a code coverage tool to verify that (see above).
</li><li>Verify that you did not break other features: Run the test cases by executing build test. </li><li>Verify that you did not break other features: Run the test cases by executing build test.
</li><li>Provide end user documentation if required (src/docsrc/html/*). </li><li>Provide end user documentation if required (src/docsrc/html/*).
</li><li>Document grammar changes in src/main/org/h2/res/help.csv </li><li>Document grammar changes in src/main/org/h2/res/help.csv
</li><li>Provide a change log entry (src/docsrc/html/changelog.html). </li><li>Provide a change log entry (src/docsrc/html/changelog.html).
</li><li>Submit patches as .patch files (compressed if big). To create a patch, use for example Eclipse Team/Create Patch. </li><li>Submit patches as .patch files (compressed if big). To create a patch, use for example Eclipse Team/Create Patch.
</ul> </li></ul>
</div></td></tr></table><!-- analytics --></body></html> </div></td></tr></table><!-- analytics --></body></html>
...@@ -35,11 +35,20 @@ SELECT * FROM PRODUCTS P ...@@ -35,11 +35,20 @@ SELECT * FROM PRODUCTS P
WHERE P.UNITS_IN_STOCK = 0 WHERE P.UNITS_IN_STOCK = 0
</pre> </pre>
<h2>Advantages</h2> <h2>Advantages and Differences to other Data Access Tools</h2>
<p> <p>
Unlike to SQL, JaQu can be easily integrated in Java applications. Because JaQu is pure Java, Unlike SQL, JaQu can be easily integrated in Java applications. Because JaQu is pure Java,
Javadoc and auto-complete are supported. Type checking is performed by the compiler. Javadoc and auto-complete are supported. Type checking is performed by the compiler.
JaQu fully protects against SQL injection. JaQu fully protects against SQL injection.
</p>
<p>
JaQu is much smaller than object-relation mapping tools such as Hibernate.
Unlike iBatis and Hibernate, no XML or annotation based configuration is required;
instead the configuration (if required at all) is done in pure Java, in the application itself.
</p>
<p>
JaQu does not require or contain any data caching mechanism. Like JDBC and iBatis,
JaQu provides full control over when and what SQL statements are executed.
</p> </p>
<h3>Why in Java?</h3> <h3>Why in Java?</h3>
......
...@@ -128,8 +128,7 @@ Of course, patches are always welcome, but are not always applied as is. Patches ...@@ -128,8 +128,7 @@ Of course, patches are always welcome, but are not always applied as is. Patches
</li><li>The HELP information schema can be directly exposed in the Console </li><li>The HELP information schema can be directly exposed in the Console
</li><li>Maybe use the 0x1234 notation for binary fields, see MS SQL Server </li><li>Maybe use the 0x1234 notation for binary fields, see MS SQL Server
</li><li>Support Oracle CONNECT BY in some way: http://www.adp-gmbh.ch/ora/sql/connect_by.html, http://philip.greenspun.com/sql/trees.html </li><li>Support Oracle CONNECT BY in some way: http://www.adp-gmbh.ch/ora/sql/connect_by.html, http://philip.greenspun.com/sql/trees.html
</li><li>SQL Server 2005, Oracle: Support COUNT(*) OVER(). See </li><li>SQL Server 2005, Oracle: Support COUNT(*) OVER(). See http://www.orafusion.com/art_anlytc.htm
http://www.orafusion.com/art_anlytc.htm
</li><li>RANK() and DENSE_RANK(), Partition using OVER() </li><li>RANK() and DENSE_RANK(), Partition using OVER()
</li><li>SQL 2003 (http://www.wiscorp.com/sql_2003_standard.zip) </li><li>SQL 2003 (http://www.wiscorp.com/sql_2003_standard.zip)
</li><li>http://www.jpackage.org </li><li>http://www.jpackage.org
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -328,7 +328,8 @@ public class SamplesTest extends TestBase { ...@@ -328,7 +328,8 @@ public class SamplesTest extends TestBase {
productCount = count(); productCount = count();
}}); }});
assertEquals("[Beverages:2, Condiments:5, Meat/Poultry:1, Produce:1, Seafood:1]", assertEquals("[Beverages:2, Condiments:5, " +
"Meat/Poultry:1, Produce:1, Seafood:1]",
list.toString()); list.toString());
} }
......
...@@ -258,7 +258,8 @@ public class Build extends BuildBase { ...@@ -258,7 +258,8 @@ public class Build extends BuildBase {
} }
/** /**
* Create the file h2jaqu.jar. This only contains the JaQu (Java Query) implementation. * Create the file h2jaqu.jar. This only contains the JaQu (Java Query)
* implementation.
*/ */
public void jarJaqu() { public void jarJaqu() {
compile(true, false); compile(true, false);
......
...@@ -552,4 +552,6 @@ refill analyzers patches popular came growing indication arabic graphic toc ...@@ -552,4 +552,6 @@ refill analyzers patches popular came growing indication arabic graphic toc
numbering goto outline makensis macro hyperlink dispatch setlocal wend numbering goto outline makensis macro hyperlink dispatch setlocal wend
widows msgbox designer styles families uno soffice orphans stan ucb rem widows msgbox designer styles families uno soffice orphans stan ucb rem
pdfurl upate pagebreak ren echo atlassian buggy submitted xcopy invention pdfurl upate pagebreak ren echo atlassian buggy submitted xcopy invention
harbor generics pojo annotations harbor generics pojo annotations ecl subclipse jmx bean plugins team cha emma
nullsoft annotation cover scriptable guidelines consider batis coding
anlytc art orafusion
...@@ -26,7 +26,8 @@ class Condition<A> implements Token { ...@@ -26,7 +26,8 @@ class Condition<A> implements Token {
public String getString(Query query) { public String getString(Query query) {
if (compareType.hasRightExpression()) { if (compareType.hasRightExpression()) {
return query.getString(x) + " " + compareType.getString() + " " + query.getString(y); return query.getString(x) + " " +
compareType.getString() + " " + query.getString(y);
} }
return query.getString(x) + " " + compareType.getString(); return query.getString(x) + " " + compareType.getString();
} }
......
...@@ -86,7 +86,9 @@ public class Function implements Token { ...@@ -86,7 +86,9 @@ public class Function implements Token {
} }
public static Boolean or(Boolean... x) { public static Boolean or(Boolean... x) {
return Db.registerToken(Utils.newObject(Boolean.class), new Function("", (Object[]) x) { return Db.registerToken(
Utils.newObject(Boolean.class),
new Function("", (Object[]) x) {
public String getString(Query query) { public String getString(Query query) {
StringBuilder buff = new StringBuilder(); StringBuilder buff = new StringBuilder();
for (int i = 0; i < x.length; i++) { for (int i = 0; i < x.length; i++) {
...@@ -101,7 +103,9 @@ public class Function implements Token { ...@@ -101,7 +103,9 @@ public class Function implements Token {
} }
public static Boolean and(Boolean... x) { public static Boolean and(Boolean... x) {
return Db.registerToken(Utils.newObject(Boolean.class), new Function("", (Object[]) x) { return Db.registerToken(
Utils.newObject(Boolean.class),
new Function("", (Object[]) x) {
public String getString(Query query) { public String getString(Query query) {
StringBuilder buff = new StringBuilder(); StringBuilder buff = new StringBuilder();
for (int i = 0; i < x.length; i++) { for (int i = 0; i < x.length; i++) {
......
...@@ -24,32 +24,38 @@ public class QueryCondition<T, A> { ...@@ -24,32 +24,38 @@ public class QueryCondition<T, A> {
} }
public QueryWhere<T> is(A y) { public QueryWhere<T> is(A y) {
query.addConditionToken(new Condition<A>(query, x, y, CompareType.EQUAL)); query.addConditionToken(
new Condition<A>(query, x, y, CompareType.EQUAL));
return new QueryWhere<T>(query); return new QueryWhere<T>(query);
} }
public QueryWhere<T> bigger(A y) { public QueryWhere<T> bigger(A y) {
query.addConditionToken(new Condition<A>(query, x, y, CompareType.BIGGER)); query.addConditionToken(
new Condition<A>(query, x, y, CompareType.BIGGER));
return new QueryWhere<T>(query); return new QueryWhere<T>(query);
} }
public QueryWhere<T> biggerEqual(A y) { public QueryWhere<T> biggerEqual(A y) {
query.addConditionToken(new Condition<A>(query, x, y, CompareType.BIGGER_EQUAL)); query.addConditionToken(
new Condition<A>(query, x, y, CompareType.BIGGER_EQUAL));
return new QueryWhere<T>(query); return new QueryWhere<T>(query);
} }
public QueryWhere<T> smaller(A y) { public QueryWhere<T> smaller(A y) {
query.addConditionToken(new Condition<A>(query, x, y, CompareType.SMALLER)); query.addConditionToken(
new Condition<A>(query, x, y, CompareType.SMALLER));
return new QueryWhere<T>(query); return new QueryWhere<T>(query);
} }
public QueryWhere<T> smallerEqual(A y) { public QueryWhere<T> smallerEqual(A y) {
query.addConditionToken(new Condition<A>(query, x, y, CompareType.SMALLER_EQUAL)); query.addConditionToken(
new Condition<A>(query, x, y, CompareType.SMALLER_EQUAL));
return new QueryWhere<T>(query); return new QueryWhere<T>(query);
} }
public QueryWhere<T> like(A pattern) { public QueryWhere<T> like(A pattern) {
query.addConditionToken(new Condition<A>(query, x, pattern, CompareType.LIKE)); query.addConditionToken(
new Condition<A>(query, x, pattern, CompareType.LIKE));
return new QueryWhere<T>(query); return new QueryWhere<T>(query);
} }
......
...@@ -13,6 +13,7 @@ import org.h2.jaqu.util.Utils; ...@@ -13,6 +13,7 @@ import org.h2.jaqu.util.Utils;
* *
* @param <A> the incomplete condition data type * @param <A> the incomplete condition data type
*/ */
//## Java 1.5 begin ##
public class TestCondition<A> { public class TestCondition<A> {
private A x; private A x;
...@@ -76,3 +77,4 @@ public class TestCondition<A> { ...@@ -76,3 +77,4 @@ public class TestCondition<A> {
} }
} }
//## Java 1.5 end ##
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论