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

--no commit message

--no commit message
上级 b6a44c99
......@@ -9,7 +9,7 @@ Initial Developer: H2 Group
<title>H2 Documentation</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
</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="overview.html" name="javadoc" />
</frameset>
......
......@@ -79,7 +79,7 @@ public abstract class ScriptBase extends Prepared implements DataHandler {
}
protected String getFileName() throws SQLException {
if (file != null) {
if (fileName != null) {
fileName = file == null ? null : file.getValue(session).getString();
if (fileName == null || fileName.trim().length() == 0) {
fileName = "script.sql";
......
......@@ -19,10 +19,12 @@ import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
import java.util.Properties;
import java.util.Set;
import java.util.TimeZone;
import java.util.Map.Entry;
import org.h2.api.DatabaseEventListener;
import org.h2.constant.SysProperties;
......@@ -353,6 +355,14 @@ public class WebServer implements Service {
byte[] trans = getFile("_text_"+language+".properties");
trace(" "+new String(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) {
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 {
if (tableName.length() == 0) {
out.println("Usage: describe <table name>");
} else {
PreparedStatement prep = null;
ResultSet rs = null;
try {
PreparedStatement prep = conn.prepareStatement(
prep = conn.prepareStatement(
"SELECT CAST(COLUMN_NAME AS VARCHAR(32)) \"Column Name\", " +
"CAST(TYPE_NAME AS VARCHAR(14)) \"Type\", " +
"NUMERIC_PRECISION \"Precision\", " +
......@@ -165,22 +167,28 @@ public class Shell {
"FROM INFORMATION_SCHEMA.COLUMNS " +
"WHERE UPPER(TABLE_NAME)=? ORDER BY ORDINAL_POSITION");
prep.setString(1, tableName.toUpperCase());
ResultSet rs = prep.executeQuery();
rs = prep.executeQuery();
printResult(rs, false);
} catch (SQLException e) {
out.println("Exception: " + e.toString());
e.printStackTrace();
} finally {
JdbcUtils.closeSilently(rs);
JdbcUtils.closeSilently(prep);
}
}
} else if (upper.startsWith("SHOW")) {
ResultSet rs = null;
try {
ResultSet rs = stat.executeQuery(
rs = stat.executeQuery(
"SELECT CAST(TABLE_SCHEMA AS VARCHAR(32)) \"Schema\", TABLE_NAME \"Table Name\" " +
"FROM INFORMATION_SCHEMA.TABLES ORDER BY TABLE_SCHEMA, TABLE_NAME");
printResult(rs, false);
} catch (SQLException e) {
out.println("Exception: " + e.toString());
e.printStackTrace();
} finally {
JdbcUtils.closeSilently(rs);
}
} else if (upper.startsWith("MAXWIDTH")) {
upper = upper.substring("MAXWIDTH".length()).trim();
......@@ -322,9 +330,10 @@ public class Shell {
out.println("Error: " + e.toString());
return;
}
ResultSet rs = null;
try {
if (result) {
ResultSet rs = stat.getResultSet();
rs = stat.getResultSet();
int rowCount = printResult(rs, listMode);
time = System.currentTimeMillis() - time;
out.println("(" + rowCount + (rowCount == 1 ? " row, " : " rows, ") + time + " ms)");
......@@ -336,6 +345,8 @@ public class Shell {
} catch (SQLException e) {
out.println("Error: " + e.toString());
e.printStackTrace();
} finally {
JdbcUtils.closeSilently(rs);
}
}
......
......@@ -159,8 +159,7 @@ java org.h2.test.TestAll timer
/*
Fix ScriptBase.getFileName()
Fix Shell.java 159 (close PreparedStatement)
Shell.java 159 (close PreparedStatement)
Browser problems:
There has been a reported incompatibility with the
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论