Package io.deephaven.importers.jdbc.util
Interface IDriverWrapper
- All Known Implementing Classes:
MysqlDriverWrapper,PostgresDriverWrapper,RedshiftDriverWrapper,SqlServerDriverWrapper
public interface IDriverWrapper
A class for abstracting away the different terminology and parameters for obtaining JDBC data; for use in the GUI
JDBC importing framework to make it friendlier for our users.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classThe necessary elements for a client UI to display information about this driver wrapper.static interfaceGeneral factory interface for obtaining driver wrappers. -
Method Summary
Modifier and TypeMethodDescriptionDefine what the UI should use to describe a catalog.Define the default URL for this driver.default IDriverWrapper.DisplayInfoCreates a DisplayInfo object for this driver wrapper.The class used by JDBC for this driver.Get the user-friendly name.String[]getCatalogNames(Connection connection) Get the list of Catalogs.getServerTimeZone(Connection conn) Return the server time zone for interpreting datetime values.String[]getTableNames(Connection connection, String catalogName) Get the list of tables within a catalog.booleanReturn if the driver supports scrollable cursors.booleanisValidUrl(String uri) Check if this is a valid URL for this driver.default voidload()Load the driver class.quoteEscapeColumnName(String columnName) Quote and escape a column name in accordance with the particular DBMS, for use in a query.quoteEscapeTableName(String schemaName, String tableName) Quote and escape a table name in accordance with the particular DBMS, for use in a query.
-
Method Details
-
friendlyName
String friendlyName()Get the user-friendly name. For example "Mysql", "Oracle", "MS SQL Server" can be displayed to the user.- Returns:
- a friendly name for this driver wrapper
-
driverClass
String driverClass()The class used by JDBC for this driver.- Returns:
- the name of the class to load for this driver
-
isValidUrl
Check if this is a valid URL for this driver.- Parameters:
uri- the uri- Returns:
- true if valid
-
getCatalogNames
Get the list of Catalogs. For our purposes, a catalog is simply a bucket of table names.Catalog matches the JDBC connection meta-data terminology; but does not map to all DBMSes.
- Parameters:
connection- the JDBC connection- Returns:
- an array of catalog names
- Throws:
SQLException- when the underlying SQL operation fails
-
catalogName
String catalogName()Define what the UI should use to describe a catalog.- Returns:
- the name of the catalog type (e.g.,"SQL Database", "Database")
-
defaultUrl
String defaultUrl()Define the default URL for this driver.- Returns:
- the default URL
-
getTableNames
Get the list of tables within a catalog.- Parameters:
connection- the JDBC connectioncatalogName- the catalog to get names for- Returns:
- an array of table names
- Throws:
SQLException- when the underlying SQL operation fails
-
hasScrollableCursors
boolean hasScrollableCursors()Return if the driver supports scrollable cursors.- Returns:
- true if scrollable cursors are supported
-
getServerTimeZone
Return the server time zone for interpreting datetime values.- Parameters:
conn- the JDBC connection- Returns:
- the server time zone
- Throws:
SQLException- when the underlying SQL operation fails
-
quoteEscapeTableName
Quote and escape a table name in accordance with the particular DBMS, for use in a query. Should handle unusual characters in table names (e.g. whitespace), if permitted by the DBAM, and prevent SQL injection attacks.- Parameters:
schemaName- the raw unquoted, unescaped schema nametableName- the raw unquoted, unescaped table name- Returns:
- the quoted, escaped table name
-
quoteEscapeColumnName
Quote and escape a column name in accordance with the particular DBMS, for use in a query. Should handle unusual characters in table names (e.g. whitespace), if permitted by the DBAM, and prevent SQL injection attacks.- Parameters:
columnName- the raw unquoted, unescaped column name- Returns:
- the quoted, escaped table name
-
displayInfo
Creates a DisplayInfo object for this driver wrapper.- Returns:
- display info for this driver wrapper.
-
load
Load the driver class.- Throws:
Exception- if the driver class cannot be loaded
-