package io.ebeaninternal.server.rawsql;
import java.sql.ResultSet;
public final class DRawSql implements SpiRawSql {
private final ResultSet resultSet;
private final Sql sql;
private final ColumnMapping columnMapping;
public DRawSql(ResultSet resultSet, String... propertyNames) {
this.resultSet = resultSet;
this.sql = null;
this.columnMapping = new ColumnMapping(propertyNames);
}
protected DRawSql(ResultSet resultSet, Sql sql, ColumnMapping columnMapping) {
this.resultSet = resultSet;
this.sql = sql;
this.columnMapping = columnMapping;
}
@Override
public Sql getSql() {
return sql;
}
@Override
public Key getKey() {
boolean parsed = sql != null && sql.isParsed();
String unParsedSql = (sql == null) ? "" : sql.getUnparsedSql();
return new Key(parsed, unParsedSql, columnMapping);
}
@Override
public ResultSet getResultSet() {
return resultSet;
}
@Override
public ColumnMapping getColumnMapping() {
return columnMapping;
}
}