Java Code Examples for com.mysql.cj.jdbc.result.ResultSetInternalMethods#setStatementUsedForFetchingRows()

The following examples show how to use com.mysql.cj.jdbc.result.ResultSetInternalMethods#setStatementUsedForFetchingRows() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StatementImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param sql
 */
private ResultSetInternalMethods createResultSetUsingServerFetch(String sql) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        java.sql.PreparedStatement pStmt = this.connection.prepareStatement(sql, this.query.getResultType().getIntValue(), this.resultSetConcurrency);

        pStmt.setFetchSize(this.query.getResultFetchSize());

        if (this.maxRows > -1) {
            pStmt.setMaxRows(this.maxRows);
        }

        statementBegins();

        pStmt.execute();

        //
        // Need to be able to get resultset irrespective if we issued DML or not to make this work.
        //
        ResultSetInternalMethods rs = ((StatementImpl) pStmt).getResultSetInternal();

        rs.setStatementUsedForFetchingRows((ClientPreparedStatement) pStmt);

        this.results = rs;

        return rs;
    }
}
 
Example 2
Source File: StatementImpl.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @param sql
 *            query
 * @return result set
 * @throws SQLException
 *             if a database access error occurs or this method is called on a closed Statement
 */
private ResultSetInternalMethods createResultSetUsingServerFetch(String sql) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        java.sql.PreparedStatement pStmt = this.connection.prepareStatement(sql, this.query.getResultType().getIntValue(), this.resultSetConcurrency);

        pStmt.setFetchSize(this.query.getResultFetchSize());

        if (this.maxRows > -1) {
            pStmt.setMaxRows(this.maxRows);
        }

        statementBegins();

        pStmt.execute();

        //
        // Need to be able to get resultset irrespective if we issued DML or not to make this work.
        //
        ResultSetInternalMethods rs = ((StatementImpl) pStmt).getResultSetInternal();

        rs.setStatementUsedForFetchingRows((ClientPreparedStatement) pStmt);

        this.results = rs;

        return rs;
    }
}