本文整理汇总了Java中java.sql.PreparedStatement.getFetchSize方法的典型用法代码示例。如果您正苦于以下问题:Java PreparedStatement.getFetchSize方法的具体用法?Java PreparedStatement.getFetchSize怎么用?Java PreparedStatement.getFetchSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.sql.PreparedStatement
的用法示例。
在下文中一共展示了PreparedStatement.getFetchSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectAllMap
import java.sql.PreparedStatement; //导入方法依赖的package包/类
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
}
}
}
示例2: selectAllXCO
import java.sql.PreparedStatement; //导入方法依赖的package包/类
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
}
}
}
示例3: test001
import java.sql.PreparedStatement; //导入方法依赖的package包/类
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();
}
}