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

package database.operations;


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

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

    public static void createPlayerTable(String tablename) throws SQLException, IOException{

         PreparedStatement pstmt =  new DatabaseConnection().getConnection().
                prepareStatement("CREATE TABLE " +tablename + "(" +
                    "code VARCHAR(32) NOT NULL, " +
                    "heuristic INTEGER NOT NULL, " +
                    "CONSTRAINT us_ga_un_"+ tablename +" UNIQUE (code))");

         pstmt.execute();
    }

        public static void createPlayerTable(Connection con, String tablename) throws SQLException, IOException{

         PreparedStatement pstmt =  con.prepareStatement("CREATE TABLE " +tablename + "(" +
                    "code VARCHAR(32) NOT NULL, " +
                    "heuristic INTEGER NOT NULL, " +
                    "CONSTRAINT us_ga_un_"+ tablename +" UNIQUE (code))");

         pstmt.execute();
    }

}
