Class TableUtilities


  • public class TableUtilities
    extends Object
    Utility in order to simplify table function usage
    Author:
    Nicolas Fortin, Adam Gouge
    • Method Detail

      • copyFields

        public static void copyFields​(Connection connection,
                                      org.h2.tools.SimpleResultSet rs,
                                      TableLocation tableLocation)
                               throws SQLException
        Copy fields from table into a SimpleResultSet
        Parameters:
        connection - Active connection
        rs - Result set that will receive columns
        tableLocation - Import columns from this table
        Throws:
        SQLException - Error
      • isColumnListConnection

        public static boolean isColumnListConnection​(Connection connection)
                                              throws SQLException
        Return true if this connection only wants the list of columns. This is a hack. See: https://groups.google.com/forum/#!topic/h2-database/NHH0rDeU258
        Parameters:
        connection - Connection
        Returns:
        True if this connection only wants the list of columns
        Throws:
        SQLException
      • parseInputTable

        public static TableLocation parseInputTable​(Connection connection,
                                                    String inputTable)
                                             throws SQLException
        Convert an input table String to a TableLocation
        Parameters:
        connection - Connection
        inputTable - Input table
        Returns:
        corresponding TableLocation
        Throws:
        SQLException
      • suffixTableLocation

        public static TableLocation suffixTableLocation​(TableLocation inputTable,
                                                        String suffix)
        Suffix a TableLocation
        Parameters:
        inputTable - Input table
        suffix - Suffix
        Returns:
        suffixed TableLocation
      • caseIdentifier

        public static String caseIdentifier​(TableLocation requestedTable,
                                            String tableName,
                                            DBTypes dbType)
        Return the table identifier in the best fit depending on database type
        Parameters:
        requestedTable - Catalog and schema used
        tableName - Table without quotes
        dbType - Database type.
        Returns:
        Find table identifier