Class QueryBuilder


  • public final class QueryBuilder
    extends java.lang.Object
    Utility class used to create queries based on provided values
    • Method Summary

      Modifier and Type Method Description
      static java.lang.String deleteQuery​(java.lang.String tableName, java.lang.String[] primary)
      creates update query
      static java.lang.String insertQuery​(java.lang.String tableName, java.util.List<Pair<java.lang.String,​java.lang.Object>> pairs)
      creates insert query
      static java.lang.String updateQuery​(java.lang.String tableName, java.lang.String[] primary, java.util.List<Pair<java.lang.String,​java.lang.Object>> pairs)
      creates update query
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • insertQuery

        public static java.lang.String insertQuery​(java.lang.String tableName,
                                                   java.util.List<Pair<java.lang.String,​java.lang.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 java.lang.String updateQuery​(java.lang.String tableName,
                                                   java.lang.String[] primary,
                                                   java.util.List<Pair<java.lang.String,​java.lang.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 java.lang.String deleteQuery​(java.lang.String tableName,
                                                   java.lang.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