Java Code Examples for java.sql.PreparedStatement.getFetchSize()

The following are Jave code examples for showing how to use getFetchSize() of the java.sql.PreparedStatement class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: tangyuan2   File: SqlActuator.java   View Source Code Vote up 6 votes
public List<Map<String, Object>> selectAllMap(Connection connection, String sql, List<Object> args, MappingVo resultMap, Integer fetchSize)
		throws SQLException {
	PreparedStatement ps = connection.prepareStatement(sql);
	try {
		setParameters(ps, args);
		if (null != fetchSize && fetchSize.intValue() != ps.getFetchSize()) {
			ps.setFetchSize(fetchSize.intValue());
		}
		ResultSet rs = ps.executeQuery();
		return getResults(rs, resultMap);
	} finally {
		try {
			ps.close();
		} catch (SQLException e) {
			// ignore
		}
	}
}
 
Example 2
Project: tangyuan2   File: SqlActuator.java   View Source Code Vote up 6 votes
public List<XCO> selectAllXCO(Connection connection, String sql, List<Object> args, MappingVo resultMap, Integer fetchSize) throws SQLException {
	PreparedStatement ps = connection.prepareStatement(sql);
	try {
		setParameters(ps, args);
		if (null != fetchSize && fetchSize.intValue() != ps.getFetchSize()) {
			ps.setFetchSize(fetchSize.intValue());
		}
		ResultSet rs = ps.executeQuery();
		return getXCOResults(rs, resultMap);
	} finally {
		try {
			ps.close();
		} catch (SQLException e) {
			// ignore
		}
	}
}
 
Example 3
Project: blanco-sfdc-jdbc-driver   File: BlancoSfdcJdbcPreparedStatementTest.java   View Source Code Vote up 5 votes
public void test001() throws Exception {
	if (BlancoSfdcJdbcTestConstants.isTestWithSfdc() == false)
		return;

	Class.forName("blanco.sfdc.jdbc.driver.BlancoSfdcJdbcDriver");
	try {
		final Properties prop = new Properties();
		final InputStream inStream = new FileInputStream("soqlro.properties");
		prop.load(new BufferedInputStream(inStream));
		inStream.close();

		final String url = prop.getProperty("url",
				"jdbc:blanco:sfdc:soqlro://login.salesforce.com/services/Soap/u/40.0");
		final String user = prop.getProperty("user", "NoUserSpesified");
		final String pass = prop.getProperty("password", "NoPassSpecified");

		final Connection conn = DriverManager.getConnection(url, user, pass);

		final String sql = "SELECT Id, Name, LastModifiedDate FROM Account";
		final PreparedStatement stmt = conn.prepareStatement(sql);

		stmt.setFetchSize(200);
		stmt.getFetchSize();

		final ResultSet rs = stmt.executeQuery();
		while (rs.next()) {
			final String id = rs.getString("id");
			final String name = rs.getString("name");
			final java.sql.Date lastModifiedDate = rs.getDate("lastmodifieddate");
			if (false)
				System.err.println("id: " + id + ", name:" + name + ", LastModifiedDate:" + lastModifiedDate);
		}
		rs.close();
		stmt.close();
		conn.close();
	} catch (SQLException ex) {
		ex.printStackTrace();
		fail();
	}
}