提交 761c70e8 authored 作者: sylvain-ilm's avatar sylvain-ilm

remove TestAll.stdDropTableRestrict, as requested

上级 efe8c198
......@@ -11,7 +11,6 @@ import java.util.ArrayList;
import java.util.Properties;
import java.util.TimerTask;
import java.util.concurrent.TimeUnit;
import org.h2.Driver;
import org.h2.engine.Constants;
import org.h2.store.fs.FilePathRec;
......@@ -432,8 +431,6 @@ java org.h2.test.TestAll timer
/** If not null the database should be opened with the collation parameter */
public String collation;
public boolean stdDropTableRestrict;
/**
* The AB-BA locking detector.
*/
......@@ -620,7 +617,6 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
defrag = false;
traceLevelFile = throttle = 0;
cipher = null;
stdDropTableRestrict = false;
// memory is a good match for multi-threaded, makes things happen
// faster, more chance of exposing race conditions
......@@ -1130,7 +1126,6 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
appendIf(buff, defrag, "defrag");
appendIf(buff, splitFileSystem, "split");
appendIf(buff, collation != null, collation);
appendIf(buff, stdDropTableRestrict, "stdDropTableRestrict");
return buff.toString();
}
......
......@@ -34,7 +34,6 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.SimpleTimeZone;
import java.util.concurrent.TimeUnit;
import org.h2.jdbc.JdbcConnection;
import org.h2.message.DbException;
import org.h2.store.fs.FilePath;
......@@ -167,8 +166,15 @@ public abstract class TestBase {
* @return the connection
*/
public Connection getConnection(String name) throws SQLException {
return getConnectionInternal(getURL(name, true), getUser(),
getPassword());
return getConnection(name, null);
}
public Connection getConnection(final String name, final Boolean stdDropTableRestrict) throws SQLException {
String url = getURL(name, true);
if (stdDropTableRestrict != null) {
url = addOption(url, "STANDARD_DROP_TABLE_RESTRICT", stdDropTableRestrict.toString());
}
return getConnectionInternal(url, getUser(), getPassword());
}
/**
......@@ -334,9 +340,6 @@ public abstract class TestBase {
if (config.collation != null) {
url = addOption(url, "COLLATION", config.collation);
}
if (config.stdDropTableRestrict) {
url = addOption(url, "STANDARD_DROP_TABLE_RESTRICT", "TRUE");
}
return "jdbc:h2:" + url;
}
......
......@@ -19,7 +19,6 @@ import java.sql.Timestamp;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import org.h2.api.ErrorCode;
import org.h2.engine.Constants;
import org.h2.store.fs.FileUtils;
......@@ -280,14 +279,8 @@ public class TestCases extends TestBase {
}
private void testDropTable() throws SQLException {
final boolean prevVal = config.stdDropTableRestrict;
try {
for (final boolean newVal : new boolean[] { true, false }) {
config.stdDropTableRestrict = newVal;
_testDropTable();
}
} finally {
config.stdDropTableRestrict = prevVal;
for (final boolean stdDropTableRestrict : new boolean[] { true, false }) {
_testDropTable(stdDropTableRestrict);
}
}
......@@ -295,13 +288,13 @@ public class TestCases extends TestBase {
NONE, VIEW, FOREIGN_KEY;
}
private void _testDropTable() throws SQLException {
private void _testDropTable(final boolean stdDropTableRestrict) throws SQLException {
trace("testDrop");
for (final boolean restrict : new boolean[] { true, false }) {
for (final DropDependent dropDep : DropDependent.values()) {
deleteDb("cases");
Connection conn = getConnection("cases");
Connection conn = getConnection("cases", stdDropTableRestrict);
Statement stat = conn.createStatement();
stat.execute("create table test(id int)");
if (dropDep == DropDependent.VIEW) {
......@@ -314,9 +307,7 @@ public class TestCases extends TestBase {
// drop allowed if no references or cascade
final boolean expectedDropSuccess = dropDep == DropDependent.NONE
|| (!config.stdDropTableRestrict
&& dropDep == DropDependent.FOREIGN_KEY)
|| !restrict;
|| (!stdDropTableRestrict && dropDep == DropDependent.FOREIGN_KEY) || !restrict;
assertThrows(expectedDropSuccess ? 0 : ErrorCode.CANNOT_DROP_2, stat).execute("drop table test " + (restrict ? "restrict" : "cascade"));
assertThrows(expectedDropSuccess ? ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1 : 0, stat).execute("select * from test");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论