Class PostgreSQLTranslator

  • All Implemented Interfaces:
    ADQLTranslator
    Direct Known Subclasses:
    PgSphereTranslator

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

    It overwrites the translation of mathematical functions whose some have a different name or signature. Besides, it is also implementing the translation of the geometrical functions. However, it does not really translate them. It is just returning the ADQL expression (by calling JDBCTranslator.getDefaultADQLFunction(ADQLFunction)). And so, of course, the execution of a SQL query containing geometrical functions and translated using this translator will not work. It is just a default implementation in case there is no interest of these geometrical functions.

    Important: The geometrical functions are translated exactly as in ADQL. You will probably need to extend this translator to correctly manage the geometrical functions. An extension is already available for PgSphere: PgSphereTranslator.

    Version:
    1.4 (08/2016)
    Author:
    Grégory Mantelet (CDS;ARI)
    See Also:
    PgSphereTranslator
    • Field Detail

      • 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 Detail

      • PostgreSQLTranslator

        public PostgreSQLTranslator()
        Builds a PostgreSQLTranslator 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 double quotes in the SQL translation.
      • PostgreSQLTranslator

        public PostgreSQLTranslator​(boolean allCaseSensitive)
        Builds a PostgreSQLTranslator 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 double quotes in the SQL translation.
        Parameters:
        allCaseSensitive - true to translate all identifiers in a case sensitive manner (surrounded by double quotes), false for case insensitivity.
      • PostgreSQLTranslator

        public PostgreSQLTranslator​(boolean catalog,
                                    boolean schema,
                                    boolean table,
                                    boolean column)
        Builds a PostgreSQLTranslator which will always translate in SQL identifiers with the defined case sensitivity.
        Parameters:
        catalog - true to translate catalog names with double quotes (case sensitive in the DBMS), false otherwise.
        schema - true to translate schema names with double quotes (case sensitive in the DBMS), false otherwise.
        table - true to translate table names with double quotes (case sensitive in the DBMS), false otherwise.
        column - true to translate column names with double quotes (case sensitive in the DBMS), false otherwise.