All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.ttddyy.dsproxy.QueryInfo Maven / Gradle / Ivy

There is a newer version: 1.10
Show newest version
package net.ttddyy.dsproxy;

import net.ttddyy.dsproxy.proxy.ParameterSetOperation;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Hold query and parameter information.
 *
 * For Statement batch execution, there will be multiple QueryInfo.
 * For Prepared/Callable batch execution, there will be one QueryInfo with multiple elements in parameters.
 * For batch execution, single instance of this class represents each batch entry.
 *
 * @author Tadaya Tsuyukubo
 */
public class QueryInfo {
    private String query;

    private List> parametersList = new ArrayList>();

    public QueryInfo() {
    }

    public QueryInfo(String query) {
        this.query = query;
    }

    public String getQuery() {
        return query;
    }

    public void setQuery(String query) {
        this.query = query;
    }

    /**
     * Deprecated: Since return doesn't contain method information, {@link #getParametersList()} is now used.
     *
     * @return list of parameter map, key is first arg as string, value is second arg.
     * @deprecated use {@link #getParametersList()}
     */
    @Deprecated
    public List> getQueryArgsList() {
        // simulate old implementation behavior
        List> result = new ArrayList>();
        for (List paramsList : this.parametersList) {
            Map map = new HashMap();

            for (ParameterSetOperation param : paramsList) {
                Object[] args = param.getArgs();
                map.put(args[0].toString(), args[1]);
            }

            result.add(map);
        }
        return result;
    }


    /**
     * List of parameter-operation-list.
     *
     * For non-batch Prepared/Callable execution, this list contains 1 element that is a list which contains all
     * parameter sets operations for the execution.
     * For batch Prepared/Callable executions, this list will have N number of elements.
     *
     * @return list of prameter operation list
     * @since 1.4
     */
    public List> getParametersList() {
        return parametersList;
    }

    public void setParametersList(List> parametersList) {
        this.parametersList = parametersList;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy