提交 74108a40 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 7c091a02
...@@ -1006,13 +1006,14 @@ public class MetaTable extends Table { ...@@ -1006,13 +1006,14 @@ public class MetaTable extends Table {
} }
String columnList = null; String columnList = null;
if(columns != null) { if(columns != null) {
columnList = ""; StringBuffer buff = new StringBuffer();
for(int j=0; j<columns.length; j++) { for(int j=0; j<columns.length; j++) {
if(j>0) { if(j>0) {
columnList += ","; buff.append(',');
} }
columnList += columns[j].getName(); buff.append(columns[j].getName());
} }
columnList = buff.toString();
} }
add(rows, new String[] { add(rows, new String[] {
catalog, // CONSTRAINT_CATALOG catalog, // CONSTRAINT_CATALOG
......
...@@ -37,12 +37,12 @@ public class Backup { ...@@ -37,12 +37,12 @@ public class Backup {
* The following options are supported: * The following options are supported:
* <ul> * <ul>
* <li>-help or -? (print the list of options) * <li>-help or -? (print the list of options)
* <li>-url jdbc:h2:... (database URL) * </li><li>-url jdbc:h2:... (database URL)
* <li>-user username * </li><li>-user username
* <li>-password password * </li><li>-password password
* <li>-script filename (default file name is backup.sql) * </li><li>-script filename (default file name is backup.sql)
* <li>-options to specify a list of options (only for H2) * </li><li>-options to specify a list of options (only for H2)
* </ul> * </li></ul>
* *
* @param args the command line arguments * @param args the command line arguments
* @throws SQLException * @throws SQLException
......
...@@ -39,13 +39,13 @@ public class ChangePassword extends FileBase { ...@@ -39,13 +39,13 @@ public class ChangePassword extends FileBase {
* The following options are supported: * The following options are supported:
* <ul> * <ul>
* <li>-help or -? (print the list of options) * <li>-help or -? (print the list of options)
* <li>-dir directory (the default is the current directory) * </li><li>-dir directory (the default is the current directory)
* <li>-db databaseName (all databases if no name is specified) * </li><li>-db databaseName (all databases if no name is specified)
* <li>-cipher type (AES or XTEA) * </li><li>-cipher type (AES or XTEA)
* <li>-decrypt password (null if the database is not encrypted) * </li><li>-decrypt password (null if the database is not encrypted)
* <li>-encrypt password (null if the database should not be encrypted) * </li><li>-encrypt password (null if the database should not be encrypted)
* <li>-quiet does not print progress information * </li><li>-quiet does not print progress information
* </ul> * </li></ul>
* *
* @param args the command line arguments * @param args the command line arguments
* @throws SQLException * @throws SQLException
......
...@@ -30,10 +30,10 @@ public class ConvertTraceFile { ...@@ -30,10 +30,10 @@ public class ConvertTraceFile {
* The following options are supported: * The following options are supported:
* <ul> * <ul>
* <li>-help or -? (print the list of options) * <li>-help or -? (print the list of options)
* <li>-traceFile filename (the default is test.trace.db) * </li><li>-traceFile filename (the default is test.trace.db)
* <li>-script filename (the default is test.sql) * </li><li>-script filename (the default is test.sql)
* <li>-javaClass className (the default is Test) * </li><li>-javaClass className (the default is Test)
* </ul> * </li></ul>
* *
* @param args the command line arguments * @param args the command line arguments
* @throws Exception * @throws Exception
......
...@@ -31,9 +31,9 @@ public class CreateCluster { ...@@ -31,9 +31,9 @@ public class CreateCluster {
* The following options are supported: * The following options are supported:
* <ul> * <ul>
* <li>-help or -? (print the list of options) * <li>-help or -? (print the list of options)
* <li>-urlSource jdbc:h2:... (the database URL of the source database) * </li><li>-urlSource jdbc:h2:... (the database URL of the source database)
* <li>-urlTarget jdbc:h2:... (the database URL of the target database) * </li><li>-urlTarget jdbc:h2:... (the database URL of the target database)
* </ul> * </li></ul>
* *
* @param args the command line arguments * @param args the command line arguments
* @throws SQLException * @throws SQLException
......
...@@ -107,7 +107,7 @@ public class Csv implements SimpleRowSource { ...@@ -107,7 +107,7 @@ public class Csv implements SimpleRowSource {
columnNames = colNames; columnNames = colNames;
initRead(); initRead();
SimpleResultSet result = new SimpleResultSet(this); SimpleResultSet result = new SimpleResultSet(this);
normalizeColumnNames(); makeColumnNamesUnique();
for(int i=0; i<columnNames.length; i++) { for(int i=0; i<columnNames.length; i++) {
result.addColumn(columnNames[i], Types.VARCHAR, 255, 0); result.addColumn(columnNames[i], Types.VARCHAR, 255, 0);
} }
...@@ -135,7 +135,7 @@ public class Csv implements SimpleRowSource { ...@@ -135,7 +135,7 @@ public class Csv implements SimpleRowSource {
this.reader = reader; this.reader = reader;
initRead(); initRead();
SimpleResultSet result = new SimpleResultSet(this); SimpleResultSet result = new SimpleResultSet(this);
normalizeColumnNames(); makeColumnNamesUnique();
for(int i=0; i<columnNames.length; i++) { for(int i=0; i<columnNames.length; i++) {
result.addColumn(columnNames[i], Types.VARCHAR, 255, 0); result.addColumn(columnNames[i], Types.VARCHAR, 255, 0);
} }
...@@ -145,7 +145,7 @@ public class Csv implements SimpleRowSource { ...@@ -145,7 +145,7 @@ public class Csv implements SimpleRowSource {
} }
} }
private void normalizeColumnNames() { private void makeColumnNamesUnique() {
for(int i=0; i<columnNames.length; i++) { for(int i=0; i<columnNames.length; i++) {
String x = columnNames[i]; String x = columnNames[i];
if(x == null || x.length()==0) { if(x == null || x.length()==0) {
......
...@@ -29,10 +29,10 @@ public class DeleteDbFiles extends FileBase { ...@@ -29,10 +29,10 @@ public class DeleteDbFiles extends FileBase {
* The following options are supported: * The following options are supported:
* <ul> * <ul>
* <li>-help or -? (print the list of options) * <li>-help or -? (print the list of options)
* <li>-dir directory (the default is the current directory) * </li><li>-dir directory (the default is the current directory)
* <li>-db databaseName (all databases if no name is specified) * </li><li>-db databaseName (all databases if no name is specified)
* <li>-quiet does not print progress information * </li><li>-quiet does not print progress information
* </ul> * </li></ul>
* *
* @param args the command line arguments * @param args the command line arguments
* @throws SQLException * @throws SQLException
......
...@@ -74,10 +74,10 @@ public class Recover implements DataHandler { ...@@ -74,10 +74,10 @@ public class Recover implements DataHandler {
* The following options are supported: * The following options are supported:
* <ul> * <ul>
* <li>-help or -? (print the list of options) * <li>-help or -? (print the list of options)
* <li>-dir directory (the default is the current directory) * </li><li>-dir directory (the default is the current directory)
* <li>-db databaseName (all databases if no name is specified) * </li><li>-db databaseName (all databases if no name is specified)
* <li>-log {true|false} (log additional messages) * </li><li>-log {true|false} (log additional messages)
* </ul> * </li></ul>
* *
* @param args the command line arguments * @param args the command line arguments
* @throws SQLException * @throws SQLException
......
...@@ -44,13 +44,13 @@ public class RunScript { ...@@ -44,13 +44,13 @@ public class RunScript {
* following options are supported: * following options are supported:
* <ul> * <ul>
* <li>-help or -? (print the list of options) * <li>-help or -? (print the list of options)
* <li>-url jdbc:h2:... (database URL) * </li><li>-url jdbc:h2:... (database URL)
* <li>-user username * </li><li>-user username
* <li>-password password * </li><li>-password password
* <li>-script filename (default file name is backup.sql) * </li><li>-script filename (default file name is backup.sql)
* <li>-driver driver the JDBC driver class name (not required for H2) * </li><li>-driver driver the JDBC driver class name (not required for H2)
* <li>-options to specify a list of options (only for H2 and only when using the embedded mode) * </li><li>-options to specify a list of options (only for H2 and only when using the embedded mode)
* </ul> * </li></ul>
* To include local files when using remote databases, use the special syntax: * To include local files when using remote databases, use the special syntax:
* <pre> * <pre>
* &#64;INCLUDE fileName * &#64;INCLUDE fileName
......
...@@ -72,34 +72,34 @@ public class Server implements Runnable { ...@@ -72,34 +72,34 @@ public class Server implements Runnable {
* The following options are supported: * The following options are supported:
* <ul> * <ul>
* <li>-help or -? (print the list of options) * <li>-help or -? (print the list of options)
* <li>-web (start the Web Server) * </li><li>-web (start the Web Server)
* <li>-tcp (start the TCP Server) * </li><li>-tcp (start the TCP Server)
* <li>-tcpShutdown {url} (shutdown the running TCP Server, URL example: tcp://localhost:9094) * </li><li>-tcpShutdown {url} (shutdown the running TCP Server, URL example: tcp://localhost:9094)
* <li>-odbc (start the ODBC Server) * </li><li>-odbc (start the ODBC Server)
* <li>-browser (start a browser and open a page to connect to the Web Server) * </li><li>-browser (start a browser and open a page to connect to the Web Server)
* <li>-log [true|false] (enable or disable logging) * </li><li>-log [true|false] (enable or disable logging)
* <li>-baseDir {directory} (sets the base directory for database files) * </li><li>-baseDir {directory} (sets the base directory for database files)
* <li>-ifExists [true|false] (only existing databases may be opened) * </li><li>-ifExists [true|false] (only existing databases may be opened)
* <li>-ftp (start the FTP Server) * </li><li>-ftp (start the FTP Server)
* </ul> * </li></ul>
* For each Server, there are additional options available: * For each Server, there are additional options available:
* <ul> * <ul>
* <li>-webPort {port} (the port of Web Server, default: 8082) * <li>-webPort {port} (the port of Web Server, default: 8082)
* <li>-webSSL [true|false] (if SSL should be used) * </li><li>-webSSL [true|false] (if SSL should be used)
* <li>-webAllowOthers [true|false] (enable/disable remote connections) * </li><li>-webAllowOthers [true|false] (enable/disable remote connections)
* <li>-tcpPort {port} (the port of TCP Server, default: 9092) * </li><li>-tcpPort {port} (the port of TCP Server, default: 9092)
* <li>-tcpSSL [true|false] (if SSL should be used) * </li><li>-tcpSSL [true|false] (if SSL should be used)
* <li>-tcpAllowOthers [true|false] (enable/disable remote connections) * </li><li>-tcpAllowOthers [true|false] (enable/disable remote connections)
* <li>-tcpPassword {password} (the password for shutting down a TCP Server) * </li><li>-tcpPassword {password} (the password for shutting down a TCP Server)
* <li>-tcpShutdownForce [true|false] (don't wait for other connections to close) * </li><li>-tcpShutdownForce [true|false] (don't wait for other connections to close)
* <li>-odbcPort {port} (the port of ODBC Server, default: 9083) * </li><li>-odbcPort {port} (the port of ODBC Server, default: 9083)
* <li>-odbcAllowOthers [true|false] (enable/disable remote connections) * </li><li>-odbcAllowOthers [true|false] (enable/disable remote connections)
* <li>-ftpPort {port} * </li><li>-ftpPort {port}
* <li>-ftpDir {directory} * </li><li>-ftpDir {directory}
* <li>-ftpRead {readUserName} * </li><li>-ftpRead {readUserName}
* <li>-ftpWrite {writeUserName} * </li><li>-ftpWrite {writeUserName}
* <li>-ftpWritePassword {password} * </li><li>-ftpWritePassword {password}
* </ul> * </li></ul>
* *
* @param args the command line arguments * @param args the command line arguments
* @throws SQLException * @throws SQLException
......
...@@ -45,9 +45,12 @@ public class Newsfeed { ...@@ -45,9 +45,12 @@ public class Newsfeed {
s = StringUtils.replaceAll(s, "<ul>", ""); s = StringUtils.replaceAll(s, "<ul>", "");
s = StringUtils.replaceAll(s, "</ul>", ""); s = StringUtils.replaceAll(s, "</ul>", "");
s = StringUtils.replaceAll(s, "<li>", "- "); s = StringUtils.replaceAll(s, "<li>", "- ");
s = StringUtils.replaceAll(s, "</li>", "");
s = StringUtils.replaceAll(s, "<a href=\"", "( "); s = StringUtils.replaceAll(s, "<a href=\"", "( ");
s = StringUtils.replaceAll(s, "\">", " ) "); s = StringUtils.replaceAll(s, "\">", " ) ");
s = StringUtils.replaceAll(s, "</a>", ""); s = StringUtils.replaceAll(s, "</a>", "");
s = StringUtils.replaceAll(s, "<br />", "");
s = StringUtils.replaceAll(s, "<br/>", "");
s = StringUtils.replaceAll(s, "<br>", ""); s = StringUtils.replaceAll(s, "<br>", "");
if(s.indexOf('<') >= 0 || s.indexOf('>') >= 0) { if(s.indexOf('<') >= 0 || s.indexOf('>') >= 0) {
throw new Error("Unsupported HTML Tag: < or > in " + s); throw new Error("Unsupported HTML Tag: < or > in " + s);
......
...@@ -86,6 +86,31 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2 ...@@ -86,6 +86,31 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
TestAll test = new TestAll(); TestAll test = new TestAll();
test.printSystem(); test.printSystem();
// improve TestHalt
// TODO backup : lobs are not backed up
// DROP TABLE IF EXISTS TEST;
// CREATE TABLE TEST(ID INT PRIMARY KEY, DATA CLOB);
// INSERT INTO TEST VALUES(1, space(10000));
// INSERT INTO TEST VALUES(2, 'World');
// drop table bar;
// drop table foo;
// create table FOO(id integer primary key);
// create table BAR(fooId integer);
// alter table bar add foreign key (fooid) references foo (id);
// truncate table bar;
// drop table FOO;
// create table FOO (ID int, A number(18, 2));
// insert into FOO (ID, A) values (1, 10.0), (2, 20.0);
// select SUM (CASE when ID=1 then 0 ELSE A END) col0 from Foo;
// hot backup: test, test encrypted database
// BACKUP: compare sql syntax with other databases
// Hot backup (incremental backup, online backup): backup data, log, index? files
// h2 // h2
// update FOO set a = dateadd('second', 4320000, a); // update FOO set a = dateadd('second', 4320000, a);
// ms sql server // ms sql server
...@@ -100,11 +125,6 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2 ...@@ -100,11 +125,6 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
// test backup // test backup
// backup: lobs, index // backup: lobs, index
// improve TestHalt
// BACKUP: compare sql syntax with other databases
// Hot backup (incremental backup, online backup): backup data, log, index? files
// GroovyServlet // GroovyServlet
// Cluster: hot deploy (adding a node on runtime) // Cluster: hot deploy (adding a node on runtime)
......
...@@ -11,6 +11,7 @@ import java.sql.Connection; ...@@ -11,6 +11,7 @@ import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.ResultSetMetaData; import java.sql.ResultSetMetaData;
import java.sql.Statement;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -82,8 +83,10 @@ public class GenerateDoc { ...@@ -82,8 +83,10 @@ public class GenerateDoc {
void map(String key, String sql) throws Exception { void map(String key, String sql) throws Exception {
ResultSet rs = null; ResultSet rs = null;
Statement stat = null;
try { try {
rs = conn.createStatement().executeQuery(sql); stat = conn.createStatement();
rs = stat.executeQuery(sql);
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
while(rs.next()) { while(rs.next()) {
HashMap map = new HashMap(); HashMap map = new HashMap();
...@@ -96,7 +99,7 @@ public class GenerateDoc { ...@@ -96,7 +99,7 @@ public class GenerateDoc {
String topic = rs.getString("TOPIC"); String topic = rs.getString("TOPIC");
String syntax = rs.getString("SYNTAX"); String syntax = rs.getString("SYNTAX");
syntax = PageParser.escapeHtml(syntax); syntax = PageParser.escapeHtml(syntax);
syntax = StringUtils.replaceAll(syntax, "<br>", ""); syntax = StringUtils.replaceAll(syntax, "<br />", "");
syntax = bnf.getSyntax(topic, syntax); syntax = bnf.getSyntax(topic, syntax);
map.put("syntax", syntax); map.put("syntax", syntax);
list.add(map); list.add(map);
...@@ -104,6 +107,7 @@ public class GenerateDoc { ...@@ -104,6 +107,7 @@ public class GenerateDoc {
session.put(key, list); session.put(key, list);
} finally { } finally {
JdbcUtils.closeSilently(rs); JdbcUtils.closeSilently(rs);
JdbcUtils.closeSilently(stat);
} }
} }
} }
...@@ -47,9 +47,9 @@ public class MergeDocs { ...@@ -47,9 +47,9 @@ public class MergeDocs {
String finalText= buff.toString(); String finalText= buff.toString();
File output = new File(baseDir, "onePage.html"); File output = new File(baseDir, "onePage.html");
PrintWriter writer = new PrintWriter(new FileWriter(output)); PrintWriter writer = new PrintWriter(new FileWriter(output));
writer.println("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"><title>"); writer.println("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" /><title>");
writer.println("H2 Documentation"); writer.println("H2 Documentation");
writer.println("</title><link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheetPdf.css\"></head><body>"); writer.println("</title><link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheetPdf.css\" /></head><body>");
writer.println(finalText); writer.println(finalText);
writer.println("</body></html>"); writer.println("</body></html>");
writer.close(); writer.close();
......
...@@ -89,9 +89,9 @@ public class XMLChecker { ...@@ -89,9 +89,9 @@ public class XMLChecker {
private static void checkXML(String xml, boolean html) throws Exception { private static void checkXML(String xml, boolean html) throws Exception {
String lastElement = null; String lastElement = null;
String[] noClose = new String[]{ // <li>: replace <li>([^\r]*[^<]*) with <li>$1</li>
"li", "link", "meta", "br", "img", "input", "hr", "frame" // use this for html file, for example if <li> is not closed
}; String[] noClose = new String[]{};
XMLParser parser = new XMLParser(xml); XMLParser parser = new XMLParser(xml);
Stack stack = new Stack(); Stack stack = new Stack();
boolean rootElement = false; boolean rootElement = false;
......
...@@ -55,13 +55,13 @@ public class Doclet { ...@@ -55,13 +55,13 @@ public class Doclet {
FileWriter out = new FileWriter(fileName); FileWriter out = new FileWriter(fileName);
PrintWriter writer = new PrintWriter(new BufferedWriter(out)); PrintWriter writer = new PrintWriter(new BufferedWriter(out));
writer.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"); writer.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
writer.println("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"><title>"); writer.println("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" /><title>");
writer.println(className); writer.println(className);
writer.println("</title><link rel=\"stylesheet\" type=\"text/css\" href=\"../../../stylesheet.css\"></head><body>"); writer.println("</title><link rel=\"stylesheet\" type=\"text/css\" href=\"../../../stylesheet.css\" /></head><body>");
writer.println("<table class=\"content\"><tr class=\"content\"><td class=\"content\"><div class=\"contentDiv\">"); writer.println("<table class=\"content\"><tr class=\"content\"><td class=\"content\"><div class=\"contentDiv\">");
writer.println("<h1>"+className+"</h1>"); writer.println("<h1>"+className+"</h1>");
writer.println(clazz.commentText()+"<br><br>"); writer.println(clazz.commentText()+"<br /><br />");
MethodDoc[] methods = clazz.methods(); MethodDoc[] methods = clazz.methods();
Arrays.sort(methods, new Comparator() { Arrays.sort(methods, new Comparator() {
...@@ -117,7 +117,7 @@ public class Doclet { ...@@ -117,7 +117,7 @@ public class Doclet {
continue; continue;
} }
if(fieldId==0) { if(fieldId==0) {
writer.println("<br><table><tr><th colspan=\"2\">Fields</th></tr>"); writer.println("<br /><table><tr><th colspan=\"2\">Fields</th></tr>");
} }
String name = field.name(); String name = field.name();
String type = getTypeName(true, field.type()); String type = getTypeName(true, field.type());
...@@ -174,7 +174,7 @@ public class Doclet { ...@@ -174,7 +174,7 @@ public class Doclet {
boolean space = false; boolean space = false;
for(int j=0; j<paramTags.length; j++) { for(int j=0; j<paramTags.length; j++) {
if(!space) { if(!space) {
writer.println("<br><br >"); writer.println("<br /><br />");
space = true; space = true;
} }
String p = paramTags[j].parameterName() + " - " + paramTags[j].parameterComment(); String p = paramTags[j].parameterName() + " - " + paramTags[j].parameterComment();
...@@ -186,7 +186,7 @@ public class Doclet { ...@@ -186,7 +186,7 @@ public class Doclet {
Tag[] returnTags = method.tags("return"); Tag[] returnTags = method.tags("return");
if(returnTags != null && returnTags.length>0) { if(returnTags != null && returnTags.length>0) {
if(!space) { if(!space) {
writer.println("<br><br >"); writer.println("<br /><br />");
space = true; space = true;
} }
writer.println("<div class=\"itemTitle\">Returns:</div>"); writer.println("<div class=\"itemTitle\">Returns:</div>");
...@@ -195,7 +195,7 @@ public class Doclet { ...@@ -195,7 +195,7 @@ public class Doclet {
ThrowsTag[] throwsTags = method.throwsTags(); ThrowsTag[] throwsTags = method.throwsTags();
if(throwsTags != null && throwsTags.length > 0) { if(throwsTags != null && throwsTags.length > 0) {
if(!space) { if(!space) {
writer.println("<br><br >"); writer.println("<br /><br />");
space = true; space = true;
} }
writer.println("<div class=\"itemTitle\">Throws:</div>"); writer.println("<div class=\"itemTitle\">Throws:</div>");
...@@ -208,7 +208,7 @@ public class Doclet { ...@@ -208,7 +208,7 @@ public class Doclet {
writer.println("<div class=\"item\">"+p+"</div>"); writer.println("<div class=\"item\">"+p+"</div>");
} }
} }
writer.println("<hr>"); writer.println("<hr />");
} }
writer.println("</div></td></tr></table></body></html>"); writer.println("</div></td></tr></table></body></html>");
writer.close(); writer.close();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论