/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package database.operations;


import database.UserGame;
import database.connection.DatabaseConnection;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

/**
 *
 * @author Ani
 */
public class InsertPlayerTable {

    public static void insertHeusristicForState(UserGame state, String table) throws SQLException, IOException{
        PreparedStatement pstmt = new DatabaseConnection().getConnection().
                prepareStatement("INSERT INTO "+ table + " (code, heuristic) " +
                "VALUES(?, ?)");
        pstmt.setString(1, state.getCode());
        pstmt.setInt(2, state.getHeuristic());

        pstmt.execute();
    }

    public static void insertHeusristicForState(Connection con, UserGame state, String table) throws SQLException, IOException{
        PreparedStatement pstmt = con.prepareStatement("INSERT INTO "+ table + " (code, heuristic) " +
                "VALUES(?, ?)");
        pstmt.setString(1, state.getCode());
        pstmt.setInt(2, state.getHeuristic());

        pstmt.execute();
    }
    


}
