Sha256: 104baaff9f4b374fcc498a1a177acd9e3f2dbe4fa0df6e2f1eb981b7371c38ad

Contents?: true

Size: 1.44 KB

Versions: 12

Compression:

Stored size: 1.44 KB

Contents

import java.util.*;
import java.io.*;
import java.sql.*;

public class BatchTest extends PgpoolTest {
    public String [] batchSqls = new String[] {
	"INSERT INTO batch VALUES (1)",
	"INSERT INTO batch VALUES (1)",
	"INSERT INTO batch VALUES (1)",
	"INSERT INTO batch VALUES (1)",
	"INSERT INTO batch VALUES (1)",
	"INSERT INTO batch VALUES (1)",
	"INSERT INTO batch VALUES (1)",
	"INSERT INTO batch VALUES (1)",
	"INSERT INTO batch VALUES (1)",
	"INSERT INTO batch VALUES (1)",
	"INSERT INTO batch VALUES (1)",
    };

    public void do_test() throws SQLException {
        connection.setAutoCommit(false);
        
        Statement stmt = null;
        ResultSet rs = null;
        
        try {
            try {
                stmt = connection.createStatement();
                for(int i=0; i<batchSqls.length; i++) {
                    stmt.addBatch(batchSqls[i]);
                }
                int [] r = stmt.executeBatch();
                
                connection.commit();
		stmt.close();

		stmt = connection.createStatement();
		rs = stmt.executeQuery("SELECT count(*) FROM batch");
		rs.next();
		logwriter.println(rs.getInt(1));
                connection.commit();
            } finally {
                if(rs != null) rs.close();
                if(stmt != null) stmt.close();
            }
        } finally {
            connection.close();
	    logwriter.close();
        }
    }

    public String getTestName() {
	return "batch";
    }
}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
prestogres-0.4.8 pgpool2/test/jdbc/BatchTest.java
prestogres-0.4.7 pgpool2/test/jdbc/BatchTest.java
prestogres-0.4.6 pgpool2/test/jdbc/BatchTest.java
prestogres-0.4.5 pgpool2/test/jdbc/BatchTest.java
prestogres-0.4.4 pgpool2/test/jdbc/BatchTest.java
prestogres-0.4.3 pgpool2/test/jdbc/BatchTest.java
prestogres-0.4.2 pgpool2/test/jdbc/BatchTest.java
prestogres-0.4.1 pgpool2/test/jdbc/BatchTest.java
prestogres-0.4.0 pgpool2/test/jdbc/BatchTest.java
prestogres-0.3.0 pgpool2/test/jdbc/BatchTest.java
prestogres-0.2.0 pgpool2/test/jdbc/BatchTest.java
prestogres-0.1.0 pgpool2/test/jdbc/BatchTest.java