提交 2e63b5ff authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 fb586555
...@@ -155,6 +155,7 @@ ...@@ -155,6 +155,7 @@
90132=Aggregat-Funktion {0} nicht gefunden 90132=Aggregat-Funktion {0} nicht gefunden
90133=Kann das Setting {0} nicht \u00E4ndern wenn die Datenbank bereits ge\u00F6ffnet ist 90133=Kann das Setting {0} nicht \u00E4ndern wenn die Datenbank bereits ge\u00F6ffnet ist
90134=Der Zugriff auf die Klasse {0} ist nicht erlaubt 90134=Der Zugriff auf die Klasse {0} ist nicht erlaubt
90135=Die Datenbank befindet sich im Exclusiv Modus; es können keine zusätzlichen Verbindungen geöffnet werden
HY000=Allgemeiner Fehler\: {0} HY000=Allgemeiner Fehler\: {0}
HY004=Unbekannter Datentyp\: {0} HY004=Unbekannter Datentyp\: {0}
HYC00=Dieses Feature wird unterst\u00FCtzt HYC00=Dieses Feature wird unterst\u00FCtzt
......
...@@ -155,6 +155,7 @@ ...@@ -155,6 +155,7 @@
90132=\#Aggregate {0} not found 90132=\#Aggregate {0} not found
90133=\#Cannot change the setting {0} when the database is already open 90133=\#Cannot change the setting {0} when the database is already open
90134=\#Access to the class {0} is denied 90134=\#Access to the class {0} is denied
90135=\#The database is open in exclusive mode; can not open additional connections
HY000=\u4E00\u822C\u30A8\u30E9\u30FC\: {0} HY000=\u4E00\u822C\u30A8\u30E9\u30FC\: {0}
HY004=\u4E0D\u660E\u306A\u30C7\u30FC\u30BF\u578B\: {0} HY004=\u4E0D\u660E\u306A\u30C7\u30FC\u30BF\u578B\: {0}
HYC00=\u6A5F\u80FD\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093 HYC00=\u6A5F\u80FD\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093
......
...@@ -155,6 +155,7 @@ ...@@ -155,6 +155,7 @@
90132=\#Aggregate {0} not found 90132=\#Aggregate {0} not found
90133=\#Cannot change the setting {0} when the database is already open 90133=\#Cannot change the setting {0} when the database is already open
90134=\#Access to the class {0} is denied 90134=\#Access to the class {0} is denied
90135=\#The database is open in exclusive mode; can not open additional connections
HY000=Blad ogolny\: {0} HY000=Blad ogolny\: {0}
HY004=Nieznany typ danyche\: {0} HY004=Nieznany typ danyche\: {0}
HYC00=Cecha nie jest wspierana HYC00=Cecha nie jest wspierana
......
...@@ -155,6 +155,7 @@ ...@@ -155,6 +155,7 @@
90132=Agrega\u00E7\u00E3o {0} n\u00E3o encontrada 90132=Agrega\u00E7\u00E3o {0} n\u00E3o encontrada
90133=\#Cannot change the setting {0} when the database is already open 90133=\#Cannot change the setting {0} when the database is already open
90134=\#Access to the class {0} is denied 90134=\#Access to the class {0} is denied
90135=\#The database is open in exclusive mode; can not open additional connections
HY000=Erro geral\: {0} HY000=Erro geral\: {0}
HY004=Tipo de dados desconhecido\: {0} HY004=Tipo de dados desconhecido\: {0}
HYC00=Recurso n\u00E3o suportado HYC00=Recurso n\u00E3o suportado
......
...@@ -19,6 +19,7 @@ import org.h2.test.db.TestCheckpoint; ...@@ -19,6 +19,7 @@ import org.h2.test.db.TestCheckpoint;
import org.h2.test.db.TestCluster; import org.h2.test.db.TestCluster;
import org.h2.test.db.TestCompatibility; import org.h2.test.db.TestCompatibility;
import org.h2.test.db.TestCsv; import org.h2.test.db.TestCsv;
import org.h2.test.db.TestExclusive;
import org.h2.test.db.TestFullText; import org.h2.test.db.TestFullText;
import org.h2.test.db.TestFunctions; import org.h2.test.db.TestFunctions;
import org.h2.test.db.TestIndex; import org.h2.test.db.TestIndex;
...@@ -152,17 +153,6 @@ java org.h2.test.TestAll timer ...@@ -152,17 +153,6 @@ java org.h2.test.TestAll timer
/* /*
test & document exclusive mode
test exclusive mode (inform_schema.settings table, disallow new connections, delay operations by other,
disable when close session, disable
translate error code 90135
C:\temp\test\db C:\temp\test\db
Web site: Web site:
...@@ -566,6 +556,7 @@ Features of H2 ...@@ -566,6 +556,7 @@ Features of H2
new TestCluster().runTest(this); new TestCluster().runTest(this);
new TestCompatibility().runTest(this); new TestCompatibility().runTest(this);
new TestCsv().runTest(this); new TestCsv().runTest(this);
new TestExclusive().runTest(this);
new TestFullText().runTest(this); new TestFullText().runTest(this);
new TestFunctions().runTest(this); new TestFunctions().runTest(this);
new TestIndex().runTest(this); new TestIndex().runTest(this);
......
/*
* Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package org.h2.test.db;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import org.h2.test.TestBase;
public class TestExclusive extends TestBase {
public void test() throws Exception {
deleteDb("exclusive");
Connection conn = getConnection("exclusive");
Statement stat = conn.createStatement();
stat.execute("set exclusive true");
try {
Connection conn2 = getConnection("exclusive");
conn2.close();
error("unexpected success");
} catch (SQLException e) {
checkNotGeneralException(e);
}
stat.execute("set exclusive false");
Connection conn2 = getConnection("exclusive");
final Statement stat2 = conn2.createStatement();
stat.execute("set exclusive true");
final int[] state = new int[1];
Thread t = new Thread() {
public void run() {
try {
stat2.execute("select * from dual");
if (state[0] != 1) {
new Error("unexpected state: " + state[0]).printStackTrace();
}
state[0] = 2;
} catch (Exception e) {
e.printStackTrace();
}
}
};
t.start();
state[0] = 1;
stat.execute("set exclusive false");
Thread.sleep(100);
check(state[0], 2);
stat.execute("set exclusive true");
conn.close();
// check that exclusive mode is off when disconnected
stat2.execute("select * from dual");
conn2.close();
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论