Class BasicJDBCMetadataProvider

  • All Implemented Interfaces:
    JDBCMetadataProvider

    public class BasicJDBCMetadataProvider
    extends Object
    implements JDBCMetadataProvider

    A basic implementation of the JDBCMetadataProvider interface.

    Since:
    3.0
    Version:
    $Revision$
    Author:
    Magnus Rylander
    • Constructor Detail

      • BasicJDBCMetadataProvider

        public BasicJDBCMetadataProvider()
        Creates a new BasicJDBCMetadataProvider instance.
        Since:
        3.0
    • Method Detail

      • getContext

        public JDBCContext getContext()
        Returns the JDBCContext.
        Returns:
        a JDBCContext instance
        Since:
        3.0
      • getTableAliases

        protected MetadataItem[] getTableAliases​(String catalog,
                                                 String schema)
        Parameters:
        catalog - catalog
        schema - schema
        Returns:
        MetadataItem
        Since:
        3.0
      • getProcedures

        protected MetadataItem[] getProcedures​(String catalog,
                                               String schema)
                                        throws SQLException
        Parameters:
        catalog - catalog
        schema - schema
        Returns:
        MetadataItem
        Throws:
        SQLException - if a database error occurs
        Since:
        3.0
      • getProcedureMetadata

        protected ProcedureMetadata getProcedureMetadata​(String catalog,
                                                         String schema,
                                                         String procedure)
                                                  throws SQLException
        Parameters:
        catalog - catalog
        schema - schema
        procedure - procedure
        Returns:
        ProcedureMetadata
        Throws:
        SQLException - if a database error occurs
        Since:
        3.0
      • createCatalogItem

        public MetadataItem createCatalogItem​(String name)
        Creates a catalog item.
        Parameters:
        name - a catalog name
        Returns:
        a catalog item
        Since:
        3.0
      • createSchemaItem

        public MetadataItem createSchemaItem​(String name)
        Creates a schema item.
        Parameters:
        name - a schema name
        Returns:
        a schema item
        Since:
        3.0
      • createTableItem

        public MetadataItem createTableItem​(String name)
        Creates a table item.
        Parameters:
        name - a table name
        Returns:
        a table item
        Since:
        3.0
      • createColumnItem

        public MetadataItem createColumnItem​(String name,
                                             int jdbcType,
                                             String typeName,
                                             int precision,
                                             int scale,
                                             String description)
        Creates a column item.
        Parameters:
        name - a column name
        jdbcType - a JDBC type
        typeName - data source dependent type name
        precision - a precision, used for numeric types
        scale - a scale, used for numeric types
        description - comment describing column
        Returns:
        a column item
        Since:
        3.0
        See Also:
        toJavaType(int, java.lang.String, int, int)
      • toJavaType

        public Class toJavaType​(int jdbcType,
                                String typeName,
                                int precision,
                                int scale)
        Description copied from interface: JDBCMetadataProvider
        Converts a JDBC type to a Java type.

        The following Java types are supported:

        • String
        • Integer
        • Long
        • Float
        • Double
        • com.spotfire.ws.dat.Date
        • com.spotfire.ws.dat.Time
        • com.spotfire.ws.dat.DateTime
        • com.spotfire.ws.dat.Clob
        • com.spotfire.ws.dat.Blob
        Specified by:
        toJavaType in interface JDBCMetadataProvider
        Parameters:
        jdbcType - jdbcType
        typeName - typeName
        precision - precision
        scale - scale
        Returns:
        Class
        Since:
        3.0
        See Also:
        Types
      • toJDBCType

        public int toJDBCType​(Class c)
        Description copied from interface: JDBCMetadataProvider
        Converts a Java type to a JDBC type.

        The following Java types must be supported:

        • String
        • Integer
        • Long
        • Float
        • Double
        • com.spotfire.ws.dat.Date
        • com.spotfire.ws.dat.Time
        • com.spotfire.ws.dat.DateTime
        • com.spotfire.ws.dat.Clob
        • com.spotfire.ws.dat.Blob
        Specified by:
        toJDBCType in interface JDBCMetadataProvider
        Parameters:
        c - a Java type
        Returns:
        a JDBC type
        Since:
        3.0
        See Also:
        Types
      • sortMetadataItemsByName

        public static MetadataItem[] sortMetadataItemsByName​(MetadataItem[] items)
        Parameters:
        items - items
        Returns:
        MetadataItem
        Since:
        3.0
      • sortMetadataItemsByName

        protected static MetadataItem[] sortMetadataItemsByName​(List<MetadataItem> items)
        Parameters:
        items - the items
        Returns:
        the meta data item
        Since:
        10.1