Class QueryOptions


  • public class QueryOptions
    extends java.lang.Object
    The QueryOptions class holds all options that are applied at various places throughout the building process of a query.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int FETCH_ALL
      The default value of the fetchSize variable.
    • Constructor Summary

      Constructors 
      Constructor Description
      QueryOptions()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String cased​(java.lang.String string)
      Turns a string uppercase if enabled, else lowercase
      QueryOptions copy()
      Copies this instance including values and returns the new instance
      QueryOptions fetchAll()
      Fetch all columns on query
      QueryOptions fetchFirst()
      Fetch the first row only on query
      static QueryOptions getDefaultOptions()
      Returns the default options
      QueryOptions indent()
      Increases the indent level by 1
      java.lang.String indentString()
      Creates an indent string based on the indent size and level
      java.lang.String newLine()
      Creates a newline if required, when pretty printing is enabled
      java.lang.String newLine​(boolean noSpace)
      Creates a newline or space, if enabled
      java.lang.String padCased​(java.lang.String keyword)
      Combines the methods padded and cased
      java.lang.String padded​(java.lang.String keyword)
      Pads a string to a specified length, if enabled
      java.lang.String preparedValuesString()
      Returns all contained prepared values as a simple, concatenated string
      static void setDefaultOptions​(QueryOptions options)
      Sets the default options
      java.lang.String ticked​(java.lang.String string)
      Wraps a keyword in ticks or quotes, if enabled
      QueryOptions unindent()
      Decreases the indent level by 1
      • Methods inherited from class java.lang.Object

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

      • FETCH_ALL

        public static int FETCH_ALL
        The default value of the fetchSize variable. Use to fetch all available rows when executing a SELECT query.
    • Constructor Detail

      • QueryOptions

        public QueryOptions()
    • Method Detail

      • indentString

        public java.lang.String indentString()
        Creates an indent string based on the indent size and level
        Returns:
        The indent string
      • newLine

        public java.lang.String newLine()
        Creates a newline if required, when pretty printing is enabled
        Returns:
        The newline or space
      • newLine

        public java.lang.String newLine​(boolean noSpace)
        Creates a newline or space, if enabled
        Parameters:
        noSpace - If true, returns an empty string if no newline should be created, else creates a string
        Returns:
        The newline, space or empty string
      • padCased

        public java.lang.String padCased​(java.lang.String keyword)
        Combines the methods padded and cased
        Parameters:
        keyword - The keyword
        Returns:
        The padded and cased keyword
      • ticked

        public java.lang.String ticked​(java.lang.String string)
        Wraps a keyword in ticks or quotes, if enabled
        Parameters:
        string - The string
        Returns:
        The ticked or quoted string
      • padded

        public java.lang.String padded​(java.lang.String keyword)
        Pads a string to a specified length, if enabled
        Parameters:
        keyword - The keyword
        Returns:
        The padded keyword
      • cased

        public java.lang.String cased​(java.lang.String string)
        Turns a string uppercase if enabled, else lowercase
        Parameters:
        string - The string
        Returns:
        Uppercase string if enabled, else lowercase
      • indent

        public QueryOptions indent()
        Increases the indent level by 1
        Returns:
        This instnace
      • unindent

        public QueryOptions unindent()
        Decreases the indent level by 1
        Returns:
        This instance
      • copy

        public QueryOptions copy()
        Copies this instance including values and returns the new instance
        Returns:
        The copied instance
      • preparedValuesString

        public java.lang.String preparedValuesString()
        Returns all contained prepared values as a simple, concatenated string
        Returns:
        The prepared values of this instance
      • fetchAll

        public QueryOptions fetchAll()
        Fetch all columns on query
        Returns:
        This QueryOptions instance
      • fetchFirst

        public QueryOptions fetchFirst()
        Fetch the first row only on query
        Returns:
        This QueryOptions instance
      • getDefaultOptions

        public static QueryOptions getDefaultOptions()
        Returns the default options
        Returns:
        The default options
      • setDefaultOptions

        public static void setDefaultOptions​(QueryOptions options)
        Sets the default options
        Parameters:
        options - The new default options