Class AbstractSqlBuilder

java.lang.Object
org.eclipse.dirigible.database.sql.builders.AbstractSqlBuilder
All Implemented Interfaces:
ISqlBuilder, ISqlKeywords
Direct Known Subclasses:
AbstractCreateSqlBuilder, AbstractCreateTableConstraintBuilder, AbstractDropSqlBuilder, AbstractQuerySqlBuilder, AlterBranchingBuilder, CreateBranchingBuilder, DropBranchingBuilder, ExpressionBuilder, InsertBuilder

public abstract class AbstractSqlBuilder extends Object implements ISqlBuilder
The Abstract SQL Builder.
  • Constructor Details

    • AbstractSqlBuilder

      protected AbstractSqlBuilder(ISqlDialect dialect)
      Instantiates a new abstract sql builder.
      Parameters:
      dialect - the dialect
  • Method Details

    • getDialect

      protected ISqlDialect getDialect()
      Gets the dialect.
      Returns:
      the dialect
    • toString

      public String toString()
      Usually returns the default generated snippet.
      Overrides:
      toString in class Object
      Returns:
      the string
    • build

      public String build()
      Returns the default generated snippet.
      Specified by:
      build in interface ISqlBuilder
      Returns:
      the string
    • isCaseSensitive

      protected boolean isCaseSensitive()
      Whether the names of tables, columns, indices are case sensitive.
      Returns:
      true if set
    • encapsulate

      protected String encapsulate(String name)
      Encapsulate the name within quotes.
      Parameters:
      name - the name
      Returns:
      the encapsulated name
    • encapsulate

      protected String encapsulate(String name, boolean isDataStructureName)
      Encapsulate the name within quotes.
      Parameters:
      name - the name
      isDataStructureName - to check if encapsulating a data structure name
      Returns:
      the encapsulated name
    • getEscapeSymbol

      public String getEscapeSymbol()
      Gets the escape symbol.
      Returns:
      the escape symbol
    • isColumn

      protected boolean isColumn(String name)
      Check whether the name is a column (one word) or it is complex expression containing functions, etc. (count(*))
      Parameters:
      name - the name of the eventual column
      Returns:
      true if it is one word
    • encapsulateMany

      protected String encapsulateMany(String line)
      Encapsulate all the non-function and non-numeric words.
      Parameters:
      line - the input string
      Returns:
      the transformed string
    • encapsulateWhere

      protected String encapsulateWhere(String where)
      Encapsulate where.
      Parameters:
      where - the where
      Returns:
      the string
    • encapsulateMany

      protected String encapsulateMany(String line, char escapeChar)
      Encapsulate many.
      Parameters:
      line - the line
      escapeChar - the escape char
      Returns:
      the string
    • isNumeric

      protected boolean isNumeric(String s)
      Check whether the string is a number.
      Parameters:
      s - the input
      Returns:
      true if it is a number
    • isValue

      protected boolean isValue(String s)
      Checks if is value.
      Parameters:
      s - the s
      Returns:
      true, if is value