提交 29ae89fd authored 作者: Thomas Mueller's avatar Thomas Mueller

Prepare for version 1.3.x beta

上级 42b1c9b7
...@@ -180,7 +180,7 @@ public class AlterTableAlterColumn extends SchemaCommand { ...@@ -180,7 +180,7 @@ public class AlterTableAlterColumn extends SchemaCommand {
throw DbException.get(ErrorCode.VIEW_IS_INVALID_2, e, getSQL(), e.getMessage()); throw DbException.get(ErrorCode.VIEW_IS_INVALID_2, e, getSQL(), e.getMessage());
} }
String tableName = table.getName(); String tableName = table.getName();
execute("DROP TABLE " + table.getSQL(), true); execute("DROP TABLE " + table.getSQL() + " CASCADE", true);
db.renameSchemaObject(session, newTable, tableName); db.renameSchemaObject(session, newTable, tableName);
for (DbObject child : newTable.getChildren()) { for (DbObject child : newTable.getChildren()) {
if (child instanceof Sequence) { if (child instanceof Sequence) {
......
...@@ -12,6 +12,7 @@ import java.io.Reader; ...@@ -12,6 +12,7 @@ import java.io.Reader;
import org.h2.command.CommandInterface; import org.h2.command.CommandInterface;
import org.h2.command.Prepared; import org.h2.command.Prepared;
import org.h2.constant.SysProperties; import org.h2.constant.SysProperties;
import org.h2.engine.Constants;
import org.h2.engine.Session; import org.h2.engine.Session;
import org.h2.message.DbException; import org.h2.message.DbException;
import org.h2.result.ResultInterface; import org.h2.result.ResultInterface;
...@@ -23,7 +24,7 @@ import org.h2.util.ScriptReader; ...@@ -23,7 +24,7 @@ import org.h2.util.ScriptReader;
*/ */
public class RunScriptCommand extends ScriptBase { public class RunScriptCommand extends ScriptBase {
private String charset = SysProperties.FILE_ENCODING; private String charset = Constants.VERSION_MINOR < 3 ? SysProperties.FILE_ENCODING : Constants.UTF8;
public RunScriptCommand(Session session) { public RunScriptCommand(Session session) {
super(session); super(session);
......
...@@ -1162,7 +1162,7 @@ public abstract class TestBase { ...@@ -1162,7 +1162,7 @@ public abstract class TestBase {
* @throws AssertionError if the databases don't match * @throws AssertionError if the databases don't match
*/ */
protected void assertEqualDatabases(Statement stat1, Statement stat2) throws SQLException { protected void assertEqualDatabases(Statement stat1, Statement stat2) throws SQLException {
ResultSet rs = stat1.executeQuery("select value from information_schema.settings where name='analyzeAuto'"); ResultSet rs = stat1.executeQuery("select value from information_schema.settings where name='ANALYZE_AUTO'");
int analyzeAuto = rs.next() ? rs.getInt(1) : 0; int analyzeAuto = rs.next() ? rs.getInt(1) : 0;
if (analyzeAuto > 0) { if (analyzeAuto > 0) {
stat1.execute("analyze"); stat1.execute("analyze");
......
...@@ -733,7 +733,7 @@ public class TestCases extends TestBase { ...@@ -733,7 +733,7 @@ public class TestCases extends TestBase {
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("create table test(id int)"); stat.execute("create table test(id int)");
stat.execute("create view abc as select * from test"); stat.execute("create view abc as select * from test");
stat.execute("drop table test"); stat.execute("drop table test cascade");
conn.close(); conn.close();
conn = getConnection("cases"); conn = getConnection("cases");
stat = conn.createStatement(); stat = conn.createStatement();
......
...@@ -37,12 +37,12 @@ public class TestOutOfMemory extends TestBase { ...@@ -37,12 +37,12 @@ public class TestOutOfMemory extends TestBase {
System.gc(); System.gc();
} }
deleteDb("outOfMemory"); deleteDb("outOfMemory");
Connection conn = getConnection("outOfMemory"); Connection conn = getConnection("outOfMemory;MAX_OPERATION_MEMORY=1000000");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("drop all objects"); stat.execute("drop all objects");
stat.execute("create table stuff (id int, text varchar as space(100) || id)"); stat.execute("create table stuff (id int, text varchar as space(100) || id)");
stat.execute("insert into stuff(id) select x from system_range(1, 3000)"); stat.execute("insert into stuff(id) select x from system_range(1, 3000)");
PreparedStatement prep = conn.prepareStatement("update stuff set text = text || ' upd'"); PreparedStatement prep = conn.prepareStatement("update stuff set text = text || space(1000) || id");
prep.execute(); prep.execute();
stat.execute("checkpoint"); stat.execute("checkpoint");
eatMemory(80); eatMemory(80);
......
...@@ -90,7 +90,7 @@ public class TestViewAlterTable extends TestBase { ...@@ -90,7 +90,7 @@ public class TestViewAlterTable extends TestBase {
} catch (SQLException e) { } catch (SQLException e) {
assertEquals(ErrorCode.VIEW_IS_INVALID_2, e.getErrorCode()); assertEquals(ErrorCode.VIEW_IS_INVALID_2, e.getErrorCode());
} }
stat.execute("drop table test"); stat.execute("drop table test cascade");
} }
private void testAlterTableAddColumnWithView() throws SQLException { private void testAlterTableAddColumnWithView() throws SQLException {
...@@ -185,7 +185,7 @@ public class TestViewAlterTable extends TestBase { ...@@ -185,7 +185,7 @@ public class TestViewAlterTable extends TestBase {
assertEquals(2, rs.getInt(1)); assertEquals(2, rs.getInt(1));
assertFalse(rs.next()); assertFalse(rs.next());
stat.execute("drop table test"); stat.execute("drop table test cascade");
ResultSet d = conn.getMetaData().getTables(null, null, null, null); ResultSet d = conn.getMetaData().getTables(null, null, null, null);
while (d.next()) { while (d.next()) {
......
...@@ -52,12 +52,12 @@ public class TestViewDropView extends TestBase { ...@@ -52,12 +52,12 @@ public class TestViewDropView extends TestBase {
stat.execute("create table test(id int)"); stat.execute("create table test(id int)");
stat.execute("alter view test_view recompile"); stat.execute("alter view test_view recompile");
stat.execute("select * from test_view"); stat.execute("select * from test_view");
stat.execute("drop table test_view, test"); stat.execute("drop table test_view, test cascade");
stat.execute("create force view test_view as select * from test where 1=0"); stat.execute("create force view test_view as select * from test where 1=0");
stat.execute("create table test(id int)"); stat.execute("create table test(id int)");
stat.execute("alter view test_view recompile"); stat.execute("alter view test_view recompile");
stat.execute("select * from test_view"); stat.execute("select * from test_view");
stat.execute("drop table test_view, test"); stat.execute("drop table test_view, test cascade");
} }
private void testDropViewDefaultBehaviour() throws SQLException { private void testDropViewDefaultBehaviour() throws SQLException {
...@@ -167,7 +167,7 @@ public class TestViewDropView extends TestBase { ...@@ -167,7 +167,7 @@ public class TestViewDropView extends TestBase {
assertEquals(ErrorCode.COLUMN_NOT_FOUND_1, e.getErrorCode()); assertEquals(ErrorCode.COLUMN_NOT_FOUND_1, e.getErrorCode());
} }
stat.execute("drop table test"); stat.execute("drop table test cascade");
} }
private void createTestData() throws SQLException { private void createTestData() throws SQLException {
...@@ -197,7 +197,7 @@ public class TestViewDropView extends TestBase { ...@@ -197,7 +197,7 @@ public class TestViewDropView extends TestBase {
assertEquals(2, rs.getInt(1)); assertEquals(2, rs.getInt(1));
assertFalse(rs.next()); assertFalse(rs.next());
stat.execute("drop table test"); stat.execute("drop table test cascade");
ResultSet d = conn.getMetaData().getTables(null, null, null, null); ResultSet d = conn.getMetaData().getTables(null, null, null, null);
while (d.next()) { while (d.next()) {
......
差异被折叠。
...@@ -646,7 +646,7 @@ select remarks from information_schema.tables where table_name = 'TEST_VIEW'; ...@@ -646,7 +646,7 @@ select remarks from information_schema.tables where table_name = 'TEST_VIEW';
@reconnect; @reconnect;
select remarks from information_schema.tables where table_name = 'TEST_VIEW'; select remarks from information_schema.tables where table_name = 'TEST_VIEW';
> abc; > abc;
drop table test; drop table test cascade;
@reconnect; @reconnect;
create table test(a int); create table test(a int);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论