import java.net.URISyntaxException;
import java.sql.*;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;

import com.heroku.sdk.jdbc.DatabaseUrl;

class IdealPrice 
{
	private Connection connection = null;
	private Statement stmt = null;
	private ArrayList<NPD> listNPD;
	private Account account;
	private ArrayList<FG> listFG;
	
	public IdealPrice(ArrayList<NPD> newNPD)
	{
		ConnectDB();		
		listNPD = newNPD;
		
		LoadData();
	}
	
	public IdealPrice(Account newAcc)
	{
		ConnectDB();		
		account = newAcc;
		listNPD = new ArrayList<NPD>();
		
		try {
			ResultSet rs = stmt.executeQuery("SELECT * FROM salesforce.NPD__c where Account_Name__c='" + newAcc.Id + "'");
			
	        while (rs.next()) 	
	        {
	        	listNPD.add(new NPD(rs));
	        }
	        
	        //LoadData();
		} 
		catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	
	private void ConnectDB()
	{
		try {
			connection = DatabaseUrl.extract().getConnection();
			stmt = connection.createStatement();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (URISyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	private void LoadData()
	{
		String listID = "";
		for(NPD npd : listNPD)
		{
			listID += npd.Id + ", ";
		}
		try 
		{
			ResultSet rs = stmt.executeQuery("SELECT * FROM salesforce.FG__c where NPD__c in (" + listID + ")");
			while (rs.next()) 
	        {
	        	listFG.add(new FG(rs));
	        }
		} 
		catch (SQLException e) 
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public String getResult()
	{
		
		String output = "";
		/*
		 * for(FG fg : listFG)
		{
			output += fg.Name + "(" + fg.AnnualVolume + "), ";
		}
		*/
		for(NPD npd : listNPD)
		{
			output += "Name: " + npd.Name + ", ";
        }
		return output;
		
		
		//return "Success";
	}
}

@@ -797,18 +797,16 @@
         
-//
 LoadData
@@ -805,24 +805,24 @@
 LoadData();%0A
+
 %09%09%7D %0A%09%09catch
@@ -1291,18 +1291,61 @@
 stID = %22
-%22;
+a0fO000000AlPnSIAV, a0fO000000AlBIQIA3%22;%0A%09%09/*
 %0A%09%09for(N
@@ -1398,16 +1398,21 @@
  %22;%0A%09%09%7D%0A
+%09%09*/%0A
 %09%09try %0A%09
@@ -1763,16 +1763,11 @@
 ;%0A%09%09
-/*
 %0A%09%09
- * 
 for(
@@ -1844,97 +1844,12 @@
  %22;%0A
+
 %09%09%7D%0A
-%09%09*/%0A%09%09for(NPD npd : listNPD)%0A%09%09%7B%0A%09%09%09output += %22Name: %22 + npd.Name + %22, %22;%0A        %7D%0A
 %09%09re

Test Query Where IN v0.2