Class AdqlSyntax

java.lang.Object
uk.ac.starlink.table.jdbc.SqlSyntax
uk.ac.starlink.vo.AdqlSyntax

public class AdqlSyntax extends uk.ac.starlink.table.jdbc.SqlSyntax
SqlSyntax instance for the ADQL 2.0 grammar. This class is a singleton.
Since:
22 Jun 2011
Author:
Mark Taylor
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String[]
    ADQL reserved words additional to the SQL92 set, taken from the ADQL standard.

    Fields inherited from class uk.ac.starlink.table.jdbc.SqlSyntax

    SQL92_IDENTIFIER_REGEX, SQL92_RESERVED
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns ADQL text representing a character literal.
    Takes an ADQL <table_name> token and returns a 3-element array giving the catalog, schema and table (delimited or regular) identifiers.
    static AdqlSyntax
    Returns the sole instance of this class.
    boolean
    Indicates whether the given token matches the ADQL <column_name> production.
    boolean
    Indicates whether the given token matches the ADQL <delimited_identifier> production.
    boolean
    Indicates whether the given token matches the ADQL <table_name> production.
    unquote(String identifier)
    Takes a regular-or-delimited-identifier and returns its raw form.

    Methods inherited from class uk.ac.starlink.table.jdbc.SqlSyntax

    getParanoidReservedWords, getReservedWords, isIdentifier, isReserved, quote, quoteIfNecessary

    Methods inherited from class java.lang.Object

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

    • ADQL_RESERVED

      public static final String[] ADQL_RESERVED
      ADQL reserved words additional to the SQL92 set, taken from the ADQL standard.
  • Method Details

    • isAdqlDelimitedIdentifier

      public boolean isAdqlDelimitedIdentifier(String token)
      Indicates whether the given token matches the ADQL <delimited_identifier> production.
      Parameters:
      token - token to test
      Returns:
      true iff token is a delimited_identifier
    • isAdqlColumnName

      public boolean isAdqlColumnName(String token)
      Indicates whether the given token matches the ADQL <column_name> production.
      Parameters:
      token - token to test
      Returns:
      true iff token is a column_name
    • isAdqlTableName

      public boolean isAdqlTableName(String token)
      Indicates whether the given token matches the ADQL <table_name> production.
      Parameters:
      token - token to test
      Returns:
      true iff token is a table_name
    • getCatalogSchemaTable

      public String[] getCatalogSchemaTable(String tableName)
      Takes an ADQL <table_name> token and returns a 3-element array giving the catalog, schema and table (delimited or regular) identifiers.

      For a non-null result, the input token must match the ADQL <table_name> production, which is the same rule that TAP_SCHEMA table_name columns must follow, which roughly means it's of the form [catalog.[schema.[table]]]. Either catalog alone, or both catalog and schema, may be null. The return value is either a three-element array (with 1, 2 or 3 non-null elements) in case of a legal table_name input, or null in case of an illegal table_name input.

      Parameters:
      tableName - table_name string
      Returns:
      3-element array giving (catalog, schema, table) identifiers, or null for parse failure
    • unquote

      public String unquote(String identifier)
      Takes a regular-or-delimited-identifier and returns its raw form. For a regular identifier, the output is the same as the input.
      Parameters:
      identifier - regular or delimited identifier, or null
      Returns:
      identifier with no surrounding quotes or other escaping, or null for null input
    • characterLiteral

      public String characterLiteral(String txt)
      Returns ADQL text representing a character literal. This quotes the supplied string by surrounding it with single quotes, escaping any internal single quote characters appropriately.
      Parameters:
      txt - raw text
      Returns:
      character literal suitable for insertion into ADQL text
    • getInstance

      public static AdqlSyntax getInstance()
      Returns the sole instance of this class.
      Returns:
      AdqlSyntax instance