001package org.itsallcode.jdbc.dialect;
002
003import org.itsallcode.jdbc.resultset.generic.ColumnMetaData;
004
005/**
006 * A database specific dialect.
007 */
008public interface DbDialect {
009
010    /**
011     * Check if this dialect supports the database type with the given JDBC URL.
012     * 
013     * @param jdbcUrl JDBC URL
014     * @return {@code true} if this dialect supports the database
015     */
016    boolean supportsUrl(String jdbcUrl);
017
018    /**
019     * Create an extractor for the given column.
020     * 
021     * @param column the column for which to get the extractor
022     * @return extractor
023     */
024    ColumnValueExtractor createExtractor(final ColumnMetaData column);
025
026    /**
027     * Create a new column value setter for setting values on a
028     * {@link java.sql.PreparedStatement} specific to the dialect.
029     * 
030     * @param <T>  object type
031     * @param type object type
032     * @return column value setter
033     */
034    <T> ColumnValueSetter<T> createSetter(Class<T> type);
035}