All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cool.scx.jdbc.JDBCContext Maven / Gradle / Ivy

There is a newer version: 2.7.4
Show newest version
package cool.scx.jdbc;

import cool.scx.jdbc.dialect.Dialect;
import cool.scx.jdbc.sql.SQLRunner;

import javax.sql.DataSource;

import static cool.scx.jdbc.dialect.DialectSelector.findDialect;

public class JDBCContext {

    private final DataSource dataSource;
    private final Dialect dialect;
    private final SQLRunner sqlRunner;

    public JDBCContext(DataSource dataSource) {
        this.dataSource = dataSource;
        this.dialect = findDialect(dataSource);
        this.sqlRunner = new SQLRunner(this);
    }

    public SQLRunner sqlRunner() {
        return sqlRunner;
    }

    public Dialect dialect() {
        return this.dialect;
    }

    public DataSource dataSource() {
        return this.dataSource;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy