提交 3ca78807 authored 作者: Thomas Mueller's avatar Thomas Mueller

switch to JDK 1.6

上级 843a46d7
...@@ -16,6 +16,10 @@ Change Log ...@@ -16,6 +16,10 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>-
</li></ul>
<h2>Version 1.0.74 (2008-06-21)</h2>
<ul> <ul>
<li>Work on row level locking has been started (but there is nothing usable yet). <li>Work on row level locking has been started (but there is nothing usable yet).
</li><li>JaQu (Java Query), a tool similar to LINQ (Language Integrated Query; from Microsoft) </li><li>JaQu (Java Query), a tool similar to LINQ (Language Integrated Query; from Microsoft)
...@@ -29,7 +33,7 @@ Change Log ...@@ -29,7 +33,7 @@ Change Log
This was possible before but caused data loss. This was possible before but caused data loss.
</li><li>When using computed columns or default values with a different data type than the column data type, </li><li>When using computed columns or default values with a different data type than the column data type,
a class cast exception could occur. Fixed. a class cast exception could occur. Fixed.
</li><li>Databases larger than 1 GB was sometimes very slow if a lot of data was deleted previously. Fixed. </li><li>Opening databases larger than 1 GB was sometimes very slow if a lot of data was deleted previously. Fixed.
</li><li>RUNSCRIPT could throw a NullPointerException if the script name was an expression. </li><li>RUNSCRIPT could throw a NullPointerException if the script name was an expression.
</li><li>Improved compatibility. New compatibility modes for Oracle and Derby. </li><li>Improved compatibility. New compatibility modes for Oracle and Derby.
New compatibility flag uniqueIndexNullDistinct to only allow one row with 'NULL' in a unique New compatibility flag uniqueIndexNullDistinct to only allow one row with 'NULL' in a unique
...@@ -489,34 +493,4 @@ Change Log ...@@ -489,34 +493,4 @@ Change Log
</li><li>Using a function in a GROUP BY expression that is used in a view as a condition did not always work. </li><li>Using a function in a GROUP BY expression that is used in a view as a condition did not always work.
</li></ul> </li></ul>
<h2>Version 1.0.57 (2007-08-25)</h2>
<ul>
<li>New experimental feature MVCC (multi version concurrency control). Can be set as a option when opening the database (jdbc:h2:~/test;MVCC=TRUE) or as a system property (-Dh2.mvcc=true). This is work-in-progress, use it at your own risk. Feedback is welcome.
</li><li>The version number is now major.minor.micro where micro is the build number. Not all version are public, so there may be gaps in the micro. The minor changes when there is a file format change.
</li><li>The backup tool (org.h2.tools.Backup) did not work. The restore tool did not work when the -db parameter was used. Fixed. The documentation of the backup tool has been changed: only one database may be backed up at any time.
</li><li>Opening large read-only databases was very slow. Fixed.
</li><li>New Japanese translation of the error messages thanks to Ikemoto Masahiro. Thanks a lot!
</li><li>Disabling / enabling referential integrity for a table can now be used inside a transaction.
</li><li>Rights checking for dynamic tables (SELECT * FROM (SELECT ...)) did not work. Fixed.
</li><li>Creating more than 10 views that depend on each other was very slow. Reconnecting was slow as well. Fixed.
</li><li>When used as as Servlet, the H2 Console did not work with SSL (using Tomcat). Fixed.
</li><li>When altering a table with foreign key constraint, if there was no manual index created for the referenced columns, the automatically created index was dropped while still being used. Fixed.
</li><li>Check and foreign key constraints now checks if the existing data is consistent (this can be disabled by appending NOCHECK). It is also possible to check existing data when re-enabling referential integrity for a table.
</li><li>Some unit tests failed on Linux because the file system works differently. The unit tests are fixed and should work now.
</li><li>Can now incrementally translate the documentation. See also FAQ.
</li><li>Improved error messages: some tools can't show the root cause of an exception. Adding the message of the root cause to the message of the thrown exception now where it makes sense.
</li><li>The H2 Console can now connect to databases using JNDI. The driver class name must be a javax.naming.Context, (for example javax.naming.InitialContext), and the URL the resource name (for example java:comp/env/jdbc/Test). This should also work for linked tables.
</li><li>Google translate did not work for the H2 homepage. It should be fixed now.
</li><li>The CONVERT function did not work with views when using UNION.
</li><li>The build now issues a warning if the source code is switched to the wrong version.
</li><li>The default lock mode is now read committed instead of serialized.
</li><li>PG server: data was truncated when reading large VARCHAR columns and decimal columns.
</li><li>PG server: when the same database was accessed multiple times using the PostgreSQL ODBC driver, the pg_catalog schema update failed, and connecting to the database was not possible. Fixed.
</li><li>Some file operations didn't work for files in the root directory. Fixed.
</li><li>In the Restore tool, the parameter -file did not work. Fixed.
</li><li>Two-phase commit: commit with transaction name was only supported in the recovery scan. Now it is always supported.
</li><li>The column name C_CURRENT_TIMESTAMP did not work in the last release.
</li><li>OpenOffice compatibility: support database name in column names.
</li></ul>
</div></td></tr></table><!-- analytics --></body></html> </div></td></tr></table><!-- analytics --></body></html>
...@@ -26,7 +26,7 @@ H2 Database Engine ...@@ -26,7 +26,7 @@ H2 Database Engine
<h3>Version ${previousVersion} (${previousVersionDate}, Last Stable)</h3> <h3>Version ${previousVersion} (${previousVersionDate}, Last Stable)</h3>
<p> <p>
<a href="http://www.h2database.com/h2-setup-${previousVersionDate}.exe">Windows Installer</a><br /> <a href="http://www.h2database.com/h2-setup-${previousVersionDate}.exe">Windows Installer</a><br />
<a href="http://www.h2database.com/${previousVersionDate}.zip">Platform-Independent Zip</a><br /> <a href="http://www.h2database.com/h2-${previousVersionDate}.zip">Platform-Independent Zip</a><br />
</p> </p>
<h3>Download Mirror and Older Versions</h3> <h3>Download Mirror and Older Versions</h3>
......
...@@ -13,6 +13,39 @@ INSERT INTO CHANNEL VALUES('H2 Database Engine' , ...@@ -13,6 +13,39 @@ INSERT INTO CHANNEL VALUES('H2 Database Engine' ,
CREATE TABLE ITEM(ID INT PRIMARY KEY, TITLE VARCHAR, ISSUED TIMESTAMP, DESC VARCHAR); CREATE TABLE ITEM(ID INT PRIMARY KEY, TITLE VARCHAR, ISSUED TIMESTAMP, DESC VARCHAR);
INSERT INTO ITEM VALUES(44,
'New version available: 1.0.74 (2008-06-21)', '2008-06-21 12:00:00',
$$A new version of H2 is available for <a href="http://www.h2database.com">download</a>.
(You may have to click 'Refresh').
<br />
<b>Changes and new functionality:</b>
<ul><li>JaQu (Java Query), a tool similar to LINQ (Language Integrated Query)
is now included. See also
<a href="http://code.google.com/p/h2database/source/browse/trunk/h2/src/test/org/h2/test/jaqu/SamplesTest.java">
code examples</a>.
</li><li>Support for overloaded Java methods. Many thanks to Gary Tong!
</li><li>Deadlocks are now detected.
</li><li>Linked tables: statements executed against the target are list with trace level 3.
</li><li>RunScript tool: new options to show and check the results of queries.
</li><li>Improved compatibility with databases that only allow one row with 'NULL' in a unique
index. Use the compatibility mode to enable this feature.
</li><li>The source code is now switched to Java 1.6 by default.
</li><li>The ChangePassword tool is now called ChangeFileEncryption.
</li><li>It is no longer allowed to create columns with the data type NULL.
</li></ul>
<b>Bugfixes:</b>
<ul><li>The Lucene fulltext index was always re-created when opening a database.
</li><li>Setting a column default with a different data type did not work.
</li><li>Opening big databases was sometimes very slow. Fixed.
</li><li>RUNSCRIPT could throw a NullPointerException.
</li></ul>
For details, see the 'Change Log' at
http://www.h2database.com/html/changelog.html
<br />
For future plans, see the 'Roadmap' page at
http://www.h2database.com/html/roadmap.html
$$);
INSERT INTO ITEM VALUES(43, INSERT INTO ITEM VALUES(43,
'New version available: 1.0.73 (2008-05-31)', '2008-05-31 12:00:00', 'New version available: 1.0.73 (2008-05-31)', '2008-05-31 12:00:00',
$$A new version of H2 is available for <a href="http://www.h2database.com">download</a>. $$A new version of H2 is available for <a href="http://www.h2database.com">download</a>.
...@@ -420,37 +453,6 @@ For future plans, see the ''Roadmap'' page at ...@@ -420,37 +453,6 @@ For future plans, see the ''Roadmap'' page at
http://www.h2database.com/html/roadmap.html http://www.h2database.com/html/roadmap.html
'); ');
INSERT INTO ITEM VALUES(32,
'New version available: 1.0.62 (2007-11-25)', '2007-11-25 12:00:00',
'A new version of H2 is available for <a href="http://www.h2database.com">download</a>.
(You may have to click ''Refresh'').
<br />
<b>Changes and new functionality:</b>
<ul><li>Large updates and deletes are now supported.
</li><li>Google Android is supported.
</li><li>Large CSV operations are now faster.
</li><li>A patch for Apache DDL Utils is available.
</li><li>Eduardo Velasques has translated H2 to Brazilian Portuguese.
</li><li>Now using custom toString() for JDBC objects.
</li><li>The setting h2.emergencySpaceInitial is now 256 KB.
</li></ul>
<b>Bugfixes:</b>
<ul><li>Creating a table from GROUP_CONCAT didn''t always work.
</li><li>CSV: Using an empty field delimiter didn''t work.
</li><li>Nested temporary views with parameters didn''t always work.
</li><li>Cluster mode: could not connect if only one server was running.
</li><li>ARRAY values are now sorted as in PostgreSQL.
</li><li>The console did not display multiple spaces correctly.
</li><li>Duplicate column names were not detected when renaming columns.
</li><li>The H2 Console now also supports -ifExists.
</li><li>Changing a user with a schema made the schema inaccessible.
</li><li>Referential integrity checks didn''t lock the referenced table.
</li><li>Now changing MVCC too late throws an Exception.
</li></ul>
For future plans, see the ''Roadmap'' page at
http://www.h2database.com/html/roadmap.html
');
SELECT 'newsfeed-rss.xml' FILE, SELECT 'newsfeed-rss.xml' FILE,
XMLSTARTDOC() || XMLSTARTDOC() ||
XMLNODE('rss', XMLATTR('version', '2.0'), XMLNODE('rss', XMLATTR('version', '2.0'),
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
package org.h2.test.jaqu; package org.h2.test.jaqu;
//## Java 1.6 begin ## /*## Java 1.6 begin ##
import static org.h2.jaqu.Define.*; import static org.h2.jaqu.Define.*;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -15,12 +15,12 @@ import java.util.Date; ...@@ -15,12 +15,12 @@ import java.util.Date;
import java.util.List; import java.util.List;
import org.h2.jaqu.Table; import org.h2.jaqu.Table;
//## Java 1.6 end ## ## Java 1.6 end ##*/
/** /**
* A table containing order data. * A table containing order data.
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public class Order implements Table { public class Order implements Table {
public String customerId; public String customerId;
...@@ -28,7 +28,8 @@ public class Order implements Table { ...@@ -28,7 +28,8 @@ public class Order implements Table {
public Date orderDate; public Date orderDate;
public BigDecimal total; public BigDecimal total;
public Order(String customerId, Integer orderId, String total, String orderDate) { public Order(String customerId, Integer orderId,
String total, String orderDate) {
this.customerId = customerId; this.customerId = customerId;
this.orderId = orderId; this.orderId = orderId;
this.total = new BigDecimal(total); this.total = new BigDecimal(total);
...@@ -58,4 +59,4 @@ public class Order implements Table { ...@@ -58,4 +59,4 @@ public class Order implements Table {
} }
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
package org.h2.test.jaqu; package org.h2.test.jaqu;
//## Java 1.6 begin ## /*## Java 1.6 begin ##
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
...@@ -17,7 +17,7 @@ import static org.h2.jaqu.Define.*; ...@@ -17,7 +17,7 @@ import static org.h2.jaqu.Define.*;
/** /**
* A table containing product data. * A table containing product data.
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public class Product implements Table { public class Product implements Table {
public Integer productId; public Integer productId;
...@@ -30,7 +30,8 @@ public class Product implements Table { ...@@ -30,7 +30,8 @@ public class Product implements Table {
// public constructor // public constructor
} }
private Product(int productId, String productName, String category, double unitPrice, int unitsInStock) { private Product(int productId, String productName,
String category, double unitPrice, int unitsInStock) {
this.productId = productId; this.productId = productId;
this.productName = productName; this.productName = productName;
this.category = category; this.category = category;
...@@ -44,8 +45,10 @@ public class Product implements Table { ...@@ -44,8 +45,10 @@ public class Product implements Table {
index(productName, category); index(productName, category);
} }
private static Product create(int productId, String productName, String category, double unitPrice, int unitsInStock) { private static Product create(int productId, String productName,
return new Product(productId, productName, category, unitPrice, unitsInStock); String category, double unitPrice, int unitsInStock) {
return new Product(productId, productName, category,
unitPrice, unitsInStock);
} }
public static List<Product> getProductList() { public static List<Product> getProductList() {
...@@ -131,5 +134,5 @@ public class Product implements Table { ...@@ -131,5 +134,5 @@ public class Product implements Table {
} }
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
...@@ -6,19 +6,19 @@ ...@@ -6,19 +6,19 @@
*/ */
package org.h2.test.jaqu; package org.h2.test.jaqu;
//## Java 1.6 begin ## /*## Java 1.6 begin ##
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
import org.h2.jaqu.Db; import org.h2.jaqu.Db;
import org.h2.test.TestBase; import org.h2.test.TestBase;
//## Java 1.6 end ## ## Java 1.6 end ##*/
/** /**
* Implementation of the 101 LINQ Samples as described in * Implementation of the 101 LINQ Samples as described in
* http://msdn2.microsoft.com/en-us/vcsharp/aa336760.aspx * http://msdn2.microsoft.com/en-us/vcsharp/aa336760.aspx
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public class SamplesTest extends TestBase { public class SamplesTest extends TestBase {
private Db db; private Db db;
...@@ -54,7 +54,8 @@ public class SamplesTest extends TestBase { ...@@ -54,7 +54,8 @@ public class SamplesTest extends TestBase {
for (Product x : soldOutProducts) { for (Product x : soldOutProducts) {
result += x.productName + ";"; result += x.productName + ";";
} }
assertEquals(result, "Chef Anton's Gumbo Mix;Alice Mutton;Thueringer Rostbratwurst;Gorgonzola Telino;Perth Pasties;"); assertEquals(result, "Chef Anton's Gumbo Mix;Alice Mutton;"
+ "Thueringer Rostbratwurst;Gorgonzola Telino;Perth Pasties;");
} }
private void testWhereSimple3() throws Exception { private void testWhereSimple3() throws Exception {
...@@ -78,12 +79,18 @@ public class SamplesTest extends TestBase { ...@@ -78,12 +79,18 @@ public class SamplesTest extends TestBase {
} }
assertEquals( assertEquals(
result, result,
"Chai;Chang;Aniseed Syrup;Chef Anton's Cajun Seasoning;Grandma's Boysenberry Spread;" "Chai;Chang;Aniseed Syrup;Chef Anton's Cajun Seasoning;"
+ "Uncle Bob's Organic Dried Pears;Northwoods Cranberry Sauce;Mishi Kobe Niku;Ikura;" + "Grandma's Boysenberry Spread;"
+ "Queso Cabrales;Queso Manchego La Pastora;Konbu;Tofu;Genen Shouyu;Pavlova;" + "Uncle Bob's Organic Dried Pears;"
+ "Carnarvon Tigers;Teatime Chocolate Biscuits;Sir Rodney's Marmalade;Sir Rodney's Scones;" + "Northwoods Cranberry Sauce;Mishi Kobe Niku;Ikura;"
+ "Gustaf's Knaeckebroed;Tunnbroed;Guarana Fantastica;NuNuCa Nuss-Nougat-Creme;Gumbaer Gummibaerchen;" + "Queso Cabrales;Queso Manchego La Pastora;"
+ "Schoggi Schokolade;Roessle Sauerkraut;Nord-Ost Matjeshering;Mascarpone Fabioli;Sasquatch Ale;" + "Konbu;Tofu;Genen Shouyu;Pavlova;"
+ "Carnarvon Tigers;Teatime Chocolate Biscuits;"
+ "Sir Rodney's Marmalade;Sir Rodney's Scones;"
+ "Gustaf's Knaeckebroed;Tunnbroed;Guarana Fantastica;"
+ "NuNuCa Nuss-Nougat-Creme;Gumbaer Gummibaerchen;"
+ "Schoggi Schokolade;Roessle Sauerkraut;"
+ "Nord-Ost Matjeshering;Mascarpone Fabioli;Sasquatch Ale;"
+ "Steeleye Stout;Inlagd Sill;Gravad lax;Cote de Blaye;" + "Steeleye Stout;Inlagd Sill;Gravad lax;Cote de Blaye;"
+ "Chartreuse verte;Boston Crab Meat;Jack's New England Clam Chowder;" + "Chartreuse verte;Boston Crab Meat;Jack's New England Clam Chowder;"
+ "Singaporean Hokkien Fried Mee;Ipoh Coffee;Gula Malacca;Rogede sild;" + "Singaporean Hokkien Fried Mee;Ipoh Coffee;Gula Malacca;Rogede sild;"
...@@ -134,12 +141,12 @@ public class SamplesTest extends TestBase { ...@@ -134,12 +141,12 @@ public class SamplesTest extends TestBase {
assertEquals(products.get(i).productName, productNames.get(i)); assertEquals(products.get(i).productName, productNames.get(i));
} }
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
/** /**
* A result set class containing the product name and price. * A result set class containing the product name and price.
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public static class ProductPrice { public static class ProductPrice {
public String productName; public String productName;
public String category; public String category;
...@@ -175,12 +182,12 @@ public class SamplesTest extends TestBase { ...@@ -175,12 +182,12 @@ public class SamplesTest extends TestBase {
assertEquals(p2.unitPrice, pr.price); assertEquals(p2.unitPrice, pr.price);
} }
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
/** /**
* A result set class containing customer data and the order total. * A result set class containing customer data and the order total.
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public static class CustOrder { public static class CustOrder {
public String customerId; public String customerId;
public Integer orderId; public Integer orderId;
...@@ -226,4 +233,4 @@ public class SamplesTest extends TestBase { ...@@ -226,4 +233,4 @@ public class SamplesTest extends TestBase {
} }
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
...@@ -9,7 +9,7 @@ package org.h2.jaqu; ...@@ -9,7 +9,7 @@ package org.h2.jaqu;
/** /**
* A enumeration of compare operations. * A enumeration of compare operations.
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public enum CompareType { public enum CompareType {
EQUAL("=", true), EQUAL("=", true),
BIGGER(">", true), BIGGER(">", true),
...@@ -38,5 +38,5 @@ public enum CompareType { ...@@ -38,5 +38,5 @@ public enum CompareType {
} }
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
...@@ -11,7 +11,7 @@ package org.h2.jaqu; ...@@ -11,7 +11,7 @@ package org.h2.jaqu;
* *
* @param <A> the operand type * @param <A> the operand type
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public class Condition<A> implements ConditionToken { public class Condition<A> implements ConditionToken {
Query< ? > query; Query< ? > query;
CompareType compareType; CompareType compareType;
...@@ -31,4 +31,4 @@ public class Condition<A> implements ConditionToken { ...@@ -31,4 +31,4 @@ public class Condition<A> implements ConditionToken {
return query.getString(x) + compareType.toString(); return query.getString(x) + compareType.toString();
} }
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
...@@ -9,7 +9,7 @@ package org.h2.jaqu; ...@@ -9,7 +9,7 @@ package org.h2.jaqu;
/** /**
* An OR or an AND condition. * An OR or an AND condition.
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public enum ConditionAndOr implements ConditionToken { public enum ConditionAndOr implements ConditionToken {
AND("AND"), AND("AND"),
OR("OR"); OR("OR");
...@@ -25,4 +25,4 @@ public enum ConditionAndOr implements ConditionToken { ...@@ -25,4 +25,4 @@ public enum ConditionAndOr implements ConditionToken {
} }
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
package org.h2.jaqu; package org.h2.jaqu;
//## Java 1.6 begin ## /*## Java 1.6 begin ##
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
...@@ -19,17 +19,18 @@ import org.h2.jaqu.TableDefinition.FieldDefinition; ...@@ -19,17 +19,18 @@ import org.h2.jaqu.TableDefinition.FieldDefinition;
import org.h2.jaqu.util.Utils; import org.h2.jaqu.util.Utils;
import org.h2.jaqu.util.WeakIdentityHashMap; import org.h2.jaqu.util.WeakIdentityHashMap;
import org.h2.util.JdbcUtils; import org.h2.util.JdbcUtils;
//## Java 1.6 end ## ## Java 1.6 end ##*/
/** /**
* This class represents a connection to a database. * This class represents a connection to a database.
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public class Db { public class Db {
private final Connection conn; private final Connection conn;
private final Map<Class, TableDefinition> classMap = Utils.newHashMap(); private final Map<Class, TableDefinition> classMap = Utils.newHashMap();
private final WeakIdentityHashMap<Object, FieldDefinition> aliasMap = Utils.newWeakIdentityHashMap(); private final WeakIdentityHashMap<Object, FieldDefinition> aliasMap =
Utils.newWeakIdentityHashMap();
Db(Connection conn) { Db(Connection conn) {
this.conn = conn; this.conn = conn;
...@@ -150,4 +151,4 @@ public class Db { ...@@ -150,4 +151,4 @@ public class Db {
} }
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
...@@ -10,7 +10,7 @@ package org.h2.jaqu; ...@@ -10,7 +10,7 @@ package org.h2.jaqu;
* This class provides utility methods to define primary keys, indexes, and set * This class provides utility methods to define primary keys, indexes, and set
* the name of the table. * the name of the table.
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public class Define { public class Define {
private static TableDefinition currentTableDefinition; private static TableDefinition currentTableDefinition;
...@@ -41,9 +41,11 @@ public class Define { ...@@ -41,9 +41,11 @@ public class Define {
private static void checkInDefine() { private static void checkInDefine() {
if (currentTable == null) { if (currentTable == null) {
throw new RuntimeException("This method may only be called from within the define() method, and the define() method is called by the framework."); throw new RuntimeException("This method may only be called " +
"from within the define() method, and the define() method " +
"is called by the framework.");
} }
} }
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
package org.h2.jaqu; package org.h2.jaqu;
//## Java 1.6 begin ## /*## Java 1.6 begin ##
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -14,14 +14,14 @@ import java.util.List; ...@@ -14,14 +14,14 @@ import java.util.List;
import org.h2.jaqu.TableDefinition.FieldDefinition; import org.h2.jaqu.TableDefinition.FieldDefinition;
import org.h2.jaqu.util.Utils; import org.h2.jaqu.util.Utils;
//## Java 1.6 end ## ## Java 1.6 end ##*/
/** /**
* This class represents a query. * This class represents a query.
* *
* @param <T> the return type * @param <T> the return type
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public class Query<T> { public class Query<T> {
private Db db; private Db db;
...@@ -108,7 +108,7 @@ public class Query<T> { ...@@ -108,7 +108,7 @@ public class Query<T> {
public <A> QueryCondition<T, A> where(A x) { public <A> QueryCondition<T, A> where(A x) {
return new QueryCondition<T, A>(this, x); return new QueryCondition<T, A>(this, x);
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
/** /**
* Order by a number of columns. * Order by a number of columns.
...@@ -116,7 +116,7 @@ public class Query<T> { ...@@ -116,7 +116,7 @@ public class Query<T> {
* @param columns the columns * @param columns the columns
* @return the query * @return the query
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public Query<T> orderBy(Integer... columns) { public Query<T> orderBy(Integer... columns) {
return this; return this;
} }
...@@ -145,7 +145,7 @@ public class Query<T> { ...@@ -145,7 +145,7 @@ public class Query<T> {
} }
return buff.toString(); return buff.toString();
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
/** /**
* Join another table. * Join another table.
...@@ -153,10 +153,10 @@ public class Query<T> { ...@@ -153,10 +153,10 @@ public class Query<T> {
* @param u an alias for the table to join * @param u an alias for the table to join
* @return the joined query * @return the joined query
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public QueryJoin innerJoin(Object u) { public QueryJoin innerJoin(Object u) {
return new QueryJoin(this); return new QueryJoin(this);
} }
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
...@@ -12,7 +12,7 @@ package org.h2.jaqu; ...@@ -12,7 +12,7 @@ package org.h2.jaqu;
* @param <T> the return type of the query * @param <T> the return type of the query
* @param <A> the incomplete condition data type * @param <A> the incomplete condition data type
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public class QueryCondition<T, A> { public class QueryCondition<T, A> {
private Query<T> query; private Query<T> query;
...@@ -39,4 +39,4 @@ public class QueryCondition<T, A> { ...@@ -39,4 +39,4 @@ public class QueryCondition<T, A> {
} }
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
...@@ -9,7 +9,7 @@ package org.h2.jaqu; ...@@ -9,7 +9,7 @@ package org.h2.jaqu;
/** /**
* This class represents a query with a join. * This class represents a query with a join.
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public class QueryJoin { public class QueryJoin {
Query< ? > query; Query< ? > query;
...@@ -22,4 +22,4 @@ public class QueryJoin { ...@@ -22,4 +22,4 @@ public class QueryJoin {
return new QueryJoinCondition<A>(query, x); return new QueryJoinCondition<A>(query, x);
} }
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
...@@ -11,7 +11,7 @@ package org.h2.jaqu; ...@@ -11,7 +11,7 @@ package org.h2.jaqu;
* *
* @param <A> the incomplete condition data type * @param <A> the incomplete condition data type
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public class QueryJoinCondition<A> { public class QueryJoinCondition<A> {
private Query< ? > query; private Query< ? > query;
...@@ -27,4 +27,4 @@ public class QueryJoinCondition<A> { ...@@ -27,4 +27,4 @@ public class QueryJoinCondition<A> {
return query; return query;
} }
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
...@@ -6,16 +6,16 @@ ...@@ -6,16 +6,16 @@
*/ */
package org.h2.jaqu; package org.h2.jaqu;
//## Java 1.6 begin ## /*## Java 1.6 begin ##
import java.util.List; import java.util.List;
//## Java 1.6 end ## ## Java 1.6 end ##*/
/** /**
* This class represents a query with a condition. * This class represents a query with a condition.
* *
* @param <T> the return type * @param <T> the return type
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public class QueryWhere<T> { public class QueryWhere<T> {
Query<T> query; Query<T> query;
...@@ -41,7 +41,7 @@ public class QueryWhere<T> { ...@@ -41,7 +41,7 @@ public class QueryWhere<T> {
public List<T> select() { public List<T> select() {
return query.select(); return query.select();
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
/** /**
* Order by a number of columns. * Order by a number of columns.
...@@ -49,10 +49,10 @@ public class QueryWhere<T> { ...@@ -49,10 +49,10 @@ public class QueryWhere<T> {
* @param columns the columns * @param columns the columns
* @return the query * @return the query
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public QueryWhere<T> orderBy(Integer... columns) { public QueryWhere<T> orderBy(Integer... columns) {
return this; return this;
} }
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
package org.h2.jaqu; package org.h2.jaqu;
//## Java 1.6 begin ## /*## Java 1.6 begin ##
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
...@@ -16,7 +16,7 @@ import java.util.IdentityHashMap; ...@@ -16,7 +16,7 @@ import java.util.IdentityHashMap;
import java.util.Map; import java.util.Map;
import org.h2.jaqu.util.Utils; import org.h2.jaqu.util.Utils;
//## Java 1.6 end ## ## Java 1.6 end ##*/
/** /**
* A table definition contains the index definitions of a table, the field * A table definition contains the index definitions of a table, the field
...@@ -24,25 +24,25 @@ import org.h2.jaqu.util.Utils; ...@@ -24,25 +24,25 @@ import org.h2.jaqu.util.Utils;
* *
* @param <T> the table type * @param <T> the table type
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
class TableDefinition<T> { class TableDefinition<T> {
//## Java 1.6 end ## ## Java 1.6 end ##*/
/** /**
* The meta data of an index. * The meta data of an index.
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
static class IndexDefinition { static class IndexDefinition {
boolean unique; boolean unique;
String indexName; String indexName;
String[] columnNames; String[] columnNames;
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
/** /**
* The meta data of a field. * The meta data of a field.
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
static class FieldDefinition<X> { static class FieldDefinition<X> {
String columnName; String columnName;
Field field; Field field;
...@@ -79,7 +79,8 @@ class TableDefinition<T> { ...@@ -79,7 +79,8 @@ class TableDefinition<T> {
String tableName; String tableName;
private Class<T> clazz; private Class<T> clazz;
private ArrayList<FieldDefinition> fields = Utils.newArrayList(); private ArrayList<FieldDefinition> fields = Utils.newArrayList();
private IdentityHashMap<Object, FieldDefinition> fieldMap = Utils.newIdentityHashMap(); private IdentityHashMap<Object, FieldDefinition> fieldMap =
Utils.newIdentityHashMap();
private String[] primaryKeyColumnNames; private String[] primaryKeyColumnNames;
private ArrayList<IndexDefinition> indexes = Utils.newArrayList(); private ArrayList<IndexDefinition> indexes = Utils.newArrayList();
...@@ -237,4 +238,4 @@ class TableDefinition<T> { ...@@ -237,4 +238,4 @@ class TableDefinition<T> {
} }
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
...@@ -17,7 +17,7 @@ public class ClassUtils { ...@@ -17,7 +17,7 @@ public class ClassUtils {
// utility class // utility class
} }
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public static Class< ? > loadClass(String className) { public static Class< ? > loadClass(String className) {
try { try {
return Class.forName(className); return Class.forName(className);
...@@ -25,5 +25,5 @@ public class ClassUtils { ...@@ -25,5 +25,5 @@ public class ClassUtils {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
} }
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
*/ */
package org.h2.jaqu.util; package org.h2.jaqu.util;
//## Java 1.6 begin ## /*## Java 1.6 begin ##
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException; import java.sql.SQLException;
//## Java 1.6 end ## ## Java 1.6 end ##*/
/** /**
* Messages used in the database engine. * Messages used in the database engine.
...@@ -30,7 +30,7 @@ public class Message { ...@@ -30,7 +30,7 @@ public class Message {
* @param e the root cause * @param e the root cause
* @return the SQL exception object * @return the SQL exception object
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public static SQLException convert(Throwable e) { public static SQLException convert(Throwable e) {
if (e instanceof SQLException) { if (e instanceof SQLException) {
return (SQLException) e; return (SQLException) e;
...@@ -46,6 +46,6 @@ public class Message { ...@@ -46,6 +46,6 @@ public class Message {
} }
return new SQLException("General exception: " + e.toString(), e); return new SQLException("General exception: " + e.toString(), e);
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
} }
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
package org.h2.jaqu.util; package org.h2.jaqu.util;
//## Java 1.6 begin ## /*## Java 1.6 begin ##
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
...@@ -18,12 +18,12 @@ import java.util.List; ...@@ -18,12 +18,12 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.h2.util.StringUtils; import org.h2.util.StringUtils;
//## Java 1.6 end ## ## Java 1.6 end ##*/
/** /**
* Generic utility methods. * Generic utility methods.
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public class Utils { public class Utils {
private static volatile long counter; private static volatile long counter;
...@@ -104,7 +104,8 @@ public class Utils { ...@@ -104,7 +104,8 @@ public class Utils {
} }
} }
} }
throw new RuntimeException("Exception trying to create " + clazz.getName() + ": " + e, e); throw new RuntimeException("Exception trying to create " +
clazz.getName() + ": " + e, e);
} }
} }
...@@ -128,4 +129,4 @@ public class Utils { ...@@ -128,4 +129,4 @@ public class Utils {
} }
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
*/ */
package org.h2.jaqu.util; package org.h2.jaqu.util;
//## Java 1.6 begin ## /*## Java 1.6 begin ##
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
//## Java 1.6 end ## ## Java 1.6 end ##*/
/** /**
* This hash map uses weak references, so that elements that are no longer * This hash map uses weak references, so that elements that are no longer
...@@ -21,7 +21,7 @@ import java.util.Set; ...@@ -21,7 +21,7 @@ import java.util.Set;
* @param <K> the keys * @param <K> the keys
* @param <V> the value * @param <V> the value
*/ */
//## Java 1.6 begin ## /*## Java 1.6 begin ##
public class WeakIdentityHashMap<K, V> implements Map<K, V> { public class WeakIdentityHashMap<K, V> implements Map<K, V> {
private static final int MAX_LOAD = 90; private static final int MAX_LOAD = 90;
private static final WeakReference DELETED_KEY = new WeakReference(null); private static final WeakReference DELETED_KEY = new WeakReference(null);
...@@ -224,4 +224,4 @@ public class WeakIdentityHashMap<K, V> implements Map<K, V> { ...@@ -224,4 +224,4 @@ public class WeakIdentityHashMap<K, V> implements Map<K, V> {
} }
} }
//## Java 1.6 end ## ## Java 1.6 end ##*/
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论