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

--no commit message

--no commit message
上级 b299be02
......@@ -38,6 +38,7 @@
<javac destdir="bin" debug="true" debuglevel="lines,source" >
<classpath location="ext/servlet-api-2.4.jar" />
<classpath location="ext/lucene-core-2.2.0.jar" />
<classpath location="ext/slf4j-api-1.5.0.jar" />
<src path="src/main"/>
<src path="src/test"/>
<src path="src/tools"/>
......
......@@ -17,7 +17,22 @@ Change Log
<h2>Next Version (unreleased)</h2>
<ul>
<li>-
<li>Some databases could not be opened when appending
;RECOVER=1 to the database URL.
</li><li>The Japanese translation of the error messages and the H2 Console
has been completed by Masahiro Ikemoto (Arizona Design Inc.)
</li><li>Updates made to updatable rows are now visible within the same result set.
DatabaseMetaData.ownUpdatesAreVisible now returns true.
</li><li>ParameterMetaData now returns the correct data
for INSERT and UPDATE statements.
</li><li>H2 Shell: DESCRIBE now supports an schema name.
</li><li>A subset of the PostgreSQL 'dollar quoting' feature is now supported.
</li><li>SLF4J is now supported by using adding TRACE_LEVEL_FILE=4
to the database URL.
</li><li>The recovery tool did not work if the table name contained spaces
or if there was a comment on the table.
</li><li>Triggers are no longer executed when executing an changing the table
structure (ALTER TABLE).
</li></ul>
<h2>Version 1.0.71 (2008-04-25)</h2>
......
......@@ -28,6 +28,8 @@ Seam In Action</a>
Spatial capabilities</a>
<h2>Blogs</h2>
<a href="http://zvikico.typepad.com/problog/2008/04/h2-performance.html">
H2 Database - Performance Tracing (2008-04-30)</a><br />
<a href="http://www.bluedevel.com/blog/?p=12">
Testing your JDBC data access layer with DBUnit and H2 (2007-09-18)</a><br />
<a href="http://www.encorewiki.org/display/encore/Open+Source+Databases+Comparison">
......
......@@ -404,6 +404,7 @@ Roadmap
</li><li>Oracle compatibility: support NLS_DATE_FORMAT.
</li><li>Support flashback queries as in Oracle.
</li><li>Import / Export of fixed with text files.
</li><li>Support for OUT parameters in user-defined procedures.
</li></ul>
<h2>Not Planned</h2>
......
......@@ -185,8 +185,8 @@ public class Parser {
private ObjectArray indexedParameterList;
public Parser(Session session) {
this.session = session;
database = session.getDatabase();
this.session = session;
}
/**
......
......@@ -7,6 +7,7 @@
package org.h2.command.ddl;
import java.sql.SQLException;
import org.h2.command.Parser;
import org.h2.command.Prepared;
import org.h2.constant.ErrorCode;
......@@ -23,6 +24,7 @@ import org.h2.result.LocalResult;
import org.h2.schema.Schema;
import org.h2.schema.SchemaObject;
import org.h2.schema.Sequence;
import org.h2.schema.TriggerObject;
import org.h2.table.Column;
import org.h2.table.Table;
import org.h2.table.TableData;
......@@ -244,6 +246,7 @@ public class AlterTableAlterColumn extends SchemaCommand {
execute(newTable.getCreateSQL(), true);
newTable = (TableData) newTable.getSchema().getTableOrView(session, newTable.getName());
ObjectArray children = table.getChildren();
ObjectArray triggers = new ObjectArray();
for (int i = 0; i < children.size(); i++) {
DbObject child = (DbObject) children.get(i);
if (child instanceof Sequence) {
......@@ -273,9 +276,13 @@ public class AlterTableAlterColumn extends SchemaCommand {
sql = child.getCreateSQLForCopy(newTable, quotedName);
}
if (sql != null) {
if (child instanceof TriggerObject) {
triggers.add(sql);
} else {
execute(sql, true);
}
}
}
StringBuffer columnList = new StringBuffer();
for (int i = 0; i < newColumns.size(); i++) {
Column nc = (Column) newColumns.get(i);
......@@ -332,6 +339,10 @@ public class AlterTableAlterColumn extends SchemaCommand {
columns[i].setSequence(null);
}
}
for (int i = 0; i < triggers.size(); i++) {
sql = (String) triggers.get(i);
execute(sql, true);
}
execute("DROP TABLE " + table.getSQL(), true);
db.renameSchemaObject(session, newTable, tableName);
children = newTable.getChildren();
......
......@@ -78,7 +78,7 @@ public class TraceSystem implements TraceWriter {
}
}
public Trace getTrace(String module) {
public synchronized Trace getTrace(String module) {
Trace t = (Trace) traces.get(module);
if (t == null) {
t = new Trace(writer, module);
......
......@@ -78,7 +78,7 @@
90055=Chiffre nicht unterst\u00FCtzt\: {0}
90056=Kein Vorgabewert f\u00FCr Feld {0}
90057=Bedingung {0} nicht gefunden
90058=Doppelter Tabellen- oder Alias-Name {0}
90058=Innerhalb eines Triggers sind Commit und Rollback ist nicht erlaubt
90059=Mehrdeutiger Feldname {0}
90060=Ung\u00FCltige Datei-Sperr-Methode {0}
90061=Fehler beim \u00D6ffnen von Port {0} (Port wird ev. bereits verwendet), Grund\: {1}
......
......@@ -78,7 +78,7 @@
90055=Unsupported cipher {0}
90056=No default value is set for column {0}
90057=Constraint {0} not found
90058=Duplicate table or table alias {0}
90058=Commit or rollback is not allowed within a trigger
90059=Ambiguous column name {0}
90060=Unsupported file lock method {0}
90061=Exception opening port {0} (port may be in use), cause\: {1}
......
......@@ -78,7 +78,7 @@
90055={0} \u306F\u672A\u30B5\u30DD\u30FC\u30C8\u306E\u6697\u53F7\u3067\u3059
90056=\u5217 {0} \u306B\u30C7\u30D5\u30A9\u30EB\u30C8\u5024\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
90057=\u5236\u7D04 {0} \u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
90058=\u30C6\u30FC\u30D6\u30EB\u304B\u3001\u30C6\u30FC\u30D6\u30EB\u306E\u5225\u540D {0} \u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059
90058=\#Commit or rollback is not allowed within a trigger
90059=\u5217\u540D {0} \u304C\u3042\u3044\u307E\u3044\u3067\u3059
90060={0} \u306F\u672A\u30B5\u30DD\u30FC\u30C8\u306E\u30D5\u30A1\u30A4\u30EB\u30ED\u30C3\u30AF\u65B9\u5F0F\u3067\u3059
90061=\u30DD\u30FC\u30C8 {0} \u3092\u30AA\u30FC\u30D7\u30F3\u4E2D\u306B\u4F8B\u5916\u304C\u767A\u751F\u3057\u307E\u3057\u305F (\u30DD\u30FC\u30C8\u304C\u4F7F\u7528\u4E2D\u306E\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059)
......
......@@ -78,7 +78,7 @@
90055=Unsupported cipher {0}
90056=Brak domyslnej wartosci dla kolumny {0}
90057=Ograniczenie {0} nie istnieje
90058=Zduplikowana tabela lub alias tabeli {0}
90058=\#Commit or rollback is not allowed within a trigger
90059=Niejednoznaczna nazwa kolumny {0}
90060=Niewspierana metoda blokowania pliku {0}
90061=\#Exception opening port {0} (port may be in use), cause\: {1}
......
......@@ -78,7 +78,7 @@
90055=Cipher {0} n\u00E3o \u00E9 suportado
90056=Nenhum valor pr\u00E9-definido foi especificado para a coluna {0}
90057=Restri\u00E7\u00E3o {0} n\u00E3o foi encontrada
90058=Tabela {0} duplicada ou o nome alternativo est\u00E1 duplicado
90058=\#Commit or rollback is not allowed within a trigger
90059=Nome da coluna {0} \u00E9 amb\u00EDguo.
90060=N\u00E3o suporta o m\u00E9todo do arquivo de bloqueio {0}
90061=Exce\u00E7\u00E3o ao abrir no porto {0} (provavelmente est\u00E1 em uso), causa\: {1}
......
......@@ -849,13 +849,9 @@ e.printStackTrace();
schema.add(meta);
if (meta.getObjectType() == DbObject.TABLE_OR_VIEW) {
String sql = data[3].getString();
int end = sql.indexOf('(');
if (end >= 0) {
int start = sql.lastIndexOf(' ', end);
String name = sql.substring(start, end).trim();
String name = extractTableOrViewName(sql);
tableMap.put(ObjectUtils.getInteger(meta.getId()), name);
}
}
} catch (Throwable t) {
writeError(writer, t);
}
......@@ -889,6 +885,37 @@ e.printStackTrace();
}
}
private String extractTableOrViewName(String sql) {
int indexTable = sql.indexOf(" TABLE ");
int indexView = sql.indexOf(" VIEW ");
if (indexTable > 0 && indexView > 0) {
if (indexTable < indexView) {
indexView = -1;
} else {
indexTable = -1;
}
}
if (indexView > 0) {
sql = sql.substring(indexView + " VIEW ".length());
} else if (indexTable > 0) {
sql = sql.substring(indexTable + " TABLE ".length());
} else {
return "UNKNOWN";
}
boolean ignore = false;
for (int i = 0; i < sql.length(); i++) {
char ch = sql.charAt(i);
if (ch == '\"') {
ignore = !ignore;
} else if (!ignore && (ch <= ' ' || ch == '(')) {
sql = sql.substring(0, i);
return sql;
}
}
return "UNKNOWN";
}
private void closeSilently(FileStore store) {
if (store != null) {
store.closeSilently();
......
......@@ -160,10 +160,6 @@ java org.h2.test.TestAll timer
/*
test and document log_level_file=4
deactivate triggers during alter table (during re-creating a table)
improve javadocs
upload jazoon
......@@ -215,18 +211,6 @@ Add where required // TODO: change in version 1.1
http://www.w3schools.com/sql/
History:
Some databases could not be opened when appending
;RECOVER=1 to the database URL.
The Japanese translation of the error messages and the H2 Console
has been completed by Masahiro Ikemoto (Arizona Design Inc.)
Updates made to updatable rows are now visible within the same result set.
DatabaseMetaData.ownUpdatesAreVisible now returns true.
ParameterMetaData now returns the correct data
for INSERT and UPDATE statements.
H2 Shell: DESCRIBE now supports an schema name.
A subset of the PostgreSQL 'dollar quoting' feature is now supported.
SLF4J is now supported by using adding TRACE_LEVEL_FILE=4
to the database URL.
Roadmap:
......
......@@ -25,10 +25,40 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
public void test() throws Exception {
deleteDb("trigger");
testTriggerAlterTable();
testTriggers();
testConstraints();
}
public static class Test implements Trigger {
public void fire(Connection conn, Object[] oldRow, Object[] newRow) throws SQLException {
conn.createStatement().execute("call seq.nextval");
}
public void init(Connection conn, String schemaName, String triggerName, String tableName, boolean before,
int type) throws SQLException {
}
}
private void testTriggerAlterTable() throws Exception {
Connection conn = getConnection("trigger");
Statement stat = conn.createStatement();
stat.execute("DROP TABLE IF EXISTS TEST");
stat.execute("create sequence seq");
stat.execute("create table test(id int primary key)");
checkSingleValue(stat, "call seq.nextval", 1);
conn.setAutoCommit(false);
stat.execute("create trigger test_upd before insert on test call \"" + Test.class.getName() + "\"");
stat.execute("insert into test values(1)");
checkSingleValue(stat, "call seq.nextval", 3);
stat.execute("alter table test add column name varchar");
checkSingleValue(stat, "call seq.nextval", 4);
stat.execute("drop sequence seq");
stat.execute("drop table test");
conn.close();
}
private void testConstraints() throws Exception {
Connection conn = getConnection("trigger");
Statement stat = conn.createStatement();
......
......@@ -30,17 +30,24 @@ I am sorry to say that, but it looks like a corruption problem. I am very intere
- What is your database URL?
- You can find out if the database is corrupted when running SCRIPT TO 'test.sql'
- What version H2 are you using?
- With which version of H2 was this database created? You can find it out using: select * from information_schema.settings where name='info.BUILD_ID'
- With which version of H2 was this database created? You can find it out using:
select * from information_schema.settings where name='info.BUILD_ID'
- Did you use multiple connections?
- The first workarounds is: append ;RECOVER=1 to the database URL. Does it work when you do this?
- The second workarounds is: delete the index.db file (it is re-created automatically) and try again. Does it work when you do this?
- The third workarounds is: use the tool org.h2.tools.Recover to create the SQL script file, and then re-create the database using this script. Does it work when you do this?
- Do you use any settings or special features (for example, the setting LOG=0, or two phase commit, linked tables, cache settings)?
- The first workarounds is: append ;RECOVER=1 to the database URL.
Does it work when you do this?
- The second workarounds is: delete the index.db file (it is re-created automatically)
and try again. Does it work when you do this?
- The third workarounds is: use the tool org.h2.tools.Recover to create the SQL script file,
and then re-create the database using this script. Does it work when you do this?
- Do you use any settings or special features (for example, the setting LOG=0,
or two phase commit, linked tables, cache settings)?
- Is the application multi-threaded?
- On what operating system, file system, and virtual machine (java -version)?
- How big is the database?
- Is the database usually closed normally, or is process terminated forcefully or the computer switched off?
- Is the database usually closed normally, or is process terminated forcefully
or the computer switched off?
- Is it possible to reproduce this problem using a fresh database (sometimes, or always)?
- Are there any other exceptions (maybe in the .trace.db file)? Could you send them to me please?
- Are there any other exceptions (maybe in the .trace.db file)?
Could you send them to me please?
- Do you still have any .trace.db files, and if yes could you send them?
- Could you send me the .data.db file where this exception occurs?
......@@ -245,7 +245,8 @@ public class TestTools extends TestBase {
Connection conn = DriverManager.getConnection(url, "sa", "sa");
Statement stat = conn.createStatement();
stat.execute("create table test(id int primary key, name varchar, b blob, c clob)");
stat.execute("create table test2(id int primary key, name varchar)");
stat.execute("create table \"test 2\"(id int primary key, name varchar)");
stat.execute("comment on table test is ';-)'");
stat.execute("insert into test values(1, 'Hello', SECURE_RAND(2000), space(2000))");
ResultSet rs;
rs = stat.executeQuery("select * from test");
......@@ -259,7 +260,7 @@ public class TestTools extends TestBase {
conn = DriverManager.getConnection(url, "another", "another");
stat = conn.createStatement();
stat.execute("runscript from '" + baseDir + "/toolsRecover.data.sql'");
rs = stat.executeQuery("select * from test2");
rs = stat.executeQuery("select * from \"test 2\"");
checkFalse(rs.next());
rs = stat.executeQuery("select * from test");
rs.next();
......
......@@ -46,10 +46,11 @@ public class Build extends BuildBase {
mkdir("temp");
resources(clientOnly);
download();
String classpath = "temp" + File.pathSeparatorChar + "ext/servlet-api-2.4.jar" + File.pathSeparatorChar
+ "ext/lucene-core-2.2.0.jar" + File.pathSeparator + System.getProperty("java.home")
+ "/../lib/tools.jar";
String classpath = "temp" +
File.pathSeparator + "ext/servlet-api-2.4.jar" +
File.pathSeparator + "ext/lucene-core-2.2.0.jar" +
File.pathSeparator + "ext/slf4j-api-1.5.0.jar" +
File.pathSeparator + System.getProperty("java.home") + "/../lib/tools.jar";
FileList files;
if (clientOnly) {
files = getFiles("src/main/org/h2/Driver.java");
......@@ -175,16 +176,20 @@ public class Build extends BuildBase {
"-sourcepath", "src/main" + File.pathSeparator + "src/test" + File.pathSeparator + "src/tools" ,
"-noindex",
"-d", "docs/javadocImpl2",
"-classpath", "ext/servlet-api-2.4.jar" + File.pathSeparator + "ext/lucene-core-2.2.0.jar" +
File.pathSeparator + System.getProperty("java.home") + "/../lib/tools.jar",
"-classpath", System.getProperty("java.home") + "/../lib/tools.jar" +
File.pathSeparator + "ext/slf4j-api-1.5.0.jar" +
File.pathSeparator + "ext/servlet-api-2.4.jar" +
File.pathSeparator + "ext/lucene-core-2.2.0.jar",
"-subpackages", "org.h2",
"-exclude", "org.h2.build.*,org.h2.dev.*" });
System.setProperty("h2.interfacesOnly", "false");
System.setProperty("h2.destDir", "docs/javadocImpl");
javadoc(new String[] {
"-sourcepath", "src/main" + File.pathSeparator + "src/test" + File.pathSeparator + "src/tools",
"-classpath", "ext/servlet-api-2.4.jar" + File.pathSeparator + "ext/lucene-core-2.2.0.jar" +
File.pathSeparator + System.getProperty("java.home") + "/../lib/tools.jar",
"-classpath", System.getProperty("java.home") + "/../lib/tools.jar" +
File.pathSeparator + "ext/slf4j-api-1.5.0.jar" +
File.pathSeparator + "ext/servlet-api-2.4.jar" +
File.pathSeparator + "ext/lucene-core-2.2.0.jar",
"-subpackages", "org.h2",
"-doclet", "org.h2.build.doclet.Doclet" });
copy("docs/javadocImpl", getFiles("src/docsrc/javadoc"), "src/docsrc/javadoc");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论