Class SQLElementFactory

  • All Implemented Interfaces:
    java.io.Serializable

    public final class SQLElementFactory
    extends java.lang.Object
    implements java.io.Serializable
    Author:
    Tim Dudgeon
    See Also:
    Serialized Form
    • Constructor Detail

      • SQLElementFactory

        public SQLElementFactory​(DBDatabaseInfo dbInfo)
      • SQLElementFactory

        public SQLElementFactory​(TermEncoder encoder)
    • Method Detail

      • createWhereClauseInListElement

        public SQLWhereClauseElement createWhereClauseInListElement​(TableColumn tableColumn,
                                                                    java.util.Collection values)
        Create an in list where clause of type:
        WHERE col IN (1,2,3...)
        .
        Parameters:
        tableColumn - The column name
        values - A list of values for the list
        Returns:
        The SQLInClause
      • createWhereClauseInListElement

        public SQLWhereClauseElement createWhereClauseInListElement​(TableColumn tableColumn,
                                                                    java.lang.Object[] values)
        Create an in list where clause of type:
        WHERE col IN (1,2,3...)
        .
        Parameters:
        tableColumn - The column name
        values - An array of values for the list
        Returns:
        The SQLInClause
      • createWhereClauseNotInListElement

        public SQLWhereClauseElement createWhereClauseNotInListElement​(TableColumn tableColumn,
                                                                       java.util.Collection values)
        Create an in list where clause of type:
        WHERE col NOT IN (1,2,3...)
        .
        Parameters:
        tableColumn - The column name
        values - A list of values for the list
        Returns:
        The SQLInClause
      • createWhereClauseNotInListElement

        public SQLWhereClauseElement createWhereClauseNotInListElement​(TableColumn tableColumn,
                                                                       java.lang.Object[] values)
        Create an in list where clause of type:
        WHERE col NOT IN (1,2,3...)
        .
        Parameters:
        tableColumn - The column name
        values - An array of values for the list
        Returns:
        The SQLInClause
      • sqlSelectInList

        public SQLSelectStatement sqlSelectInList​(java.util.List<SQLSelectElement> selectElements,
                                                  TableColumn inClauseColumn,
                                                  java.util.Collection<?> idValues)
        Creates a SQL SELECT statement in the form SELECT foo, bar FROM baz WHERE idClauseColumn IN (idValues).
        Parameters:
        selectElements - The elements that the SELECT statement will return as a result.
        inClauseColumn - The column for the WHERE clause term constraint.
        idValues - The values constraining the inClauseColumn.
        Returns:
        A SQLSelectStatement suitable for creating a SQL SELECT string.
      • sqlSelectPS

        public SQLSelectStatement sqlSelectPS​(java.util.List<SQLSelectElement> selectElements,
                                              TableColumn whereTermColumn)
        Creates SQL for a PreparedStatement in the form SELECT foo, bar FROM baz WHERE whereTermColumn = ?. All selectElements and whereTermColumn have to refer to the same TableDefinition.
        Parameters:
        selectElements - The elements that the SELECT statement will return as a result.
        whereTermColumn - The column for the WHERE clause term constraint.
        Returns:
        A SQLSelectStatement suitable for creating a PreparedStatement.
      • sqlSelectPSmore

        public SQLSelectStatement sqlSelectPSmore​(java.util.List<SQLSelectElement> selectElements,
                                                  java.util.List<TableColumn> whereTermColumns)
        Creates SQL for a PreparedStatement in the form SELECT foo, bar FROM baz WHERE whereTermColumn1 = ? AND ... AND whereTermColumnN = ?. All selectElements and whereTermColumns have to refer to the same TableDefinition.
        Parameters:
        selectElements - The elements that the SELECT statement will return as a result.
        whereTermColumns - The columns for the WHERE clause term constraints.
        Returns:
        A SQLSelectStatement suitable for creating a PreparedStatement.