提交 9f7ca082 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 c0c73bcb
......@@ -16,7 +16,10 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>Oracle compatibility: old style outer join syntax using (+) did work correctly sometimes.
<ul><li>MySQL compatibility: linked tables had lower case column names on some systems.
</li><li>DB2 compatibility: the DB2 fetch-first-clause is supported.
</li><li>Oracle compatibility: old style outer join syntax using (+) did work correctly sometimes.
</li><li>ResultSet.setFetchSize is now supported.
</li></ul>
<h2>Version 1.0.76 (2008-07-27)</h2>
......
......@@ -125,6 +125,7 @@ to be dangerous by design, and some problems are hard to solve. Those are:
<li>Using SET LOG 0 to disable the transaction log file.
</li><li>Using the transaction isolation level READ_UNCOMMITTED (LOCK_MODE 0) while at the same time using multiple
connections may result in inconsistent transactions.
</li><li>Using FILE_LOCK=NO in the database URL.
</li></ul>
<p>
In addition to that, running out of memory should be avoided.
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Copyright 2004-2008 H2 Group. Multiple-Licensed under the H2 License, Version 1.0,,
and under the Eclipse Public License, Version 1.0
(http://h2database.com/html/license.html).
Initial Developer: H2 Group
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title>
JaQu
</title><link rel="stylesheet" type="text/css" href="stylesheet.css" />
<script type="text/javascript" src="navigation.js"></script>
</head><body onload="frameMe();">
<table class="content"><tr class="content"><td class="content"><div class="contentDiv">
<h1>JaQu</h1>
<h2>What is JaQu</h2>
<p>
JaQu stands for Java Query and allows to access databases using pure Java.
JaQu replaces SQL, JDBC, and O/R frameworks such as Hibernate.
JaQu is something like LINQ for Java (LINQ stands for "language integrated query" and is a
Microsoft .NET technology). The following JaQu code:
</p>
<pre>
Product p = new Product();
List&lt;Product> soldOutProducts =
db.from(p).where(p.unitsInStock).is(0).select();
</pre>
<p>
stands for the SQL statement:
</p>
<pre>
SELECT * FROM PRODUCTS P
WHERE P.UNITS_IN_STOCK = 0
</pre>
<h2>Advantages</h2>
<p>
Unlike to 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.
JaQu fully protects against SQL injection.
</p>
<h3>Why in Java?</h3>
<p>
Most people use Java in their application. Mixing Java and another language (for example Scala or Groovy)
in the same application is complicated. It would be required to split the code to access the database
and the application code.
</p>
<h2>Current State</h2>
<p>
JaQu is not yet stable, and not part of the h2.jar file. However the source code is included in H2,
under:
</p>
<ul><li>src/test/org/h2/test/jaqu/* (samples and tests)
</li><li>src/tools/org/h2/jaqu/* (framework)
</li></ul>
<h2>Requirements</h2>
<p>
JaQu requires Java 1.5. Annotations are not need.
Currently, JaQu is only tested with the H2 database engine, however in theory it should
work with any database that supports the JDBC API.
</p>
<h2>Example Code</h2>
<pre>
package org.h2.test.jaqu;
import java.math.BigDecimal;
import java.util.List;
import org.h2.jaqu.Db;
import static org.h2.jaqu.Function.*;
public class Test {
Db db;
public static void main(String[] args) throws Exception {
new SamplesTest().test();
}
public void test() throws Exception {
db = Db.open("jdbc:h2:mem:", "sa", "sa");
db.insertAll(Product.getProductList());
db.insertAll(Customer.getCustomerList());
db.insertAll(Order.getOrderList());
testLength();
testCount();
testGroup();
testSelectManyCompoundFrom2();
testWhereSimple4();
testSelectSimple2();
testAnonymousTypes3();
testWhereSimple2();
testWhereSimple3();
db.close();
}
private void testWhereSimple2() throws Exception {
Product p = new Product();
List&lt;Product> soldOutProducts =
db.from(p).
where(p.unitsInStock).is(0).
orderBy(p.productId).select();
}
private void testWhereSimple3() throws Exception {
Product p = new Product();
List&lt;Product> expensiveInStockProducts =
db.from(p).
where(p.unitsInStock).bigger(0).
and(p.unitPrice).bigger(3.0).
orderBy(p.productId).select();
}
private void testWhereSimple4() throws Exception {
Customer c = new Customer();
List&lt;Customer> waCustomers =
db.from(c).
where(c.region).is("WA").
select();
}
private void testSelectSimple2() throws Exception {
Product p = new Product();
List&lt;String> productNames =
db.from(p).
orderBy(p.productId).select(p.productName);
List&lt;Product> products = Product.getProductList();
}
public static class ProductPrice {
public String productName;
public String category;
public Double price;
}
private void testAnonymousTypes3() throws Exception {
final Product p = new Product();
List&lt;ProductPrice> productInfos =
db.from(p).orderBy(p.productId).
select(new ProductPrice() { {
productName = p.productName;
category = p.category;
price = p.unitPrice;
}});
List&lt;Product> products = Product.getProductList();
}
public static class CustOrder {
public String customerId;
public Integer orderId;
public BigDecimal total;
}
private void testSelectManyCompoundFrom2() throws Exception {
final Customer c = new Customer();
final Order o = new Order();
List&lt;CustOrder> orders =
db.from(c).
innerJoin(o).on(c.customerId).is(o.customerId).
where(o.total).smaller(new BigDecimal("500.00")).
orderBy(1).
select(new CustOrder() { {
customerId = c.customerId;
orderId = o.orderId;
total = o.total;
}});
}
private void testLength() throws Exception {
Product p = new Product();
List&lt;Integer> lengths = db.from(p).
where(length(p.productName)).smaller(10).
orderBy(1).
selectDistinct(length(p.productName));
}
private void testCount() throws Exception {
long count = db.from(new Product()).selectCount();
}
public static class ProductGroup {
public String category;
public Long productCount;
}
private void testGroup() throws Exception {
final Product p = new Product();
List&lt;ProductGroup> list =
db.from(p).
groupBy(p.category).
orderBy(1).
select(new ProductGroup() { {
category = p.category;
productCount = count();
}});
}
}
</pre>
</div></td></tr></table><!-- analytics --></body></html>
......@@ -140,6 +140,11 @@ HA-JDBC</a><br />
High-Availability JDBC: A JDBC proxy that provides light-weight, transparent, fault tolerant clustering capability to any underlying JDBC driver.
</p>
<p><a href="http://coolharbor.100free.com/index.htm">
Harbor</a><br />
Pojo Application Server.
</p>
<p><a href="http://henplus.sourceforge.net">
HenPlus</a><br />
HenPlus is a SQL shell written in Java.
......
......@@ -60,6 +60,7 @@ Initial Developer: H2 Group
<a href="features.html" target="main">Features</a><br />
<a href="performance.html" target="main">Performance</a><br />
<a href="advanced.html" target="main">Advanced Topics</a><br />
<a href="jaqu.html" target="main">JaQu</a><br />
<a href="download.html" target="main">Download</a><br />
<br />
<b>Reference</b><br />
......
......@@ -271,8 +271,8 @@ java org.h2.test.TestAll timer
/*
Improved compatibility with DB2: support for FETCH .. ROWS
GRANT SELECT, UPDATE ON *
Check Eclipse DTP, see also
https://bugs.eclipse.org/bugs/show_bug.cgi?id=137701
......
......@@ -37,9 +37,11 @@ I am sorry to say that, but it looks like a corruption problem. I am very intere
- Could you send the full stack trace of the exception including message text?
- What is your database URL?
- You can find out if the database is corrupted when running SCRIPT TO 'test.sql'
- You can find out if the database is corrupted when running
SCRIPT TO 'test.sql'
- What version H2 are you using?
- With which version of H2 was this database created? You can find it out using:
- With which version of H2 was this database created?
You can find it out using:
select * from information_schema.settings where name='CREATE_BUILD'
- Did you use multiple connections?
- The first workarounds is: append ;RECOVER=1 to the database URL.
......
......@@ -551,4 +551,5 @@ geocoder geocoding longitude estimating microarray latitude magnolia pfgrc
refill analyzers patches popular came growing indication arabic graphic toc
numbering goto outline makensis macro hyperlink dispatch setlocal wend
widows msgbox designer styles families uno soffice orphans stan ucb rem
pdfurl upate pagebreak ren echo atlassian buggy submitted xcopy
pdfurl upate pagebreak ren echo atlassian buggy submitted xcopy invention
harbor generics pojo annotations
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论