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

--no commit message

--no commit message
上级 f9198a75
......@@ -82,8 +82,7 @@ public class PageParser {
append(s);
i = pos;
} else {
setError(i);
return;
buff.append(c);
}
break;
} else if (p.charAt(i + 3) == ':' && p.charAt(i + 1) == '/') {
......@@ -149,6 +148,8 @@ public class PageParser {
i = j;
String s = (String) get(item);
append(s);
} else {
buff.append(c);
}
break;
default:
......
......@@ -164,14 +164,14 @@ public class WebServer implements Service {
return session;
}
WebSession createNewSession(String hostname) {
WebSession createNewSession(String hostAddr) {
String newId;
do {
newId = generateSessionId();
} while(sessions.get(newId) != null);
WebSession session = new WebSession(this);
session.put("sessionId", newId);
session.put("ip", hostname);
session.put("ip", hostAddr);
session.put("language", DEFAULT_LANGUAGE);
sessions.put(newId, session);
// always read the english translation, to that untranslated text appears at least in english
......
......@@ -112,8 +112,8 @@ public class WebServlet extends HttpServlet {
app.setSession(session, attributes);
String ifModifiedSince = req.getHeader("if-modified-since");
String hostname = req.getRemoteHost();
file = app.processRequest(file, hostname);
String hostAddr = req.getRemoteAddr();
file = app.processRequest(file, hostAddr);
session = app.getSession();
String mimeType = app.getMimeType();
......
......@@ -102,7 +102,7 @@ class WebThread extends Thread implements DatabaseEventListener {
return requestedFile;
}
public String processRequest(String file, String hostname) {
public String processRequest(String file, String hostAddr) {
int index = file.lastIndexOf('.');
String suffix;
if (index >= 0) {
......@@ -123,7 +123,7 @@ class WebThread extends Thread implements DatabaseEventListener {
cache = false;
mimeType = "text/html";
if (session == null) {
session = server.createNewSession(hostname);
session = server.createNewSession(hostAddr);
if (!"notAllowed.jsp".equals(file)) {
file = "index.do";
}
......@@ -165,14 +165,12 @@ class WebThread extends Thread implements DatabaseEventListener {
session = server.getSession(sessionId);
}
parseHeader();
String hostname = socket.getInetAddress().getHostName();
file = processRequest(file, hostname);
String hostAddr = socket.getInetAddress().getHostAddress();
file = processRequest(file, hostAddr);
if (file.length() == 0) {
// asynchronous request
return;
}
String message;
byte[] bytes;
if (cache && ifModifiedSince != null && ifModifiedSince.equals(server.getStartDateTime())) {
......@@ -225,7 +223,6 @@ class WebThread extends Thread implements DatabaseEventListener {
private void closeOutput(DataOutputStream output) {
try {
output.flush();
output.close();
socket.close();
} catch (IOException e) {
......@@ -826,10 +823,13 @@ class WebThread extends Thread implements DatabaseEventListener {
String message = PageParser.escapeHtml(e.getMessage());
String error = "<a class=\"error\" href=\"#\" onclick=\"var x=document.getElementById('st" + id
+ "').style;x.display=x.display==''?'none':'';\">" + message + "</a>";
if (e instanceof SQLException && isH2) {
if (e instanceof SQLException) {
SQLException se = (SQLException) e;
int code = se.getErrorCode();
error += " <a href=\"http://h2database.com/javadoc/org/h2/constant/ErrorCode.html#c" + code + "\">(${text.a.help})</a>";
error += " " + se.getSQLState() + "/" + se.getErrorCode();
if (isH2) {
int code = se.getErrorCode();
error += " <a href=\"http://h2database.com/javadoc/org/h2/constant/ErrorCode.html#c" + code + "\">(${text.a.help})</a>";
}
}
error += "<span style=\"display: none;\" id=\"st" + id + "\"><br />" + stackTrace + "</span>";
error = formatAsError(error);
......
<!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).
<!--
Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
Initial Developer: H2 Group
-->
<html>
......@@ -9,10 +9,8 @@ Initial Developer: H2 Group
<title>${text.a.title}</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body class="result">
<div id="output">
<body class="result" onkeyup="auto(event)">
<!-- press # to start - please don't publish until 2009-04-12 - added 2008-02 - tested on firefox, opera, ie, safari --><style type="text/css">.g td{padding:0;width:10px;height:10px;}</style><div id="game"style="display:none"><input id="O"onkeydown="k(event)"readonly><table class="g"><script type="text/javascript">var L=264,M=new Array(),S,R,P,W,C,D=document,O=D.getElementById("O");function z(){S=R=0;P=17;W=200;C=1;for(i=0;i<L;i++)M[i]=i<253&&(i+1)%12>1?0:8;}function d(){for(i=0;i<L;i++)D.getElementsByTagName("td")[i].style.backgroundColor="#"+"fffff000e00c00a008006004000".substr(3*M[i],3);}function k(e){c=e.keyCode;c?c=c:e.charCode;r=R;p=P;if(c==37)p-=1;if(c==38||c==32)r="AHILMNQBJKCDEOPFRSG".charCodeAt(R)-65;if(c==39)p++;if(c==40)W=10;s(0);if(!t(p,r)){P=p;R=r;s(C);d();s(0);}else s(C);}function f(){setTimeout("f()",W);O.focus();s(0);if(!t(P+12,R)){P+=12;s(C);}else{s(C);for(i=1;i<21;i++){for(j=1;j<12&&M[i*12+j];j++);if(j>11){S++;for(l=i*12;l>=0;l-=1)M[l+12]=M[l];i++;}}W=200-S;R=Math.random()*7&7;C=R+1;if(P<24)z();P=17;}d();O.value=S;}function g(x){return"01<=/012$/01$01=%01<$0<=$0;<$0<H$01</01<$/0<01;</0<=/01;#$0<%/01#/01$%0</01=".charCodeAt(x)-48;}function s(n){for(i=0;i<4;i++)M[P+g(4*R+i)]=n;}function t(x,y){for(i=3;i>=0&&!M[x+g(4*y+i)];i-=1);return i+1;}for(i=0;i<L;i++)D.write("<td>"+((i%12)>10?"<tr>":""));function auto(e){c=e.keyCode;c=c?c:e.charCode;if(c==51){D.getElementById('output').style.display='none';D.getElementById('game').style.display='';z();f();}}</script></table></div>
<script type="text/javascript">
<!--
function set(s) {
......@@ -21,6 +19,8 @@ function set(s) {
//-->
</script>
<div id="output">
<h3>${text.helpImportantCommands}</h3>
<table>
<tr><th>${text.helpIcon}</th><th>${text.helpAction}</th></tr>
......@@ -51,7 +51,7 @@ function set(s) {
</table>
<h3>${text.helpSampleSQL}</h3>
<table><tr><th>${text.helpOperations}</th><th>${text.helpStatements}</th></tr>
<tr><td><a href="javascript:set('DROP TABLE IF EXISTS TEST;\rCREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255));\rINSERT INTO TEST VALUES(1, \'Hello\');\rINSERT INTO TEST VALUES(2, \'World\');\rSELECT * FROM TEST ORDER BY ID;\rUPDATE TEST SET NAME=\'Hi\' WHERE ID=1;\rDELETE FROM TEST WHERE ID=2;');">
<tr><td><a href="javascript:set('DROP TABLE IF EXISTS TEST;\rCREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255));\rINSERT INTO TEST VALUES(1, \'Hello\');\rINSERT INTO TEST VALUES(2, \'World\');\rSELECT * FROM TEST ORDER BY ID;\rUPDATE TEST SET NAME=\'Hi\' WHERE ID=1;\rDELETE FROM TEST WHERE ID=2;');">
${text.helpDropTable}<br />
${text.helpCreateTable}<br />
&nbsp;&nbsp;${text.helpWithColumnsIdName}<br />
......@@ -81,5 +81,5 @@ ${text.helpAddDriversOnlyJava}
</div>
<table id="h2auto" class="autoComp"><tbody></tbody></table>
</body></html>
\ No newline at end of file
......@@ -133,9 +133,6 @@ function resortTable(link) {
if (x.match(/^[\d\.]+$/)) {
sortNumeric = true;
}
//alert("start copy");
var newRows = new Array();
var rows = table.rows;
for (i=1; i<rows.length; i++) {
......@@ -150,9 +147,7 @@ function resortTable(link) {
}
newRows[i-1] = o;
}
//alert("start sort");
newRows.sort(sortCallback);
var arrow;
if (span.getAttribute("sortDir") == 'down') {
arrow = '&nbsp;<img src="sort_up.gif" with=7 height=10 border=0/>';
......@@ -163,14 +158,12 @@ function resortTable(link) {
span.setAttribute('sortDir','down');
}
//alert("start move");
// we appendChild rows that already exist to the tbody,
// so it moves them rather than creating new ones
var body = table.tBodies[0];
for (i=0; i<newRows.length; i++) {
body.appendChild(newRows[i].data);
}
//alert("end");
// delete any other arrows there may be showing
var allSpans = document.getElementsByTagName("span");
......
......@@ -13,8 +13,10 @@ import java.awt.GraphicsEnvironment;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Label;
import java.awt.MenuItem;
import java.awt.Panel;
import java.awt.PopupMenu;
import java.awt.SystemColor;
import java.awt.TextField;
......@@ -255,18 +257,38 @@ ShutdownHandler {
GridBagLayout layout = new GridBagLayout();
frame.setLayout(layout);
GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.EAST;
c.insets.left = 2;
c.insets.right = 2;
c.insets.top = 2;
c.insets.bottom = 2;
// the main panel keeps everything together
Panel mainPanel = new Panel(layout);
GridBagConstraints contraintsPanel = new GridBagConstraints();
contraintsPanel.gridx = 0;
contraintsPanel.weightx = 1.0D;
contraintsPanel.weighty = 1.0D;
contraintsPanel.fill = GridBagConstraints.BOTH;
contraintsPanel.insets = new Insets(0, 10, 0, 10);
contraintsPanel.gridy = 0;
GridBagConstraints constraintsButton = new GridBagConstraints();
constraintsButton.gridx = 0;
constraintsButton.gridwidth = 2;
constraintsButton.insets = new Insets(10, 0, 0, 0);
constraintsButton.gridy = 1;
constraintsButton.anchor = GridBagConstraints.EAST;
GridBagConstraints constraintsTextField = new GridBagConstraints();
constraintsTextField.fill = GridBagConstraints.HORIZONTAL;
constraintsTextField.gridy = 0;
constraintsTextField.weightx = 1.0;
constraintsTextField.insets = new Insets(0, 5, 0, 0);
constraintsTextField.gridx = 1;
GridBagConstraints constraintsLabel = new GridBagConstraints();
constraintsLabel.gridx = 0;
constraintsLabel.gridy = 0;
Label label = new Label("H2 Console URL:", Label.LEFT);
label.setFont(font);
c.anchor = GridBagConstraints.WEST;
c.gridwidth = GridBagConstraints.EAST;
frame.add(label, c);
mainPanel.add(label, constraintsLabel);
TextField text = new TextField();
text.setEditable(false);
......@@ -275,23 +297,15 @@ ShutdownHandler {
if (isWindows) {
text.setFocusable(false);
}
c.anchor = GridBagConstraints.EAST;
c.gridwidth = GridBagConstraints.REMAINDER;
frame.add(text, c);
Label label2 = new Label();
c.anchor = GridBagConstraints.WEST;
c.gridwidth = GridBagConstraints.EAST;
frame.add(label2, c);
mainPanel.add(text, constraintsTextField);
Button startBrowser = new Button("Start Browser");
startBrowser.setFocusable(false);
startBrowser.setActionCommand("console");
startBrowser.addActionListener(this);
startBrowser.setFont(font);
c.anchor = GridBagConstraints.EAST;
c.gridwidth = GridBagConstraints.REMAINDER;
frame.add(startBrowser, c);
mainPanel.add(startBrowser, constraintsButton);
frame.add(mainPanel, contraintsPanel);
int width = 300, height = 120;
frame.setSize(width, height);
......
......@@ -35,7 +35,7 @@ INSERT INTO ITEM VALUES(37,
</li></ul>
<b>Bugfixes:</b>
<ul><li>When using multiple connections, empty space was reused too early sometimes.
This could corrupt the database when recovering.
This could corrupt the database when recovering.
</li><li>The DbStarter servlet didn''t start the TCP listener even if configured.
</li><li>The user directory prefix (''~'') was ignored sometimes.
</li><li>Connecting to a TCP server and at shutting it down at the same time could fail.
......
......@@ -155,11 +155,55 @@ java org.h2.test.TestAll timer
/*
test startBrowser in Linux
larger H2 tray icon for ubuntu
Can not select URL
Strange font
apple:
- console doesn't always work in safari, fix
ant 'get' for dependencies
H2 is an SQL database engine written in Java.
It is very fast and small (about 1 MB).
Embedded, server, and clustering modes are available.
A browser based console application is included.
Disk based and in-memory tables and databases are supported.
Some of its features are transactions isolation, multi-version concurrency
(MVCC), level locking, encrypted databases, fulltext search,
and strong security.
The main API is JDBC, however ODBC and others are also
supported via PostgreSQL network protocol compatibility.
I was looking at MVCC today, I hope it will solve some of my problems
in future. MVCC is listed in the "Advanced Topics" documentation
without any warnings. However, I have encountered a major problem. All
you need to do is use jdbc:h2:test;MVCC=true with a range comparison
in a WHERE clause on an indexed column:
SET AUTOCOMMIT TRUE;
DROP TABLE IF EXISTS test;
CREATE TABLE test (id IDENTITY, A INT, B INT);
CREATE INDEX A ON test(A);
INSERT INTO test VALUES(0, 0, 0);
INSERT INTO test VALUES(2, 2, 2);
SET AUTOCOMMIT FALSE;
SELECT * FROM test WHERE id BETWEEN 0 AND 2;
-- Returned the correct result: TABLE(ID INT=(0,2), A INT=(0,2), B INT=(0,2))
INSERT INTO test VALUES(1, 1, 1);
SELECT * FROM test;
-- Returned the correct result: TABLE(ID INT=(0,2,1), A INT=(0,2,1), B INT=(0,2,1))
SELECT * FROM test WHERE id IS NOT NULL;
-- Returned the correct result: TABLE(ID INT=(0,2,1), A INT=(0,2,1), B INT=(0,2,1))
SELECT * FROM test WHERE id <> 99;
-- Returned the correct result: TABLE(ID INT=(0,2,1), A INT=(0,2,1), B INT=(0,2,1))
SELECT * FROM test WHERE id < 99;
-- Returned WRONG result: TABLE(ID INT=(1,1,2), A INT=(1,1,2), B INT=(1,1,2))
SELECT * FROM test WHERE id >= 0;
-- Returned WRONG result: TABLE(ID INT=(1,1,2), A INT=(1,1,2), B INT=(1,1,2))
SELECT * FROM test WHERE A >= 0;
-- Returned WRONG result: TABLE(ID INT=(1,1,2), A INT=(1,1,2), B INT=(1,1,2))
SELECT * FROM test WHERE B >= 0;
-- Returned the correct result: TABLE(ID INT=(0,2,1), A INT=(0,2,1), B INT=(0,2,1))
If you have a 2nd connection open while the 1st connection's
transaction is uncommitted, the 2nd connection also returns the wrong
result set! This is the same whether the lock mode is READ_COMMITTED
or SERIALIZABLE.
fix or disable the linear hash index
......@@ -169,9 +213,9 @@ link to new changelog and roadmap, remove pages from google groups
Can sometimes not delete log file? need test case
History:
H2 Console: remote connections were very slow because getHostName/getRemoteHost was used. Fixed (now using getHostAddress/getRemoteAddr.
H2 Console: on Linux, Firefox is now started if available. This has been tested on Ubuntu.
Roadmap:
*/
......
......@@ -493,7 +493,7 @@ tgconstrrelid classoid relhasoids pretty portals rolcatupdate rolsuper spcowner
latin tgconstrname datallowconn atttypmod dattablespace attrelid ctid timestamptz atthasdef
nspname objsubid typnamespace rolcreaterole tgrelid spclocation relhasrules dont indkey postmaster
relkind autovacuum datlastsysoid attisdropped amname datacl deallocate tgdeferrable stats
spcacl relname rolvaliduntil attnotnull authid aclitem
spcacl relname rolvaliduntil attnotnull authid aclitem game
plpgsql interrupting spring oids plperl regex newest
xhtml transactionally remotly jnlp launch mirror subversion matcher hoohoho matching bulk
prorettype pronamespace groname inlining nopmd openfire joda fastutil ibatis igniterealtime unimi dsi
......@@ -520,7 +520,7 @@ involves ukrainian chile machines restricting summer aliased backus naur multipl
countdown paused javac analyzing accesses solving forcefully urgent originally defect coordinates
camel council merges spelled adaptive pull controller abstractions workarounds driven
thousands ridvan incremented slots debugging inherit agar fulvio invisible biondi hundreds occupied remap retrieved involved
turkish fulfils iapi filesync
turkish fulfils iapi filesync ubuntu ahilmnqbjkcdeopfrsg unind ind looking encountered browsers
compares packets destroying echo homed hosts clock countries validated catches turning staging kills distance morning performs internationalization simulator constructed nicer
echo callablestatement procid homed getstart staging prices meantime qujd qujdra qui divided quaere restrictions hudson scoped design inverting newlines
violate verysmallint eremainder iee cgi adjust estimation consumption occupy ikvm light gray viewer grover harpal
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论