Class MySQLTranslator

java.lang.Object
adql.translator.JDBCTranslator
adql.translator.MySQLTranslator
All Implemented Interfaces:
ADQLTranslator

public class MySQLTranslator extends JDBCTranslator
Translates all ADQL objects into an SQL interrogation query designed for MySQL.

Important note 1: The geometrical functions and IN_UNIT are translated exactly as in ADQL. You will probably need to extend this translator to correctly manage the geometrical functions.

Important note 2: If new optional features are supported in an extension of this translator, they should be visible in getSupportedFeatures(). To customize this list, you must overwrite initSupportedFeatures() and update in there the attribute supportedFeatures.

Since:
1.4
  • Field Details

    • DEFAULT_VARIABLE_LENGTH

      public static int DEFAULT_VARIABLE_LENGTH
      MySQL requires a length for variable-length types such as CHAR, VARCHAR, BINARY and VARBINARY. This static attributes is the default value set by this translator if no length is specified.
    • caseSensitivity

      protected byte caseSensitivity
      Indicate the case sensitivity to apply to each SQL identifier (only SCHEMA, TABLE and COLUMN).

      Note: In this implementation, this field is set by the constructor and never modified elsewhere. It would be better to never modify it after the construction in order to keep a certain consistency.

    • supportedFeatures

      protected final FeatureSet supportedFeatures
      List of all optional features supported by this translator.

      Note: This list can be customized by extending this translator and then overwriting initSupportedFeatures().

      Since:
      2.0
  • Constructor Details

    • MySQLTranslator

      public MySQLTranslator()
      Build a MySQLTranslator which always translates in SQL all identifiers (schema, table and column) in a case sensitive manner ; in other words, schema, table and column names will be surrounded by back-quotes in the SQL translation.
    • MySQLTranslator

      public MySQLTranslator(boolean allCaseSensitive)
      Build a MySQLTranslator which always translates in SQL all identifiers (schema, table and column) in the specified case sensitivity ; in other words, schema, table and column names will all be surrounded or not by back-quotes in the SQL translation.
      Parameters:
      allCaseSensitive - true to translate all identifiers in a case sensitive manner (surrounded by back-quotes), false for case insensitivity.
    • MySQLTranslator

      public MySQLTranslator(boolean catalog, boolean schema, boolean table, boolean column)
      Build a MySQLTranslator which will always translate in SQL identifiers with the defined case sensitivity.
      Parameters:
      catalog - true to translate catalog names with back-quotes (case sensitive in the DBMS), false otherwise.
      schema - true to translate schema names with back-quotes (case sensitive in the DBMS), false otherwise.
      table - true to translate table names with back-quotes (case sensitive in the DBMS), false otherwise.
      column - true to translate column names with back-quotes (case sensitive in the DBMS), false otherwise.
  • Method Details