package core.operation;

import core.user.User;
import dao.DBManagement;

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class Search extends Operation {
    @Override
    public Map<String, Object> execute(User subject) throws Exception {
        String table = (String)this.getOptions().get("table");
        List<String> fields = (List<String>)this.getOptions().get("fields");
        Map<String, String> limits = (Map<String, String>)this.getOptions().get("limits");
        int start = (int)this.getOptions().get("start");
        int end = (int)this.getOptions().get("end");
        List<String[]> ls = DBManagement.select(fields,table,limits,start,end);
        this.getOptions().put("result",ls);
        return this.getOptions();
    }
}
