com.mysql.cj.jdbc.result.ResultSetInternalMethods Java Examples

The following examples show how to use com.mysql.cj.jdbc.result.ResultSetInternalMethods. 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 6 votes vote down vote up
/**
 * Close any open result sets that have been 'held open'
 */
protected void closeAllOpenResults() throws SQLException {
    JdbcConnection locallyScopedConn = this.connection;

    if (locallyScopedConn == null) {
        return; // already closed
    }

    synchronized (locallyScopedConn.getConnectionMutex()) {
        if (this.openResults != null) {
            for (ResultSetInternalMethods element : this.openResults) {
                try {
                    element.realClose(false);
                } catch (SQLException sqlEx) {
                    AssertionFailedException.shouldNotHappen(sqlEx);
                }
            }

            this.openResults.clear();
        }
    }
}
 
Example #2
Source File: JDBCMySQLProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep
List<NativeImageProxyDefinitionBuildItem> registerProxies() {
    List<NativeImageProxyDefinitionBuildItem> proxies = new ArrayList<>();
    proxies.add(new NativeImageProxyDefinitionBuildItem(JdbcConnection.class.getName()));
    proxies.add(new NativeImageProxyDefinitionBuildItem(MysqlConnection.class.getName()));
    proxies.add(new NativeImageProxyDefinitionBuildItem(Statement.class.getName()));
    proxies.add(new NativeImageProxyDefinitionBuildItem(AutoCloseable.class.getName()));
    proxies.add(new NativeImageProxyDefinitionBuildItem(JdbcStatement.class.getName()));
    proxies.add(new NativeImageProxyDefinitionBuildItem(Connection.class.getName()));
    proxies.add(new NativeImageProxyDefinitionBuildItem(ResultSet.class.getName()));
    proxies.add(
            new NativeImageProxyDefinitionBuildItem(JdbcPreparedStatement.class.getName(), JdbcStatement.class.getName()));
    proxies.add(new NativeImageProxyDefinitionBuildItem(JdbcPropertySet.class.getName(), PropertySet.class.getName(),
            Serializable.class.getName()));
    proxies.add(
            new NativeImageProxyDefinitionBuildItem(Resultset.class.getName(), ResultSetInternalMethods.class.getName()));
    proxies.add(new NativeImageProxyDefinitionBuildItem(LoadBalancedConnection.class.getName(),
            JdbcConnection.class.getName()));
    proxies.add(
            new NativeImageProxyDefinitionBuildItem(ReplicationConnection.class.getName(), JdbcConnection.class.getName()));
    proxies.add(
            new NativeImageProxyDefinitionBuildItem(ResultSetInternalMethods.class.getName(),
                    WarningListener.class.getName(), Resultset.class.getName()));
    return proxies;
}
 
Example #3
Source File: CallableStatement.java    From FoxTelem with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the ResultSet that holds the output parameters, or throws an
 * appropriate exception if none exist, or they weren't returned.
 * 
 * @param paramIndex
 *            parameter index
 * 
 * @return the ResultSet that holds the output parameters
 * 
 * @throws SQLException
 *             if no output parameters were defined, or if no output
 *             parameters were returned.
 */
protected ResultSetInternalMethods getOutputParameters(int paramIndex) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        this.outputParamWasNull = false;

        if (paramIndex == 1 && this.callingStoredFunction && this.returnValueParam != null) {
            return this.functionReturnValueResults;
        }

        if (this.outputParameterResults == null) {
            if (this.paramInfo.numberOfParameters() == 0) {
                throw SQLError.createSQLException(Messages.getString("CallableStatement.7"), MysqlErrorNumbers.SQL_STATE_ILLEGAL_ARGUMENT,
                        getExceptionInterceptor());
            }
            throw SQLError.createSQLException(Messages.getString("CallableStatement.8"), MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
                    getExceptionInterceptor());
        }

        return this.outputParameterResults;
    }
}
 
Example #4
Source File: StatementImpl.java    From FoxTelem with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Close any open result sets that have been 'held open'
 * 
 * @throws SQLException
 *             if an error occurs
 */
protected void closeAllOpenResults() throws SQLException {
    JdbcConnection locallyScopedConn = this.connection;

    if (locallyScopedConn == null) {
        return; // already closed
    }

    synchronized (locallyScopedConn.getConnectionMutex()) {
        if (this.openResults != null) {
            for (ResultSetInternalMethods element : this.openResults) {
                try {
                    element.realClose(false);
                } catch (SQLException sqlEx) {
                    AssertionFailedException.shouldNotHappen(sqlEx);
                }
            }

            this.openResults.clear();
        }
    }
}
 
Example #5
Source File: CallableStatement.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.sql.CallableStatement#getString(int)
 */
public String getString(int parameterIndex) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(parameterIndex);

        String retValue = rs.getString(mapOutputParameterIndexToRsIndex(parameterIndex));

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #6
Source File: CallableStatement.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.sql.CallableStatement#getObject(java.lang.String, java.util.Map)
 */
public Object getObject(String parameterName, Map<String, Class<?>> map) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(0); // definitely not going to be from ?=

        Object retValue = rs.getObject(fixParameterName(parameterName), map);

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #7
Source File: CallableStatement.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.sql.CallableStatement#getTimestamp(int, java.util.Calendar)
 */
public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(parameterIndex);

        Timestamp retValue = rs.getTimestamp(mapOutputParameterIndexToRsIndex(parameterIndex), cal);

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #8
Source File: CallableStatement.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.sql.CallableStatement#getTimestamp(int)
 */
public Timestamp getTimestamp(int parameterIndex) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(parameterIndex);

        Timestamp retValue = rs.getTimestamp(mapOutputParameterIndexToRsIndex(parameterIndex));

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #9
Source File: CallableStatement.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Deprecated
public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(parameterIndex);

        BigDecimal retValue = rs.getBigDecimal(mapOutputParameterIndexToRsIndex(parameterIndex), scale);

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #10
Source File: CallableStatement.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.sql.CallableStatement#getTime(java.lang.String)
 */
public Time getTime(String parameterName) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(0); // definitely not going to be from ?=

        Time retValue = rs.getTime(fixParameterName(parameterName));

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #11
Source File: CallableStatement.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.sql.CallableStatement#getTime(int, java.util.Calendar)
 */
public Time getTime(int parameterIndex, Calendar cal) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(parameterIndex);

        Time retValue = rs.getTime(mapOutputParameterIndexToRsIndex(parameterIndex), cal);

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #12
Source File: CallableStatement.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Ref getRef(String parameterName) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(0); // definitely not going to be from ?=

        Ref retValue = rs.getRef(fixParameterName(parameterName));

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #13
Source File: CallableStatement.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Time getTime(String parameterName, Calendar cal) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(0); // definitely not going to be from ?=

        Time retValue = rs.getTime(fixParameterName(parameterName), cal);

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #14
Source File: CallableStatement.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public <T> T getObject(int parameterIndex, Class<T> type) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(parameterIndex);

        // remove cast once 1.5, 1.6 EOL'd
        T retVal = ((ResultSetImpl) rs).getObject(mapOutputParameterIndexToRsIndex(parameterIndex), type);

        this.outputParamWasNull = rs.wasNull();

        return retVal;
    }
}
 
Example #15
Source File: CallableStatement.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public short getShort(String parameterName) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(0); // definitely not going to be from ?=

        short retValue = rs.getShort(fixParameterName(parameterName));

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #16
Source File: CallableStatement.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.sql.CallableStatement#getRef(int)
 */
public Ref getRef(int parameterIndex) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(parameterIndex);

        Ref retValue = rs.getRef(mapOutputParameterIndexToRsIndex(parameterIndex));

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #17
Source File: CallableStatement.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public byte getByte(String parameterName) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(0); // definitely not going to be from ?=

        byte retValue = rs.getByte(fixParameterName(parameterName));

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #18
Source File: CallableStatement.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.sql.CallableStatement#getObject(java.lang.String)
 */
public Object getObject(String parameterName) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(0); // definitely not going to be from ?=

        Object retValue = rs.getObject(fixParameterName(parameterName));

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #19
Source File: CallableStatement.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Timestamp getTimestamp(int parameterIndex) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(parameterIndex);

        Timestamp retValue = rs.getTimestamp(mapOutputParameterIndexToRsIndex(parameterIndex));

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #20
Source File: CallableStatement.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.sql.CallableStatement#getLong(java.lang.String)
 */
public long getLong(String parameterName) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(0); // definitely not going to be from ?=

        long retValue = rs.getLong(fixParameterName(parameterName));

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #21
Source File: CallableStatement.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.sql.CallableStatement#getLong(int)
 */
public long getLong(int parameterIndex) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(parameterIndex);

        long retValue = rs.getLong(mapOutputParameterIndexToRsIndex(parameterIndex));

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #22
Source File: CallableStatement.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.sql.CallableStatement#getInt(java.lang.String)
 */
public int getInt(String parameterName) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(0); // definitely not going to be from ?=

        int retValue = rs.getInt(fixParameterName(parameterName));

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #23
Source File: CallableStatement.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public byte getByte(int parameterIndex) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(parameterIndex);

        byte retValue = rs.getByte(mapOutputParameterIndexToRsIndex(parameterIndex));

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #24
Source File: CallableStatement.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.sql.CallableStatement#getFloat(java.lang.String)
 */
public float getFloat(String parameterName) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(0); // definitely not going to be from ?=

        float retValue = rs.getFloat(fixParameterName(parameterName));

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #25
Source File: CallableStatement.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String getString(String parameterName) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(0); // definitely not going to be from ?=

        String retValue = rs.getString(fixParameterName(parameterName));

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #26
Source File: CallableStatement.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public URL getURL(int parameterIndex) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(parameterIndex);

        URL retValue = rs.getURL(mapOutputParameterIndexToRsIndex(parameterIndex));

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #27
Source File: CallableStatement.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.sql.CallableStatement#getDouble(int)
 */
public double getDouble(int parameterIndex) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(parameterIndex);

        double retValue = rs.getDouble(mapOutputParameterIndexToRsIndex(parameterIndex));

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #28
Source File: CallableStatement.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.sql.CallableStatement#getDate(java.lang.String, java.util.Calendar)
 */
public Date getDate(String parameterName, Calendar cal) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(0); // definitely not going to be from ?=

        Date retValue = rs.getDate(fixParameterName(parameterName), cal);

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #29
Source File: CallableStatement.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Date getDate(String parameterName) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(0); // definitely not going to be from ?=

        Date retValue = rs.getDate(fixParameterName(parameterName));

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}
 
Example #30
Source File: CallableStatement.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Date getDate(int parameterIndex, Calendar cal) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        ResultSetInternalMethods rs = getOutputParameters(parameterIndex);

        Date retValue = rs.getDate(mapOutputParameterIndexToRsIndex(parameterIndex), cal);

        this.outputParamWasNull = rs.wasNull();

        return retValue;
    }
}