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 Classes Modifier and Type Interface Description static class
IDriverWrapper.DisplayInfo
The necessary elements for a client UI to display information about this driver wrapper.static class
IDriverWrapper.DriverWrapperException
static interface
IDriverWrapper.Factory
-
Field Summary
Fields Modifier and Type Field Description static IDriverWrapper.Factory
FACTORY
-
Method Summary
Modifier and Type Method Description String
catalogName()
What should the UI use to describe a catalog?String
defaultUrl()
What should the default URL for this driver be?default IDriverWrapper.DisplayInfo
displayInfo()
Creates a DisplayInfo object for this driver wrapper.String
driverClass()
The class used by JDBC for this driver.String
friendlyName()
For example "Mysql", "Oracle", "MS SQL Server"; shows up in the Combo Box dropdown of the different Drivers.String[]
getCatalogNames(Connection connection)
Get the list of Catalogs.TimeZone
getServerTimeZone(Connection conn)
Return server time zone (for interpreting datetime values)String[]
getTableNames(Connection connection, String catalogName)
Get the list of tables within a catalog.boolean
hasScrollableCursors()
Return if the driver supports scrollable cursorsboolean
isValidUrl(String uri)
Check if this is a valid URL for this driver.default void
load()
String
quoteEscapeColumnName(String columnName)
Quote and escape a column name in accordance with the particular DBMS, for use in a query.String
quoteEscapeTableName(String schemaName, String tableName)
Quote and escape a table name in accordance with the particular DBMS, for use in a query.
-
Field Details
-
Method Details
-
friendlyName
String friendlyName()For example "Mysql", "Oracle", "MS SQL Server"; shows up in the Combo Box dropdown of the different Drivers.- 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. -
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()What should the UI use to describe a catalog? -
defaultUrl
String defaultUrl()What should the default URL for this driver be? -
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:
-
getServerTimeZone
Return server time zone (for interpreting datetime values)- Throws:
SQLException
-
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
- Throws:
Exception
-