Class QueryBuilder


  • public final class QueryBuilder
    extends Object
    Utility class used to create queries based on provided values
    • Method Detail

      • insertQuery

        public static String insertQuery​(String tableName,
                                         List<Pair<String,​Object>> pairs)
        creates insert query
        Parameters:
        tableName - the name of table in the database
        pairs - pairs of key column names and their values
        Returns:
        string of the insert query
      • updateQuery

        public static String updateQuery​(String tableName,
                                         String[] primary,
                                         List<Pair<String,​Object>> pairs)
        creates update query
        Parameters:
        tableName - the name of table in the database
        primary - array of strings that represent the primary key of the table
        pairs - pairs of key column names and their values
        Returns:
        string of the update query
      • deleteQuery

        public static String deleteQuery​(String tableName,
                                         String[] primary)
        creates update query
        Parameters:
        tableName - the name of table in the database
        primary - array of strings that represent the primary key of the table
        Returns:
        string of the delete query