本文整理匯總了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();
}
}