public abstract class JdbcDialect
extends java.lang.Object
implements scala.Serializable
Currently, the only thing done by the dialect is type mapping.
getCatalystType
is used when reading from a JDBC table and getJDBCType
is used when writing to a JDBC table. If getCatalystType
returns null
,
the default type handling is used for the given JDBC type. Similarly,
if getJDBCType
returns (null, None)
, the default type handling is used
for the given Catalyst type.
Constructor and Description |
---|
JdbcDialect() |
Modifier and Type | Method and Description |
---|---|
void |
beforeFetch(java.sql.Connection connection,
scala.collection.immutable.Map<java.lang.String,java.lang.String> properties)
Override connection specific properties to run before a select is made.
|
abstract boolean |
canHandle(java.lang.String url)
Check if this dialect instance can handle a certain jdbc url.
|
scala.Option<DataType> |
getCatalystType(int sqlType,
java.lang.String typeName,
int size,
MetadataBuilder md)
Get the custom datatype mapping for the given jdbc meta information.
|
scala.Option<JdbcType> |
getJDBCType(DataType dt)
Retrieve the jdbc / sql type for a given datatype.
|
java.lang.String |
getTableExistsQuery(java.lang.String table)
Get the SQL query that should be used to find if the given table exists.
|
java.lang.String |
quoteIdentifier(java.lang.String colName)
Quotes the identifier.
|
public abstract boolean canHandle(java.lang.String url)
url
- the jdbc url.java.lang.NullPointerException
- if the url is null.public scala.Option<DataType> getCatalystType(int sqlType, java.lang.String typeName, int size, MetadataBuilder md)
sqlType
- The sql type (see java.sql.Types)typeName
- The sql type name (e.g. "BIGINT UNSIGNED")size
- The size of the type.md
- Result metadata associated with this type.DataType
)
or null if the default type mapping should be used.public scala.Option<JdbcType> getJDBCType(DataType dt)
dt
- The datatype (e.g. StringType
)public java.lang.String quoteIdentifier(java.lang.String colName)
colName
- (undocumented)public java.lang.String getTableExistsQuery(java.lang.String table)
table
- The name of the table.public void beforeFetch(java.sql.Connection connection, scala.collection.immutable.Map<java.lang.String,java.lang.String> properties)
connection
- The connection objectproperties
- The connection properties. This is passed through from the relation.