org.fluentjdbc.Inserter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fluent-jdbc Show documentation
Show all versions of fluent-jdbc Show documentation
A Java library used to execute JDBC statements and build SQL
package org.fluentjdbc;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;
public class Inserter extends DatabaseStatement {
private final PreparedStatement statement;
private final List fields;
Inserter(PreparedStatement statement, List fields) {
this.statement = statement;
this.fields = fields;
}
public void setField(String fieldName, Object value) throws SQLException {
int position = fields.indexOf(fieldName);
if (position < 0) {
throw new IllegalArgumentException("Unknown field " + fieldName);
}
bindParameter(statement, position+1, value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy