// Path: DB_and_virustotal_submission/MalwareAnalysisDBProject/src/com/progetto_sicurezza/dbconfig/DBConfiguration.java
// public class DBConfiguration
// {
// 	public static final String DB_URL = "jdbc:mysql://localhost:3306/malware_data_collection";
// 	public static final String USERNAME ="root";
// 	public static final String PASSWORD = "";
// }
// 
// Path: DB_and_virustotal_submission/MalwareAnalysisDBProject/src/com/progetto_sicurezza/model/MalwareFamily.java
// public class MalwareFamily
// {
// 	private Integer id;
// 	private String familyName;
// 	private String familyDescription;
// 
// 	public Integer getId() {
// 		return id;
// 	}
// 	public void setId(int id) {
// 		this.id = id;
// 	}
// 	public String getFamilyName() {
// 		return familyName;
// 	}
// 	public void setFamily_name(String familyName) {
// 		this.familyName = familyName;
// 	}
// 	public String getFamilyDescription() {
// 		return familyDescription;
// 	}
// 	public void setFamily_description(String familyDescription) {
// 		this.familyDescription = familyDescription;
// 	}
// 	
// 	
// }


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.progetto_sicurezza.dbconfig.DBConfiguration;
import com.progetto_sicurezza.model.MalwareFamily;
                        "VALUES (?,?);";
        
        System.out.println(insert);

        stmt = dbCon.prepareStatement(insert,Statement.RETURN_GENERATED_KEYS);
        stmt.setString(1,malwareF.getFamilyName());
        stmt.setString(2,malwareF.getFamilyDescription());
	    stmt.executeUpdate();
	    
	    ResultSet rs = stmt.getGeneratedKeys();
        if (rs.next() )
        {
        	int toRet = rs.getInt(1);
        	dbCon.close();
            return toRet;
        }

        // never reached
        dbCon.close();
		return -1;
	}
	
	public MalwareFamily getMalwareFamilyByName(String nome) throws SQLException
	{
		if(nome == null) throw new IllegalArgumentException();

		Connection dbCon = DriverManager.getConnection(DBConfiguration.DB_URL,DBConfiguration.USERNAME,DBConfiguration.PASSWORD);
		PreparedStatement stmt;
        ResultSet rs;
        
// Path: DB_and_virustotal_submission/MalwareAnalysisDBProject/src/com/progetto_sicurezza/dbconfig/DBConfiguration.java
// public class DBConfiguration
// {
// 	public static final String DB_URL = "jdbc:mysql://localhost:3306/malware_data_collection";
// 	public static final String USERNAME ="root";
// 	public static final String PASSWORD = "";
// }
// 
// Path: DB_and_virustotal_submission/MalwareAnalysisDBProject/src/com/progetto_sicurezza/model/MalwareFamily.java
// public class MalwareFamily
// {
// 	private Integer id;
// 	private String familyName;
// 	private String familyDescription;
// 
// 	public Integer getId() {
// 		return id;
// 	}
// 	public void setId(int id) {
// 		this.id = id;
// 	}
// 	public String getFamilyName() {
// 		return familyName;
// 	}
// 	public void setFamily_name(String familyName) {
// 		this.familyName = familyName;
// 	}
// 	public String getFamilyDescription() {
// 		return familyDescription;
// 	}
// 	public void setFamily_description(String familyDescription) {
// 		this.familyDescription = familyDescription;
// 	}
// 	
// 	
// }


// Path: DB_and_virustotal_submission/MalwareAnalysisDBProject/src/com/progetto_sicurezza/dao/MalwareFamilyDao.java
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.progetto_sicurezza.dbconfig.DBConfiguration;
import com.progetto_sicurezza.model.MalwareFamily;

                        "VALUES (?,?);";
        
        System.out.println(insert);

        stmt = dbCon.prepareStatement(insert,Statement.RETURN_GENERATED_KEYS);
        stmt.setString(1,malwareF.getFamilyName());
        stmt.setString(2,malwareF.getFamilyDescription());
	    stmt.executeUpdate();
	    
	    ResultSet rs = stmt.getGeneratedKeys();
        if (rs.next() )
        {
        	int toRet = rs.getInt(1);
        	dbCon.close();
            return toRet;
        }

        // never reached
        dbCon.close();
		return -1;
	}
	
	public MalwareFamily getMalwareFamilyByName(String nome) throws SQLException
	{
		if(nome == null) throw new IllegalArgumentException();

		Connection dbCon = DriverManager.getConnection(DBConfiguration.DB_URL,DBConfiguration.USERNAME,DBConfiguration.PASSWORD);
		PreparedStatement stmt;
        ResultSet rs;
        
		String query = "SELECT  * " +