|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.d2rq.db.SQLConnection
public class SQLConnection
TODO: Move all engine-specific code from here to Vendor
and its implementations
TODO: Move keepalive agent into a separate class
Field Summary | |
---|---|
static int |
DEFAULT_KEEP_ALIVE_INTERVAL
|
static String |
DEFAULT_KEEP_ALIVE_QUERY
|
static String |
KEEP_ALIVE_PROPERTY
|
static String |
KEEP_ALIVE_QUERY_PROPERTY
|
Constructor Summary | |
---|---|
SQLConnection(String jdbcURL,
String jdbcDriver,
String username,
String password)
|
|
SQLConnection(String jdbcURL,
String jdbcDriver,
String username,
String password,
Properties connectionProperties)
|
Method Summary | |
---|---|
boolean |
areCompatibleFormats(DatabaseOp table1,
ColumnName column1,
DatabaseOp table2,
ColumnName 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. |
Connection |
connection()
|
boolean |
equals(Object other)
|
int |
fetchSize()
|
protected String |
getDatabaseProductType()
|
String |
getJdbcDriverClass()
|
String |
getJdbcURL()
|
String |
getParseError(String sql)
|
String |
getPassword()
|
SQLOp |
getSelectStatement(String sql)
|
TableOp |
getTable(TableName table)
|
Collection<TableName> |
getTableNames(String searchInSchema)
Lists available table names. |
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 |
isReferencedByForeignKey(TableName table)
|
boolean |
isTable(TableName table)
|
int |
limit()
|
static void |
registerJDBCDriverIfPresent(String driverClassName)
Pre-registers a JDBC driver if its class can be found on the classpath. |
void |
setDefaultFetchSize(int value)
|
void |
setFetchSize(int fetchSize)
|
void |
setLimit(int resultSizeLimit)
|
Vendor |
vendor()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public SQLConnection(String jdbcURL, String jdbcDriver, String username, String password)
public SQLConnection(String jdbcURL, String jdbcDriver, String username, String password, Properties connectionProperties)
Method Detail |
---|
public String getJdbcURL()
public String getJdbcDriverClass()
public String getUsername()
public String getPassword()
public Connection connection()
public String getParseError(String sql)
public SQLOp getSelectStatement(String sql)
public Collection<TableName> getTableNames(String searchInSchema)
searchInSchema
- Schema to list tables from; null to list tables from all schemas
public boolean isTable(TableName table)
public TableOp getTable(TableName table)
table
- A table name
null
if it doesn't existpublic boolean isReferencedByForeignKey(TableName table)
true
if another table has a foreign key referencing
this table's primary keypublic int limit()
public void setLimit(int resultSizeLimit)
public void setFetchSize(int fetchSize)
fetchSize
- Value specified in user config or mapping filepublic void setDefaultFetchSize(int value)
value
- Default value for the current operation mode (e.g., increase for dumps)public int fetchSize()
public Vendor vendor()
protected String getDatabaseProductType() throws SQLException
SQLException
public boolean areCompatibleFormats(DatabaseOp table1, ColumnName column1, DatabaseOp table2, ColumnName 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 void close()
public boolean equals(Object other)
equals
in class Object
public int hashCode()
hashCode
in class Object
public static void registerJDBCDriverIfPresent(String driverClassName)
driverClassName
- Fully qualified class name of a JDBC driverpublic static String guessJDBCDriverClass(String jdbcURL)
jdbcURL
- A JDBC URL
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |