Package uk.ac.starlink.vo
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:
- ADQL 2.0 Standard, ADQL 2.0 BNF
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String[]
ADQL_RESERVED
ADQL reserved words additional to the SQL92 set, taken from the ADQL standard.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
characterLiteral(java.lang.String txt)
Returns ADQL text representing a character literal.java.lang.String[]
getCatalogSchemaTable(java.lang.String tableName)
Takes an ADQL<table_name>
token and returns a 3-element array giving the catalog, schema and table (delimited or regular) identifiers.static AdqlSyntax
getInstance()
Returns the sole instance of this class.boolean
isAdqlColumnName(java.lang.String token)
Indicates whether the given token matches the ADQL<column_name>
production.boolean
isAdqlDelimitedIdentifier(java.lang.String token)
Indicates whether the given token matches the ADQL<delimited_identifier>
production.boolean
isAdqlTableName(java.lang.String token)
Indicates whether the given token matches the ADQL<table_name>
production.java.lang.String
unquote(java.lang.String identifier)
Takes a regular-or-delimited-identifier and returns its raw form.
-
-
-
Method Detail
-
isAdqlDelimitedIdentifier
public boolean isAdqlDelimitedIdentifier(java.lang.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(java.lang.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(java.lang.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 java.lang.String[] getCatalogSchemaTable(java.lang.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 java.lang.String unquote(java.lang.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 java.lang.String characterLiteral(java.lang.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
-
-