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

--no commit message

--no commit message
上级 e9852b45
...@@ -38,19 +38,19 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch. ...@@ -38,19 +38,19 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
<h3>Version 1.0 / TODO (Build TODO)</h3><ul> <h3>Version 1.0 / TODO (Build TODO)</h3><ul>
<li>If SHUTDOWN IMMEDIATELY was called, then the connection was not closed and the database <li>If SHUTDOWN IMMEDIATELY was called, then the connection was not closed and the database
opened from somebody else at the same time, in some cases this could result in errors with LOB files. Fixed. opened from somebody else at the same time, in some cases this could result in errors with LOB files. Fixed.
</li><li>The new view implementation is now enabled by default. </li><li>The new view implementation is now enabled by default.
To use the old implementation, set the system property 'h2.indexOld' to true To use the old implementation, set the system property 'h2.indexOld' to true
(java -Dh2.indexOld=true ..., or in source code Constants.INDEX_OLD = true). (java -Dh2.indexOld=true ..., or in source code Constants.INDEX_OLD = true).
If no problems are found, the old implementation will be removed in the next release. If no problems are found, the old implementation will be removed in the next release.
The old implementation does not work with multi-level nested temporary views The old implementation does not work with multi-level nested temporary views
(select * from (select * from (select * from test))). (select * from (select * from (select * from test))).
</li><li>The new view implementation did not work with &lt; and &lt;= comparison. Fixed. </li><li>The new view implementation did not work with &lt; and &lt;= comparison. Fixed.
</li><li>Both view implementations did not work with multiple levels of nested temporary views (FROM (SELECT...)). Fixed. </li><li>Both view implementations did not work with multiple levels of nested temporary views (FROM (SELECT...)). Fixed.
</li><li>The H2 Console can now be run as a standalone web application, </li><li>The H2 Console can now be run as a standalone web application,
or it can be embedded as a servlet into any existing web application. To build the or it can be embedded as a servlet into any existing web application. To build the
'H2 Console' web application, execute 'ant warConsole'. 'H2 Console' web application, execute 'ant warConsole'.
See src/tools/org/h2/server/web and src/tools/WEB-INF for details. See src/tools/org/h2/server/web and src/tools/WEB-INF for details.
</li><li>Deleting database files didn't work for Windows if the database was on the root directory of a drive. </li><li>Deleting database files didn't work for Windows if the database was on the root directory of a drive.
</li><li>The Polish translation is available. Thanks a lot to Tomek! </li><li>The Polish translation is available. Thanks a lot to Tomek!
</li><li>Windows service: the CLASSPATH was not included when starting the service. Fixed. </li><li>Windows service: the CLASSPATH was not included when starting the service. Fixed.
...@@ -1096,6 +1096,7 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch. ...@@ -1096,6 +1096,7 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
</li><li>Support multiple directories (on different hard drives) for the same database </li><li>Support multiple directories (on different hard drives) for the same database
</li><li>Server protocol: use challenge response authentication, but client sends hash(user+password) encrypted with response </li><li>Server protocol: use challenge response authentication, but client sends hash(user+password) encrypted with response
</li><li>Support EXEC[UTE] (doesn't return a result set, compatible to MS SQL Server) </li><li>Support EXEC[UTE] (doesn't return a result set, compatible to MS SQL Server)
</li><li>GROUP BY and DISTINCT: support large groups (buffer to disk), do not keep large sets in memory
</li></ul> </li></ul>
<h3>Not Planned</h3> <h3>Not Planned</h3>
......
h2/src/docsrc/html/images/download.png

806 Bytes | W: | H:

h2/src/docsrc/html/images/download.png

745 Bytes | W: | H:

h2/src/docsrc/html/images/download.png
h2/src/docsrc/html/images/download.png
h2/src/docsrc/html/images/download.png
h2/src/docsrc/html/images/download.png
  • 2-up
  • Swipe
  • Onion skin
h2/src/docsrc/html/images/mail-support.png

768 Bytes | W: | H:

h2/src/docsrc/html/images/mail-support.png

756 Bytes | W: | H:

h2/src/docsrc/html/images/mail-support.png
h2/src/docsrc/html/images/mail-support.png
h2/src/docsrc/html/images/mail-support.png
h2/src/docsrc/html/images/mail-support.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -181,13 +181,6 @@ public class CommandRemote implements CommandInterface { ...@@ -181,13 +181,6 @@ public class CommandRemote implements CommandInterface {
} }
} }
// public void finalize() {
// if(!Constants.RUN_FINALIZE) {
// return;
// }
// close();
// }
public void cancel() { public void cancel() {
// TODO server: support cancel // TODO server: support cancel
} }
......
...@@ -283,11 +283,11 @@ public class ConstraintReferential extends Constraint { ...@@ -283,11 +283,11 @@ public class ConstraintReferential extends Constraint {
Cursor cursor = index.find(session, check, check); Cursor cursor = index.find(session, check, check);
while(cursor.next()) { while(cursor.next()) {
SearchRow found; SearchRow found;
if(Constants.INDEX_LOOKUP_NEW) { if(Constants.INDEX_LOOKUP_NEW) {
found = cursor.getSearchRow(); found = cursor.getSearchRow();
} else { } else {
found = cursor.get(); found = cursor.get();
} }
Column[] cols = index.getColumns(); Column[] cols = index.getColumns();
boolean allEqual = true; boolean allEqual = true;
for(int i=0; i<columns.length && i<cols.length; i++) { for(int i=0; i<columns.length && i<cols.length; i++) {
......
...@@ -41,8 +41,8 @@ public class ConnectionInfo { ...@@ -41,8 +41,8 @@ public class ConnectionInfo {
} }
// TODO document these settings // TODO document these settings
String[] connectionTime = new String[]{ String[] connectionTime = new String[]{
"ACCESS_MODE_LOG", "ACCESS_MODE_DATA", "AUTOCOMMIT", "ACCESS_MODE_LOG", "ACCESS_MODE_DATA", "AUTOCOMMIT",
"CIPHER", "CREATE", "CACHE_TYPE", "CIPHER", "CREATE", "CACHE_TYPE",
"DB_CLOSE_ON_EXIT", "FILE_LOCK", "IGNORE_UNKNOWN_SETTINGS", "IFEXISTS", "DB_CLOSE_ON_EXIT", "FILE_LOCK", "IGNORE_UNKNOWN_SETTINGS", "IFEXISTS",
"PASSWORD", "RECOVER", "STORAGE", "USER" "PASSWORD", "RECOVER", "STORAGE", "USER"
}; };
......
...@@ -67,8 +67,8 @@ package org.h2.engine; ...@@ -67,8 +67,8 @@ package org.h2.engine;
*/ */
public class Constants { public class Constants {
public static final int BUILD_ID = 50; public static final int BUILD_ID = 51;
private static final String BUILD = "2007-06-17"; private static final String BUILD = "2007-06-25";
public static final int VERSION_MAJOR = 1; public static final int VERSION_MAJOR = 1;
public static final int VERSION_MINOR = 0; public static final int VERSION_MINOR = 0;
...@@ -246,7 +246,8 @@ public class Constants { ...@@ -246,7 +246,8 @@ public class Constants {
public static int MAX_FILE_RETRY = Math.max(1, getIntSetting("h2.maxFileRetry", 16)); public static int MAX_FILE_RETRY = Math.max(1, getIntSetting("h2.maxFileRetry", 16));
public static boolean LOB_CLOSE_BETWEEN_READS = getBooleanSetting("h2.lobCloseBetweenReads", false); public static boolean LOB_CLOSE_BETWEEN_READS = getBooleanSetting("h2.lobCloseBetweenReads", false);
public static boolean INDEX_OLD = getBooleanSetting("h2.indexOld", false); public static boolean INDEX_OLD = getBooleanSetting("h2.indexOld", false);
public static final boolean INDEX_LOOKUP_NEW = getBooleanSetting("h2.indexLookupNew", true); public static final boolean INDEX_LOOKUP_NEW = getBooleanSetting("h2.indexLookupNew", true);
public static final boolean TRACE_IO = getBooleanSetting("h2.traceIO", false);
public static boolean getBooleanSetting(String name, boolean defaultValue) { public static boolean getBooleanSetting(String name, boolean defaultValue) {
String s = System.getProperty(name); String s = System.getProperty(name);
......
...@@ -838,20 +838,20 @@ public class Database implements DataHandler { ...@@ -838,20 +838,20 @@ public class Database implements DataHandler {
log = null; log = null;
} }
closeFiles(); closeFiles();
if (persistent && lock == null && fileLockMethod != FileLock.LOCK_NO) { if (persistent && lock == null && fileLockMethod != FileLock.LOCK_NO) {
// everything already closed (maybe in checkPowerOff) // everything already closed (maybe in checkPowerOff)
// don't delete temp files in this case because // don't delete temp files in this case because
// the database could be open now (even from within another process) // the database could be open now (even from within another process)
return; return;
} }
deleteOldTempFiles(); deleteOldTempFiles();
if(systemSession != null) { if(systemSession != null) {
systemSession.close(); systemSession.close();
systemSession = null; systemSession = null;
} }
if(lock != null) { if(lock != null) {
lock.unlock(); lock.unlock();
lock = null; lock = null;
} }
} }
......
...@@ -469,7 +469,7 @@ public class Session implements SessionInterface { ...@@ -469,7 +469,7 @@ public class Session implements SessionInterface {
} }
public String getNextTempViewName() { public String getNextTempViewName() {
return "TEMP_VIEW_" + tempViewIndex++; return "TEMP_VIEW_" + tempViewIndex++;
} }
} }
...@@ -683,9 +683,9 @@ public class Function extends Expression implements FunctionCall { ...@@ -683,9 +683,9 @@ public class Function extends Expression implements FunctionCall {
case DATEDIFF: case DATEDIFF:
return ValueLong.get(datediff(v0.getString(), v1.getTimestampNoCopy(), v2.getTimestampNoCopy())); return ValueLong.get(datediff(v0.getString(), v1.getTimestampNoCopy(), v2.getTimestampNoCopy()));
case DAYNAME: case DAYNAME:
synchronized(FORMAT_DAYNAME) { synchronized(FORMAT_DAYNAME) {
return ValueString.get(FORMAT_DAYNAME.format(v0.getDateNoCopy())); return ValueString.get(FORMAT_DAYNAME.format(v0.getDateNoCopy()));
} }
case DAYOFMONTH: case DAYOFMONTH:
return ValueInt.get(getDatePart(v0.getTimestampNoCopy(), Calendar.DAY_OF_MONTH)); return ValueInt.get(getDatePart(v0.getTimestampNoCopy(), Calendar.DAY_OF_MONTH));
case DAYOFWEEK: case DAYOFWEEK:
...@@ -699,9 +699,9 @@ public class Function extends Expression implements FunctionCall { ...@@ -699,9 +699,9 @@ public class Function extends Expression implements FunctionCall {
case MONTH: case MONTH:
return ValueInt.get(getDatePart(v0.getTimestampNoCopy(), Calendar.MONTH)); return ValueInt.get(getDatePart(v0.getTimestampNoCopy(), Calendar.MONTH));
case MONTHNAME: case MONTHNAME:
synchronized(FORMAT_MONTHNAME) { synchronized(FORMAT_MONTHNAME) {
return ValueString.get(FORMAT_MONTHNAME.format(v0.getDateNoCopy())); return ValueString.get(FORMAT_MONTHNAME.format(v0.getDateNoCopy()));
} }
case QUARTER: case QUARTER:
return ValueInt.get((getDatePart(v0.getTimestamp(), Calendar.MONTH) - 1) / 3 + 1); return ValueInt.get((getDatePart(v0.getTimestamp(), Calendar.MONTH) - 1) / 3 + 1);
case SECOND: case SECOND:
......
...@@ -49,19 +49,19 @@ public class BtreeCursor implements Cursor { ...@@ -49,19 +49,19 @@ public class BtreeCursor implements Cursor {
} }
void setCurrentRow(SearchRow searchRow) throws SQLException { void setCurrentRow(SearchRow searchRow) throws SQLException {
this.currentSearchRow = searchRow; this.currentSearchRow = searchRow;
currentRow = null; currentRow = null;
} }
public Row get() throws SQLException { public Row get() throws SQLException {
if(currentRow == null && currentSearchRow != null) { if(currentRow == null && currentSearchRow != null) {
currentRow = index.getRow(currentSearchRow.getPos()); currentRow = index.getRow(currentSearchRow.getPos());
} }
return currentRow; return currentRow;
} }
public SearchRow getSearchRow() throws SQLException { public SearchRow getSearchRow() throws SQLException {
return currentSearchRow; return currentSearchRow;
} }
public int getPos() { public int getPos() {
...@@ -76,8 +76,8 @@ public class BtreeCursor implements Cursor { ...@@ -76,8 +76,8 @@ public class BtreeCursor implements Cursor {
top.page.next(this, top.position); top.page.next(this, top.position);
if(currentSearchRow != null && last != null) { if(currentSearchRow != null && last != null) {
if (index.compareRows(currentSearchRow, last) > 0) { if (index.compareRows(currentSearchRow, last) > 0) {
currentSearchRow = null; currentSearchRow = null;
currentRow = null; currentRow = null;
} }
} }
return currentSearchRow != null; return currentSearchRow != null;
......
...@@ -24,9 +24,9 @@ public class FunctionCursor implements Cursor { ...@@ -24,9 +24,9 @@ public class FunctionCursor implements Cursor {
return row; return row;
} }
public SearchRow getSearchRow() throws SQLException { public SearchRow getSearchRow() throws SQLException {
return row; return row;
} }
public int getPos() { public int getPos() {
throw Message.getInternalError(); throw Message.getInternalError();
......
...@@ -24,9 +24,9 @@ public class HashCursor implements Cursor { ...@@ -24,9 +24,9 @@ public class HashCursor implements Cursor {
return row; return row;
} }
public SearchRow getSearchRow() throws SQLException { public SearchRow getSearchRow() throws SQLException {
return row; return row;
} }
public int getPos() { public int getPos() {
return row == null ? -1 : row.getPos(); return row == null ? -1 : row.getPos();
......
...@@ -24,9 +24,9 @@ public class LinearHashCursor implements Cursor { ...@@ -24,9 +24,9 @@ public class LinearHashCursor implements Cursor {
return row; return row;
} }
public SearchRow getSearchRow() throws SQLException { public SearchRow getSearchRow() throws SQLException {
return row; return row;
} }
public int getPos() { public int getPos() {
return row == null ? -1 : row.getPos(); return row == null ? -1 : row.getPos();
......
...@@ -37,9 +37,9 @@ public class LinkedCursor implements Cursor { ...@@ -37,9 +37,9 @@ public class LinkedCursor implements Cursor {
return current; return current;
} }
public SearchRow getSearchRow() throws SQLException { public SearchRow getSearchRow() throws SQLException {
return current; return current;
} }
public int getPos() { public int getPos() {
throw Message.getInternalError(); throw Message.getInternalError();
......
...@@ -30,9 +30,9 @@ public class MetaCursor implements Cursor { ...@@ -30,9 +30,9 @@ public class MetaCursor implements Cursor {
return current; return current;
} }
public SearchRow getSearchRow() throws SQLException { public SearchRow getSearchRow() throws SQLException {
return current; return current;
} }
public int getPos() { public int getPos() {
throw Message.getInternalError(); throw Message.getInternalError();
......
...@@ -29,9 +29,9 @@ public class RangeCursor implements Cursor { ...@@ -29,9 +29,9 @@ public class RangeCursor implements Cursor {
return currentRow; return currentRow;
} }
public SearchRow getSearchRow() throws SQLException { public SearchRow getSearchRow() throws SQLException {
return currentRow; return currentRow;
} }
public int getPos() { public int getPos() {
throw Message.getInternalError(); throw Message.getInternalError();
......
...@@ -138,11 +138,11 @@ public class ViewIndex extends Index { ...@@ -138,11 +138,11 @@ public class ViewIndex extends Index {
} }
int len; int len;
if(first != null) { if(first != null) {
len = first.getColumnCount(); len = first.getColumnCount();
} else if(last != null) { } else if(last != null) {
len = last.getColumnCount(); len = last.getColumnCount();
} else { } else {
len = 0; len = 0;
} }
for(int i=0; i < len; i++) { for(int i=0; i < len; i++) {
if(first != null) { if(first != null) {
......
...@@ -139,7 +139,6 @@ Serializable, Referenceable { ...@@ -139,7 +139,6 @@ Serializable, Referenceable {
this.user = user; this.user = user;
} }
public Reference getReference() throws NamingException { public Reference getReference() throws NamingException {
debugCodeCall("getReference"); debugCodeCall("getReference");
String factoryClassName = JdbcDataSourceFactory.class.getName(); String factoryClassName = JdbcDataSourceFactory.class.getName();
......
...@@ -114,9 +114,9 @@ public class TraceSystem { ...@@ -114,9 +114,9 @@ public class TraceSystem {
} }
private String format(String module, String s) { private String format(String module, String s) {
synchronized(dateFormat) { synchronized(dateFormat) {
return dateFormat.format(new Date()) + module + ": " + s; return dateFormat.format(new Date()) + module + ": " + s;
} }
} }
void write(int l, String module, String s, Throwable t) { void write(int l, String module, String s, Throwable t) {
......
...@@ -192,13 +192,6 @@ public class ResultRemote implements ResultInterface { ...@@ -192,13 +192,6 @@ public class ResultRemote implements ResultInterface {
} }
} }
// public void finalize() {
// if(!Constants.RUN_FINALIZE) {
// return;
// }
// close();
// }
private Value[] fetchRow(boolean sendFetch) throws SQLException { private Value[] fetchRow(boolean sendFetch) throws SQLException {
synchronized (session) { synchronized (session) {
session.checkClosed(); session.checkClosed();
......
...@@ -24,14 +24,14 @@ public class SimpleRowValue implements SearchRow { ...@@ -24,14 +24,14 @@ public class SimpleRowValue implements SearchRow {
return pos; return pos;
} }
public Value getValue(int idx) { public Value getValue(int idx) {
return idx == index ? data : null; return idx == index ? data : null;
} }
public void setPos(int pos) { public void setPos(int pos) {
this.pos = pos; this.pos = pos;
} }
public void setValue(int idx, Value v) { public void setValue(int idx, Value v) {
index = idx; index = idx;
data = v; data = v;
} }
......
...@@ -100,13 +100,13 @@ public class FtpServer implements Service { ...@@ -100,13 +100,13 @@ public class FtpServer implements Service {
Date now = new Date(), mod = new Date(f.lastModified()); Date now = new Date(), mod = new Date(f.lastModified());
String date; String date;
if(mod.after(now) || Math.abs((now.getTime() - mod.getTime())/1000/60/60/24) > 180) { if(mod.after(now) || Math.abs((now.getTime() - mod.getTime())/1000/60/60/24) > 180) {
synchronized(dateFormatOld) { synchronized(dateFormatOld) {
date = dateFormatOld.format(mod); date = dateFormatOld.format(mod);
} }
} else { } else {
synchronized(dateFormatNew) { synchronized(dateFormatNew) {
date = dateFormatNew.format(mod); date = dateFormatNew.format(mod);
} }
} }
buff.append(date); buff.append(date);
buff.append(' '); buff.append(' ');
...@@ -115,9 +115,9 @@ public class FtpServer implements Service { ...@@ -115,9 +115,9 @@ public class FtpServer implements Service {
} }
String formatLastModified(FileObject file) { String formatLastModified(FileObject file) {
synchronized(dateFormat) { synchronized(dateFormat) {
return dateFormat.format(new Date(file.lastModified())); return dateFormat.format(new Date(file.lastModified()));
} }
} }
FileObject getFile(String path) { FileObject getFile(String path) {
......
...@@ -182,10 +182,10 @@ public class WebServer implements Service { ...@@ -182,10 +182,10 @@ public class WebServer implements Service {
// TraceSystem.traceThrowable(e); // TraceSystem.traceThrowable(e);
// } // }
// } // }
SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss z", new Locale("en", "")); SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss z", new Locale("en", ""));
synchronized(format) { synchronized(format) {
format.setTimeZone(TimeZone.getTimeZone("GMT")); format.setTimeZone(TimeZone.getTimeZone("GMT"));
startDateTime = format.format(new Date()); startDateTime = format.format(new Date());
} }
trace(startDateTime); trace(startDateTime);
for(int i=0; i<LANGUAGES.length; i++) { for(int i=0; i<LANGUAGES.length; i++) {
...@@ -278,7 +278,7 @@ public class WebServer implements Service { ...@@ -278,7 +278,7 @@ public class WebServer implements Service {
} }
public boolean getAllowOthers() { public boolean getAllowOthers() {
return allowOthers; return allowOthers;
} }
void setSSL(boolean b) { void setSSL(boolean b) {
...@@ -415,12 +415,12 @@ public class WebServer implements Service { ...@@ -415,12 +415,12 @@ public class WebServer implements Service {
return JdbcUtils.getConnection(driver, url, user, password); return JdbcUtils.getConnection(driver, url, user, password);
} }
public void setAllowShutdown(boolean b) { public void setAllowShutdown(boolean b) {
this.allowShutdown = b; this.allowShutdown = b;
} }
boolean getAllowShutdown() { boolean getAllowShutdown() {
return allowShutdown; return allowShutdown;
} }
} }
...@@ -121,7 +121,7 @@ public class WebSession { ...@@ -121,7 +121,7 @@ public class WebSession {
} }
public HashMap getMainInfo() { public HashMap getMainInfo() {
int todoRefactorMergeWithGetInfo; int todoRefactorMergeWithGetInfo;
HashMap m = new HashMap(); HashMap m = new HashMap();
m.putAll(map); m.putAll(map);
m.put("lastAccess", new Timestamp(lastAccess).toString()); m.put("lastAccess", new Timestamp(lastAccess).toString());
......
...@@ -53,16 +53,16 @@ class WebThread extends Thread { ...@@ -53,16 +53,16 @@ class WebThread extends Thread {
// TODO web: support online data editing like http://numsum.com/ // TODO web: support online data editing like http://numsum.com/
WebThread(Socket socket, WebServer server) { WebThread(Socket socket, WebServer server) {
this.server = server; this.server = server;
this.socket = socket; this.socket = socket;
setName("H2 Console thread"); setName("H2 Console thread");
} }
void setSession(WebSession session, Properties attributes) { void setSession(WebSession session, Properties attributes) {
int todoRefactor; int todoRefactor;
this.session = session; this.session = session;
this.attributes = attributes; this.attributes = attributes;
} }
protected String getComboBox(String[] elements, String selected) { protected String getComboBox(String[] elements, String selected) {
...@@ -146,7 +146,7 @@ class WebThread extends Thread { ...@@ -146,7 +146,7 @@ class WebThread extends Thread {
cache=false; cache=false;
mimeType = "text/html"; mimeType = "text/html";
if (session == null) { if (session == null) {
String hostname = socket.getInetAddress().getHostName(); String hostname = socket.getInetAddress().getHostName();
session = server.createNewSession(hostname); session = server.createNewSession(hostname);
if (!file.equals("notAllowed.jsp")) { if (!file.equals("notAllowed.jsp")) {
file = "index.do"; file = "index.do";
...@@ -463,9 +463,9 @@ class WebThread extends Thread { ...@@ -463,9 +463,9 @@ class WebThread extends Thread {
} }
private String adminShutdown() { private String adminShutdown() {
if(server.getAllowShutdown()) { if(server.getAllowShutdown()) {
System.exit(0); System.exit(0);
} }
return "admin.jsp"; return "admin.jsp";
} }
......
...@@ -137,6 +137,7 @@ public class FileStore { ...@@ -137,6 +137,7 @@ public class FileStore {
public void close() throws IOException { public void close() throws IOException {
if(file != null) { if(file != null) {
try { try {
trace("close", name, file);
file.close(); file.close();
} finally { } finally {
file = null; file = null;
...@@ -145,12 +146,10 @@ public class FileStore { ...@@ -145,12 +146,10 @@ public class FileStore {
} }
public void closeSilently() { public void closeSilently() {
if(file != null) { try {
try { close();
file.close(); } catch(IOException e) {
} catch(IOException e) { // ignore
file = null;
}
} }
} }
...@@ -307,6 +306,7 @@ public class FileStore { ...@@ -307,6 +306,7 @@ public class FileStore {
public void sync() { public void sync() {
try { try {
file.getFD().sync(); file.getFD().sync();
} catch(IOException e) { } catch(IOException e) {
// TODO log exception // TODO log exception
...@@ -337,5 +337,11 @@ public class FileStore { ...@@ -337,5 +337,11 @@ public class FileStore {
file.seek(filePos); file.seek(filePos);
} }
} }
private static void trace(String method, String fileName, Object o) {
if(Constants.TRACE_IO) {
System.out.println("FileStore." + method + " " + fileName + " " + o);
}
}
} }
...@@ -299,12 +299,12 @@ public abstract class Table extends SchemaObject { ...@@ -299,12 +299,12 @@ public abstract class Table extends SchemaObject {
} }
private void remove(ObjectArray list, DbObject obj) { private void remove(ObjectArray list, DbObject obj) {
if(list != null) { if(list != null) {
int i = list.indexOf(obj); int i = list.indexOf(obj);
if(i>=0) { if(i>=0) {
list.remove(i); list.remove(i);
} }
} }
} }
public void removeIndex(Index index) { public void removeIndex(Index index) {
......
...@@ -245,7 +245,7 @@ public class TableFilter implements ColumnResolver { ...@@ -245,7 +245,7 @@ public class TableFilter implements ColumnResolver {
} else { } else {
scanCount++; scanCount++;
if(cursor.next()) { if(cursor.next()) {
currentSearchRow = cursor.getSearchRow(); currentSearchRow = cursor.getSearchRow();
current = null; current = null;
// cursor.get(); // cursor.get();
state = FOUND; state = FOUND;
...@@ -301,9 +301,9 @@ public class TableFilter implements ColumnResolver { ...@@ -301,9 +301,9 @@ public class TableFilter implements ColumnResolver {
} }
public Row get() throws SQLException { public Row get() throws SQLException {
if(current == null && currentSearchRow != null) { if(current == null && currentSearchRow != null) {
current = cursor.get(); current = cursor.get();
} }
return current; return current;
} }
...@@ -515,29 +515,29 @@ public class TableFilter implements ColumnResolver { ...@@ -515,29 +515,29 @@ public class TableFilter implements ColumnResolver {
} }
public Value getValue(Column column) throws SQLException { public Value getValue(Column column) throws SQLException {
if(Constants.INDEX_LOOKUP_NEW) { if(Constants.INDEX_LOOKUP_NEW) {
if(currentSearchRow == null) { if(currentSearchRow == null) {
return null; return null;
} }
int columnId = column.getColumnId(); int columnId = column.getColumnId();
if(current == null) { if(current == null) {
Value v = currentSearchRow.getValue(columnId); Value v = currentSearchRow.getValue(columnId);
if(v != null) { if(v != null) {
return v; return v;
} }
current = cursor.get(); current = cursor.get();
} }
return current.getValue(columnId); return current.getValue(columnId);
} else { } else {
if(currentSearchRow == null) { if(currentSearchRow == null) {
return null; return null;
} }
if(current == null) { if(current == null) {
current = cursor.get(); current = cursor.get();
} }
int columnId = column.getColumnId(); int columnId = column.getColumnId();
return current.getValue(columnId); return current.getValue(columnId);
} }
} }
public TableFilter getTableFilter() { public TableFilter getTableFilter() {
......
...@@ -58,47 +58,47 @@ public class Console implements ActionListener, MouseListener { ...@@ -58,47 +58,47 @@ public class Console implements ActionListener, MouseListener {
web = Server.createWebServer(args); web = Server.createWebServer(args);
web.start(); web.start();
} catch (SQLException e) { } catch (SQLException e) {
if(web == null) { if(web == null) {
e.printStackTrace(); e.printStackTrace();
} else { } else {
System.out.println(web.getStatus()); System.out.println(web.getStatus());
} }
} }
Server tcp = null, odbc = null; Server tcp = null, odbc = null;
try { try {
tcp = Server.createTcpServer(args); tcp = Server.createTcpServer(args);
tcp.start(); tcp.start();
} catch(SQLException e) { } catch(SQLException e) {
if(tcp == null) { if(tcp == null) {
e.printStackTrace(); e.printStackTrace();
} else { } else {
System.out.println(tcp.getStatus()); System.out.println(tcp.getStatus());
} }
} }
try { try {
odbc = Server.createOdbcServer(args); odbc = Server.createOdbcServer(args);
odbc.start(); odbc.start();
} catch(SQLException e) { } catch(SQLException e) {
if(odbc == null) { if(odbc == null) {
e.printStackTrace(); e.printStackTrace();
} else { } else {
System.out.println(odbc.getStatus()); System.out.println(odbc.getStatus());
} }
} }
if(!GraphicsEnvironment.isHeadless()) { if(!GraphicsEnvironment.isHeadless()) {
font = new Font("Dialog", Font.PLAIN, 11); font = new Font("Dialog", Font.PLAIN, 11);
try { try {
InputStream in = getClass().getResourceAsStream("/org/h2/res/h2.png"); InputStream in = getClass().getResourceAsStream("/org/h2/res/h2.png");
if(in != null) { if(in != null) {
byte[] imageData = IOUtils.readBytesAndClose(in, -1); byte[] imageData = IOUtils.readBytesAndClose(in, -1);
icon = Toolkit.getDefaultToolkit().createImage(imageData); icon = Toolkit.getDefaultToolkit().createImage(imageData);
} }
if(!createTrayIcon()) { if(!createTrayIcon()) {
showWindow(true); showWindow(true);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
// start browser anyway (even if the server is already running) // start browser anyway (even if the server is already running)
// because some people don't look at the output, // because some people don't look at the output,
...@@ -167,11 +167,11 @@ public class Console implements ActionListener, MouseListener { ...@@ -167,11 +167,11 @@ public class Console implements ActionListener, MouseListener {
final Frame frame = new Frame("H2 Console"); final Frame frame = new Frame("H2 Console");
frame.addWindowListener(new WindowAdapter() { frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) { public void windowClosing(WindowEvent we) {
if(exit) { if(exit) {
System.exit(0); System.exit(0);
} else { } else {
frame.dispose(); frame.dispose();
} }
} }
}); });
if(icon != null) { if(icon != null) {
...@@ -230,7 +230,7 @@ public class Console implements ActionListener, MouseListener { ...@@ -230,7 +230,7 @@ public class Console implements ActionListener, MouseListener {
* INTERNAL * INTERNAL
*/ */
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand(); String command = e.getActionCommand();
if ("exit".equals(command)) { if ("exit".equals(command)) {
System.exit(0); System.exit(0);
} else if ("console".equals(command)) { } else if ("console".equals(command)) {
......
...@@ -36,7 +36,9 @@ public class FileUtils { ...@@ -36,7 +36,9 @@ public class FileUtils {
public static RandomAccessFile openRandomAccessFile(String fileName, String mode) throws IOException { public static RandomAccessFile openRandomAccessFile(String fileName, String mode) throws IOException {
fileName = translateFileName(fileName); fileName = translateFileName(fileName);
try { try {
return new RandomAccessFile(fileName, mode); RandomAccessFile file = new RandomAccessFile(fileName, mode);
trace("openRandomAccessFile", fileName, file);
return file;
} catch(IOException e) { } catch(IOException e) {
freeMemoryAndFinalize(); freeMemoryAndFinalize();
return new RandomAccessFile(fileName, mode); return new RandomAccessFile(fileName, mode);
...@@ -45,6 +47,7 @@ public class FileUtils { ...@@ -45,6 +47,7 @@ public class FileUtils {
public static void setLength(RandomAccessFile file, long newLength) throws IOException { public static void setLength(RandomAccessFile file, long newLength) throws IOException {
try { try {
trace("setLength", null, file);
file.setLength(newLength); file.setLength(newLength);
} catch(IOException e) { } catch(IOException e) {
long length = file.length(); long length = file.length();
...@@ -88,7 +91,9 @@ public class FileUtils { ...@@ -88,7 +91,9 @@ public class FileUtils {
public static FileInputStream openFileInputStream(String fileName) throws IOException { public static FileInputStream openFileInputStream(String fileName) throws IOException {
fileName = translateFileName(fileName); fileName = translateFileName(fileName);
return new FileInputStream(fileName); FileInputStream in = new FileInputStream(fileName);
trace("openFileInputStream", fileName, in);
return in;
} }
public static FileOutputStream openFileOutputStream(String fileName) throws IOException, SQLException { public static FileOutputStream openFileOutputStream(String fileName) throws IOException, SQLException {
...@@ -96,7 +101,9 @@ public class FileUtils { ...@@ -96,7 +101,9 @@ public class FileUtils {
try { try {
File file = new File(fileName); File file = new File(fileName);
FileUtils.createDirs(file.getAbsolutePath()); FileUtils.createDirs(file.getAbsolutePath());
return new FileOutputStream(fileName); FileOutputStream out = new FileOutputStream(fileName);
trace("openFileOutputStream", fileName, out);
return out;
} catch(IOException e) { } catch(IOException e) {
freeMemoryAndFinalize(); freeMemoryAndFinalize();
return new FileOutputStream(fileName); return new FileOutputStream(fileName);
...@@ -104,6 +111,7 @@ public class FileUtils { ...@@ -104,6 +111,7 @@ public class FileUtils {
} }
private static void freeMemoryAndFinalize() { private static void freeMemoryAndFinalize() {
trace("freeMemoryAndFinalize", null, null);
Runtime rt = Runtime.getRuntime(); Runtime rt = Runtime.getRuntime();
long mem = rt.freeMemory(); long mem = rt.freeMemory();
for(int i=0; i<16; i++) { for(int i=0; i<16; i++) {
...@@ -138,6 +146,7 @@ public class FileUtils { ...@@ -138,6 +146,7 @@ public class FileUtils {
throw Message.getSQLException(Message.FILE_RENAME_FAILED_2, new String[]{oldName, newName + " (exists)"}, null); throw Message.getSQLException(Message.FILE_RENAME_FAILED_2, new String[]{oldName, newName + " (exists)"}, null);
} }
for(int i=0; i<Constants.MAX_FILE_RETRY; i++) { for(int i=0; i<Constants.MAX_FILE_RETRY; i++) {
trace("rename", oldName + " >" + newName, null);
boolean ok = oldFile.renameTo(newFile); boolean ok = oldFile.renameTo(newFile);
if(ok) { if(ok) {
return; return;
...@@ -232,6 +241,7 @@ public class FileUtils { ...@@ -232,6 +241,7 @@ public class FileUtils {
File file = new File(fileName); File file = new File(fileName);
if(file.exists()) { if(file.exists()) {
for(int i=0; i<Constants.MAX_FILE_RETRY; i++) { for(int i=0; i<Constants.MAX_FILE_RETRY; i++) {
trace("delete", fileName, null);
boolean ok = file.delete(); boolean ok = file.delete();
if(ok) { if(ok) {
return; return;
...@@ -295,6 +305,7 @@ public class FileUtils { ...@@ -295,6 +305,7 @@ public class FileUtils {
memoryFiles.remove(fileName); memoryFiles.remove(fileName);
return; return;
} }
trace("tryDelete", fileName, null);
new File(fileName).delete(); new File(fileName).delete();
} }
...@@ -392,7 +403,7 @@ public class FileUtils { ...@@ -392,7 +403,7 @@ public class FileUtils {
} }
String base = f.getCanonicalPath(); String base = f.getCanonicalPath();
if(!base.endsWith(File.separator)) { if(!base.endsWith(File.separator)) {
base += File.separator; base += File.separator;
} }
for(int i=0; i<list.length; i++) { for(int i=0; i<list.length; i++) {
list[i] = base + list[i]; list[i] = base + list[i];
...@@ -482,4 +493,10 @@ public class FileUtils { ...@@ -482,4 +493,10 @@ public class FileUtils {
return new File(fileName).canWrite(); return new File(fileName).canWrite();
} }
private static void trace(String method, String fileName, Object o) {
if(Constants.TRACE_IO) {
System.out.println("FileUtils." + method + " " + fileName + " " + o);
}
}
} }
...@@ -27,6 +27,7 @@ public class IOUtils { ...@@ -27,6 +27,7 @@ public class IOUtils {
public static void closeSilently(OutputStream out) { public static void closeSilently(OutputStream out) {
if(out != null) { if(out != null) {
try { try {
trace("closeSilently", null, out);
out.close(); out.close();
} catch(IOException e) { } catch(IOException e) {
// ignore // ignore
...@@ -97,6 +98,7 @@ public class IOUtils { ...@@ -97,6 +98,7 @@ public class IOUtils {
public static void closeSilently(InputStream in) { public static void closeSilently(InputStream in) {
if(in != null) { if(in != null) {
try { try {
trace("closeSilently", null, in);
in.close(); in.close();
} catch(IOException e) { } catch(IOException e) {
// ignore // ignore
...@@ -240,5 +242,11 @@ public class IOUtils { ...@@ -240,5 +242,11 @@ public class IOUtils {
throw Message.convert(e); throw Message.convert(e);
} }
} }
private static void trace(String method, String fileName, Object o) {
if(Constants.TRACE_IO) {
System.out.println("IOUtils." + method + " " + fileName + " " + o);
}
}
} }
...@@ -365,7 +365,7 @@ public class StringUtils { ...@@ -365,7 +365,7 @@ public class StringUtils {
public static String formatDateTime(Date date, String format, String locale, String timezone) throws SQLException { public static String formatDateTime(Date date, String format, String locale, String timezone) throws SQLException {
SimpleDateFormat dateFormat = getDateFormat(format, locale, timezone); SimpleDateFormat dateFormat = getDateFormat(format, locale, timezone);
synchronized(dateFormat) { synchronized(dateFormat) {
return dateFormat.format(date); return dateFormat.format(date);
} }
} }
...@@ -376,7 +376,7 @@ public class StringUtils { ...@@ -376,7 +376,7 @@ public class StringUtils {
SimpleDateFormat dateFormat = getDateFormat(format, locale, timezone); SimpleDateFormat dateFormat = getDateFormat(format, locale, timezone);
try { try {
synchronized(dateFormat) { synchronized(dateFormat) {
return dateFormat.parse(date); return dateFormat.parse(date);
} }
} catch(ParseException e) { } catch(ParseException e) {
throw Message.getSQLException(Message.PARSE_ERROR_1, date); throw Message.getSQLException(Message.PARSE_ERROR_1, date);
...@@ -385,8 +385,8 @@ public class StringUtils { ...@@ -385,8 +385,8 @@ public class StringUtils {
private static SimpleDateFormat getDateFormat(String format, String locale, String timezone) throws SQLException { private static SimpleDateFormat getDateFormat(String format, String locale, String timezone) throws SQLException {
try { try {
// currently, a new instance is create for each call // currently, a new instance is create for each call
// however, could cache the last few instances // however, could cache the last few instances
SimpleDateFormat df; SimpleDateFormat df;
if(locale == null) { if(locale == null) {
df = new SimpleDateFormat(format); df = new SimpleDateFormat(format);
......
...@@ -93,11 +93,42 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2 ...@@ -93,11 +93,42 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
test.printSystem(); test.printSystem();
/* /*
runscript from 'C:\download\backup.sql';
alter table download_link add html_ltarget_ord INTEGER(10) default 0;
alter table navigation_link add html_ltarget_ord INTEGER(10) default 0;
alter table web_link add html_ltarget_ord INTEGER(10) default 0;
ALTER TABLE navigation_page_content DROP COLUMN parent_type_id;
ALTER TABLE entity_info DROP COLUMN parent_type_id;
ALTER TABLE navigation_point_content DROP COLUMN parent_type_id;
ALTER TABLE paragraph_proxy DROP COLUMN parent_type_id;
ALTER TABLE patch DROP COLUMN parent_type_id;
ALTER TABLE page_content DROP COLUMN parent_type_id;
ALTER TABLE image_gallery_image_usage_ref DROP COLUMN ref_image_gallery;
ALTER TABLE navigation_page_content_reference DROP COLUMN ref_element_provider;
ALTER TABLE paragraph_proxy DROP COLUMN ref_page_content;
alter table navigation_page_content_reference add contained BOOLEAN(1) default false;
update navigation_page_content_reference set contained=true where state=7;
alter table navigation_page_content add contained BOOLEAN(1) default false;
update navigation_page_content set contained=true where state=7;
alter table navigation_point_content add contained BOOLEAN(1) default false;
update navigation_point_content set contained=true where state=7;
alter table weblica_link add contained BOOLEAN(1) default false;
update weblica_link set contained=true where state=7;
alter table image_usage add contained BOOLEAN(1) default false;
update image_usage set contained=true where state=7;
alter table paragraph_proxy add contained BOOLEAN(1) default false;
make sure INDEX_LOOKUP_NEW = is true by default. make sure INDEX_LOOKUP_NEW = is true by default.
Test Console (batch, javaw, different platforms) Test Console (batch, javaw, different platforms)
backup.sql / lob file problem
Change documentation and default database for H2 Console: jdbc:h2:~/test Change documentation and default database for H2 Console: jdbc:h2:~/test
testHalt testHalt
...@@ -158,9 +189,7 @@ support translated exceptions (english + translated) ...@@ -158,9 +189,7 @@ support translated exceptions (english + translated)
select * from H2.PUBLIC.ORDERS select * from H2.PUBLIC.ORDERS
Wre es nicht besser, unabhngig von DB_CLOSE_DELAY eine Datenbank offen keep db open (independent of DB_CLOSE_DELAY) while a PooledConnections exists.
zu halten, solange dafr offene PooledConnections vorhanden sind?
*/ */
......
...@@ -38,11 +38,11 @@ Initial Developer: H2 Group ...@@ -38,11 +38,11 @@ Initial Developer: H2 Group
<!-- <!--
<security-constraint> <security-constraint>
<web-resource-collection> <web-resource-collection>
<web-resource-name>H2 Console</web-resource-name> <web-resource-name>H2 Console</web-resource-name>
<url-pattern>/console/*</url-pattern> <url-pattern>/console/*</url-pattern>
</web-resource-collection> </web-resource-collection>
<auth-constraint> <auth-constraint>
<role-name>admin</role-name> <role-name>admin</role-name>
</auth-constraint> </auth-constraint>
</security-constraint> </security-constraint>
......
...@@ -459,6 +459,8 @@ netscape mywebpage javaplayer fuse davidlbarron helps player appfuse awt ...@@ -459,6 +459,8 @@ netscape mywebpage javaplayer fuse davidlbarron helps player appfuse awt
gridwidth editable pressed entered awt east toolkit insets exited grid mouse west resizable popup focusable bag anchor gridwidth editable pressed entered awt east toolkit insets exited grid mouse west resizable popup focusable bag anchor
headless headless
polish javaee resp xsi instances tomek realm xsd appended auth polski polish javaee resp xsi instances tomek realm xsd appended auth polski
signsoft intellibo jdo intelli middleware ute war sends snippet
gallery ord javaw weblica ltarget
### check those again: ### check those again:
populate slowly xacon inser maxbqualsize counter regards attaching official xatest populate slowly xacon inser maxbqualsize counter regards attaching official xatest
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论