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: The geometrical functions are translated exactly as in ADQL. You will probably need to extend this translator to correctly manage the geometrical functions.

Since:
1.4
Version:
1.5 (08/2023)
Author:
Grégory Mantelet (ARI;CDS)
  • 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.

  • 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