public abstract class SqlManager extends ConnManager
Modifier and Type | Field and Description |
---|---|
protected static int |
DEFAULT_FETCH_SIZE |
static org.apache.commons.logging.Log |
LOG |
Constructor and Description |
---|
SqlManager()
Constructs the SqlManager.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Perform any shutdown operations on the connection.
|
protected ResultSet |
execute(String stmt,
Integer fetchSize,
Object... args)
Executes an arbitrary SQL statement.
|
protected ResultSet |
execute(String stmt,
Object... args) |
protected String |
getColNamesQuery(String tableName) |
protected String |
getColTypesQuery(String tableName) |
String[] |
getColumnDataForRawQuery(String stmt)
Get column names for a query statement that we do not modify further.
|
Map<String,DatabaseMetaData.Column> |
getColumnTypeNamesForQuery(String query)
Return an unordered mapping from colname to sql type name for all columns
in a query.
|
protected Map<String,DatabaseMetaData.Column> |
getColumnTypeNamesForRawQuery(String stmt) |
Map<String,DatabaseMetaData.Column> |
getColumnTypeNamesForTable(String tableName)
Return an unordered mapping from colname to sql type name for all columns
in a table.
|
abstract Connection |
getConnection()
Retrieve the actual connection from the outer ConnManager.
|
protected abstract String |
getConnectionString() |
protected int |
getMetadataIsolationLevel() |
protected abstract String |
getPassword() |
String[] |
getPrimaryKeyColDetails(String stmt) |
String[] |
getPrimaryKeyColumnNames(String tableName) |
protected abstract String |
getPrimaryKeyQuery(String tableName) |
protected abstract String |
getUserName() |
protected Connection |
makeConnection()
Create a connection to the database; usually used only from within
getConnection(), which enforces a singleton guarantee around the
Connection object.
|
void |
release()
If a method of this ConnManager has returned a ResultSet to you, you are
responsible for calling release() after you close the ResultSet object,
to free internal resources.
|
escapeTableName, getColumnTypeNames, getColumnTypesForQuery, getDriverClass, timestampToQueryString
public static final org.apache.commons.logging.Log LOG
protected static final int DEFAULT_FETCH_SIZE
public SqlManager()
opts
- the SqoopOptions describing the user's requested action.protected String getColNamesQuery(String tableName)
public String[] getColumnDataForRawQuery(String stmt) throws SQLException
SQLException
protected String getColTypesQuery(String tableName)
public Map<String,DatabaseMetaData.Column> getColumnTypeNamesForTable(String tableName)
ConnManager
getColumnTypeNamesForTable
in class ConnManager
public Map<String,DatabaseMetaData.Column> getColumnTypeNamesForQuery(String query)
ConnManager
getColumnTypeNamesForQuery
in class ConnManager
protected Map<String,DatabaseMetaData.Column> getColumnTypeNamesForRawQuery(String stmt)
protected ResultSet execute(String stmt, Object... args) throws SQLException
SQLException
public abstract Connection getConnection() throws SQLException
getConnection
in class ConnManager
SQLException
protected Connection makeConnection() throws SQLException
SQLException
protected abstract String getConnectionString()
protected abstract String getPassword()
protected abstract String getUserName()
protected ResultSet execute(String stmt, Integer fetchSize, Object... args) throws SQLException
stmt
- The SQL statement to executefetchSize
- Overrides default or parameterized fetch sizeSQLException
public void close() throws SQLException
ConnManager
close
in class ConnManager
SQLException
protected int getMetadataIsolationLevel()
public void release()
ConnManager
release
in class ConnManager
Copyright © 2016 Actian Corporation. All Rights Reserved.