Class SqlNameContext


  • public class SqlNameContext
    extends Object
    Given a column, we need to determinate to which table it belongs to. This is not always simple, as SQL queries can use "aliases".

    This problem is further exacerbated by: 1) a SELECT can have many sub-SELECTs inside it, each one defining their own independent aliases 2) a SQL command might not have all the necessary info to infer the right table for a column. In those (valid) cases of ambiguity, we must refer to the schema

    • Constructor Detail

      • SqlNameContext

        public SqlNameContext​(net.sf.jsqlparser.statement.Statement statement)
        WARNING: should only be used in tests, to avoid each time having to provide a schema for the test data
        Parameters:
        statement - to create context for
      • SqlNameContext

        public SqlNameContext​(net.sf.jsqlparser.statement.Statement statement,
                              DbSchemaDto schema)
    • Method Detail

      • getTableName

        public String getTableName​(net.sf.jsqlparser.schema.Column column)
        Parameters:
        column - a column object
        Returns:
        the name of the table that this column belongs to