01: /*
02: * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
03: * (license2)
04: * Initial Developer: H2 Group
05: */
06: package org.h2.test.mvcc;
07:
08: import java.sql.Connection;
09: import java.sql.ResultSet;
10: import java.sql.Statement;
11:
12: import org.h2.test.TestBase;
13:
14: /**
15: * Additional MVCC (multi version concurrency) test cases.
16: */
17: public class TestMvcc3 extends TestBase {
18:
19: public void test() throws Exception {
20: if (!config.mvcc) {
21: return;
22: }
23: deleteDb("mvcc3");
24: Connection conn = getConnection("mvcc3");
25: Statement stat = conn.createStatement();
26: stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY)");
27: stat.execute("INSERT INTO TEST VALUES(0)");
28: conn.setAutoCommit(false);
29: stat.execute("INSERT INTO TEST VALUES(1)");
30: ResultSet rs = stat
31: .executeQuery("SELECT * FROM TEST ORDER BY ID");
32: rs.next();
33: check(0, rs.getInt(1));
34: rs.next();
35: check(1, rs.getInt(1));
36: conn.close();
37: }
38: }
|