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

liquibase.database.PreparedStatementFactory Maven / Gradle / Ivy

There is a newer version: 3.6.2.5.inovus
Show newest version
package liquibase.database;

import liquibase.database.jvm.JdbcConnection;
import liquibase.exception.DatabaseException;

import java.sql.PreparedStatement;

/**
 * Factory for PreparedStatements
 */
public final class PreparedStatementFactory {

    private final JdbcConnection con;

    public PreparedStatementFactory(JdbcConnection con) {
        if(con == null) throw new IllegalArgumentException("connection must not be null");
        this.con = con;
    }

    /**
     * Create a PreparedStatement object,
     * sql pre-compilation might take place, depending on driver support. 
     * @param sql to execute
     * @return a PreparedStatement object
     * @throws DatabaseException
     */
    public PreparedStatement create(String sql) throws DatabaseException {
        return con.prepareStatement(sql);
    }

    @Override
    public String toString() {
        return "[con: " + con.toString() + "]";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy