Java Code Examples for java.sql.CallableStatement

The following are top voted examples for showing how to use java.sql.CallableStatement. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: ProyectoPacientes   File: CallableStatementRegressionTest.java   View source code 6 votes vote down vote up
/**
 * Tests fix for BUG#25379 - INOUT parameters in CallableStatements get
 * doubly-escaped.
 * 
 * @throws Exception
 *             if the test fails.
 */
public void testBug25379() throws Exception {
    if (!serverSupportsStoredProcedures()) {
        return;
    }

    createTable("testBug25379", "(col char(40))");

    createProcedure("sp_testBug25379", "(INOUT invalue char(255))\nBEGIN" + "\ninsert into testBug25379(col) values(invalue);\nEND");

    CallableStatement cstmt = this.conn.prepareCall("{call sp_testBug25379(?)}");
    cstmt.setString(1, "'john'");
    cstmt.executeUpdate();
    assertEquals("'john'", cstmt.getString(1));
    assertEquals("'john'", getSingleValue("testBug25379", "col", "").toString());
}
 
Example 2
Project: s-store   File: WrapperInvocationHandler.java   View source code 6 votes vote down vote up
/**
 * Given a delegate, retrieves the interface that must be implemented by a
 * surrogate dynamic proxy to ensure pooling sensitive methods
 * of the delegate are not exposed directly to clients.
 *
 * @param delegate the target delegate of interest
 * @return the interface that must be implemented by a surrogate dynamic
 *         proxy to ensure pooling sensitive methods of the delegate are
 *         not exposed directly to clients
 */
protected static Class[] _computeProxiedInterface(Object delegate) {

    // NOTE:  Order is important for XXXStatement.
    if (delegate instanceof Array) {
        return arrayInterface;
    } else if (delegate instanceof Connection) {
        return connectionInterface;
    } else if (delegate instanceof CallableStatement) {
        return callableStatementInterface;
    } else if (delegate instanceof DatabaseMetaData) {
        return databaseMetaDataInterface;
    } else if (delegate instanceof PreparedStatement) {
        return preparedStatementInterface;
    } else if (delegate instanceof ResultSet) {
        return resultSetInterface;
    } else if (delegate instanceof Statement) {
        return statementInterface;
    } else {
        return null;
    }
}
 
Example 3
Project: sstore-soft   File: WrapperInvocationHandler.java   View source code 6 votes vote down vote up
/**
 * Given a delegate, retrieves the interface that must be implemented by a
 * surrogate dynamic proxy to ensure pooling sensitive methods
 * of the delegate are not exposed directly to clients.
 *
 * @param delegate the target delegate of interest
 * @return the interface that must be implemented by a surrogate dynamic
 *         proxy to ensure pooling sensitive methods of the delegate are
 *         not exposed directly to clients
 */
protected static Class[] _computeProxiedInterface(Object delegate) {

    // NOTE:  Order is important for XXXStatement.
    if (delegate instanceof Array) {
        return arrayInterface;
    } else if (delegate instanceof Connection) {
        return connectionInterface;
    } else if (delegate instanceof CallableStatement) {
        return callableStatementInterface;
    } else if (delegate instanceof DatabaseMetaData) {
        return databaseMetaDataInterface;
    } else if (delegate instanceof PreparedStatement) {
        return preparedStatementInterface;
    } else if (delegate instanceof ResultSet) {
        return resultSetInterface;
    } else if (delegate instanceof Statement) {
        return statementInterface;
    } else {
        return null;
    }
}
 
Example 4
Project: lams   File: OracleTableMetaDataProvider.java   View source code 6 votes vote down vote up
private void lookupDefaultSchema(DatabaseMetaData databaseMetaData) {
	try {
		CallableStatement cstmt = null;
		try {
			cstmt = databaseMetaData.getConnection().prepareCall("{? = call sys_context('USERENV', 'CURRENT_SCHEMA')}");
			cstmt.registerOutParameter(1, Types.VARCHAR);
			cstmt.execute();
			this.defaultSchema = cstmt.getString(1);
		}
		finally {
			if (cstmt != null) {
				cstmt.close();
			}
		}
	}
	catch (Exception ignore) {
	}
}
 
Example 5
Project: the-vigilantes   File: CallableStatementRegressionTest.java   View source code 6 votes vote down vote up
/**
 * Tests fix for BUG#22024 - Newlines causing whitespace to span confuse
 * procedure parser when getting parameter metadata for stored procedures.
 * 
 * @throws Exception
 *             if the test fails
 */
public void testBug22024() throws Exception {
    if (!serverSupportsStoredProcedures()) {
        return;
    }

    createProcedure("testBug22024_1", "(\r\n)\r\n BEGIN SELECT 1; END");
    createProcedure("testBug22024_2", "(\r\na INT)\r\n BEGIN SELECT 1; END");

    CallableStatement cstmt = null;

    try {
        cstmt = this.conn.prepareCall("{CALL testBug22024_1()}");
        cstmt.execute();

        cstmt = this.conn.prepareCall("{CALL testBug22024_2(?)}");
        cstmt.setInt(1, 1);
        cstmt.execute();
    } finally {
        if (cstmt != null) {
            cstmt.close();
        }
    }

}
 
Example 6
Project: OpenVertretung   File: CallableStatementRegressionTest.java   View source code 6 votes vote down vote up
/**
 * Tests fix for BUG#21462 - JDBC (and ODBC) specifications allow
 * no-parenthesis CALL statements for procedures with no arguments, MySQL
 * server does not.
 * 
 * @throws Exception
 *             if the test fails.
 */
public void testBug21462() throws Exception {
    if (!serverSupportsStoredProcedures()) {
        return;
    }

    createProcedure("testBug21462", "() BEGIN SELECT 1; END");

    CallableStatement cstmt = null;

    try {
        cstmt = this.conn.prepareCall("{CALL testBug21462}");
        cstmt.execute();
    } finally {
        if (cstmt != null) {
            cstmt.close();
        }
    }

}
 
Example 7
Project: OpenVertretung   File: CallableStatementRegressionTest.java   View source code 6 votes vote down vote up
public void testBug35199() throws Exception {
    if (!versionMeetsMinimum(5, 0)) {
        return;
    }

    createFunction("test_function", "(a varchar(40), b bigint(20), c varchar(80)) RETURNS bigint(20) LANGUAGE SQL DETERMINISTIC "
            + "MODIFIES SQL DATA COMMENT 'bbb' BEGIN RETURN 1; END; ");

    CallableStatement callable = null;
    try {
        callable = this.conn.prepareCall("{? = call test_function(?,101,?)}");
        callable.registerOutParameter(1, Types.BIGINT);

        callable.setString(2, "FOO");
        callable.setString(3, "BAR");
        callable.executeUpdate();
    } finally {
        if (callable != null) {
            callable.close();
        }
    }
}
 
Example 8
Project: BibliotecaPS   File: JDBC4CallableStatementWrapper.java   View source code 5 votes vote down vote up
public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setSQLXML(parameterName, xmlObject);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example 9
Project: lams   File: JDBC4CallableStatementWrapper.java   View source code 5 votes vote down vote up
public void setClob(String parameterName, Reader reader) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setClob(parameterName, reader);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example 10
Project: dswork.jdbc   File: ConnectionSpy.java   View source code 5 votes vote down vote up
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
{
	try
	{
		CallableStatement statement = realConnection.prepareCall(sql, resultSetType, resultSetConcurrency);
		return (CallableStatement) new CallableStatementSpy(sql, this, statement);
	}
	catch(SQLException s)
	{
		String methodCall = "prepareCall(" + sql + ", " + resultSetType + ", " + resultSetConcurrency + ")";
		reportException(methodCall, s, sql);
		throw s;
	}
}
 
Example 11
Project: BibliotecaPS   File: JDBC42CallableStatementWrapper.java   View source code 5 votes vote down vote up
/**
 * Support for java.sql.JDBCType/java.sql.SQLType.
 * 
 * @param parameterIndex
 * @param x
 * @param targetSqlType
 * @param scaleOrLength
 * @throws SQLException
 */
public void setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setObject(parameterIndex, x, targetSqlType, scaleOrLength);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example 12
Project: uavstack   File: DAOFactory.java   View source code 5 votes vote down vote up
public Object getResult(CallableStatement cs, int columnIndex) throws SQLException {

            Object bigdec = cs.getBigDecimal(columnIndex);
            if (cs.wasNull()) {
                return null;
            }
            else {
                return bigdec;
            }
        }
 
Example 13
Project: the-vigilantes   File: JDBC4CallableStatementWrapper.java   View source code 5 votes vote down vote up
public String getNString(int parameterIndex) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return ((CallableStatement) this.wrappedStmt).getNString(parameterIndex);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }

    return null;
}
 
Example 14
Project: OpenVertretung   File: CallableStatementWrapper.java   View source code 5 votes vote down vote up
public Time getTime(int parameterIndex) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return ((CallableStatement) this.wrappedStmt).getTime(parameterIndex);
        }
        throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);

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

    return null;
}
 
Example 15
Project: s-store   File: BaseConnectionWrapper.java   View source code 5 votes vote down vote up
public CallableStatement prepareCall(String sql, int resultSetType,
        int resultSetConcurrency) throws SQLException {

    validate();

    return this.getConnection().prepareCall(sql, resultSetType,
            resultSetConcurrency);
}
 
Example 16
Project: jaffa-framework   File: JDBCLogger.java   View source code 5 votes vote down vote up
private CallableStatement createCallableStatement(int numberOfParameters) throws Exception {
	CallableStatement cStmt = null;

	String callString = "{call " + procedure + "( ";
	for (int i = 0; i < numberOfParameters - 1; i++) {
		callString = callString + "?, ";
	}
	if (numberOfParameters > 0) {
		callString = callString + "? ";
	}
	callString = callString + " )}";
	cStmt = con.prepareCall(callString);

	return cStmt;
}
 
Example 17
Project: BibliotecaPS   File: CallableStatementWrapper.java   View source code 5 votes vote down vote up
public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return ((CallableStatement) this.wrappedStmt).getTimestamp(parameterName, cal);
        }
        throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);

    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
    return null;
}
 
Example 18
Project: BibliotecaPS   File: CallableStatementWrapper.java   View source code 5 votes vote down vote up
public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setObject(parameterName, x, targetSqlType, scale);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example 19
Project: ProyectoPacientes   File: JDBC42CallableStatementWrapper.java   View source code 5 votes vote down vote up
/**
 * Support for java.sql.JDBCType/java.sql.SQLType.
 * 
 * @param parameterIndex
 * @param x
 * @param targetSqlType
 * @param scaleOrLength
 * @throws SQLException
 */
public void setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setObject(parameterIndex, x, targetSqlType, scaleOrLength);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example 20
Project: the-vigilantes   File: CallableStatementWrapper.java   View source code 5 votes vote down vote up
public void setTime(String parameterName, Time x, Calendar cal) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setTime(parameterName, x, cal);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example 21
Project: the-vigilantes   File: CallableStatementWrapper.java   View source code 5 votes vote down vote up
public void setBytes(String parameterName, byte[] x) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setBytes(parameterName, x);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example 22
Project: OpenVertretung   File: CallableStatementWrapper.java   View source code 5 votes vote down vote up
public void setBytes(String parameterName, byte[] x) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setBytes(parameterName, x);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example 23
Project: s-store   File: TestJDBCDriver.java   View source code 5 votes vote down vote up
@Test
public void testBadProcedureName() throws SQLException {
    CallableStatement cs = conn.prepareCall("{call Oopsy(?)}");
    cs.setLong(1, 99);
    try {
        cs.execute();
    } catch (SQLException e) {
        assertEquals(e.getSQLState(), SQLError.GENERAL_ERROR);
    }
}
 
Example 24
Project: the-vigilantes   File: JDBC4CallableStatementWrapper.java   View source code 5 votes vote down vote up
/**
 * @see java.sql.CallableStatement#getNCharacterStream(java.lang.String)
 */
public Reader getNCharacterStream(String parameterName) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return ((CallableStatement) this.wrappedStmt).getNCharacterStream(parameterName);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }

    return null;
}
 
Example 25
Project: OpenVertretung   File: CallableStatementRegressionTest.java   View source code 5 votes vote down vote up
/**
 * Tests fix for BUG#28689 - CallableStatement.executeBatch() doesn't work
 * when connection property "noAccessToProcedureBodies" has been set to
 * "true".
 * 
 * The fix involves changing the behavior of "noAccessToProcedureBodies", in
 * that the driver will now report all paramters as "IN" paramters but allow
 * callers to call registerOutParameter() on them.
 * 
 * @throws Exception
 */
public void testBug28689() throws Exception {
    if (!versionMeetsMinimum(5, 0)) {
        return; // no stored procedures
    }

    createTable("testBug28689", "(" +

            "`id` int(11) NOT NULL auto_increment,`usuario` varchar(255) default NULL,PRIMARY KEY  (`id`))");

    this.stmt.executeUpdate("INSERT INTO testBug28689 (usuario) VALUES ('AAAAAA')");

    createProcedure("sp_testBug28689", "(tid INT)\nBEGIN\nUPDATE testBug28689 SET usuario = 'BBBBBB' WHERE id = tid;\nEND");

    Connection noProcedureBodiesConn = getConnectionWithProps("noAccessToProcedureBodies=true");
    CallableStatement cStmt = null;

    try {
        cStmt = noProcedureBodiesConn.prepareCall("{CALL sp_testBug28689(?)}");
        cStmt.setInt(1, 1);
        cStmt.addBatch();
        cStmt.executeBatch();

        assertEquals("BBBBBB", getSingleIndexedValueWithQuery(noProcedureBodiesConn, 1, "SELECT `usuario` FROM testBug28689 WHERE id=1"));
    } finally {
        if (cStmt != null) {
            cStmt.close();
        }

        if (noProcedureBodiesConn != null) {
            noProcedureBodiesConn.close();
        }
    }
}
 
Example 26
Project: BibliotecaPS   File: StatementRegressionTest.java   View source code 5 votes vote down vote up
/**
 * Tests fix for Bug#71131 - Poor error message in CallableStatement.java.
 */
public void testBug71131() throws Exception {
    createProcedure("testBug71131", "(IN r DOUBLE, OUT p DOUBLE) BEGIN SET p = 2 * r * PI(); END");
    final CallableStatement cstmt = this.conn.prepareCall("{ CALL testBug71131 (?, 5) }");
    assertThrows(SQLException.class, "Parameter p is not registered as an output parameter", new Callable<Void>() {
        public Void call() throws Exception {
            cstmt.execute();
            return null;
        }
    });
    cstmt.close();
}
 
Example 27
Project: ProyectoPacientes   File: CallableStatementWrapper.java   View source code 5 votes vote down vote up
public float getFloat(int parameterIndex) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return ((CallableStatement) this.wrappedStmt).getFloat(parameterIndex);
        }
        throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);

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

    return 0;
}
 
Example 28
Project: ProyectoPacientes   File: CallableStatementWrapper.java   View source code 5 votes vote down vote up
public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return ((CallableStatement) this.wrappedStmt).getTimestamp(parameterIndex, cal);
        }
        throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);

    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
    return null;
}
 
Example 29
Project: OpenVertretung   File: CallableStatementWrapper.java   View source code 5 votes vote down vote up
public void registerOutParameter(int paramIndex, int sqlType, String typeName) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).registerOutParameter(paramIndex, sqlType, typeName);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example 30
Project: tangyuan2   File: DateTypeHandler.java   View source code 5 votes vote down vote up
@Override
public Date getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
	Timestamp sqlTimestamp = cs.getTimestamp(columnIndex);
	if (sqlTimestamp != null) {
		return new Date(sqlTimestamp.getTime());
	}
	return null;
}
 
Example 31
Project: BibliotecaPS   File: JDBC4CallableStatementWrapper.java   View source code 5 votes vote down vote up
/**
 * @see java.sql.CallableStatement#getCharacterStream(int)
 */
public Reader getCharacterStream(int parameterIndex) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return ((CallableStatement) this.wrappedStmt).getCharacterStream(parameterIndex);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }

    return null;
}
 
Example 32
Project: ats-framework   File: SQLServerDbReadAccess.java   View source code 5 votes vote down vote up
public int getSuitesCount( String whereClause ) throws DatabaseAccessException {

        Connection connection = getConnection();

        String sqlLog = new SqlRequestFormatter().add("where", whereClause).format();
        CallableStatement callableStatement = null;
        ResultSet rs = null;
        try {

            callableStatement = connection.prepareCall("{ call sp_get_suites_count(?) }");
            callableStatement.setString(1, whereClause);

            rs = callableStatement.executeQuery();
            int suitesCount = 0;
            while (rs.next()) {
                suitesCount = rs.getInt("suitesCount");
                logQuerySuccess(sqlLog, "suites", suitesCount);
                break;
            }

            return suitesCount;
        } catch (Exception e) {
            throw new DatabaseAccessException("Error when " + sqlLog, e);
        } finally {
            DbUtils.closeResultSet(rs);
            DbUtils.close(connection, callableStatement);
        }
    }
 
Example 33
Project: lams   File: CallableStatementWrapper.java   View source code 5 votes vote down vote up
public long getLong(String parameterName) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return ((CallableStatement) this.wrappedStmt).getLong(parameterName);
        }
        throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);

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

    return 0;
}
 
Example 34
Project: ProyectoPacientes   File: JDBC4CallableStatementWrapper.java   View source code 5 votes vote down vote up
public void setRowId(String parameterName, RowId x) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setRowId(parameterName, x);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example 35
Project: ProyectoPacientes   File: CallableStatementWrapper.java   View source code 5 votes vote down vote up
public void setBoolean(String parameterName, boolean x) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setBoolean(parameterName, x);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example 36
Project: the-vigilantes   File: CallableStatementWrapper.java   View source code 5 votes vote down vote up
public void setNull(String parameterName, int sqlType) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setNull(parameterName, sqlType);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example 37
Project: OpenVertretung   File: JDBC42CallableStatementWrapper.java   View source code 5 votes vote down vote up
/**
 * Support for java.sql.JDBCType/java.sql.SQLType.
 * 
 * @param parameterName
 * @param sqlType
 * @param scale
 * @throws SQLException
 */
public void registerOutParameter(String parameterName, SQLType sqlType, int scale) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).registerOutParameter(parameterName, sqlType, scale);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example 38
Project: the-vigilantes   File: CallableStatementWrapper.java   View source code 5 votes vote down vote up
public void setNull(String parameterName, int sqlType, String typeName) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setNull(parameterName, sqlType, typeName);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example 39
Project: ProyectoPacientes   File: CallableStatementWrapper.java   View source code 5 votes vote down vote up
public int getInt(String parameterName) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return ((CallableStatement) this.wrappedStmt).getInt(parameterName);
        }
        throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);

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

    return 0;
}
 
Example 40
Project: the-vigilantes   File: CallableStatementWrapper.java   View source code 5 votes vote down vote up
public void setDate(String parameterName, Date x, Calendar cal) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setDate(parameterName, x, cal);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}