Search in sources :

Example 6 with TestCache

use of org.h2.test.unit.TestCache in project h2database by h2database.

the class TestView method testCache.

private void testCache() throws SQLException {
    deleteDb("view");
    Connection conn = getConnection("view");
    Statement stat = conn.createStatement();
    stat.execute("SET @X 8");
    stat.execute("CREATE VIEW V AS SELECT * FROM (SELECT @X)");
    ResultSet rs;
    rs = stat.executeQuery("SELECT * FROM V");
    rs.next();
    assertEquals(8, rs.getInt(1));
    stat.execute("SET @X 5");
    rs = stat.executeQuery("SELECT * FROM V");
    rs.next();
    assertEquals(5, rs.getInt(1));
    conn.close();
}
Also used : Statement(java.sql.Statement) PreparedStatement(java.sql.PreparedStatement) Connection(java.sql.Connection) JdbcConnection(org.h2.jdbc.JdbcConnection) ResultSet(java.sql.ResultSet)

Aggregations

Connection (java.sql.Connection)3 PreparedStatement (java.sql.PreparedStatement)3 Statement (java.sql.Statement)3 ResultSet (java.sql.ResultSet)2 Random (java.util.Random)2 JdbcConnection (org.h2.jdbc.JdbcConnection)2 Task (org.h2.util.Task)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 MVStore (org.h2.mvstore.MVStore)1 TestCluster (org.h2.test.db.TestCluster)1 TestMultiThreadedKernel (org.h2.test.db.TestMultiThreadedKernel)1 TestUpgrade (org.h2.test.db.TestUpgrade)1 TestUsingIndex (org.h2.test.db.TestUsingIndex)1 RecoverLobTest (org.h2.test.recover.RecoverLobTest)1 TestWeb (org.h2.test.server.TestWeb)1 TestCacheConcurrentLIRS (org.h2.test.store.TestCacheConcurrentLIRS)1 TestCacheLIRS (org.h2.test.store.TestCacheLIRS)1 TestCacheLongKeyLIRS (org.h2.test.store.TestCacheLongKeyLIRS)1 TestConcurrent (org.h2.test.store.TestConcurrent)1 TestConcurrentLinkedList (org.h2.test.store.TestConcurrentLinkedList)1