提交 54385eb0 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 b6a44c99
...@@ -9,7 +9,7 @@ Initial Developer: H2 Group ...@@ -9,7 +9,7 @@ Initial Developer: H2 Group
<title>H2 Documentation</title> <title>H2 Documentation</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" /> <link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head> </head>
<frameset cols="185,*" rows="*" frameborder="2" framespacing="4" border="4" > <frameset cols="194,*" rows="*" frameborder="2" framespacing="4" border="4" >
<frame frameborder="0" marginheight="0" marginwidth="0" src="classes.html" name="classes" /> <frame frameborder="0" marginheight="0" marginwidth="0" src="classes.html" name="classes" />
<frame frameborder="0" marginheight="0" marginwidth="0" src="overview.html" name="javadoc" /> <frame frameborder="0" marginheight="0" marginwidth="0" src="overview.html" name="javadoc" />
</frameset> </frameset>
......
...@@ -79,7 +79,7 @@ public abstract class ScriptBase extends Prepared implements DataHandler { ...@@ -79,7 +79,7 @@ public abstract class ScriptBase extends Prepared implements DataHandler {
} }
protected String getFileName() throws SQLException { protected String getFileName() throws SQLException {
if (file != null) { if (fileName != null) {
fileName = file == null ? null : file.getValue(session).getString(); fileName = file == null ? null : file.getValue(session).getString();
if (fileName == null || fileName.trim().length() == 0) { if (fileName == null || fileName.trim().length() == 0) {
fileName = "script.sql"; fileName = "script.sql";
......
...@@ -19,10 +19,12 @@ import java.util.Collections; ...@@ -19,10 +19,12 @@ import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale; import java.util.Locale;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.Map.Entry;
import org.h2.api.DatabaseEventListener; import org.h2.api.DatabaseEventListener;
import org.h2.constant.SysProperties; import org.h2.constant.SysProperties;
...@@ -353,6 +355,14 @@ public class WebServer implements Service { ...@@ -353,6 +355,14 @@ public class WebServer implements Service {
byte[] trans = getFile("_text_"+language+".properties"); byte[] trans = getFile("_text_"+language+".properties");
trace(" "+new String(trans)); trace(" "+new String(trans));
text.load(new ByteArrayInputStream(trans)); text.load(new ByteArrayInputStream(trans));
// remove starting # (if not translated yet)
for (Iterator it = text.entrySet().iterator(); it.hasNext();) {
Entry entry = (Entry) it.next();
String value = (String) entry.getValue();
if (value.startsWith("#")) {
entry.setValue(value.substring(1));
}
}
} catch (IOException e) { } catch (IOException e) {
TraceSystem.traceThrowable(e); TraceSystem.traceThrowable(e);
} }
......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
Initial Developer: H2 Group
-->
<html><head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>${text.a.title}</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
<script type="text/javascript">
<!--
if(self != top) {
top.location = "main.jsp";
}
//-->
</script>
</head>
<body margin="10">
<h1>Welcome to H2</h1>
<h2><a href="index.jsp">Connect</a></h2>
Login to a database.
<h2><a href="docs.jsp">Documentation</a></h2>
View the online documentation.
<h2><a href="admin.jsp">Preferences</a></h2>
Allows to you to view and change server settings.
</body></html>
\ No newline at end of file
...@@ -155,8 +155,10 @@ public class Shell { ...@@ -155,8 +155,10 @@ public class Shell {
if (tableName.length() == 0) { if (tableName.length() == 0) {
out.println("Usage: describe <table name>"); out.println("Usage: describe <table name>");
} else { } else {
PreparedStatement prep = null;
ResultSet rs = null;
try { try {
PreparedStatement prep = conn.prepareStatement( prep = conn.prepareStatement(
"SELECT CAST(COLUMN_NAME AS VARCHAR(32)) \"Column Name\", " + "SELECT CAST(COLUMN_NAME AS VARCHAR(32)) \"Column Name\", " +
"CAST(TYPE_NAME AS VARCHAR(14)) \"Type\", " + "CAST(TYPE_NAME AS VARCHAR(14)) \"Type\", " +
"NUMERIC_PRECISION \"Precision\", " + "NUMERIC_PRECISION \"Precision\", " +
...@@ -165,22 +167,28 @@ public class Shell { ...@@ -165,22 +167,28 @@ public class Shell {
"FROM INFORMATION_SCHEMA.COLUMNS " + "FROM INFORMATION_SCHEMA.COLUMNS " +
"WHERE UPPER(TABLE_NAME)=? ORDER BY ORDINAL_POSITION"); "WHERE UPPER(TABLE_NAME)=? ORDER BY ORDINAL_POSITION");
prep.setString(1, tableName.toUpperCase()); prep.setString(1, tableName.toUpperCase());
ResultSet rs = prep.executeQuery(); rs = prep.executeQuery();
printResult(rs, false); printResult(rs, false);
} catch (SQLException e) { } catch (SQLException e) {
out.println("Exception: " + e.toString()); out.println("Exception: " + e.toString());
e.printStackTrace(); e.printStackTrace();
} finally {
JdbcUtils.closeSilently(rs);
JdbcUtils.closeSilently(prep);
} }
} }
} else if (upper.startsWith("SHOW")) { } else if (upper.startsWith("SHOW")) {
ResultSet rs = null;
try { try {
ResultSet rs = stat.executeQuery( rs = stat.executeQuery(
"SELECT CAST(TABLE_SCHEMA AS VARCHAR(32)) \"Schema\", TABLE_NAME \"Table Name\" " + "SELECT CAST(TABLE_SCHEMA AS VARCHAR(32)) \"Schema\", TABLE_NAME \"Table Name\" " +
"FROM INFORMATION_SCHEMA.TABLES ORDER BY TABLE_SCHEMA, TABLE_NAME"); "FROM INFORMATION_SCHEMA.TABLES ORDER BY TABLE_SCHEMA, TABLE_NAME");
printResult(rs, false); printResult(rs, false);
} catch (SQLException e) { } catch (SQLException e) {
out.println("Exception: " + e.toString()); out.println("Exception: " + e.toString());
e.printStackTrace(); e.printStackTrace();
} finally {
JdbcUtils.closeSilently(rs);
} }
} else if (upper.startsWith("MAXWIDTH")) { } else if (upper.startsWith("MAXWIDTH")) {
upper = upper.substring("MAXWIDTH".length()).trim(); upper = upper.substring("MAXWIDTH".length()).trim();
...@@ -322,9 +330,10 @@ public class Shell { ...@@ -322,9 +330,10 @@ public class Shell {
out.println("Error: " + e.toString()); out.println("Error: " + e.toString());
return; return;
} }
ResultSet rs = null;
try { try {
if (result) { if (result) {
ResultSet rs = stat.getResultSet(); rs = stat.getResultSet();
int rowCount = printResult(rs, listMode); int rowCount = printResult(rs, listMode);
time = System.currentTimeMillis() - time; time = System.currentTimeMillis() - time;
out.println("(" + rowCount + (rowCount == 1 ? " row, " : " rows, ") + time + " ms)"); out.println("(" + rowCount + (rowCount == 1 ? " row, " : " rows, ") + time + " ms)");
...@@ -336,6 +345,8 @@ public class Shell { ...@@ -336,6 +345,8 @@ public class Shell {
} catch (SQLException e) { } catch (SQLException e) {
out.println("Error: " + e.toString()); out.println("Error: " + e.toString());
e.printStackTrace(); e.printStackTrace();
} finally {
JdbcUtils.closeSilently(rs);
} }
} }
......
...@@ -159,8 +159,7 @@ java org.h2.test.TestAll timer ...@@ -159,8 +159,7 @@ java org.h2.test.TestAll timer
/* /*
Fix ScriptBase.getFileName() Shell.java 159 (close PreparedStatement)
Fix Shell.java 159 (close PreparedStatement)
Browser problems: Browser problems:
There has been a reported incompatibility with the There has been a reported incompatibility with the
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论