All pastes #807145 Raw Edit

Stuff

public text v1 · immutable
·published 2007-12-06 08:15 UTC
rendered paste body
String recNameQuery = "SELECT recipe_name " +	
	"FROM recipe, ingredient_recipe " +
	"WHERE recipe.recipe_id = ingredient_recipe.recipe_id AND (ingredient_recipe.ingredient_id = ?";
						
	//For Loop for preparing rest of Query String
	for(int i = 1; i < extractedIngredientIDs.size(); i ++) {
		recNameQuery += "OR ingredient_recipe.ingredient_id = ?";
	} // end for 
	recNameQuery += ") GROUP BY recipe_name";
 	st = dbconn.prepareStatement(recNameQuery);
				
	//For Loop for preparing statement
	for(int i = 1; i < extractedIngredientIDs.size()+1; i ++) {
		st.setInt(i, extractedIngredientIDs.get(i-1));
	} // end for
	
	rs = st.executeQuery();
	while(rs.next()){
		recipesToDisplay.add(rs.getString("recipe_name"));
	}
												
	ListModel recipeListBoxModel = 
		new DefaultComboBoxModel(recipesToDisplay.toArray());
	recipeListBox.removeAll();
	recipeListBox.setModel(recipeListBoxModel);
	
} // end if anyParam