Class TSQLObject

Object
gudusoft.gsqlparser.sqlenv.TSQLObject
Direct Known Subclasses:
TFunctoinColumn, TSQLCatalog, TSQLColumn, TSQLParameter, TSQLSchema, TSQLSchemaObject

public abstract class TSQLObject extends Object
base class of all the database object such as catalog, schema, table, column and etc
  • Field Details

  • Constructor Details

    • TSQLObject

      public TSQLObject(TSQLEnv sqlEnv, String objectName, ESQLDataObjectType dataObjectType)
      create a new database object and add to the SQL environment.
      Parameters:
      sqlEnv - SQL environment
      objectName - object name
  • Method Details

    • getSqlEnv

      public TSQLEnv getSqlEnv()
      SQL environment where this database object belonged to.
      Returns:
      SQL environment
    • getNameKeepCase

      name of this database object. With the case unchanged.
      Returns:
      database object name
    • getName

      public String getName()
      name of this database object. case of the name was normalized according to the database vendor's implementation. If the name was picked up from a SQL script, it's case maybe changed and not the same as it appeared in the SQL script.
      Returns:
      name
    • setDataObjectType

      public void setDataObjectType(ESQLDataObjectType dataObjectType)
    • getDataObjectType

      Type of this database object
      Returns:
      database object type
    • getQualifiedName

      qualified name for database object such as: databaseName.schemaName.tableName
      Returns:
      qualified name
    • isDelimitedIdentifier

      public boolean isDelimitedIdentifier(String identifier)
      whether is this a delimited identifier.
      Parameters:
      identifier - name of a database object
      Returns:
      true if it's a delimited/quoted identifer.
    • normalizeIdentifier

      public String normalizeIdentifier(String identifier)
      Change the case of the name of database object.
      Parameters:
      identifier - database object name
      Returns:
      normalized database object name
    • compareTo

      public int compareTo(String objectName)
      compare the name of this object to objectname with carefully handle of the case [in]sensitive.
      Parameters:
      objectName - object name need to be compared
      Returns:
      a negative integer, zero, or a positive integer as the specified String is greater than, equal to, or less than this object name
    • isDelimitedIdentifier

      public static boolean isDelimitedIdentifier(TSQLEnv sqlEnv, String identifier)
      check whether a database object name is a delimited identifier or not based on the database.
      Parameters:
      sqlEnv - SQL environment
      identifier - database object name
      Returns:
      true if it's delimited/quoted identifier
    • compareTo

      public static int compareTo(TSQLEnv sqlEnv, ESQLDataObjectType sqlDataObjectType, TSQLObject targetDataObject, String objectName)
      how to compare the name of database object is various from different databases due to the different implementation. We need to consider the database vendor, the database object type when comparing the database object name.
      Parameters:
      sqlEnv - SQL environment
      sqlDataObjectType - database object type
      targetDataObject - instance of database object need to be compared
      objectName - database object name
      Returns:
    • compareTo

      public static int compareTo(EDbVendor dbVendor, ESQLDataObjectType sqlDataObjectType, TSQLObject targetDataObject, String objectName)
    • compareTo

      public static int compareTo(EDbVendor dbVendor, ESQLDataObjectType sqlDataObjectType, String pTargetObjectName, String objectName)
      Deprecated.
      since version 2.2.3.2(2021-05-10), replaced by @TSQLEnv.compareIdentifier()
      Parameters:
      dbVendor -
      sqlDataObjectType -
      pTargetObjectName -
      objectName -
      Returns: