| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_KEEP_ALIVE_INTERVAL |
static String |
DEFAULT_KEEP_ALIVE_QUERY |
static String |
KEEP_ALIVE_PROPERTY |
static String |
KEEP_ALIVE_QUERY_PROPERTY |
| Constructor and Description |
|---|
ConnectedDB(String jdbcURL,
String username,
String password) |
ConnectedDB(String jdbcURL,
String username,
String password,
Map<String,DataType.GenericType> columnTypes,
int limit,
int fetchSize,
Properties connectionProperties) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
areCompatibleFormats(Attribute column1,
Attribute column2)
Checks if two columns are formatted by the database in a compatible
fashion.
|
void |
close()
Closes the database connection and shuts down the keep alive agent.
|
DataType |
columnType(Attribute column)
Returns a column's datatype.
|
Connection |
connection() |
boolean |
equals(Object otherObject) |
int |
fetchSize() |
protected String |
getDatabaseProductType() |
String |
getJdbcURL() |
String |
getPassword() |
Map<String,List<String>> |
getUniqueKeyColumns(RelationName tableName) |
String |
getUsername() |
static String |
guessJDBCDriverClass(String jdbcURL)
Tries to guess the class name of a suitable JDBC driver from a JDBC URL.
|
int |
hashCode() |
boolean |
isNullable(Attribute column) |
int |
limit() |
boolean |
lowerCaseTableNames()
In some situations, MySQL stores table names using lowercase only, and then performs
case-insensitive comparison.
|
static void |
registerJDBCDriver(String driverClassName)
Registers a JDBC driver class.
|
static void |
registerJDBCDriverIfPresent(String driverClassName)
Pre-registers a JDBC driver if its class can be found on the
classpath.
|
DatabaseSchemaInspector |
schemaInspector() |
void |
setDefaultFetchSize(int value) |
Vendor |
vendor() |
boolean |
vendorIs(Vendor vendor)
Reports the brand of RDBMS.
|
public static final String KEEP_ALIVE_PROPERTY
public static final int DEFAULT_KEEP_ALIVE_INTERVAL
public static final String KEEP_ALIVE_QUERY_PROPERTY
public static final String DEFAULT_KEEP_ALIVE_QUERY
public ConnectedDB(String jdbcURL, String username, String password, Map<String,DataType.GenericType> columnTypes, int limit, int fetchSize, Properties connectionProperties)
public String getJdbcURL()
public String getUsername()
public String getPassword()
public Connection connection()
public int limit()
public void setDefaultFetchSize(int value)
public int fetchSize()
public DatabaseSchemaInspector schemaInspector()
public DataType columnType(Attribute column)
column - null if unknownpublic boolean isNullable(Attribute column)
public boolean vendorIs(Vendor vendor)
TODO make private, use {@link #vendor()} and its methods insteadpublic Vendor vendor()
protected String getDatabaseProductType() throws SQLException
SQLExceptionpublic boolean areCompatibleFormats(Attribute column1, Attribute column2)
Checks if two columns are formatted by the database in a compatible fashion.
Assuming v1 is a value from column1, and v2 a value from column2, and v1 = v2 evaluates to true within the database, then we call the values have compatible formatting if SELECTing them results in character-for-character identical strings. As an example, a TINYINT and a BIGINT are compatible because equal values will be formatted in the same way when SELECTed, e.g. 1 = 1. But if one of them is ZEROFILL, then SELECTing will result in a different character string, e.g. 1 = 0000000001. The two columns wouldn't be compatible.
This is used by the engine when removing unnecessary joins. If two columns have compatible formatting, then we can sometimes use one in place of the other when they are known to have equal values. But not if they are incompatible, because e.g. http://example.org/id/1 is different from http://example.org/id/0000000001.
public Map<String,List<String>> getUniqueKeyColumns(RelationName tableName)
public boolean lowerCaseTableNames()
public void close()
public static void registerJDBCDriverIfPresent(String driverClassName)
driverClassName - Fully qualified class name of a JDBC driverpublic static String guessJDBCDriverClass(String jdbcURL)
jdbcURL - A JDBC URLpublic static void registerJDBCDriver(String driverClassName)
driverClassName - Fully qualified class name of a JDBC driverD2RQException - If the class could not be found