Class SQLProber


  • public class SQLProber
    extends Object
    • Method Detail

      • getConstraints

        public List<Constraint> getConstraints​(@NonNull
                                               @NonNull Table table)
                                        throws SQLException
        Gets the table constraints for a given table
        Parameters:
        table - the table
        Returns:
        the table constraints
        Throws:
        SQLException - Something went wrong building the table constraints
      • getConstraints

        public List<Constraint> getConstraints​(@NonNull
                                               @NonNull String table)
                                        throws SQLException
        Gets the table constraints for a given table
        Parameters:
        table - the table
        Returns:
        the table constraints
        Throws:
        SQLException - Something went wrong building the table constraints
      • getStoredColumns

        public List<Column> getStoredColumns​(@NonNull
                                             @NonNull Table table)
                                      throws SQLException
        Gets the list of columns (non-virtual) for the given table. Tries to infer the constraints on the columns and whether or not the column is a primary key. In some cases the constraints will not be retrieved on the column, but will be retrievable through a call to getTableIndices(Table).
        Parameters:
        table - the table name
        Returns:
        the table columns
        Throws:
        SQLException - Something went wrong learning about the table
      • getStoredColumns

        public List<Column> getStoredColumns​(@NonNull
                                             @NonNull String table)
                                      throws SQLException
        Gets the list of columns (non-virtual) for the given table. Tries to infer the constraints on the columns and whether or not the column is a primary key. In some cases the constraints will not be retrieved on the column, but will be retrievable through a call to getTableIndices(Table).
        Parameters:
        table - the table name
        Returns:
        the table columns
        Throws:
        SQLException - Something went wrong learning about the table
      • getTable

        public Table getTable​(@NonNull
                              @NonNull String name)
                       throws SQLException
        Reverse engineers a Table definition from the database.
        Parameters:
        name - the name of the table to reverse engineer
        Returns:
        the reverse engineered table
        Throws:
        SQLException - Something went wrong building the table
      • getTableIndices

        public List<Index> getTableIndices​(@NonNull
                                           @NonNull Table table)
                                    throws SQLException
        Retrieves the indices on table
        Parameters:
        table - the table whose indices we want
        Returns:
        the list of Index on the table
        Throws:
        SQLException - something happened trying to query for table indices
      • getTableIndices

        public List<Index> getTableIndices​(@NonNull
                                           @NonNull String table)
                                    throws SQLException
        Retrieves the indices on table
        Parameters:
        table - the table whose indices we want
        Returns:
        the list of Index on the table
        Throws:
        SQLException - something happened trying to query for table indices
      • getTableNames

        public List<String> getTableNames()
                                   throws SQLException
        Gets a list of the table names in the database
        Returns:
        the table names
        Throws:
        SQLException - Something went wrong getting the table names
      • getVirtualColumns

        public List<Column> getVirtualColumns​(@NonNull
                                              @NonNull Table table)
                                       throws SQLException
        Attempts to the get the virtual columns for a given table. Note that it may not be possible to retrieve the generated as statement that accompanies the virtual column.
        Parameters:
        table - the table name
        Returns:
        the virtual columns
        Throws:
        SQLException - Something went wrong getting the virtual names
      • getVirtualColumns

        public List<Column> getVirtualColumns​(@NonNull
                                              @NonNull String table)
                                       throws SQLException
        Attempts to the get the virtual columns for a given table. Note that it may not be possible to retrieve the generated as statement that accompanies the virtual column.
        Parameters:
        table - the table name
        Returns:
        the virtual columns
        Throws:
        SQLException - Something went wrong getting the virtual names