Search in sources :

Example 1 with JdbcQueryMetadataRequest

use of org.apache.ignite.internal.processors.odbc.jdbc.JdbcQueryMetadataRequest in project ignite by apache.

the class JdbcThinResultSet method meta.

/**
 * @return Results metadata.
 * @throws SQLException On error.
 */
private List<JdbcColumnMeta> meta() throws SQLException {
    if (finished && (!isQuery || autoClose))
        throw new SQLException("Server cursor is already closed.", SqlStateCode.INVALID_CURSOR_STATE);
    if (!metaInit) {
        JdbcQueryMetadataResult res = stmt.conn.sendRequest(new JdbcQueryMetadataRequest(cursorId), stmt, stickyIO).response();
        meta = res.meta();
        metaInit = true;
    }
    return meta;
}
Also used : JdbcQueryMetadataRequest(org.apache.ignite.internal.processors.odbc.jdbc.JdbcQueryMetadataRequest) SQLException(java.sql.SQLException) JdbcQueryMetadataResult(org.apache.ignite.internal.processors.odbc.jdbc.JdbcQueryMetadataResult)

Example 2 with JdbcQueryMetadataRequest

use of org.apache.ignite.internal.processors.odbc.jdbc.JdbcQueryMetadataRequest 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;
}
Also used : JdbcQuery(org.apache.ignite.internal.processors.odbc.jdbc.JdbcQuery) JdbcBatchExecuteRequest(org.apache.ignite.internal.processors.odbc.jdbc.JdbcBatchExecuteRequest) JdbcQueryMetadataRequest(org.apache.ignite.internal.processors.odbc.jdbc.JdbcQueryMetadataRequest) JdbcQueryCloseRequest(org.apache.ignite.internal.processors.odbc.jdbc.JdbcQueryCloseRequest) IpcClientTcpEndpoint(org.apache.ignite.internal.util.ipc.loopback.IpcClientTcpEndpoint) JdbcQueryFetchRequest(org.apache.ignite.internal.processors.odbc.jdbc.JdbcQueryFetchRequest)

Aggregations

JdbcQueryMetadataRequest (org.apache.ignite.internal.processors.odbc.jdbc.JdbcQueryMetadataRequest)2 SQLException (java.sql.SQLException)1 JdbcBatchExecuteRequest (org.apache.ignite.internal.processors.odbc.jdbc.JdbcBatchExecuteRequest)1 JdbcQuery (org.apache.ignite.internal.processors.odbc.jdbc.JdbcQuery)1 JdbcQueryCloseRequest (org.apache.ignite.internal.processors.odbc.jdbc.JdbcQueryCloseRequest)1 JdbcQueryFetchRequest (org.apache.ignite.internal.processors.odbc.jdbc.JdbcQueryFetchRequest)1 JdbcQueryMetadataResult (org.apache.ignite.internal.processors.odbc.jdbc.JdbcQueryMetadataResult)1 IpcClientTcpEndpoint (org.apache.ignite.internal.util.ipc.loopback.IpcClientTcpEndpoint)1