Interface QueryHelper

All Known Implementing Classes:
QueryHelperImpl

public interface QueryHelper
Helper class that provides useful methods when creating a SQL query.
  • Method Details

    • makeWhereClause

      String makeWhereClause(@NotNull @NotNull DABase daBase, @NotNull @NotNull String prefix, Map<String,Object> filters)
      Returns a String about the WHERE portion of an SQL query using the provided parameters.
      Parameters:
      daBase - DABase associated with the SQL query that needs to be created.
      prefix - String about the prefix to use before the value placeholder.
      filters - Map<String, Object> about the filters to apply to the generated SQL query.
      Returns:
      a String about the WHERE portion of an SQL query using the provided parameters.
    • makeWhereClause

      String makeWhereClause(String[] fields, @NotNull @NotNull String prefix, Map<String,Object> filters)
      Returns a String about the WHERE portion of an SQL query using the provided parameters.
      Parameters:
      fields - String[] relating to the fields on which it is necessary to set a filter criterion.
      prefix - String about the prefix to use before the value placeholder.
      filters - Map<String, Object> about the filters to apply to the generated SQL query.
      Returns:
      a String about the WHERE portion of an SQL query using the provided parameters.
    • makeWhereClauseWithPrimaryKeysOnly

      String makeWhereClauseWithPrimaryKeysOnly(@NotNull @NotNull DABase daBase, Map<String,Object> filters)
      Returns a String about the WHERE portion of an SQL query using only filters defined on primary key fields of the provided DABase.
      Parameters:
      daBase - DABase associated with the SQL query that needs to be created.
      filters - Map<String, Object> about the filters to apply to the generated SQL query.
      Returns:
      a String about the WHERE portion of an SQL query using only filters defined on primary key fields of the provided DABase.
    • makeOrderClause

      String makeOrderClause(@NotNull @NotNull DABase daBase)
      Returns a String about the ORDER BY portion of an SQL query associated to the provided DABase.
      Parameters:
      daBase - DABase associated with the SQL query that needs to be created.
      Returns:
      a String about the ORDER BY portion of an SQL query associated to the provided DABase.
    • makeColumnList

      String makeColumnList(Map<String,Object> values)
      Returns a String about the comma separated column list associated to each values key.
      Each returned column will be prefixed with @.
      Parameters:
      values - Map<String, Object> about the values to consider when creating an SQL query.
      Returns:
      a String about the comma separated column list associated to each values key.
      Each returned column will be prefixed with @.
    • makeQuestionList

      String makeQuestionList(Map<String,Object> values)
      Returns a String about the comma separated column list associated to each values key.
      Each returned column will be prefixed with ?.
      Parameters:
      values - Map<String, Object> about the values to consider when creating an SQL query.
      Returns:
      a String about the comma separated column list associated to each values key
      Each returned column will be prefixed with ?.
    • makeColumnList

      String makeColumnList(String[] columns)
      Returns a String about the comma separated column list using the provided columns.
      Each returned column will be prefixed with @.
      Parameters:
      columns - String[] about the columns to consider when creating an SQL query.
      Returns:
      a String about the comma separated column list using the provided columns.
      Each returned column will be prefixed with @.
    • makeUpdateList

      Returns a String about a list of fields that have to be updated when creating an UPDATE query, using the provided parameters.
      Parameters:
      daBase - DABase associated with the SQL query that needs to be created.
      values - Map<String, Object> about the values to consider when creating an SQL query.
      filters - Map<String, Object> about the filters to apply to the generated SQL query.
      Returns:
      a String about a list of fields that have to be updated when creating an UPDATE query, using the provided parameters.