mirror of
https://github.com/moparisthebest/JdbcMapper
synced 2024-11-22 00:52:16 -05:00
Remove some incorrect QueryMapper.toResultSet overrides
This commit is contained in:
parent
1003819064
commit
c80bc43243
@ -165,7 +165,7 @@ public class CachingQueryMapper extends QueryMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResultSet toResultSet(String sql, Integer rsType, Integer rsConcurrency, Object... bindObjects) throws SQLException {
|
public ResultSet toResultSet(String sql, int rsType, int rsConcurrency, Object... bindObjects) throws SQLException {
|
||||||
return super.toResultSet(getPreparedStatement(sql,rsType,rsConcurrency), bindObjects);
|
return super.toResultSet(getPreparedStatement(sql,rsType,rsConcurrency), bindObjects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,8 @@ public class QueryMapper implements JdbcMapper {
|
|||||||
public static final Object noBind = new Object();
|
public static final Object noBind = new Object();
|
||||||
public static final ResultSetMapper defaultRsm = new ResultSetMapper();
|
public static final ResultSetMapper defaultRsm = new ResultSetMapper();
|
||||||
|
|
||||||
|
protected static final int[] SINGLE_COLUMN_INDEX = new int[]{1};
|
||||||
|
|
||||||
/*IFJAVA6_START
|
/*IFJAVA6_START
|
||||||
private static final Charset UTF_8 = Charset.forName("UTF-8");
|
private static final Charset UTF_8 = Charset.forName("UTF-8");
|
||||||
IFJAVA6_END*/
|
IFJAVA6_END*/
|
||||||
@ -333,7 +335,7 @@ public class QueryMapper implements JdbcMapper {
|
|||||||
public Long insertGetGeneratedKey(final String sql, final Object... bindObjects) throws SQLException {
|
public Long insertGetGeneratedKey(final String sql, final Object... bindObjects) throws SQLException {
|
||||||
PreparedStatement ps = null;
|
PreparedStatement ps = null;
|
||||||
try {
|
try {
|
||||||
ps = conn.prepareStatement(sql, new int[]{1}); // todo: create this array private static final
|
ps = conn.prepareStatement(sql, SINGLE_COLUMN_INDEX);
|
||||||
return this.insertGetGeneratedKey(ps, bindObjects);
|
return this.insertGetGeneratedKey(ps, bindObjects);
|
||||||
} finally {
|
} finally {
|
||||||
tryClose(ps);
|
tryClose(ps);
|
||||||
@ -387,10 +389,6 @@ public class QueryMapper implements JdbcMapper {
|
|||||||
// these grab ResultSets from the database
|
// these grab ResultSets from the database
|
||||||
|
|
||||||
public ResultSet toResultSet(PreparedStatement ps, final Object... bindObjects) throws SQLException {
|
public ResultSet toResultSet(PreparedStatement ps, final Object... bindObjects) throws SQLException {
|
||||||
return toResultSet(ps, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, bindObjects);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResultSet toResultSet(PreparedStatement ps, int rsType, int rsConcurrency, final Object... bindObjects) throws SQLException {
|
|
||||||
return bindExecute(ps, bindObjects);
|
return bindExecute(ps, bindObjects);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,14 +396,13 @@ public class QueryMapper implements JdbcMapper {
|
|||||||
return toResultSet(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, bindObjects);
|
return toResultSet(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, bindObjects);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultSet toResultSet(String sql, Integer rsType, Integer rsConcurrency, final Object... bindObjects) throws SQLException {
|
public ResultSet toResultSet(String sql, int rsType, int rsConcurrency, final Object... bindObjects) throws SQLException {
|
||||||
//throw new UnsupportedOperationException("Can't return ResultSet from String because the PreparedStatement can't be closed before the ResultSet is, so CachingQueryMapper will work.");
|
|
||||||
// works with StatementClosingResultSet
|
// works with StatementClosingResultSet
|
||||||
boolean error = true;
|
boolean error = true;
|
||||||
PreparedStatement ps = null;
|
PreparedStatement ps = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
ps = conn.prepareStatement(sql, rsType.intValue(), rsConcurrency.intValue());
|
ps = conn.prepareStatement(sql, rsType, rsConcurrency);
|
||||||
rs = this.toResultSet(ps, bindObjects);
|
rs = this.toResultSet(ps, bindObjects);
|
||||||
error = false;
|
error = false;
|
||||||
return new StatementClosingResultSet(rs, ps);
|
return new StatementClosingResultSet(rs, ps);
|
||||||
|
Loading…
Reference in New Issue
Block a user