提交 2ce30790 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 10f6b2b4
......@@ -73,22 +73,22 @@ public class Constants {
/**
* The build id is incremented for each public release.
*/
public static final int BUILD_ID = 74;
public static final int BUILD_ID = 75;
/**
* The build id of the previous release.
*/
public static final int BUILD_ID_PREVIOUS = 73;
public static final int BUILD_ID_PREVIOUS = 74;
/**
* The build date is updated for each public release.
*/
public static final String BUILD_DATE = "2008-06-21";
public static final String BUILD_DATE = "2008-07-14";
/**
* The build date is updated for each public release.
*/
public static final String BUILD_DATE_PREVIOUS = "2008-05-31";
public static final String BUILD_DATE_PREVIOUS = "2008-06-21";
/**
* The TCP protocol version number 5. This protocol is used by the TCP
......
......@@ -1482,6 +1482,14 @@ public class JdbcConnection extends TraceObject implements Connection {
}
//## Java 1.6 end ##
/**
* Create a clob value from this reader.
*
* @param x the reader
* @param length the length (if smaller or equal to 0, all data until the
* end of file is read)
* @return the value
*/
Value createClob(Reader x, long length) throws SQLException {
if (x == null) {
return ValueNull.INSTANCE;
......
......@@ -236,7 +236,6 @@ public class Message {
* Convert an exception to a SQL exception using the default mapping.
*
* @param e the root cause
* @param sql the SQL statement or null if it is not known
* @return the SQL exception object
*/
public static SQLException convert(Throwable e) {
......
......@@ -23,7 +23,8 @@ import org.h2.tools.RunScript;
public class Compact {
/**
* This method is called when executing this sample application.
* This method is called when executing this sample application from the
* command line.
*
* @param args the command line parameters
*/
......
......@@ -23,7 +23,8 @@ import org.h2.tools.SimpleResultSet;
public class CsvSample {
/**
* This method is called when executing this sample application.
* This method is called when executing this sample application from the
* command line.
*
* @param args the command line parameters
*/
......
......@@ -20,7 +20,8 @@ import java.sql.Statement;
public class FileFunctions {
/**
* This method is called when executing this sample application.
* This method is called when executing this sample application from the
* command line.
*
* @param args the command line parameters
*/
......
......@@ -23,7 +23,8 @@ import org.h2.tools.SimpleResultSet;
public class Function {
/**
* This method is called when executing this sample application.
* This method is called when executing this sample application from the
* command line.
*
* @param args the command line parameters
*/
......
......@@ -25,7 +25,8 @@ import org.h2.tools.SimpleResultSet;
public class FunctionMultiReturn {
/**
* This method is called when executing this sample application.
* This method is called when executing this sample application from the
* command line.
*
* @param args the command line parameters
*/
......
......@@ -22,7 +22,8 @@ import org.h2.tools.RunScript;
public class InitDatabaseFromJar {
/**
* This method is called when executing this sample application.
* This method is called when executing this sample application from the
* command line.
*
* @param args the command line parameters
*/
......
......@@ -20,7 +20,8 @@ import org.h2.tools.Server;
public class MixedMode {
/**
* This method is called when executing this sample application.
* This method is called when executing this sample application from the
* command line.
*
* @param args the command line parameters
*/
......
......@@ -26,7 +26,8 @@ import org.h2.util.StringUtils;
public class Newsfeed {
/**
* This method is called when executing this sample application.
* This method is called when executing this sample application from the
* command line.
*
* @param args the command line parameters
*/
......
......@@ -27,7 +27,8 @@ public class SQLInjection {
private Statement stat;
/**
* This method is called when executing this sample application.
* This method is called when executing this sample application from the
* command line.
*
* @param args the command line parameters
*/
......
......@@ -20,7 +20,8 @@ import java.util.Properties;
public class SecurePassword {
/**
* This method is called when executing this sample application.
* This method is called when executing this sample application from the
* command line.
*
* @param args the command line parameters
*/
......
......@@ -32,7 +32,8 @@ public class ShowProgress implements DatabaseEventListener {
}
/**
* This method is called when executing this sample application.
* This method is called when executing this sample application from the
* command line.
*
* @param args the command line parameters
*/
......
......@@ -13,7 +13,8 @@ package org.h2.samples;
public class ShutdownServer {
/**
* This method is called when executing this sample application.
* This method is called when executing this sample application from the
* command line.
*
* @param args the command line parameters
*/
......
......@@ -22,7 +22,8 @@ import org.h2.api.Trigger;
public class TriggerSample {
/**
* This method is called when executing this sample application.
* This method is called when executing this sample application from the
* command line.
*
* @param args the command line parameters
*/
......
......@@ -13,6 +13,34 @@ INSERT INTO CHANNEL VALUES('H2 Database Engine' ,
CREATE TABLE ITEM(ID INT PRIMARY KEY, TITLE VARCHAR, ISSUED TIMESTAMP, DESC VARCHAR);
INSERT INTO ITEM VALUES(45,
'New version available: 1.0.75 (2008-07-14)', '2008-07-14 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>The JaQu (Java Query) tool has been improved.
</li><li>The H2 Console can be started with an open connection to inspect a database while debugging.
</li><li>The referential constraint checking performance has been improvement.
</li></ul>
<b>Bugfixes:</b>
<ul><li>Running out of memory could result in incomplete transactions or corrupted databases. Fixed.
</li><li>Stopping a WebServer didn't always work. Fixed.
</li><li>Sometimes, order by in a query that uses the same table multiple times didn't work.
</li><li>A multi version concurrency (MVCC) problem has been fixed.
</li><li>Some views with multiple joined tables didn't work.
</li><li>The Oracle mode now allows multiple rows with NULL in a unique index.
</li><li>Some database metadata calls returned the wrong data type for DATA_TYPE columns.
</li><li>A bug int the Lucene fulltext implementation has been fixed.
</li><li>The character '$' could not be used in identifier names.
</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(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>.
......@@ -427,32 +455,6 @@ For future plans, see the ''Roadmap'' page at
http://www.h2database.com/html/roadmap.html
');
INSERT INTO ITEM VALUES(33,
'New version available: 1.0.63 (2007-12-02)', '2007-12-02 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>Performance optimization for IN(...) and IN(SELECT...),
currently disabled by default. To enable, use java -Dh2.optimizeInJoin=true
</li><li>The H2 Console has been translated to Ukrainian by Igor Dobrovolskyi. Thanks a lot!
</li><li>The SecurePassword example has been improved.
</li><li>Improved FTP server: now the PORT command is supported.
</li><li>New function TABLE_DISTINCT.
</li></ul>
<b>Bugfixes:</b>
<ul><li>Certain setting in the Server didn''t work.
</li><li>In time zones where the summer time saving limit is at midnight,
some dates did not work in some virtual machines,
for example 2007-10-14 in Chile, using the Sun JVM 1.6.0_03-b05.
</li><li>The native fulltext search was not working properly after re-connecting.
</li><li>Temporary views (FROM(...)) with UNION didn''t work if nested.
</li><li>Using LIMIT with values close to Integer.MAX_VALUE didn''t work.
</li></ul>
For future plans, see the ''Roadmap'' page at
http://www.h2database.com/html/roadmap.html
');
SELECT 'newsfeed-rss.xml' FILE,
XMLSTARTDOC() ||
XMLNODE('rss', XMLATTR('version', '2.0'),
......
......@@ -26,16 +26,22 @@ import org.h2.test.TestBase;
* no more SQL injection.</p>
*/
public class SamplesTest extends TestBase {
/**
* This object represents a database (actually a connection to the database).
*/
//## Java 1.5 begin ##
Db db;
//## Java 1.5 end ##
// TODO length
/**
* This method is called when executing this application from the command
* line.
*
* @param args the command line parameters
*/
public static void main(String[] args) throws Exception {
new SamplesTest().test();
}
//## Java 1.5 end ##
public void test() throws Exception {
//## Java 1.5 begin ##
......
......@@ -491,8 +491,8 @@ public class BuildBase {
* @param basePath the base path
*/
protected void jar(String destFile, List files, String basePath) {
out.println("Jar " + destFile);
zipOrJar(destFile, files, basePath, false, false, true);
long kb = zipOrJar(destFile, files, basePath, false, false, true);
out.println("Jar " + destFile + " (" + kb + " KB)");
}
/**
......@@ -505,11 +505,11 @@ public class BuildBase {
* @param sortBySuffix if the file should be sorted by the file suffix
*/
protected void zip(String destFile, List files, String basePath, boolean storeOnly, boolean sortBySuffix) {
out.println("Zip " + destFile);
zipOrJar(destFile, files, basePath, storeOnly, sortBySuffix, false);
long kb = zipOrJar(destFile, files, basePath, storeOnly, sortBySuffix, false);
out.println("Zip " + destFile + " (" + kb + " KB)");
}
private void zipOrJar(String destFile, List files, String basePath, boolean storeOnly, boolean sortBySuffix, boolean jar) {
private long zipOrJar(String destFile, List files, String basePath, boolean storeOnly, boolean sortBySuffix, boolean jar) {
if (sortBySuffix) {
// for better compressibility, sort by suffix, then name
Collections.sort(files, new Comparator() {
......@@ -555,6 +555,7 @@ public class BuildBase {
}
zipOut.closeEntry();
zipOut.close();
return new File(destFile).length() / 1024;
} catch (IOException e) {
throw new Error("Error creating file " + destFile, e);
}
......
......@@ -545,4 +545,4 @@ crab northwoods escargots organic sasquatch bourgogne clam camembert tigers
chang lumberjack roed biscuits
usable weblica jena preserved instrumentation inspect jayaprakash ashwin
varargs automate couldn unclear eat dtp disks tablespaces
\ No newline at end of file
varargs automate couldn unclear eat dtp disks tablespaces great reproduces
\ No newline at end of file
......@@ -26,7 +26,8 @@ import org.h2.util.JdbcUtils;
//## Java 1.5 begin ##
public class Db {
private static final WeakIdentityHashMap<Object, Token> TOKENS = Utils.newWeakIdentityHashMap();
private static final WeakIdentityHashMap<Object, Token> TOKENS =
Utils.newWeakIdentityHashMap();
private final Connection conn;
private final Map<Class, TableDefinition> classMap = Utils.newHashMap();
......
......@@ -29,18 +29,19 @@ public class Function implements Token {
public String getString(Query query) {
return name + "(" + query.getString(x) + ")";
}
//## Java 1.5 end ##
public static Long count() {
return COUNT_STAR;
}
public static Integer length(Object x) {
return Db.registerToken(Utils.newObject(Integer.class), new Function("LENGTH", x));
return Db.registerToken(
Utils.newObject(Integer.class), new Function("LENGTH", x));
}
public static Long count(Object x) {
return Db.registerToken(Utils.newObject(Long.class), new Function("COUNT", x));
return Db.registerToken(
Utils.newObject(Long.class), new Function("COUNT", x));
}
public static <X> X min(X x) {
......@@ -55,6 +56,5 @@ public class Function implements Token {
return Db.registerToken(o, new Function("MAX", x));
}
//## Java 1.5 end ##
}
......@@ -19,7 +19,8 @@ class OrderExpression<T> {
private boolean nullsFirst;
private boolean nullsLast;
OrderExpression(Query query, T expression, boolean desc, boolean nullsFirst, boolean nullsLast) {
OrderExpression(Query query, T expression, boolean desc,
boolean nullsFirst, boolean nullsLast) {
this.query = query;
this.expression = expression;
this.desc = desc;
......
......@@ -145,14 +145,16 @@ public class Query<T> {
//## Java 1.5 begin ##
public Query<T> orderBy(Object... expressions) {
for (Object expr : expressions) {
OrderExpression<Object> e = new OrderExpression<Object>(this, expr, false, false, false);
OrderExpression<Object> e =
new OrderExpression<Object>(this, expr, false, false, false);
addOrderBy(e);
}
return this;
}
public Query<T> orderByDesc(Object expr) {
OrderExpression<Object> e = new OrderExpression<Object>(this, expr, true, false, false);
OrderExpression<Object> e =
new OrderExpression<Object>(this, expr, true, false, false);
addOrderBy(e);
return this;
}
......@@ -228,7 +230,7 @@ public class Query<T> {
/**
* Join another table.
*
* @param u an alias for the table to join
* @param alias an alias for the table to join
* @return the joined query
*/
//## Java 1.5 begin ##
......
......@@ -61,38 +61,44 @@ public class QueryWhere<T> {
//## Java 1.5 begin ##
public QueryWhere<T> orderBy(Object... expressions) {
for (Object expr : expressions) {
OrderExpression<Object> e = new OrderExpression<Object>(query, expr, false, false, false);
OrderExpression<Object> e =
new OrderExpression<Object>(query, expr, false, false, false);
query.addOrderBy(e);
}
return this;
}
public QueryWhere<T> orderByNullsFirst(Object expr) {
OrderExpression<Object> e = new OrderExpression<Object>(query, expr, false, true, false);
OrderExpression<Object> e =
new OrderExpression<Object>(query, expr, false, true, false);
query.addOrderBy(e);
return this;
}
public QueryWhere<T> orderByNullsLast(Object expr) {
OrderExpression<Object> e = new OrderExpression<Object>(query, expr, false, false, true);
OrderExpression<Object> e =
new OrderExpression<Object>(query, expr, false, false, true);
query.addOrderBy(e);
return this;
}
public QueryWhere<T> orderByDesc(Object expr) {
OrderExpression<Object> e = new OrderExpression<Object>(query, expr, true, false, false);
OrderExpression<Object> e =
new OrderExpression<Object>(query, expr, true, false, false);
query.addOrderBy(e);
return this;
}
public QueryWhere<T> orderByDescNullsFirst(Object expr) {
OrderExpression<Object> e = new OrderExpression<Object>(query, expr, true, true, false);
OrderExpression<Object> e =
new OrderExpression<Object>(query, expr, true, true, false);
query.addOrderBy(e);
return this;
}
public QueryWhere<T> orderByDescNullsLast(Object expr) {
OrderExpression<Object> e = new OrderExpression<Object>(query, expr, true, false, true);
OrderExpression<Object> e =
new OrderExpression<Object>(query, expr, true, false, true);
query.addOrderBy(e);
return this;
}
......
......@@ -230,7 +230,8 @@ class TableDefinition<T> {
}
}
void initSelectObject(SelectTable table, Object obj, Map<Object, SelectColumn> map) {
void initSelectObject(SelectTable table, Object obj,
Map<Object, SelectColumn> map) {
for (FieldDefinition def : fields) {
def.initWithNewObject(obj);
SelectColumn column = new SelectColumn(table, def);
......
......@@ -151,7 +151,8 @@ public class Utils {
return n.floatValue();
}
}
throw new RuntimeException("Can not convert the value " + o + " from " + currentType + " to " + targetType);
throw new RuntimeException("Can not convert the value " + o +
" from " + currentType + " to " + targetType);
}
//## Java 1.5 end ##
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论