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

--no commit message

--no commit message
上级 3169053d
#Fri Mar 14 15:37:20 CET 2008
#Tue Mar 18 08:37:19 CET 2008
benchmark.drivers.dir=C\:/data/java
javac=javac
jdk=1.4
......
......@@ -57,15 +57,20 @@ public class Backup {
String db = null;
boolean quiet = false;
for (int i = 0; args != null && i < args.length; i++) {
if (args[i].equals("-dir")) {
String arg = args[i];
if (arg.equals("-dir")) {
dir = args[++i];
} else if (args[i].equals("-db")) {
} else if (arg.equals("-db")) {
db = args[++i];
} else if (args[i].equals("-quiet")) {
} else if (arg.equals("-quiet")) {
quiet = true;
} else if (args[i].equals("-file")) {
} else if (arg.equals("-file")) {
zipFileName = args[++i];
} else if (arg.equals("-help") || arg.equals("-?")) {
showUsage();
return;
} else {
System.out.println("Unsupported option: " + arg);
showUsage();
return;
}
......
......@@ -66,19 +66,24 @@ public class ChangePassword {
String db = null;
boolean quiet = false;
for (int i = 0; args != null && i < args.length; i++) {
if (args[i].equals("-dir")) {
String arg = args[i];
if (arg.equals("-dir")) {
dir = args[++i];
} else if (args[i].equals("-cipher")) {
} else if (arg.equals("-cipher")) {
cipher = args[++i];
} else if (args[i].equals("-db")) {
} else if (arg.equals("-db")) {
db = args[++i];
} else if (args[i].equals("-decrypt")) {
} else if (arg.equals("-decrypt")) {
decryptPassword = args[++i].toCharArray();
} else if (args[i].equals("-encrypt")) {
} else if (arg.equals("-encrypt")) {
encryptPassword = args[++i].toCharArray();
} else if (args[i].equals("-quiet")) {
} else if (arg.equals("-quiet")) {
quiet = true;
} else if (arg.equals("-help") || arg.equals("-?")) {
showUsage();
return;
} else {
System.out.println("Unsupported option: " + arg);
showUsage();
return;
}
......
......@@ -48,13 +48,18 @@ public class ConvertTraceFile {
String javaClass = "Test";
String script = "test.sql";
for (int i = 0; args != null && i < args.length; i++) {
if (args[i].equals("-traceFile")) {
String arg = args[i];
if (arg.equals("-traceFile")) {
traceFile = args[++i];
} else if (args[i].equals("-javaClass")) {
} else if (arg.equals("-javaClass")) {
javaClass = args[++i];
} else if (args[i].equals("-script")) {
} else if (arg.equals("-script")) {
script = args[++i];
} else if (arg.equals("-help") || arg.equals("-?")) {
showUsage();
return;
} else {
System.out.println("Unsupported option: " + arg);
showUsage();
return;
}
......
......@@ -51,17 +51,22 @@ public class CreateCluster {
String password = "";
String serverlist = null;
for (int i = 0; args != null && i < args.length; i++) {
if (args[i].equals("-urlSource")) {
String arg = args[i];
if (arg.equals("-urlSource")) {
urlSource = args[++i];
} else if (args[i].equals("-urlTarget")) {
} else if (arg.equals("-urlTarget")) {
urlTarget = args[++i];
} else if (args[i].equals("-user")) {
} else if (arg.equals("-user")) {
user = args[++i];
} else if (args[i].equals("-password")) {
} else if (arg.equals("-password")) {
password = args[++i];
} else if (args[i].equals("-serverlist")) {
} else if (arg.equals("-serverlist")) {
serverlist = args[++i];
} else if (arg.equals("-help") || arg.equals("-?")) {
showUsage();
return;
} else {
System.out.println("Unsupported option: " + arg);
showUsage();
return;
}
......
......@@ -46,13 +46,18 @@ public class DeleteDbFiles {
String db = null;
boolean quiet = false;
for (int i = 0; args != null && i < args.length; i++) {
if (args[i].equals("-dir")) {
String arg = args[i];
if (arg.equals("-dir")) {
dir = args[++i];
} else if (args[i].equals("-db")) {
} else if (arg.equals("-db")) {
db = args[++i];
} else if (args[i].equals("-quiet")) {
} else if (arg.equals("-quiet")) {
quiet = true;
} else if (arg.equals("-help") || arg.equals("-?")) {
showUsage();
return;
} else {
System.out.println("Unsupported option: " + arg);
showUsage();
return;
}
......
......@@ -98,16 +98,21 @@ public class Recover implements DataHandler {
String db = null;
boolean removePassword = false;
for (int i = 0; args != null && i < args.length; i++) {
if ("-dir".equals(args[i])) {
String arg = args[i];
if ("-dir".equals(arg)) {
dir = args[++i];
} else if ("-db".equals(args[i])) {
} else if ("-db".equals(arg)) {
db = args[++i];
} else if ("-removePassword".equals(args[i])) {
} else if ("-removePassword".equals(arg)) {
removePassword = true;
log = true;
} else if ("-log".equals(args[i])) {
} else if ("-log".equals(arg)) {
log = Boolean.valueOf(args[++i]).booleanValue();
} else if (arg.equals("-help") || arg.equals("-?")) {
showUsage();
return;
} else {
System.out.println("Unsupported option: " + arg);
showUsage();
return;
}
......
......@@ -54,15 +54,20 @@ public class Restore {
String db = null;
boolean quiet = false;
for (int i = 0; args != null && i < args.length; i++) {
if (args[i].equals("-dir")) {
String arg = args[i];
if (arg.equals("-dir")) {
dir = args[++i];
} else if (args[i].equals("-file")) {
} else if (arg.equals("-file")) {
zipFileName = args[++i];
} else if (args[i].equals("-db")) {
} else if (arg.equals("-db")) {
db = args[++i];
} else if (args[i].equals("-quiet")) {
} else if (arg.equals("-quiet")) {
quiet = true;
} else if (arg.equals("-help") || arg.equals("-?")) {
showUsage();
return;
} else {
System.out.println("Unsupported option: " + arg);
showUsage();
return;
}
......
......@@ -78,26 +78,27 @@ public class RunScript {
boolean continueOnError = false;
boolean showTime = false;
for (int i = 0; args != null && i < args.length; i++) {
if (args[i].equals("-url")) {
String arg = args[i];
if (arg.equals("-url")) {
url = args[++i];
} else if (args[i].equals("-user")) {
} else if (arg.equals("-user")) {
user = args[++i];
} else if (args[i].equals("-password")) {
} else if (arg.equals("-password")) {
password = args[++i];
} else if (args[i].equals("-continueOnError")) {
} else if (arg.equals("-continueOnError")) {
continueOnError = true;
} else if (args[i].equals("-script")) {
} else if (arg.equals("-script")) {
script = args[++i];
} else if (args[i].equals("-time")) {
} else if (arg.equals("-time")) {
showTime = true;
} else if (args[i].equals("-driver")) {
} else if (arg.equals("-driver")) {
String driver = args[++i];
try {
ClassUtils.loadUserClass(driver);
} catch (ClassNotFoundException e) {
throw Message.convert(e);
}
} else if (args[i].equals("-options")) {
} else if (arg.equals("-options")) {
StringBuffer buff = new StringBuffer();
i++;
for (; i < args.length; i++) {
......@@ -105,7 +106,11 @@ public class RunScript {
buff.append(args[i]);
}
options = buff.toString();
} else if (arg.equals("-help") || arg.equals("-?")) {
showUsage();
return;
} else {
System.out.println("Unsupported option: " + arg);
showUsage();
return;
}
......
......@@ -56,15 +56,16 @@ public class Script {
String file = "backup.sql";
String options1 = null, options2 = null;
for (int i = 0; args != null && i < args.length; i++) {
if (args[i].equals("-url")) {
String arg = args[i];
if (arg.equals("-url")) {
url = args[++i];
} else if (args[i].equals("-user")) {
} else if (arg.equals("-user")) {
user = args[++i];
} else if (args[i].equals("-password")) {
} else if (arg.equals("-password")) {
password = args[++i];
} else if (args[i].equals("-script")) {
} else if (arg.equals("-script")) {
file = args[++i];
} else if (args[i].equals("-options")) {
} else if (arg.equals("-options")) {
StringBuffer buff1 = new StringBuffer();
StringBuffer buff2 = new StringBuffer();
i++;
......@@ -81,7 +82,11 @@ public class Script {
}
options1 = buff1.toString();
options2 = buff2.toString();
} else if (arg.equals("-help") || arg.equals("-?")) {
showUsage();
return;
} else {
System.out.println("Unsupported option: " + arg);
showUsage();
return;
}
......
......@@ -32,7 +32,7 @@ public class Server implements Runnable, ShutdownHandler {
private void showUsage(String a, PrintStream out) {
if (a != null) {
out.println("Unknown option: " + a);
out.println("Unsupported option: " + a);
out.println();
}
out.println("java "+getClass().getName() + " [options]");
......@@ -141,93 +141,94 @@ public class Server implements Runnable, ShutdownHandler {
String tcpShutdownServer = "";
boolean startDefaultServers = true;
for (int i = 0; args != null && i < args.length; i++) {
String a = args[i];
if (a == null) {
String arg = args[i];
if (arg == null) {
continue;
} else if ("-?".equals(a) || "-help".equals(a)) {
} else if ("-?".equals(arg) || "-help".equals(arg)) {
showUsage(null, out);
return EXIT_ERROR;
} else if (a.startsWith("-web")) {
if ("-web".equals(a)) {
} else if (arg.startsWith("-web")) {
if ("-web".equals(arg)) {
startDefaultServers = false;
webStart = true;
} else if ("-webAllowOthers".equals(a)) {
} else if ("-webAllowOthers".equals(arg)) {
i++;
} else if ("-webPort".equals(a)) {
} else if ("-webPort".equals(arg)) {
i++;
} else if ("-webScript".equals(a)) {
} else if ("-webScript".equals(arg)) {
i++;
} else if ("-webSSL".equals(a)) {
} else if ("-webSSL".equals(arg)) {
i++;
} else {
showUsage(a, out);
showUsage(arg, out);
return EXIT_ERROR;
}
} else if ("-browser".equals(a)) {
} else if ("-browser".equals(arg)) {
startDefaultServers = false;
browserStart = true;
} else if (a.startsWith("-tcp")) {
if ("-tcp".equals(a)) {
} else if (arg.startsWith("-tcp")) {
if ("-tcp".equals(arg)) {
startDefaultServers = false;
tcpStart = true;
} else if ("-tcpAllowOthers".equals(a)) {
} else if ("-tcpAllowOthers".equals(arg)) {
i++;
} else if ("-tcpPort".equals(a)) {
} else if ("-tcpPort".equals(arg)) {
i++;
} else if ("-tcpSSL".equals(a)) {
} else if ("-tcpSSL".equals(arg)) {
i++;
} else if ("-tcpPassword".equals(a)) {
} else if ("-tcpPassword".equals(arg)) {
tcpPassword = args[++i];
} else if ("-tcpShutdown".equals(a)) {
} else if ("-tcpShutdown".equals(arg)) {
startDefaultServers = false;
tcpShutdown = true;
tcpShutdownServer = args[++i];
} else if ("-tcpShutdownForce".equals(a)) {
} else if ("-tcpShutdownForce".equals(arg)) {
tcpShutdownForce = Boolean.valueOf(args[++i]).booleanValue();
} else {
showUsage(a, out);
showUsage(arg, out);
return EXIT_ERROR;
}
} else if (a.startsWith("-pg")) {
if ("-pg".equals(a)) {
} else if (arg.startsWith("-pg")) {
if ("-pg".equals(arg)) {
startDefaultServers = false;
pgStart = true;
} else if ("-pgAllowOthers".equals(a)) {
} else if ("-pgAllowOthers".equals(arg)) {
i++;
} else if ("-pgPort".equals(a)) {
} else if ("-pgPort".equals(arg)) {
i++;
} else {
showUsage(a, out);
showUsage(arg, out);
return EXIT_ERROR;
}
} else if (a.startsWith("-ftp")) {
if ("-ftp".equals(a)) {
} else if (arg.startsWith("-ftp")) {
if ("-ftp".equals(arg)) {
startDefaultServers = false;
ftpStart = true;
} else if ("-ftpPort".equals(a)) {
} else if ("-ftpPort".equals(arg)) {
i++;
} else if ("-ftpDir".equals(a)) {
} else if ("-ftpDir".equals(arg)) {
i++;
} else if ("-ftpRead".equals(a)) {
} else if ("-ftpRead".equals(arg)) {
i++;
} else if ("-ftpWrite".equals(a)) {
} else if ("-ftpWrite".equals(arg)) {
i++;
} else if ("-ftpWritePassword".equals(a)) {
} else if ("-ftpWritePassword".equals(arg)) {
i++;
} else if ("-ftpTask".equals(a)) {
} else if ("-ftpTask".equals(arg)) {
i++;
} else {
showUsage(a, out);
showUsage(arg, out);
return EXIT_ERROR;
}
} else if (a.startsWith("-log")) {
} else if (arg.startsWith("-log")) {
i++;
} else if ("-baseDir".equals(a)) {
} else if ("-baseDir".equals(arg)) {
i++;
} else if ("-ifExists".equals(a)) {
} else if ("-ifExists".equals(arg)) {
i++;
} else {
showUsage(a, out);
out.println("Unsupported option: " + arg);
showUsage(arg, out);
return EXIT_ERROR;
}
}
......
/*
* Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package org.h2.tools;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.StringTokenizer;
import org.h2.engine.Constants;
import org.h2.message.Message;
import org.h2.util.ClassUtils;
import org.h2.util.JdbcUtils;
/**
* Interactive command line tool to access a database using JDBC.
*/
public class Shell {
private Connection conn;
private Statement stat;
private void showUsage() {
System.out.println("java " + getClass().getName() + " [-url <url> -user <user> -password <pwd> -driver <driver]");
System.out.println("See also http://h2database.com/javadoc/org/h2/tools/Prompt.html");
}
/**
* The command line interface for this tool. The options must be split into
* strings like this: "-user", "sa",... Options are case sensitive. The
* following options are supported:
* <ul>
* <li>-help or -? (print the list of options) </li>
* <li>-url jdbc:h2:... (database URL) </li>
* <li>-user username </li>
* <li>-password password </li>
* <li>-driver driver the JDBC driver class name (not required for H2)
* </li>
* </ul>
*
* @param args the command line arguments
* @throws SQLException
*/
public static void main(String[] args) throws SQLException {
new Shell().run(args);
}
private void run(String[] args) throws SQLException {
String url = null;
String user = "";
String password = "";
for (int i = 0; args != null && i < args.length; i++) {
if (args[i].equals("-url")) {
url = args[++i];
} else if (args[i].equals("-user")) {
user = args[++i];
} else if (args[i].equals("-password")) {
password = args[++i];
} else if (args[i].equals("-driver")) {
String driver = args[++i];
try {
ClassUtils.loadUserClass(driver);
} catch (ClassNotFoundException e) {
throw Message.convert(e);
}
} else {
System.out.println("Unsupported option: " + args[i]);
showUsage();
return;
}
}
if (url != null) {
org.h2.Driver.load();
conn = DriverManager.getConnection(url, user, password);
}
promptLoop();
}
private void showHelp() {
System.out.println("Commands are case insensitive; SQL statements end with ';'");
System.out.println("HELP or ? - Display this help");
System.out.println("CONNECT - Connect to a database. Optional arguments: url, user, password");
System.out.println("DRIVER - Load a JDBC driver class (usually not required)");
System.out.println("QUIT or EXIT - End this program");
System.out.println();
}
private void promptLoop() {
System.out.println();
System.out.println("Welcome to the H2 Shell " + Constants.getVersion());
showHelp();
String statement = null;
while (true) {
try {
if (statement == null) {
System.out.print("sql> ");
} else {
System.out.print("...> ");
}
String line = readLine();
if (line == null) {
break;
}
line = line.trim();
if (line.length() == 0) {
continue;
}
boolean end = line.endsWith(";");
if (end) {
line = line.substring(0, line.length() - 1).trim();
}
String upper = line.toUpperCase();
if ("EXIT".equals(upper) || "QUIT".equals(upper)) {
break;
} else if ("HELP".equals(upper) || "?".equals(upper)) {
showHelp();
} else {
if (statement == null) {
if (upper.startsWith("DRIVER")) {
loadDriver(line);
} else if (upper.startsWith("CONNECT")) {
conn = connect(line);
stat = conn.createStatement();
} else {
statement = line;
}
} else {
statement = statement + " " + line;
}
if (end) {
execute(statement);
statement = null;
}
}
} catch (SQLException e) {
System.out.println("SQL Exception: " + e.getMessage());
statement = null;
} catch (IOException e) {
System.out.println(e.getMessage());
break;
} catch (Exception e) {
System.out.println("Exception: " + e.toString());
e.printStackTrace();
break;
}
}
if (conn != null) {
try {
conn.close();
System.out.println("Connection closed");
} catch (SQLException e) {
System.out.println("SQL Exception:");
e.printStackTrace();
}
}
}
private void execute(String sql) throws SQLException {
if (stat == null) {
System.out.println("Not connected; type CONNECT to open a connection");
return;
}
stat.execute(sql);
}
private void loadDriver(String statement) throws IOException, ClassNotFoundException, SQLException {
StringTokenizer tokenizer = new StringTokenizer(statement);
tokenizer.nextToken();
String driver;
if (tokenizer.hasMoreTokens()) {
driver = tokenizer.nextToken();
} else {
System.out.print("URL: ");
driver = readLine();
}
ClassUtils.loadUserClass(driver);
}
private Connection connect(String statement) throws IOException, SQLException {
StringTokenizer tokenizer = new StringTokenizer(statement);
tokenizer.nextToken();
String url, user, password;
if (tokenizer.hasMoreTokens()) {
url = tokenizer.nextToken();
} else {
System.out.print("URL : ");
url = readLine();
}
if (tokenizer.hasMoreTokens()) {
user = tokenizer.nextToken();
} else {
System.out.print("User : ");
user = readLine();
}
if (tokenizer.hasMoreTokens()) {
password = tokenizer.nextToken();
} else {
password = readPassword();
}
Connection conn = JdbcUtils.getConnection(null, url, user, password);
System.out.println("Connected");
return conn;
}
private String readPassword() throws IOException {
class PasswordHider extends Thread {
volatile boolean stop;
public void run() {
while (!stop) {
System.out.print("\b\b><");
try {
Thread.sleep(10);
} catch (InterruptedException e) {
}
}
}
}
PasswordHider thread = new PasswordHider();
thread.start();
System.out.print("Password: > ");
String p = readLine();
thread.stop = true;
try {
thread.join();
} catch (InterruptedException e) {
// ignore
}
System.out.print("\b\b");
return p;
}
private String readLine() throws IOException {
String line = new BufferedReader(new InputStreamReader(System.in)).readLine();
if (line == null) {
throw new IOException("Aborted");
}
return line;
}
}
/*
* Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package org.h2.util;
/**
* This class tries to automatically load the right JDBC driver for a given
* database URL.
*/
public class JdbcDriverLoader {
private static final String[] DRIVERS = {
"jdbc:h2:", "org.h2.Driver",
"jdbc:firebirdsql:", "org.firebirdsql.jdbc.FBDriver",
"jdbc:db2:", "COM.ibm.db2.jdbc.net.DB2Driver",
"jdbc:oracle:", "oracle.jdbc.driver.OracleDriver",
"jdbc:microsoft:", "com.microsoft.jdbc.sqlserver.SQLServerDriver",
"jdbc:sqlserver:", "com.microsoft.sqlserver.jdbc.SQLServerDriver",
"jdbc:postgresql:", "org.postgresql.Driver",
"jdbc:mysql:", "com.mysql.jdbc.Driver",
"jdbc:derby://", "org.apache.derby.jdbc.ClientDriver",
"jdbc:derby:", "org.apache.derby.jdbc.EmbeddedDriver",
"jdbc:hsqldb:", "org.hsqldb.jdbcDriver"
};
public static void load(String url) throws ClassNotFoundException {
for (int i = 0; i < DRIVERS.length; i += 2) {
String prefix = DRIVERS[i];
if (url.startsWith(prefix)) {
Class.forName(DRIVERS[i + 1]);
break;
}
}
}
}
......@@ -94,8 +94,10 @@ public class JdbcUtils {
}
public static Connection getConnection(String driver, String url, Properties prop) throws SQLException {
if (!StringUtils.isNullOrEmpty(driver)) {
try {
try {
if (StringUtils.isNullOrEmpty(driver)) {
JdbcDriverLoader.load(url);
} else {
Class d = ClassUtils.loadUserClass(driver);
if (java.sql.Driver.class.isAssignableFrom(d)) {
return DriverManager.getConnection(url, prop);
......@@ -124,11 +126,11 @@ public class JdbcUtils {
// Don't know, but maybe it loaded a JDBC Driver
return DriverManager.getConnection(url, prop);
}
} catch (ClassNotFoundException e) {
throw Message.getSQLException(ErrorCode.CLASS_NOT_FOUND_1, new String[]{driver}, e);
} catch (NoClassDefFoundError e) {
throw Message.getSQLException(ErrorCode.CLASS_NOT_FOUND_1, new String[]{driver}, e);
}
} catch (ClassNotFoundException e) {
throw Message.getSQLException(ErrorCode.CLASS_NOT_FOUND_1, new String[]{driver}, e);
} catch (NoClassDefFoundError e) {
throw Message.getSQLException(ErrorCode.CLASS_NOT_FOUND_1, new String[]{driver}, e);
}
return DriverManager.getConnection(url, prop);
}
......
......@@ -20,6 +20,7 @@ import org.h2.message.Message;
public class ObjectUtils {
public static Integer getInteger(int x) {
// actually this method is available in JDK15
//#ifdef JDK16
/*
if(true)
......
......@@ -156,18 +156,39 @@ java org.h2.test.TestAll timer
long time = System.currentTimeMillis();
TestAll test = new TestAll();
test.printSystem();
/*
new TestCrashAPI().init(test).testCase(2046453618);
write to system table before adding to internal data structures
//new TestCrashAPI().init(test).testCase(2046453618);
MiniConnectionPoolManager
Hi,
Thanks a lot for your help! I can now also reproduce this problem. It only happens when using LOG=2,
and deleting or updating all rows of a table. There is a workaround (beside not using LOG=1):
System.setProperty("h2.reuseSpaceQuickly", "false");
or java -Dh2.reuseSpaceQuickly=false
I will fix this for the next release.
Regards,
Thomas
--------------
scheduler: what if invoke takes more than...
scheduler: log at startup next 5
scheduler: add an a cron functionality
performance of drop table / index is slow
(when deleting a lot of rows randomly?)
Allow to set all passwords as parameters
Remove Parser.readString()
use a default delay of 1 second before closing a database.
more tests with disk based select distinct; order by:
select distinct x from system_range(1, 200000);
DROP TABLE TEST;
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255), VALUE DECIMAL(10,2));
CREATE TABLE TEST(ID INT PRIMARY KEY,
NAME VARCHAR(255), VALUE DECIMAL(10,2));
INSERT INTO TEST VALUES(1,'Apples',1.20),
(2,'Oranges',2.05),
(3,'Cherries',5.10),
......@@ -183,6 +204,8 @@ CREATE TABLE p(d DATE);
INSERT INTO p VALUES('0000-01-01');
INSERT INTO p VALUES('0001-01-01');
C:\temp\db\diff.patch
out of memory problem:
java -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m
-cp bin/h2.jar org.h2.tools.Server -log true
......@@ -193,51 +216,47 @@ CREATE TABLE test (field1 number(10) not null, field2 number(8));
create index idx_number1 on test(field1);
The table 'test' contains a little over 100.000.000 records.
Read HenPlus features
http://henplus.sourceforge.net/
better document DataSource usage in an own section in the Tutorial.
Including Pooling if possible
link to or include
http://www.source-code.biz/snippets/java/8.htm
add regular javadocs to the homepage
the database should be kept open for a longer time when using the server mode
add link to new in use, links
Javadocs: for each tool, add a copy & paste sample in the class level
Add google site search to web page
merge query and result frames
in-place auto-complete
scheduler: what if invoke takes more than...
scheduler: log at startup next 5
scheduler: add an a cron functionality
test with:
- large varchar columns (40 KB)
- not closing the database
read uncommitted and multi-threaded mode at the same time is dangerous
add @author
test multi-threaded kernel fulltext
fix or disable the linear hash index
Can sometimes not delete log file? need test case
Add where required // TODO: change in version 1.1
History:
A first (experimental) implementation of a Shell tools is now included (org.h2.tools.Shell).
Performance was very slow when using LOG=2 and deleting or
updating all rows of a table in a loop. Fixed.
ALTER TABLE or CREATE TABLE now support parameters for the password field.
The linear hash has been removed. It was always slower than the b-tree index,
and there were some bugs that would be hard to fix.
TRACE_LEVEL_ settings are no longer persistent. This was a problem
when database initialization code caused a lot of logging.
Fulltext search (native implementation): The words table is no longer
an in-memory table because this caused memory problems in some cases.
It was possible to create a role with the name as an existing user
(but not vice versa). This is not allowed any more.
Roadmap:
SET LOG_SYSTEM {NATIVE|LOG4J|COMMONS|DRIVER_MANAGER}
Fluent API for tools: Server.createTcpServer().setPort(9081).setPassword(password).start();
console features:
- reset?
- use StringBuffer to append (copy and paste problems)
- password mask option
- result set: two modes (list and table)
- Show Tables of MySQL and Show Fields (also ij)
(not required for H2) > not required for most databases
*/
......
......@@ -12,6 +12,8 @@ import java.sql.PreparedStatement;
import java.sql.Statement;
import java.util.HashMap;
import org.h2.util.JdbcDriverLoader;
/**
* A simple wrapper around the JDBC API.
* Currently used for testing.
......@@ -23,34 +25,13 @@ import java.util.HashMap;
*/
public class Db {
private static final String[] DRIVERS = {
"jdbc:h2:", "org.h2.Driver",
"jdbc:firebirdsql:", "org.firebirdsql.jdbc.FBDriver",
"jdbc:db2:", "COM.ibm.db2.jdbc.net.DB2Driver",
"jdbc:oracle:", "oracle.jdbc.driver.OracleDriver",
"jdbc:microsoft:", "com.microsoft.jdbc.sqlserver.SQLServerDriver",
"jdbc:sqlserver:", "com.microsoft.sqlserver.jdbc.SQLServerDriver",
"jdbc:postgresql:", "org.postgresql.Driver",
"jdbc:mysql:", "com.mysql.jdbc.Driver",
"jdbc:derby://", "org.apache.derby.jdbc.ClientDriver",
"jdbc:derby:", "org.apache.derby.jdbc.EmbeddedDriver",
"jdbc:hsqldb:", "org.hsqldb.jdbcDriver"
};
private Connection conn;
private Statement stat;
private HashMap prepared = new HashMap();
private long start;
public static Db open(String url, String user, String password) {
try {
for (int i = 0; i < DRIVERS.length; i += 2) {
String prefix = DRIVERS[i];
if (url.startsWith(prefix)) {
Class.forName(DRIVERS[i + 1]);
break;
}
}
JdbcDriverLoader.load(url);
return new Db(DriverManager.getConnection(url, user, password));
} catch (Exception e) {
throw convert(e);
......@@ -152,11 +133,4 @@ public class Db {
return new Error("Error: " + e.toString(), e);
}
public void startTime() {
start = System.currentTimeMillis();
}
public void printTime(String s) {
System.out.println(s + ": " + (System.currentTimeMillis() - start));
}
}
......@@ -33,8 +33,7 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
Statement stat = conn.createStatement();
stat.execute("DROP TABLE IF EXISTS TEST");
stat.execute("create table test(id int primary key, parent int)");
stat
.execute("alter table test add constraint test_parent_id foreign key(parent) references test (id) on delete cascade");
stat.execute("alter table test add constraint test_parent_id foreign key(parent) references test (id) on delete cascade");
stat.execute("insert into test select x, x/2 from system_range(0, 100)");
stat.execute("delete from test");
checkSingleValue(stat, "select count(*) from test", 0);
......
......@@ -32,14 +32,14 @@ public class TestSampleApps extends TestBase {
testApp(org.h2.samples.TriggerSample.class, null, "The sum is 20.00");
// tools
testApp(org.h2.tools.ChangePassword.class, new String[] { "-?" },
testApp(org.h2.tools.ChangePassword.class, new String[] { "-help" },
"java org.h2.tools.ChangePassword [-dir <dir>] "
+ "[-db <database>] [-cipher <cipher>] [-decrypt <pwd>] [-encrypt <pwd>] [-quiet]\n"
+ "See also http://h2database.com/javadoc/org/h2/tools/ChangePassword.html");
testApp(org.h2.tools.ChangePassword.class, null, "java org.h2.tools.ChangePassword [-dir <dir>] "
+ "[-db <database>] [-cipher <cipher>] [-decrypt <pwd>] [-encrypt <pwd>] [-quiet]\n"
+ "See also http://h2database.com/javadoc/org/h2/tools/ChangePassword.html");
testApp(org.h2.tools.DeleteDbFiles.class, new String[] { "-?" },
testApp(org.h2.tools.DeleteDbFiles.class, new String[] { "-help" },
"java org.h2.tools.DeleteDbFiles [-dir <dir>] [-db <database>] [-quiet]\n"
+ "See also http://h2database.com/javadoc/org/h2/tools/DeleteDbFiles.html");
}
......
......@@ -72,7 +72,7 @@ public class TestTools extends TestBase {
result = runServer(new String[]{"-xy"}, 1);
check(result.indexOf("[options]") >= 0);
check(result.indexOf("Unknown option") >= 0);
check(result.indexOf("Unsupported option") >= 0);
result = runServer(new String[]{"-tcp", "-tcpAllowOthers", "false", "-tcpPort", "9001", "-tcpPassword", "abc"}, 0);
check(result.indexOf("tcp://") >= 0);
check(result.indexOf(":9001") >= 0);
......
......@@ -483,4 +483,5 @@ year yen yes yet yield yielding ymd you your yourkit yourself ytd yuml yusuke
yyyy zeile zero zeros zeta zip zloty zone zwj zwnj
cron ide pageview track gat analytics tracker implicitly ignores pro providers
tmpdir mini
\ No newline at end of file
tmpdir mini owns accordingly snippets receiving rainbow pools groupware biz
greenwich
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论