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

--no commit message

--no commit message
上级 a67837cb
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -222,6 +222,7 @@ class PageBtreeLeaf extends PageBtree {
}
void remapChildren() {
// nothing to do
}
/**
......
......@@ -46,12 +46,12 @@ public class PageDataLeafOverflow extends Record {
/**
* The previous page (overflow or leaf).
*/
private final int previous;
private final int previousPage;
/**
* The next overflow page, or 0.
*/
private final int next;
private final int nextPage;
/**
* The number of content bytes.
......@@ -70,8 +70,8 @@ public class PageDataLeafOverflow extends Record {
this.leaf = leaf;
setPos(pageId);
this.type = type;
this.previous = previous;
this.next = next;
this.previousPage = previous;
this.nextPage = next;
this.offset = offset;
this.size = size;
}
......@@ -81,14 +81,14 @@ public class PageDataLeafOverflow extends Record {
setPos(pageId);
this.data = data;
this.offset = offset;
previous = data.readInt();
previousPage = data.readInt();
type = data.readByte();
if (type == (Page.TYPE_DATA_OVERFLOW | Page.FLAG_LAST)) {
size = data.readShortInt();
next = 0;
nextPage = 0;
} else if (type == Page.TYPE_DATA_OVERFLOW) {
size = leaf.getPageStore().getPageSize() - START_MORE;
next = data.readInt();
nextPage = data.readInt();
} else {
throw Message.getSQLException(ErrorCode.FILE_CORRUPTED_1, "page:" + getPos() + " type:" + type);
}
......@@ -106,7 +106,7 @@ public class PageDataLeafOverflow extends Record {
return 0;
}
target.write(data.getBytes(), START_MORE, size);
return next;
return nextPage;
}
public int getByteCount(DataPage dummy) {
......@@ -117,10 +117,10 @@ public class PageDataLeafOverflow extends Record {
PageStore store = leaf.getPageStore();
DataPage overflow = store.createDataPage();
DataPage data = leaf.getDataPage();
overflow.writeInt(previous);
overflow.writeInt(previousPage);
overflow.writeByte((byte) type);
if (type == Page.TYPE_DATA_OVERFLOW) {
overflow.writeInt(next);
overflow.writeInt(nextPage);
} else {
overflow.writeShortInt(size);
}
......@@ -129,7 +129,7 @@ public class PageDataLeafOverflow extends Record {
}
public String toString() {
return "page[" + getPos() + "] data leaf overflow prev:" + previous + " next:" + next;
return "page[" + getPos() + "] data leaf overflow prev:" + previousPage + " next:" + nextPage;
}
/**
......
......@@ -22,7 +22,6 @@ import java.sql.Statement;
import java.util.Map;
import java.util.Properties;
import org.h2.command.CommandInterface;
import org.h2.constant.ErrorCode;
import org.h2.constant.SysProperties;
......
org.h2.tools.Backup=Creates a backup of a database.
org.h2.tools.Backup.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-file <filename>] The target file name (default\: backup.zip)\n[-dir <dir>] The source directory (default\: .)\n[-db <database>] Source database; not required if there is only one\n[-quiet] Do not print progress information
org.h2.tools.ChangeFileEncryption=Allows changing the database file encryption password or algorithm.\nThis tool can not be used to change a password of a user.
org.h2.tools.ChangeFileEncryption.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-cipher type] The encryption type (AES or XTEA)\n[-dir <dir>] The database directory (default\: .)\n[-db <database>] Database name (all databases if not set)\n[-decrypt <pwd>] The decryption password (if not set\: not yet encrypted)\n[-encrypt <pwd>] The encryption password (if not set\: do not encrypt)\n[-quiet] Do not print progress information
org.h2.tools.Console=Starts the H2 Console (web-) server, as well as the TCP and PG server.
org.h2.tools.Console.main=When running without options, -tcp, -web, -browser and -pg are started.\nOptions are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-web] Start the web server with the H2 Console\n[-tool] Start the icon or window that allows to start a browser\n[-browser] Start a browser and open a page to connect to the web server\n[-tcp] Start the TCP server\n[-pg] Start the PG server\nFor each Server, additional options are available;\n for details, see the Server tool.\nIf a service can not be started, the program\n terminates with an exit code of 1.
org.h2.tools.ConvertTraceFile=Converts a .trace.db file to a SQL script and Java source code.\nSQL statement statistics are listed as well.
org.h2.tools.ConvertTraceFile.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-traceFile <file>] The trace file name (default\: test.trace.db)\n[-script <file>] The script file name (default\: test.sql)\n[-javaClass <file>] The Java directory and class file name (default\: Test)
org.h2.tools.CreateCluster=Creates a cluster from a standalone database.\nCopies a database to another location if required.
org.h2.tools.CreateCluster.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-urlSource <url>] The database URL of the source database (jdbc\:h2\:...)\n[-urlTarget <url>] The database URL of the target database (jdbc\:h2\:...)\n[-user <user>] The user name (default\: sa)\n[-password <pwd>] The password\n[-serverList <list>] The comma separated list of host names or IP addresses
org.h2.tools.DeleteDbFiles=Deletes all files belonging to a database.\nThe database must be closed before calling this tool.
org.h2.tools.DeleteDbFiles.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-dir <dir>] The directory (default\: .)\n[-db <database>] The database name\n[-quiet] Do not print progress information
org.h2.tools.Recover=Helps recovering a corrupted database.
org.h2.tools.Recover.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-dir <dir>] The directory (default\: .)\n[-db <database>] The database name (all databases if not set)\n[-trace] Print additional trace information
org.h2.tools.Restore=Restores a H2 database by extracting the database files from a .zip file.
org.h2.tools.Restore.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-file <filename>] The source file name (default\: backup.zip)\n[-dir <dir>] The target directory (default\: .)\n[-db <database>] The target database name (as stored if not set)\n[-quiet] Do not print progress information
org.h2.tools.RunScript=Runs a SQL script against a database.
org.h2.tools.RunScript.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-url <url>] The database URL (jdbc\:...)\n[-user <user>] The user name (default\: sa)\n[-password <pwd>] The password\n[-script <file>] The script file to run (default\: backup.sql)\n[-driver <class>] The JDBC driver class to use (not required in most cases)\n[-showResults] Show the statements and the results of queries\n[-checkResults] Check if the query results match the expected results\n[-options ...] RUNSCRIPT options (embedded H2; -*Results not supported)
org.h2.tools.Script=Creates a SQL script file by extracting the schema and data of a database.
org.h2.tools.Script.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-url <url>] The database URL (jdbc\:...)\n[-user <user>] The user name (default\: sa)\n[-password <pwd>] The password\n[-script <file>] The target script file name (default\: backup.sql)\n[-options ...] A list of options (only for embedded H2, see RUNSCRIPT)\n[-quiet] Do not print progress information
org.h2.tools.Server=Starts the H2 Console (web-) server, TCP, and PG server.
org.h2.tools.Server.main=When running without options, -tcp, -web, -browser and -pg are started.\nOptions are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-web] Start the web server with the H2 Console\n[-webAllowOthers] Allow other computers to connect\n[-webPort <port>] The port (default\: 8082)\n[-webSSL] Use encrypted (HTTPS) connections\n[-browser] Start a browser and open a page to connect to the web server\n[-tcp] Start the TCP server\n[-tcpAllowOthers] Allow other computers to connect\n[-tcpPort <port>] The port (default\: 9092)\n[-tcpSSL] Use encrypted (SSL) connections\n[-tcpPassword <pwd>] The password for shutting down a TCP server\n[-tcpShutdown <url>] Stop the TCP server; example\: tcp\://localhost\:9094\n[-tcpShutdownForce] Do not wait until all connections are closed\n[-pg] Start the PG server\n[-pgAllowOthers] Allow other computers to connect\n[-pgPort <port>] The port (default\: 5435)\n[-baseDir <dir>] The base directory for H2 databases; for all servers\n[-ifExists] Only existing databases may be opened; for all servers\n[-trace] Print additional trace information; for all servers
org.h2.tools.Shell=Interactive command line tool to access a database using JDBC.
org.h2.tools.Shell.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-url <url>] The database URL (jdbc\:h2\:...)\n[-user <user>] The user name\n[-password <pwd>] The password\n[-driver <class>] The JDBC driver class to use (not required in most cases)\nIf special characters don't work as expected, you may need to use\n -Dfile.encoding\=UTF-8 (Mac OS X) or CP850 (Windows).
org.h2.tools.Backup=Creates a backup of a database.
org.h2.tools.Backup.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-file <filename>] The target file name (default\: backup.zip)\n[-dir <dir>] The source directory (default\: .)\n[-db <database>] Source database; not required if there is only one\n[-quiet] Do not print progress information
org.h2.tools.ChangeFileEncryption=Allows changing the database file encryption password or algorithm.\nThis tool can not be used to change a password of a user.
org.h2.tools.ChangeFileEncryption.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-cipher type] The encryption type (AES or XTEA)\n[-dir <dir>] The database directory (default\: .)\n[-db <database>] Database name (all databases if not set)\n[-decrypt <pwd>] The decryption password (if not set\: not yet encrypted)\n[-encrypt <pwd>] The encryption password (if not set\: do not encrypt)\n[-quiet] Do not print progress information
org.h2.tools.Console=Starts the H2 Console (web-) server, as well as the TCP and PG server.
org.h2.tools.Console.main=When running without options, -tcp, -web, -browser and -pg are started.\nOptions are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-web] Start the web server with the H2 Console\n[-tool] Start the icon or window that allows to start a browser\n[-browser] Start a browser and open a page to connect to the web server\n[-tcp] Start the TCP server\n[-pg] Start the PG server\nFor each Server, additional options are available;\n for details, see the Server tool.\nIf a service can not be started, the program\n terminates with an exit code of 1.
org.h2.tools.ConvertTraceFile=Converts a .trace.db file to a SQL script and Java source code.\nSQL statement statistics are listed as well.
org.h2.tools.ConvertTraceFile.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-traceFile <file>] The trace file name (default\: test.trace.db)\n[-script <file>] The script file name (default\: test.sql)\n[-javaClass <file>] The Java directory and class file name (default\: Test)
org.h2.tools.CreateCluster=Creates a cluster from a standalone database.\nCopies a database to another location if required.
org.h2.tools.CreateCluster.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-urlSource <url>] The database URL of the source database (jdbc\:h2\:...)\n[-urlTarget <url>] The database URL of the target database (jdbc\:h2\:...)\n[-user <user>] The user name (default\: sa)\n[-password <pwd>] The password\n[-serverList <list>] The comma separated list of host names or IP addresses
org.h2.tools.DeleteDbFiles=Deletes all files belonging to a database.\nThe database must be closed before calling this tool.
org.h2.tools.DeleteDbFiles.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-dir <dir>] The directory (default\: .)\n[-db <database>] The database name\n[-quiet] Do not print progress information
org.h2.tools.Recover=Helps recovering a corrupted database.
org.h2.tools.Recover.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-dir <dir>] The directory (default\: .)\n[-db <database>] The database name (all databases if not set)\n[-trace] Print additional trace information
org.h2.tools.Restore=Restores a H2 database by extracting the database files from a .zip file.
org.h2.tools.Restore.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-file <filename>] The source file name (default\: backup.zip)\n[-dir <dir>] The target directory (default\: .)\n[-db <database>] The target database name (as stored if not set)\n[-quiet] Do not print progress information
org.h2.tools.RunScript=Runs a SQL script against a database.
org.h2.tools.RunScript.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-url <url>] The database URL (jdbc\:...)\n[-user <user>] The user name (default\: sa)\n[-password <pwd>] The password\n[-script <file>] The script file to run (default\: backup.sql)\n[-driver <class>] The JDBC driver class to use (not required in most cases)\n[-showResults] Show the statements and the results of queries\n[-checkResults] Check if the query results match the expected results\n[-options ...] RUNSCRIPT options (embedded H2; -*Results not supported)
org.h2.tools.Script=Creates a SQL script file by extracting the schema and data of a database.
org.h2.tools.Script.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-url <url>] The database URL (jdbc\:...)\n[-user <user>] The user name (default\: sa)\n[-password <pwd>] The password\n[-script <file>] The target script file name (default\: backup.sql)\n[-options ...] A list of options (only for embedded H2, see RUNSCRIPT)\n[-quiet] Do not print progress information
org.h2.tools.Server=Starts the H2 Console (web-) server, TCP, and PG server.
org.h2.tools.Server.main=When running without options, -tcp, -web, -browser and -pg are started.\nOptions are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-web] Start the web server with the H2 Console\n[-webAllowOthers] Allow other computers to connect\n[-webPort <port>] The port (default\: 8082)\n[-webSSL] Use encrypted (HTTPS) connections\n[-browser] Start a browser and open a page to connect to the web server\n[-tcp] Start the TCP server\n[-tcpAllowOthers] Allow other computers to connect\n[-tcpPort <port>] The port (default\: 9092)\n[-tcpSSL] Use encrypted (SSL) connections\n[-tcpPassword <pwd>] The password for shutting down a TCP server\n[-tcpShutdown <url>] Stop the TCP server; example\: tcp\://localhost\:9094\n[-tcpShutdownForce] Do not wait until all connections are closed\n[-pg] Start the PG server\n[-pgAllowOthers] Allow other computers to connect\n[-pgPort <port>] The port (default\: 5435)\n[-baseDir <dir>] The base directory for H2 databases; for all servers\n[-ifExists] Only existing databases may be opened; for all servers\n[-trace] Print additional trace information; for all servers
org.h2.tools.Shell=Interactive command line tool to access a database using JDBC.
org.h2.tools.Shell.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-url <url>] The database URL (jdbc\:h2\:...)\n[-user <user>] The user name\n[-password <pwd>] The password\n[-driver <class>] The JDBC driver class to use (not required in most cases)\nIf special characters don't work as expected, you may need to use\n -Dfile.encoding\=UTF-8 (Mac OS X) or CP850 (Windows).
......@@ -83,10 +83,6 @@ public class PageFreeList extends Record {
*/
void free(int pageId) throws SQLException {
full = false;
int test;
if (pageId - getPos() <= 0) {
System.out.println("stop!");
}
used.clear(pageId - getPos());
store.updateRecord(this, true, data);
}
......
......@@ -22,12 +22,10 @@ import org.h2.index.PageBtreeIndex;
import org.h2.index.PageScanIndex;
import org.h2.log.InDoubtTransaction;
import org.h2.log.LogSystem;
import org.h2.log.SessionState;
import org.h2.message.Message;
import org.h2.message.Trace;
import org.h2.message.TraceSystem;
import org.h2.result.Row;
import org.h2.result.SortOrder;
import org.h2.schema.Schema;
import org.h2.table.Column;
import org.h2.table.IndexColumn;
......@@ -968,8 +966,8 @@ public class PageStore implements CacheWriter {
}
/**
* Commit or rollback a prepared transaction after opening a database with in-doubt
* transactions.
* Commit or rollback a prepared transaction after opening a database with
* in-doubt transactions.
*
* @param sessionId the session id
* @param pageId the page where the transaction was prepared
......
......@@ -807,13 +807,13 @@ public class Recover extends Tool implements DataHandler {
case Page.TYPE_BTREE_NODE:
writer.println("-- page " + page + ": btree node" + (last ? "(last)" : ""));
if (trace) {
dumpPageBtreeNode(store, pageSize, writer, s, last, page);
dumpPageBtreeNode(writer, s);
}
break;
case Page.TYPE_BTREE_LEAF:
writer.println("-- page " + page + ": btree leaf " + (last ? "(last)" : ""));
if (trace) {
dumpPageBtreeLeaf(store, pageSize, writer, s, last, page);
dumpPageBtreeLeaf(writer, s);
}
break;
case Page.TYPE_FREE_LIST:
......@@ -1012,7 +1012,7 @@ public class Recover extends Tool implements DataHandler {
}
}
private void dumpPageBtreeNode(FileStore store, int pageSize, PrintWriter writer, DataPage s, boolean last, long pageId) {
private void dumpPageBtreeNode(PrintWriter writer, DataPage s) {
int entryCount = s.readShortInt();
int rowCount = s.readInt();
int[] children = new int[entryCount + 1];
......@@ -1038,7 +1038,7 @@ public class Recover extends Tool implements DataHandler {
writer.println("-- [" + entryCount + "] child: " + children[entryCount] + " rowCount: " + rowCount);
}
private void dumpPageBtreeLeaf(FileStore store, int pageSize, PrintWriter writer, DataPage s, boolean last, long pageId) {
private void dumpPageBtreeLeaf(PrintWriter writer, DataPage s) {
s.readInt();
int entryCount = s.readShortInt();
int[] offsets = new int[entryCount];
......
......@@ -21,8 +21,8 @@ import org.h2.constant.SysProperties;
public class ObjectArray<T> implements Iterable<T> {
private static final int CAPACITY_INIT = 4, CAPACITY_SHRINK = 256;
int size;
private T[] data;
private int size;
private ObjectArray(int capacity) {
data = createArray(capacity);
......@@ -323,7 +323,7 @@ public class ObjectArray<T> implements Iterable<T> {
/**
* The iterator for this list.
*/
private class ObjectArrayIterator implements Iterator<T> {
class ObjectArrayIterator implements Iterator<T> {
private int index;
public boolean hasNext() {
......
......@@ -29,13 +29,15 @@ package org.h2.util;
*</pre>
*/
public class StatementBuilder {
private StringBuilder builder = new StringBuilder();
private final StringBuilder builder = new StringBuilder();
private int index;
/**
* Create a new builder.
*/
public StatementBuilder() {
// nothing to do
}
/**
......
......@@ -13,8 +13,6 @@ import java.sql.Statement;
import java.util.Random;
import java.util.Set;
import java.util.TreeSet;
import org.h2.engine.ConnectionInfo;
import org.h2.engine.Database;
import org.h2.test.TestBase;
/**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论