本文整理匯總了Java中java.sql.Statement.getMaxRows方法的典型用法代碼示例。如果您正苦於以下問題:Java Statement.getMaxRows方法的具體用法?Java Statement.getMaxRows怎麽用?Java Statement.getMaxRows使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.sql.Statement
的用法示例。
在下文中一共展示了Statement.getMaxRows方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: TsfileQueryResultSet
import java.sql.Statement; //導入方法依賴的package包/類
public TsfileQueryResultSet(Statement statement, List<String> columnName, TSIService.Iface client,
TS_SessionHandle sessionHandle, TSOperationHandle operationHandle, String sql,
String aggregations, List<String> columnTypeList)
throws SQLException {
this.statement = statement;
this.sql = sql;
this.columnInfoList = new ArrayList<>();
this.columnInfoMap = new HashMap<>();
this.client = client;
this.operationHandle = operationHandle;
this.columnInfoList.add(TIMESTAMP_STR);
this.columnInfoMap.put(TIMESTAMP_STR, 1);
int index = 2;
for (String name : columnName) {
columnInfoList.add(name);
if(!columnInfoMap.containsKey(name)){
columnInfoMap.put(name, index++);
}
}
this.maxRows = statement.getMaxRows();
this.fetchSize = statement.getFetchSize();
this.operationHandle = operationHandle;
this.operationType = aggregations;
this.columnTypeList = columnTypeList;
}
示例2: setMaxRowsToReturn
import java.sql.Statement; //導入方法依賴的package包/類
/**
* Set the maximum rows to return to the client side
*
* @param statement
* the statement to set
* @param databaseConfigurator
* the DatabaseConfigurator which contains the getMaxRowsToReturn()
* method
* @throws SQLException
*/
public static void setMaxRowsToReturn(Statement statement,
DatabaseConfigurator databaseConfigurator) throws SQLException, IOException {
int maxRowsToReturn = DatabaseConfiguratorCall
.getMaxRowsToReturn(databaseConfigurator);
if (maxRowsToReturn > 0) {
if (statement.getMaxRows() == 0
|| (statement.getMaxRows() > maxRowsToReturn)) {
statement.setFetchSize(0); // To avoid any possible conflict
statement.setMaxRows(maxRowsToReturn);
}
}
}