use of org.apache.ignite.internal.processors.odbc.jdbc.JdbcQueryFetchRequest in project ignite by apache.
the class JdbcThinTcpIo method guessCapacity.
/**
* Try to guess request capacity.
*
* @param req Request.
* @return Expected capacity.
*/
private static int guessCapacity(JdbcRequest req) {
int cap;
if (req instanceof JdbcBatchExecuteRequest) {
List<JdbcQuery> qrys = ((JdbcBatchExecuteRequest) req).queries();
int cnt = !F.isEmpty(qrys) ? Math.min(MAX_BATCH_QRY_CNT, qrys.size()) : 0;
// One additional byte for autocommit and last batch flags.
cap = cnt * DYNAMIC_SIZE_MSG_CAP + 2;
} else if (req instanceof JdbcQueryCloseRequest)
cap = QUERY_CLOSE_MSG_SIZE;
else if (req instanceof JdbcQueryMetadataRequest)
cap = QUERY_META_MSG_SIZE;
else if (req instanceof JdbcQueryFetchRequest)
cap = QUERY_FETCH_MSG_SIZE;
else
cap = DYNAMIC_SIZE_MSG_CAP;
return cap;
}
use of org.apache.ignite.internal.processors.odbc.jdbc.JdbcQueryFetchRequest in project ignite by apache.
the class JdbcThinResultSet method next.
/**
* {@inheritDoc}
*/
@Override
public boolean next() throws SQLException {
ensureAlive();
if ((rowsIter == null || !rowsIter.hasNext()) && !finished) {
JdbcQueryFetchResult res = stmt.conn.sendRequest(new JdbcQueryFetchRequest(cursorId, fetchSize), stmt, stickyIO).response();
rows = res.items();
finished = res.last();
rowsIter = rows.iterator();
}
if (rowsIter != null) {
if (rowsIter.hasNext()) {
curRow = rowsIter.next();
curPos++;
return true;
} else {
rowsIter = null;
curRow = null;
return false;
}
} else
return false;
}
Aggregations