public List<StoredProc> retrieveProcList( String schema, String search, String procType, String userKey) throws SqlFireException { Connection conn = null; PreparedStatement stmt = null; ResultSet rset = null; List<StoredProc> procs = null; String srch = null; try { conn = AdminUtil.getConnection(userKey); stmt = conn.prepareStatement(Constants.USER_STORED_CODE); if (search == null) srch = "%"; else srch = "%" + search.toUpperCase() + "%"; stmt.setString(1, procType); stmt.setString(2, schema); stmt.setString(3, srch); rset = stmt.executeQuery(); procs = makeProcListFromResultSet(rset); } catch (SQLException se) { logger.debug("Error retrieving all procs with search string = " + search); throw new SqlFireException(se); } catch (Exception ex) { logger.debug("Error retrieving all procs with search string = " + search); throw new SqlFireException(ex); } finally { // close all resources JDBCUtil.close(rset); JDBCUtil.close(stmt); } return procs; }
public List<ProcedureParameter> describeProcedure( String schemaName, String procName, String userKey) throws SqlFireException { List<ProcedureParameter> procParams = new ArrayList<ProcedureParameter>(); Connection conn = null; ResultSet rset = null; try { conn = AdminUtil.getConnection(userKey); rset = conn.getMetaData() .getProcedureColumns(null, schemaName.toUpperCase(), procName.toUpperCase(), "%"); while (rset.next()) { ProcedureParameter param = new ProcedureParameter( rset.getInt("PARAMETER_ID"), rset.getString("COLUMN_NAME"), rset.getString("TYPE_NAME")); procParams.add(param); } } catch (SQLException se) { logger.debug("Error retrieving all parameters for procedure with name " + procName); throw new SqlFireException(se); } catch (Exception ex) { logger.debug("Error retrieving all parameters for procedure with name " + procName); throw new SqlFireException(ex); } finally { // close all resources JDBCUtil.close(rset); } // TODO Auto-generated method stub return procParams; }