pgpool2.git / summary / log / commit / refs
commit 0e51f96bc840d8dec4716d9ab3ebf1c9944cfcc5
Author: Tatsuo Ishii <ishii at sraoss.co.jp>
Date: Sun Oct 25 07:21:10 2009 +0000
Add temp table test
test/jdbc/CreateTempTableTest.java | 48 ++++++++++++++++++++++++++++++++++++++
test/jdbc/RunTest.java | 3 +++
test/jdbc/expected/CreateTempTable | 1 +
3 files changed, 52 insertions(+)
diff --git a/test/jdbc/CreateTempTableTest.java b/test/jdbc/CreateTempTableTest.java
new file mode 100644
index 000000000..0045a2ae7
--- /dev/null
+++ b/test/jdbc/CreateTempTableTest.java
@@ -0,0 +1,48 @@
+/*
+ * Test for master/slave mode + temporary tables
+ */
+import java.sql.*;
+
+public class CreateTempTableTest extends PgpoolTest {
+ public void do_test() throws SQLException {
+
+ try {
+ ResultSet rs;
+ PreparedStatement pstmt = null;
+ Statement stmt = null;
+
+ connection.setAutoCommit(false);
+
+ pstmt = connection.prepareStatement("CREATE TEMP TABLE t1(i INTEGER)");
+ pstmt.executeUpdate();
+ pstmt.close();
+
+ pstmt = connection.prepareStatement("/*NO LOAD BALANCE*/ INSERT INTO t1 SELECT ?");
+ pstmt.setInt(1, 100);
+ pstmt.executeUpdate();
+ pstmt.close();
+
+ pstmt = connection.prepareStatement("/*NO LOAD BALANCE*/ UPDATE t1 SET i = ?");
+ pstmt.setInt(1, 200);
+ pstmt.executeUpdate();
+ pstmt.close();
+
+ pstmt = connection.prepareStatement("/*NO LOAD BALANCE*/ SELECT sum(i) FROM t1");
+ rs = pstmt.executeQuery();
+ rs.next();
+ logwriter.println(rs.getInt(1));
+ rs.close();
+ pstmt.close();
+
+ connection.commit();
+ }
+ finally {
+ connection.close();
+ logwriter.close();
+ }
+ }
+
+ public String getTestName() {
+ return "CreateTempTable";
+ }
+}
diff --git a/test/jdbc/RunTest.java b/test/jdbc/RunTest.java
index 77698a645..4b63a7553 100644
--- a/test/jdbc/RunTest.java
+++ b/test/jdbc/RunTest.java
@@ -74,6 +74,9 @@ public class RunTest {
if (testcase.equals("insert"))
return new InsertTest();
+ if (testcase.equals("CreateTempTable"))
+ return new CreateTempTableTest();
+
/* unknown test case */
return null;
}
diff --git a/test/jdbc/expected/CreateTempTable b/test/jdbc/expected/CreateTempTable
new file mode 100644
index 000000000..08839f6bb
--- /dev/null
+++ b/test/jdbc/expected/CreateTempTable
@@ -0,0 +1 @@
+200
[parent: 44fd9b737e90]