com.mysql.cj.exceptions.MysqlErrorNumbers Java Examples

The following examples show how to use com.mysql.cj.exceptions.MysqlErrorNumbers. 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: CallableStatementWrapper.java    From FoxTelem with GNU General Public License v3.0 6 votes vote down vote up
@Override
public synchronized <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException {
    try {
        if ("java.sql.Statement".equals(iface.getName()) || "java.sql.CallableStatement".equals(iface.getName())
                || "java.sql.PreparedStatement".equals(iface.getName()) || "java.sql.Wrapper.class".equals(iface.getName())) {
            return iface.cast(this);
        }

        if (this.unwrappedInterfaces == null) {
            this.unwrappedInterfaces = new HashMap<>();
        }

        Object cachedUnwrapped = this.unwrappedInterfaces.get(iface);

        if (cachedUnwrapped == null) {
            cachedUnwrapped = Proxy.newProxyInstance(this.wrappedStmt.getClass().getClassLoader(), new Class<?>[] { iface },
                    new ConnectionErrorFiringInvocationHandler(this.wrappedStmt));
            this.unwrappedInterfaces.put(iface, cachedUnwrapped);
        }

        return iface.cast(cachedUnwrapped);
    } catch (ClassCastException cce) {
        throw SQLError.createSQLException(Messages.getString("Common.UnableToUnwrap", new Object[] { iface.toString() }),
                MysqlErrorNumbers.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
    }
}
 
Example #2
Source File: XProtocolTest.java    From FoxTelem with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Test the create/drop collection admin commands.
 */
@Test
public void testCreateAndDropCollection() {
    if (!this.isSetForXTests) {
        return;
    }
    try {
        this.protocol.send(this.messageBuilder.buildCreateCollection(getTestDatabase(), "testCreateAndDropCollection"), 0);
        this.protocol.readQueryResult();
    } catch (XProtocolError err) {
        // leftovers, clean them up now
        if (err.getErrorCode() == MysqlErrorNumbers.ER_TABLE_EXISTS_ERROR) {
            this.protocol.send(this.messageBuilder.buildDropCollection(getTestDatabase(), "testCreateAndDropCollection"), 0);
            this.protocol.readQueryResult();
            // try again
            this.protocol.send(this.messageBuilder.buildCreateCollection(getTestDatabase(), "testCreateAndDropCollection"), 0);
            this.protocol.readQueryResult();
        } else {
            throw err;
        }
    }
    // we don't verify the existence. That's the job of the server/xplugin
    this.protocol.send(this.messageBuilder.buildDropCollection(getTestDatabase(), "testCreateAndDropCollection"), 0);
    this.protocol.readQueryResult();
}
 
Example #3
Source File: Blob.java    From FoxTelem with GNU General Public License v3.0 6 votes vote down vote up
@Override
public synchronized void truncate(long len) throws SQLException {
    checkClosed();

    if (len < 0) {
        throw SQLError.createSQLException(Messages.getString("Blob.5"), MysqlErrorNumbers.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
    }

    if (len > this.binaryData.length) {
        throw SQLError.createSQLException(Messages.getString("Blob.6"), MysqlErrorNumbers.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
    }

    // TODO: Do this without copying byte[]s by maintaining some end pointer on the original data

    byte[] newData = new byte[(int) len];
    System.arraycopy(getBinaryData(), 0, newData, 0, (int) len);
    this.binaryData = newData;
}
 
Example #4
Source File: ClientPreparedStatement.java    From FoxTelem with GNU General Public License v3.0 6 votes vote down vote up
protected void checkBounds(int paramIndex, int parameterIndexOffset) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        if ((paramIndex < 1)) {
            throw SQLError.createSQLException(Messages.getString("PreparedStatement.49") + paramIndex + Messages.getString("PreparedStatement.50"),
                    MysqlErrorNumbers.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
        } else if (paramIndex > ((PreparedQuery<?>) this.query).getParameterCount()) {
            throw SQLError.createSQLException(
                    Messages.getString("PreparedStatement.51") + paramIndex + Messages.getString("PreparedStatement.52")
                            + ((PreparedQuery<?>) this.query).getParameterCount() + Messages.getString("PreparedStatement.53"),
                    MysqlErrorNumbers.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
        } else if (parameterIndexOffset == -1 && paramIndex == 1) {
            throw SQLError.createSQLException(Messages.getString("PreparedStatement.63"), MysqlErrorNumbers.SQL_STATE_ILLEGAL_ARGUMENT,
                    this.exceptionInterceptor);
        }
    }
}
 
Example #5
Source File: StatementImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Sets the maxFieldSize
 * 
 * @param max
 *            the new max column size limit; zero means unlimited
 * 
 * @exception SQLException
 *                if size exceeds buffer size
 */
public void setMaxFieldSize(int max) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        if (max < 0) {
            throw SQLError.createSQLException(Messages.getString("Statement.11"), MysqlErrorNumbers.SQL_STATE_ILLEGAL_ARGUMENT, getExceptionInterceptor());
        }

        int maxBuf = this.maxAllowedPacket.getValue();

        if (max > maxBuf) {
            throw SQLError.createSQLException(Messages.getString("Statement.13", new Object[] { Long.valueOf(maxBuf) }),
                    MysqlErrorNumbers.SQL_STATE_ILLEGAL_ARGUMENT, getExceptionInterceptor());
        }

        this.maxFieldSize = max;
    }
}
 
Example #6
Source File: StatementImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @throws SQLException
 */
public java.sql.ResultSet getGeneratedKeys() throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        if (!this.retrieveGeneratedKeys) {
            throw SQLError.createSQLException(Messages.getString("Statement.GeneratedKeysNotRequested"), MysqlErrorNumbers.SQL_STATE_ILLEGAL_ARGUMENT,
                    getExceptionInterceptor());
        }

        if (this.batchedGeneratedKeys == null) {
            if (this.lastQueryIsOnDupKeyUpdate) {
                return this.generatedKeysResults = getGeneratedKeysInternal(1);
            }
            return this.generatedKeysResults = getGeneratedKeysInternal();
        }

        String encoding = this.session.getServerSession().getCharacterSetMetadata();
        int collationIndex = this.session.getServerSession().getMetadataCollationIndex();
        Field[] fields = new Field[1];
        fields[0] = new Field("", "GENERATED_KEY", collationIndex, encoding, MysqlType.BIGINT_UNSIGNED, 20);

        this.generatedKeysResults = this.resultSetFactory.createFromResultsetRows(ResultSet.CONCUR_READ_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE,
                new ResultsetRowsStatic(this.batchedGeneratedKeys, new DefaultColumnDefinition(fields)));

        return this.generatedKeysResults;
    }
}
 
Example #7
Source File: StatementImpl.java    From FoxTelem with GNU General Public License v3.0 6 votes vote down vote up
@Override
public java.sql.ResultSet getGeneratedKeys() throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        if (!this.retrieveGeneratedKeys) {
            throw SQLError.createSQLException(Messages.getString("Statement.GeneratedKeysNotRequested"), MysqlErrorNumbers.SQL_STATE_ILLEGAL_ARGUMENT,
                    getExceptionInterceptor());
        }

        if (this.batchedGeneratedKeys == null) {
            if (this.lastQueryIsOnDupKeyUpdate) {
                return this.generatedKeysResults = getGeneratedKeysInternal(1);
            }
            return this.generatedKeysResults = getGeneratedKeysInternal();
        }

        String encoding = this.session.getServerSession().getCharacterSetMetadata();
        int collationIndex = this.session.getServerSession().getMetadataCollationIndex();
        Field[] fields = new Field[1];
        fields[0] = new Field("", "GENERATED_KEY", collationIndex, encoding, MysqlType.BIGINT_UNSIGNED, 20);

        this.generatedKeysResults = this.resultSetFactory.createFromResultsetRows(ResultSet.CONCUR_READ_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE,
                new ResultsetRowsStatic(this.batchedGeneratedKeys, new DefaultColumnDefinition(fields)));

        return this.generatedKeysResults;
    }
}
 
Example #8
Source File: PreparedStatementWrapper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public void addBatch() throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((PreparedStatement) this.wrappedStmt).addBatch();
        } else {
            throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
                    this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example #9
Source File: PreparedStatementWrapper.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setNClob(int parameterIndex, NClob value) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((PreparedStatement) this.wrappedStmt).setNClob(parameterIndex, value);
        } else {
            throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
                    this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example #10
Source File: UpdatableResultSet.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException {
    try {
        // This works for classes that aren't actually wrapping anything
        return iface.cast(this);
    } catch (ClassCastException cce) {
        throw SQLError.createSQLException("Unable to unwrap to " + iface.toString(), MysqlErrorNumbers.SQL_STATE_ILLEGAL_ARGUMENT,
                getExceptionInterceptor());
    }
}
 
Example #11
Source File: PreparedStatementWrapper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public void setInt(int parameterIndex, int x) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((PreparedStatement) this.wrappedStmt).setInt(parameterIndex, x);
        } else {
            throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
                    this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example #12
Source File: StatementWrapper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public boolean execute(String sql, String[] columnNames) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return this.wrappedStmt.execute(sql, columnNames);
        }

        throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_ILLEGAL_ARGUMENT,
                this.exceptionInterceptor);
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }

    return false; // we actually never get here, but the compiler can't figure that out
}
 
Example #13
Source File: PreparedStatementWrapper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((PreparedStatement) this.wrappedStmt).setTimestamp(parameterIndex, x, cal);
        } else {
            throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
                    this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example #14
Source File: CallableStatementWrapper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Support for java.sql.JDBCType/java.sql.SQLType.
 * 
 * @param parameterName
 * @param x
 * @param targetSqlType
 * @param scaleOrLength
 * @throws SQLException
 */
public void setObject(String parameterName, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setObject(parameterName, x, targetSqlType, scaleOrLength);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
                    this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example #15
Source File: PreparedStatementWrapper.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setBytes(int parameterIndex, byte[] x) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((PreparedStatement) this.wrappedStmt).setBytes(parameterIndex, x);
        } else {
            throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
                    this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example #16
Source File: CallableStatementWrapper.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Array getArray(String parameterName) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return ((CallableStatement) this.wrappedStmt).getArray(parameterName);
        }
        throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
                this.exceptionInterceptor);

    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
    return null;
}
 
Example #17
Source File: SessionTest.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void createExistingSchemaError() {
    if (!this.isSetForXTests) {
        return;
    }
    String testSchemaName = getRandomTestSchemaName();
    Schema newSchema = this.session.createSchema(testSchemaName);
    assertTrue(this.session.getSchemas().contains(newSchema));
    try {
        this.session.createSchema(testSchemaName);
        fail("Attempt to create a schema with the name of an existing schema should fail");
    } catch (XProtocolError err) {
        assertEquals(MysqlErrorNumbers.ER_DB_CREATE_EXISTS, err.getErrorCode());
    }
}
 
Example #18
Source File: PreparedStatementWrapper.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setString(int parameterIndex, String x) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((PreparedStatement) this.wrappedStmt).setString(parameterIndex, x);
        } else {
            throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
                    this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example #19
Source File: PreparedStatementWrapper.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((PreparedStatement) this.wrappedStmt).setNull(parameterIndex, sqlType, typeName);
        } else {
            throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
                    this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example #20
Source File: ClientPreparedStatement.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setObject(int parameterIndex, Object parameterObj, int targetSqlType) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        try {
            ((PreparedQuery<?>) this.query).getQueryBindings().setObject(getCoreParameterIndex(parameterIndex), parameterObj,
                    MysqlType.getByJdbcType(targetSqlType));
        } catch (FeatureNotAvailableException nae) {
            throw SQLError.createSQLFeatureNotSupportedException(Messages.getString("Statement.UnsupportedSQLType") + JDBCType.valueOf(targetSqlType),
                    MysqlErrorNumbers.SQL_STATE_DRIVER_NOT_CAPABLE, this.exceptionInterceptor);
        }
    }
}
 
Example #21
Source File: PreparedStatementWrapper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public void setClob(int parameterIndex, Reader reader, long length) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((PreparedStatement) this.wrappedStmt).setClob(parameterIndex, reader, length);
        } else {
            throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
                    this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example #22
Source File: CallableStatementWrapper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public URL getURL(int parameterIndex) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return ((CallableStatement) this.wrappedStmt).getURL(parameterIndex);
        }
        throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
                this.exceptionInterceptor);

    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }

    return null;
}
 
Example #23
Source File: StatementWrapper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public void setFetchDirection(int direction) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            this.wrappedStmt.setFetchDirection(direction);
        } else {
            throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_ILLEGAL_ARGUMENT,
                    this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example #24
Source File: PreparedStatementWrapper.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Deprecated
public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((PreparedStatement) this.wrappedStmt).setUnicodeStream(parameterIndex, x, length);
        } else {
            throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
                    this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example #25
Source File: StatementWrapper.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return this.wrappedStmt.execute(sql, autoGeneratedKeys);
        }

        throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_ILLEGAL_ARGUMENT,
                this.exceptionInterceptor);
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }

    return false; // we actually never get here, but the compiler can't figure that out
}
 
Example #26
Source File: EscapeProcessor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private static void processTimeToken(StringBuilder newSql, String token, boolean serverSupportsFractionalSecond, ExceptionInterceptor exceptionInterceptor)
        throws SQLException {
    int startPos = token.indexOf('\'') + 1;
    int endPos = token.lastIndexOf('\''); // no }

    if ((startPos == -1) || (endPos == -1)) {
        newSql.append(token); // it's just part of the query, push possible syntax errors onto server's shoulders
    } else {

        String argument = token.substring(startPos, endPos);

        try {
            StringTokenizer st = new StringTokenizer(argument, " :.");
            String hour = st.nextToken();
            String minute = st.nextToken();
            String second = st.nextToken();

            String fractionalSecond = "";

            if (serverSupportsFractionalSecond && st.hasMoreTokens()) {
                fractionalSecond = "." + st.nextToken();
            }

            newSql.append("'");
            newSql.append(hour);
            newSql.append(":");
            newSql.append(minute);
            newSql.append(":");
            newSql.append(second);
            if (serverSupportsFractionalSecond) {
                newSql.append(fractionalSecond);
            }
            newSql.append("'");
        } catch (java.util.NoSuchElementException e) {
            throw SQLError.createSQLException(Messages.getString("EscapeProcessor.3", new Object[] { argument }), MysqlErrorNumbers.SQL_STATE_SYNTAX_ERROR,
                    exceptionInterceptor);
        }
    }
}
 
Example #27
Source File: PreparedStatementWrapper.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setArray(int parameterIndex, Array x) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((PreparedStatement) this.wrappedStmt).setArray(parameterIndex, x);
        } else {
            throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
                    this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example #28
Source File: CallableStatementWrapper.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setClob(String parameterName, Reader reader, long length) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setClob(parameterName, reader, length);
        } else {
            throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
                    this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example #29
Source File: CallableStatementWrapper.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setTime(String parameterName, Time x) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setTime(parameterName, x);
        } else {
            throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
                    this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example #30
Source File: CallableStatementWrapper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public Date getDate(String parameterName, Calendar cal) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return ((CallableStatement) this.wrappedStmt).getDate(parameterName, cal);
        }
        throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
                this.exceptionInterceptor);

    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
    return null;
}