Package adql.db

Class DBChecker

java.lang.Object
adql.db.DBChecker
All Implemented Interfaces:
QueryChecker

public class DBChecker extends Object implements QueryChecker

ADQL Query verification

This QueryChecker implementation is able to do the following verifications on an ADQL query:
  1. Check existence of all table and column references,
  2. Resolve User Defined Functions (UDFs),
  3. Check types of columns and UDFs.

IMPORTANT note: Since v2.0, the check of supported geometric functions, STC-s expressions and coordinate systems are performed automatically in ADQLParser through the notion of Optional Features. The declaration of supported geometric functions must now be done with ADQLParser.getSupportedFeatures() (see also FeatureSet).

DB content annotations

In addition to check the existence of tables and columns referenced in the query, database metadata (DBTable or DBColumn) will also be attached to (ADQLTable and ADQLColumn instances when they are resolved.

Note: Knowing DB metadata of ADQLTable and ADQLColumn is particularly useful for the translation of the ADQL query to SQL, because the ADQL name of columns and tables can be replaced in SQL by their DB name, if different. This mapping is done automatically by JDBCTranslator.

  • Field Details

    • lstTables

      protected SearchTableApi lstTables
      List of all available tables (DBTable).

      IMPORTANT: List shared with all threads. This list must list all the tables in common to any ADQL query. It must never contain any temporary table (e.g. uploads).

    • allowedUdfs

      protected FunctionDef[] allowedUdfs
      List of all allowed User Defined Functions (UDFs).

      Note: If this list is NULL, any encountered UDF will be allowed. However, if not, all items of this list must be the only allowed UDFs. So, if the list is empty, no UDF is allowed.

      IMPORTANT: List shared with all threads.

      Since:
      1.3
    • allowedGeo

      @Deprecated protected String[] allowedGeo
      Deprecated.
      Since v2.0, supported geometrical functions must be declared in ADQLParser.
      List of all allowed geometrical functions (i.e. CONTAINS, REGION, POINT, COORD2, ...).

      If this list is NULL, all geometrical functions are allowed. However, if not, all items of this list must be the only allowed geometrical functions. So, if the list is empty, no such function is allowed.

      Since:
      1.3
    • allowedCoordSys

      @Deprecated protected String[] allowedCoordSys
      Deprecated.
      Since v2.0, supported coordinate systems must be declared in ADQLParser.

      List of all allowed coordinate systems.

      Each item of this list must be of the form: "{frame} {refpos} {flavor}". Each of these 3 items can be either of value, a list of values expressed with the syntax "({value1}|{value2}|...)" or a '*' to mean all possible values.

      Note: since a default value (corresponding to the empty string - '') should always be possible for each part of a coordinate system, the checker will always add the default value (UNKNOWNFRAME, UNKNOWNREFPOS or SPHERICAL2) into the given list of possible values for each coord. sys. part.

      If this list is NULL, all coordinates systems are allowed. However, if not, all items of this list must be the only allowed coordinate systems. So, if the list is empty, none is allowed.

      Since:
      1.3
    • coordSysRegExp

      @Deprecated protected String coordSysRegExp
      Deprecated.
      Since v2.0, supported coordinate systems must be declared in ADQLParser.

      A regular expression built using the list of allowed coordinate systems. With this regex, it is possible to known whether a coordinate system expression is allowed or not.

      If NULL, all coordinate systems are allowed.

      Since:
      1.3
  • Constructor Details

    • DBChecker

      public DBChecker()
      Builds a DBChecker with an empty list of tables.

      Verifications done by this object after creation:

      • Existence of tables and columns: NO (even unknown or fake tables and columns are allowed)
      • Existence of User Defined Functions (UDFs): NO (any "unknown" function is allowed)
      • Types consistency: NO
    • DBChecker

      public DBChecker(Collection<? extends DBTable> tables)
      Builds a DBChecker with the given list of known tables.

      Verifications done by this object after creation:

      • Existence of tables and columns: OK
      • Existence of User Defined Functions (UDFs): NO (any "unknown" function is allowed)
      • Types consistency: OK, except with unknown functions
      Parameters:
      tables - List of all available tables.
    • DBChecker

      public DBChecker(Collection<? extends DBTable> tables, Collection<? extends FunctionDef> allowedUdfs)
      Builds a DBChecker with the given list of known tables and with a restricted list of User Defined Functions (UDFs).

      Verifications done by this object after creation:

      • Existence of tables and columns: OK
      • Existence of User Defined Functions (UDFs): OK
      • Types consistency: OK
      Parameters:
      tables - List of all available tables.
      allowedUdfs - List of all allowed user defined functions. If NULL, no verification will be done (and so, all UDFs are allowed). If empty list, no "unknown" (or UDF) is allowed. Note: match with items of this list are done case insensitively.
      Since:
      1.3
    • DBChecker

      @Deprecated public DBChecker(Collection<? extends DBTable> tables, Collection<String> allowedGeoFcts, Collection<String> allowedCoordSys) throws ParseException
      Deprecated.
      Since v2.0, the check of geometrical functions support is performed in ADQLParser. It must now be done with ADQLParser.getSupportedFeatures() (see also FeatureSet).

      Builds a DBChecker with the given list of known tables and with a restricted list of user defined functions.

      Verifications done by this object after creation:

      • Existence of tables and columns: OK
      • Existence of User Defined Functions (UDFs): NO (any "unknown" function is allowed)
      • Support of geometrical functions: OK
      • Support of coordinate systems: OK
      Parameters:
      tables - List of all available tables.
      allowedGeoFcts - List of all allowed geometrical functions (i.e. CONTAINS, POINT, UNION, CIRCLE, COORD1). If NULL, no verification will be done (and so, all geometries are allowed). If empty list, no geometry function is allowed. Note: match with items of this list are done case insensitively.
      allowedCoordSys - List of all allowed coordinate system patterns. The syntax of a such pattern is the following: "{frame} {refpos} {flavor}" ; on the contrary to a coordinate system expression, here no part is optional. Each part of this pattern can be one the possible values (case insensitive), a list of possible values expressed with the syntax "({value1}|{value2}|...)", or a '*' for any valid value. For instance: "ICRS (GEOCENTER|heliocenter) *". If the given list is NULL, no verification will be done (and so, all coordinate systems are allowed). If it is empty, no coordinate system is allowed (except the default values - generally expressed by an empty string: '').
      Throws:
      ParseException
      Since:
      1.3
    • DBChecker

      @Deprecated public DBChecker(Collection<? extends DBTable> tables, Collection<? extends FunctionDef> allowedUdfs, Collection<String> allowedGeoFcts, Collection<String> allowedCoordSys) throws ParseException
      Deprecated.
      Since v2.0, the check of geometrical functions support is performed in ADQLParser. It must now be done with ADQLParser.getSupportedFeatures() (see also FeatureSet).

      Builds a DBChecker.

      Verifications done by this object after creation:

      • Existence of tables and columns: OK
      • Existence of User Defined Functions (UDFs): OK
      • Support of coordinate systems: OK

      IMPORTANT note: Since v2.0, the check of supported geometrical functions is performed directly in ADQLParser through the notion of Optional Features. The declaration of supported geometrical functions must now be done with ADQLParser.getSupportedFeatures() (see also FeatureSet).

      Parameters:
      tables - List of all available tables.
      allowedUdfs - List of all allowed user defined functions. If NULL, no verification will be done (and so, all UDFs are allowed). If empty list, no "unknown" (or UDF) is allowed. Note: match with items of this list are done case insensitively.
      allowedGeoFcts - List of all allowed geometrical functions (i.e. CONTAINS, POINT, UNION, CIRCLE, COORD1). If NULL, no verification will be done (and so, all geometries are allowed). If empty list, no geometry function is allowed. Note: match with items of this list are done case insensitively.
      allowedCoordSys - List of all allowed coordinate system patterns. The syntax of a such pattern is the following: "{frame} {refpos} {flavor}" ; on the contrary to a coordinate system expression, here no part is optional. Each part of this pattern can be one the possible values (case insensitive), a list of possible values expressed with the syntax "({value1}|{value2}|...)", or a '*' for any valid value. For instance: "ICRS (GEOCENTER|heliocenter) *". If the given list is NULL, no verification will be done (and so, all coordinate systems are allowed). If it is empty, no coordinate system is allowed (except the default values - generally expressed by an empty string: '').
      Throws:
      ParseException
      Since:
      2.0
  • Method Details

    • setTables

      public final void setTables(Collection<? extends DBTable> tables)
      Sets the list of all available tables.

      Note: Only if the given collection is an implementation of SearchTableApi, it will be used directly as provided. Otherwise the given collection will be copied inside a new SearchTableList.

      Parameters:
      tables - List of DBTables.
    • check

      public final void check(ADQLSet query) throws ParseException
      Check all the column, table and UDF references inside the given query.

      Note: This query has already been parsed ; thus it is already syntactically correct. Only the consistency with the published tables, columns and all the defined UDFs will be checked.

      Specified by:
      check in interface QueryChecker
      Parameters:
      query - The query to check.
      Throws:
      ParseException - An UnresolvedIdentifiersException if some tables or columns can not be resolved.
      See Also:
      • #check(ADQLQuery, Stack)
    • check

      protected void check(ADQLSet query, Stack<CheckContext> contextList) throws UnresolvedIdentifiersException
      Process several (semantic) verifications in the given ADQL query.

      Main operations performed in this function:

      1. Check all tables possibly defined in the WITH clause
      2. Check the main query (a simple SELECT) or the set operation (e.g. UNION, INTERSECT, EXCEPT)
      Parameters:
      query - The (sub-)query to check.
      contextList - Each item of this stack represents a recursion level inside the main ADQL query. A such item contains the list of columns and tables available at this level.
      Throws:
      UnresolvedIdentifiersException - An UnresolvedIdentifiersException if one or several of the above listed tests have detected some semantic errors (i.e. unresolved table, columns, function).
      Since:
      2.0
      See Also:
    • check

      protected void check(SetOperation setOp, Stack<CheckContext> contextList, UnresolvedIdentifiersException errors)
      Process several (semantic) verifications in the queries used in the given UNION/INTERSECT/EXCEPT operation.

      Main operations performed in this function:

      1. Check left query
      2. Check right query
      3. Check equality of both sets of columns
      4. Check equality of these columns' datatypes
      Parameters:
      query - The (sub-)query to check.
      contextList - Each item of this stack represents a recursion level inside the main ADQL query. A such item contains the list of columns and tables available at this level.
      errors - Accumulative list of semantic errors. Detected semantic errors should be appended to this list.
      Since:
      2.0
      See Also:
    • check

      protected void check(ADQLQuery query, Stack<CheckContext> contextList, UnresolvedIdentifiersException errors)
      Process several (semantic) verifications in the given ADQL query.

      Main verifications done in this function:

      1. Existence of DB items (tables and columns)
      2. Semantic verification of sub-queries
      3. Support of every encountered User Defined Functions (UDFs - functions unknown by the syntactic parser)
      4. Consistency of types still unknown (because the syntactic parser could not yet resolve them)
      Parameters:
      query - The query to check.
      contextList - Each item of this stack represents a recursion level inside the main ADQL query. A such item contains the list of columns and tables available at this level.
      Since:
      1.2
      See Also:
    • checkDBItems

      protected SearchColumnList checkDBItems(ADQLQuery query, Stack<CheckContext> contextList, UnresolvedIdentifiersException errors)
      Check DB items (tables and columns) used in the given ADQL query.

      Operations done in this function:

      1. Resolve all found tables
      2. Get the whole list of all available columns. (note: this list is returned by this function)
      3. Resolve all found columns
      Parameters:
      query - Query in which the existence of DB items must be checked.
      contextList - Each item of this stack represents a recursion level inside the main ADQL query. A such item contains the list of columns and tables available at this level.
      errors - List of errors to complete in this function each time an unknown table or column is encountered.
      Returns:
      List of all columns available in the given query.
      Since:
      1.3
      See Also:
    • resolveTables

      protected void resolveTables(ADQLQuery query, Stack<CheckContext> contextList, UnresolvedIdentifiersException errors)
      Search all table references inside the given query, resolve them against the available tables, and if there is only one match, attach the matching metadata to them.

      Management of Common Table Expressions (CTEs ; WITH expressions)

      If the clause WITH is not empty, any declared CTE/sub-query will be checked. If correct, a DBTable will be generated using generateDBTable(WithItem) representing this sub-query. This DBTable is immediately added to the current context so that being referenced in the main query.

      Management of sub-query tables

      If a table is not a DB table reference but a sub-query, this latter is first checked, using #check(ADQLQuery, Stack). Then, its corresponding table metadata are generated (using generateDBTable(ADQLQuery, String)) and attached to it.

      Management of "{table}.*" in the SELECT clause

      For each of this SELECT item, this function tries to resolve the table name. If only one match is found, the corresponding ADQL table object is got from the list of resolved tables and attached to this SELECT item (thus, the joker item will also have the good metadata, particularly if the referenced table is a sub-query).

      Table alias

      When a simple table (i.e. not a sub-query) is aliased, the metadata of this table will be wrapped inside a DBTableAlias in order to keep the original metadata but still declare use the table with the alias instead of its original name. The original name will be used only when translating the corresponding FROM item ; the rest of the time (i.e. for references when using a column), the alias name must be used.

      In order to avoid unpredictable behavior at execution of the SQL query, the alias will be put in lower case if not defined between double quotes.

      Parameters:
      query - Query in which the existence of tables must be checked.
      contextList - Each item of this stack represents a recursion level inside the main ADQL query. A such item contains the list of columns and tables available at this level.
      errors - List of errors to complete in this function each time an unknown table or column is encountered.
    • resolveTable

      protected DBTable resolveTable(ADQLTable table, Stack<CheckContext> contextList) throws ParseException
      Resolve the given table, that's to say search for the corresponding DBTable.
      Parameters:
      table - The table to resolve.
      contextList - Each item of this stack represents a recursion level inside the main ADQL query. A such item contains the list of columns and tables available at this level.
      Returns:
      The corresponding DBTable if found.
      Throws:
      ParseException - An UnresolvedTableException if the given table can't be resolved.
    • resolveColumns

      @Deprecated protected final void resolveColumns(ADQLQuery query, Stack<CheckContext> contextList, Map<DBTable,ADQLTable> mapTables, UnresolvedIdentifiersException errors)
      Deprecated.
      Since v2.0, the parameter 'mapTables' is no more used. You should used resolveColumns(ADQLQuery, Stack, UnresolvedIdentifiersException) instead.
      Search all column references inside the given query, resolve them thanks to the given tables' metadata, and if there is only one match, attach the matching metadata to them.

      Management of selected columns' references

      A column reference is not only a direct reference to a table column using a column name. It can also be a reference to an item of the SELECT clause (which will then call a "selected column"). That kind of reference can be either an index (an unsigned integer starting from 1 to N, where N is the number selected columns), or the name/alias of the column.

      These references are also checked, in second steps, in this function. Thus, column metadata are also attached to them, as common columns.

      Parameters:
      query - Query in which the existence of tables must be checked.
      contextList - Each item of this stack represents a recursion level inside the main ADQL query. A such item contains the list of columns and tables available at this level.
      mapTables - List of all resolved tables.
      list - List of column metadata to complete in this function each time a column reference is resolved.
      errors - List of errors to complete in this function each time an unknown table or column is encountered.
    • resolveColumns

      protected void resolveColumns(ADQLQuery query, Stack<CheckContext> contextList, UnresolvedIdentifiersException errors)
      Search all column references inside the given query, resolve them thanks to the given tables' metadata, and if there is only one match, attach the matching metadata to them.

      Management of selected columns' references

      A column reference is not only a direct reference to a table column using a column name. It can also be a reference to an item of the SELECT clause (which will then call a "selected column"). That kind of reference can be either an index (an unsigned integer starting from 1 to N, where N is the number selected columns), or the name/alias of the column.

      These references are also checked, in second steps, in this function. Column metadata are also attached to them, as common columns.

      Parameters:
      query - Query in which the existence of columns must be checked.
      contextList - Each item of this stack represents a recursion level inside the main ADQL query. A such item contains the list of columns and tables available at this level.
      errors - List of errors to complete in this function each time an unknown table or column is encountered.
      Since:
      2.0
    • resolveColumn

      protected DBColumn resolveColumn(ADQLColumn column, Stack<CheckContext> contextList) throws ParseException
      Resolve the given column, that's to say search for the corresponding DBColumn.
      Parameters:
      column - The column to resolve.
      contextList - Each item of this stack represents a recursion level inside the main ADQL query. A such item contains the list of columns and tables available at this level.
      Returns:
      The corresponding DBColumn if found. Otherwise an exception is thrown.
      Throws:
      ParseException - An UnresolvedColumnException if the given column can't be resolved or an UnresolvedTableException if its table reference can't be resolved.
    • checkGroupBy

      protected void checkGroupBy(ClauseADQL<ADQLOperand> groupBy, ClauseSelect select, Stack<CheckContext> contextList, UnresolvedIdentifiersException errors)
      Check and resolve all columns (or column references) inside the given GROUP BY clause.
      Parameters:
      groupBy - The GROUP BY to check.
      select - The SELECT clause (and all its selected items).
      contextList - Each item of this stack represents a recursion level inside the main ADQL query. A such item contains the list of columns and tables available at this level.
      errors - List of errors to complete in this function each time an unknown table or column is encountered.
      Since:
      2.0
    • checkOrderBy

      protected void checkOrderBy(ClauseADQL<ADQLOrder> orderBy, ClauseSelect select, Stack<CheckContext> contextList, UnresolvedIdentifiersException errors)
      Check and resolve all columns (or column references) inside the given ORDER BY clause.
      Parameters:
      orderBy - The ORDER BY to check.
      select - The SELECT clause (and all its selected items).
      contextList - Each item of this stack represents a recursion level inside the main ADQL query. A such item contains the list of columns and tables available at this level.
      errors - List of errors to complete in this function each time an unknown table or column is encountered.
      Since:
      2.0
    • resolveColumnNameReference

      protected DBColumn resolveColumnNameReference(ADQLColumn col, ClauseSelect select, Stack<CheckContext> contextList) throws ParseException
      Check whether the given column corresponds to a selected item's alias or to an existing column.
      Parameters:
      col - The column to check.
      select - The SELECT clause of the ADQL query.
      contextList - Each item of this stack represents a recursion level inside the main ADQL query. A such item contains the list of columns and tables available at this level.
      Returns:
      The corresponding DBColumn if this column corresponds to an existing column, NULL otherwise.
      Throws:
      ParseException - An UnresolvedColumnException if the given column can't be resolved or an UnresolvedTableException if its table reference can't be resolved.
      Since:
      2.0
      See Also:
    • checkColumnReference

      protected DBColumn checkColumnReference(ColumnReference colRef, ClauseSelect select, Stack<CheckContext> contextList) throws ParseException
      Check whether the given column reference corresponds to a selected item (column or an expression with an alias).
      Parameters:
      colRef - The column reference which must be checked.
      select - The SELECT clause of the ADQL query.
      contextList - Each item of this stack represents a recursion level inside the main ADQL query. A such item contains the list of columns and tables available at this level.
      Returns:
      The corresponding DBColumn if this reference is actually referencing a selected column, NULL otherwise.
      Throws:
      ParseException - An UnresolvedColumnException if the given column can't be resolved or an UnresolvedTableException if its table reference can't be resolved.
    • generateDBTable

      public static DBTable generateDBTable(ADQLSet subQuery, String tableName) throws ParseException
      Generate a DBTable corresponding to the given sub-query with the given table name. This DBTable will contain all DBColumn returned by ADQLQuery.getResultingColumns().
      Parameters:
      subQuery - Sub-query in which the specified table must be searched.
      tableName - Name of the table to search. If between double quotes, the table name will be considered as case sensitive.
      Returns:
      The corresponding DBTable if the table has been found in the given sub-query, or NULL otherwise.
      Throws:
      ParseException - Can be used to explain why the table has not been found. Not used by default.
    • generateDBTable

      public static DBTable generateDBTable(WithItem withItem)
      Generate a DBTable corresponding to the given Common Table Expression (i.e. CTE = item of a WITH clause).

      This DBTable will contain all DBColumns returned by WithItem.getResultingColumns().

      Parameters:
      withItem - CTE declaration.
      Returns:
      The corresponding DBTable, or NULL otherwise.
      Since:
      2.0
    • checkUDFs

      protected void checkUDFs(ADQLQuery query, UnresolvedIdentifiersException errors)
      Search all UDFs (User Defined Functions) inside the given query, and then check their signature against the list of allowed UDFs.

      Note: When more than one allowed function match, the function is considered as correct and no error is added. However, in case of multiple matches, the return type of matching functions could be different and in this case, there would be an error while checking later the types. In such case, throwing an error could make sense, but the user would then need to cast some parameters to help the parser identifying the right function. But the type-casting ability is not yet possible in ADQL.

      Parameters:
      query - Query in which UDFs must be checked.
      errors - List of errors to complete in this function each time a UDF does not match to any of the allowed UDFs.
      Since:
      1.3
    • isAllParamTypesResolved

      protected final boolean isAllParamTypesResolved(ADQLFunction fct)
      Tell whether the type of all parameters of the given ADQL function is resolved.

      A parameter type may not be resolved for 2 main reasons:

      • the parameter is a column, but this column has not been successfully resolved. Thus its type is still unknown.
      • the parameter is a UDF, but this UDF has not been already resolved. Thus, as for the column, its return type is still unknown. But it could be known later if the UDF is resolved later ; a second try should be done afterwards.
      Parameters:
      fct - ADQL function whose the parameters' type should be checked.
      Returns:
      true if the type of all parameters is known, false otherwise.
      Since:
      1.3
    • checkTypes

      protected void checkTypes(ADQLQuery query, UnresolvedIdentifiersException errors)
      Search all operands whose the type is not yet known and try to resolve it now and to check whether it matches the type expected by the syntactic parser.

      Only two operands may have an unresolved type: columns and user defined functions. Indeed, their type can be resolved only if the list of available columns and UDFs is known, and if columns and UDFs used in the query are resolved successfully.

      When an operand type is still unknown, they will own the three kinds of type and so this function won't raise an error: it is thus automatically on the expected type. This behavior is perfectly correct because if the type is not resolved that means the item/operand has not been resolved in the previous steps and so that an error about this item has already been raised.

      Important note: This function does not check the types exactly, but just roughly by considering only three categories: string, numeric and geometry.

      Parameters:
      query - Query in which unknown types must be resolved and checked.
      errors - List of errors to complete in this function each time a types does not match to the expected one.
      Since:
      1.3
      See Also:
    • checkSubQueries

      protected void checkSubQueries(ADQLQuery query, Stack<CheckContext> contextList, UnresolvedIdentifiersException errors)
      Search for all sub-queries found in the given query but not in the clause FROM. These sub-queries are then checked using #check(ADQLQuery, Stack).
      Parameters:
      query - Query in which sub-queries must be checked.
      contextList - Each item of this stack represents a recursion level inside the main ADQL query. A such item contains the list of columns and tables available at this level.
      availableColumns - List of all columns resolved in the given query.
      errors - List of errors to complete in this function each time a semantic error is encountered.
      Since:
      1.3
    • specialSort

      @Deprecated protected static final String[] specialSort(Collection<String> items)
      Deprecated.
      Since v2.0, this tool function is no longer used. It was useful only to collect allowed geometries and coordinate systems....but these are now checked by ADQLParser.
      Transform the given collection of string elements in a sorted array. Only non-NULL and non-empty strings are kept.
      Parameters:
      items - Items to copy and sort.
      Returns:
      A sorted array containing all - except NULL and empty strings - items of the given collection.
      Since:
      1.3
    • checkGeometries

      @Deprecated protected void checkGeometries(ADQLQuery query, UnresolvedIdentifiersException errors)
      Deprecated.
      Since 2.0, validation of the geometric functions is performed automatically by ADQLParser. Geometric functions are optional features and should be declared as such in the ADQLParser if they are supported (see ADQLParser.getSupportedFeatures()).

      Check all geometries.

      Operations done in this function:

      1. Check that all explicit (string constant) coordinate system definitions are supported
      2. Check all STC-S expressions (only in RegionFunction for the moment) and Apply the 2 previous checks on them

      IMPORTANT note: Since v2.0, the check of supported geometrical functions is performed directly in ADQLParser through the notion of Optional Features. The declaration of supported geometrical functions must now be done with ADQLParser.getSupportedFeatures() (see also FeatureSet).

      Parameters:
      query - Query in which geometries must be checked.
      errors - List of errors to complete in this function each time a geometry item is not supported.
      Since:
      1.3
      See Also:
    • resolveGeometryFunctions

      @Deprecated protected final void resolveGeometryFunctions(ADQLQuery query, DBChecker.BinarySearch<String,String> binSearch, UnresolvedIdentifiersException errors)
      Deprecated.
      Since 2.0, validation of the geometric functions is performed automatically by ADQLParser. Geometric functions are optional features and should be declared as such in the ADQLParser if they are supported (see ADQLParser.getSupportedFeatures()).
      Search for all geometrical functions and check whether they are allowed.
      Parameters:
      query - Query in which geometrical functions must be checked.
      errors - List of errors to complete in this function each time a geometrical function is not supported.
      Since:
      1.3
      See Also:
    • checkGeometryFunction

      @Deprecated protected final void checkGeometryFunction(String fctName, ADQLFunction fct, DBChecker.BinarySearch<String,String> binSearch, UnresolvedIdentifiersException errors)
      Deprecated.
      Since 2.0, validation of the geometric functions is performed automatically by ADQLParser. Geometric functions are optional features and should be declared as such in the ADQLParser if they are supported (see ADQLParser.getSupportedFeatures()).

      Check whether the specified geometrical function is allowed by this implementation.

      Note: If the list of allowed geometrical functions is empty, this function will always add an errors to the given list. Indeed, it means that no geometrical function is allowed and so that the specified function is automatically not supported.

      Parameters:
      fctName - Name of the geometrical function to test.
      fct - The function instance being or containing the geometrical function to check. Note: this function can be the function to test or a function embedding the function under test (i.e. RegionFunction).
      binSearch - The object to use in order to search a function name inside the list of allowed functions. It is able to perform a binary search inside a sorted array of String objects. The interest of this object is its compare function which must be overridden and tells how to compare the item to search and the items of the array (basically, a non-case-sensitive comparison between 2 strings).
      errors - List of errors to complete in this function each time a geometrical function is not supported.
      Since:
      1.3
    • resolveCoordinateSystems

      @Deprecated protected void resolveCoordinateSystems(ADQLQuery query, UnresolvedIdentifiersException errors)
      Deprecated.
      Since 2.0, the validation of coordinate systems is performed automatically by ADQLParser.

      Search all explicit coordinate system declarations, check their syntax and whether they are allowed by this implementation.

      Note: "explicit" means here that all StringConstant instances. Only coordinate systems expressed as string can be parsed and so checked. So if a coordinate system is specified by a column, no check can be done at this stage... it will be possible to perform such test only at the execution.

      Parameters:
      query - Query in which coordinate systems must be checked.
      errors - List of errors to complete in this function each time a coordinate system has a wrong syntax or is not supported.
      Since:
      1.3
      See Also:
    • checkCoordinateSystem

      @Deprecated protected void checkCoordinateSystem(StringConstant adqlCoordSys, UnresolvedIdentifiersException errors)
      Deprecated.
      Since 2.0, the validation of coordinate systems is performed automatically by ADQLParser.
      Parse and then check the coordinate system contained in the given StringConstant instance.
      Parameters:
      adqlCoordSys - The StringConstant object containing the coordinate system to check.
      errors - List of errors to complete in this function each time a coordinate system has a wrong syntax or is not supported.
      Since:
      1.3
      See Also:
    • checkCoordinateSystem

      @Deprecated protected void checkCoordinateSystem(CoordSys coordSys, ADQLOperand operand, UnresolvedIdentifiersException errors)
      Deprecated.
      Since 2.0, the validation of coordinate systems is performed automatically by ADQLParser.
      Check whether the given coordinate system is allowed by this implementation.
      Parameters:
      coordSys - Coordinate system to test.
      operand - The operand representing or containing the coordinate system under test.
      errors - List of errors to complete in this function each time a coordinate system is not supported.
      Since:
      1.3
    • resolveSTCSExpressions

      @Deprecated protected void resolveSTCSExpressions(ADQLQuery query, DBChecker.BinarySearch<String,String> binSearch, UnresolvedIdentifiersException errors)
      Deprecated.
      Since 2.0, the validation of STCs expressions is performed automatically by ADQLParser.

      Search all STC-S expressions inside the given query, parse them (and so check their syntax) and then determine whether the declared coordinate system and the expressed region are allowed in this implementation.

      Note: In the current ADQL language definition, STC-S expressions can be found only as only parameter of the REGION function.

      Parameters:
      query - Query in which STC-S expressions must be checked.
      binSearch - The object to use in order to search a region name inside the list of allowed functions/regions. It is able to perform a binary search inside a sorted array of String objects. The interest of this object is its compare function which must be overridden and tells how to compare the item to search and the items of the array (basically, a non-case-sensitive comparison between 2 strings).
      errors - List of errors to complete in this function each time the STC-S syntax is wrong or each time the declared coordinate system or region is not supported.
      Since:
      1.3
      See Also:
    • checkRegion

      @Deprecated protected void checkRegion(Region r, RegionFunction fct, DBChecker.BinarySearch<String,String> binSearch, UnresolvedIdentifiersException errors)
      Deprecated.
      Since 2.0, the validation of REGIONs is performed automatically by ADQLParser.

      Check the given region.

      The following points are checked in this function:

      • whether the coordinate system is allowed
      • whether the type of region is allowed
      • whether the inner regions are correct (here this function is called recursively on each inner region).
      Parameters:
      r - The region to check.
      fct - The REGION function containing the region to check.
      errors - List of errors to complete in this function if the given region or its inner regions are not supported.
      Since:
      1.3
      See Also: