Package com.openmeet.shared.utils

# Class QueryBuilder

java.lang.Object
com.openmeet.shared.utils.QueryBuilder

public class QueryBuilder extends Object
Class for programmatically constructing a SQL query.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static QueryBuilder`
  `DELETE_FROM(String table)`
  Creates a "delete from" query.
  `QueryBuilder`
  `FROM(String... tables)`
  Appends a "from" clause to a query.
  `static QueryBuilder`
  `INSERT_INTO(String table, Map<String,?> values)`
  Creates an "insert into" query.
  `QueryBuilder`
  `JOIN(String table)`
  Appends a "join" clause to a query.
  `QueryBuilder`
  `LEFT_JOIN(String table)`
  Appends a "left join" clause to a query.
  `QueryBuilder`
  `LIMIT(int row_count)`
  Appends a "limit" clause to a query.
  `QueryBuilder`
  `LIMIT(int offset, int row_count)`
  Appends a "limit" clause to a query.
  `QueryBuilder`
  `ON(String predicate)`
  Appends an "on" clause to a query.
  `QueryBuilder`
  `ORDER_BY(String... columns)`
  Appends an "order by" clause to a query.
  `QueryBuilder`
  `RIGHT_JOIN(String table)`
  Appends a "right join" clause to a query.
  `static QueryBuilder`
  `SELECT(String... columns)`
  Creates a "select" query.
  `QueryBuilder`
  `SET(Map<String,?> values)`
  Appends a "set" command to a query.
  `String`
  `toString()`
  `QueryBuilder`
  `UNION(QueryBuilder queryBuilder)`
  Appends a "union" clause to a query.
  `static QueryBuilder`
  `UPDATE(String table)`
  Creates an "update" query.
  `QueryBuilder`
  `WHERE(String predicate)`
  Appends a "where" clause to a query.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Method Details

  - ### SELECT

    public static QueryBuilder SELECT(String... columns)
    Creates a "select" query.
    Parameters:
      `columns` - The column names.
    Returns:
      The new `QueryBuilder` instance.

  - ### FROM

    public QueryBuilder FROM(String... tables)
    Appends a "from" clause to a query.
    Parameters:
      `tables` - The table names.
    Returns:
      The `QueryBuilder` instance.

  - ### JOIN

    public QueryBuilder JOIN(String table)
    Appends a "join" clause to a query.
    Parameters:
      `table` - The table name.
    Returns:
      The `QueryBuilder` instance.

  - ### LEFT_JOIN

    public QueryBuilder LEFT_JOIN(String table)
    Appends a "left join" clause to a query.
    Parameters:
      `table` - The table name.
    Returns:
      The `QueryBuilder` instance.

  - ### RIGHT_JOIN

    public QueryBuilder RIGHT_JOIN(String table)
    Appends a "right join" clause to a query.
    Parameters:
      `table` - The table name.
    Returns:
      The `QueryBuilder` instance.

  - ### ON

    public QueryBuilder ON(String predicate)
    Appends an "on" clause to a query.
    Parameters:
      `predicate` - The predicate.
    Returns:
      The `QueryBuilder` instance.

  - ### WHERE

    public QueryBuilder WHERE(String predicate)
    Appends a "where" clause to a query.
    Parameters:
      `predicate` - The predicate.
    Returns:
      The `QueryBuilder` instance.

  - ### ORDER_BY

    public QueryBuilder ORDER_BY(String... columns)
    Appends an "order by" clause to a query.
    Parameters:
      `columns` - The column names.
    Returns:
      The `QueryBuilder` instance.

  - ### LIMIT

    public QueryBuilder LIMIT(int row_count)
    Appends a "limit" clause to a query.
    Parameters:
      `row_count` - The limit count.
    Returns:
      The `QueryBuilder` instance.

  - ### LIMIT

    public QueryBuilder LIMIT(int offset, int row_count)
    Appends a "limit" clause to a query.
    Parameters:
      `offset` - Starting offset
      `row_count` - Ending offset
    Returns:
      The `QueryBuilder` instance.

  - ### UNION

    public QueryBuilder UNION(QueryBuilder queryBuilder)
    Appends a "union" clause to a query.
    Parameters:
      `queryBuilder` - The query builder to append.
    Returns:
      The `QueryBuilder` instance.

  - ### INSERT_INTO

    public static QueryBuilder INSERT_INTO(String table, Map<String,?> values)
    Creates an "insert into" query.
    Parameters:
      `table` - The table name.
      `values` - The values to insert.
    Returns:
      The new `QueryBuilder` instance.

  - ### UPDATE

    public static QueryBuilder UPDATE(String table)
    Creates an "update" query.
    Parameters:
      `table` - The table name.
    Returns:
      The new `QueryBuilder` instance.

  - ### SET

    public QueryBuilder SET(Map<String,?> values)
    Appends a "set" command to a query.
    Parameters:
      `values` - The values to update.
    Returns:
      The `QueryBuilder` instance.

  - ### DELETE_FROM

    public static QueryBuilder DELETE_FROM(String table)
    Creates a "delete from" query.
    Parameters:
      `table` - The table name.
    Returns:
      The new `QueryBuilder` instance.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`