mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1312 - ENH: added SqlRow factory method to RawSqlService
Support the PR added binaryOptimizedUUID
This commit is contained in:
@@ -26,12 +26,10 @@ public interface RawSqlBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and return a SqlRow based on the resultSet and the dbTrueValue.
|
||||
* @throws SQLException
|
||||
* Create and return a SqlRow based on the resultSet with dbTrueValue and binaryOptimizedUUID options.
|
||||
*/
|
||||
static SqlRow sqlRow(ResultSet resultSet, final String dbTrueValue) throws SQLException {
|
||||
return XServiceProvider.rawSql().sqlRow(resultSet, dbTrueValue);
|
||||
|
||||
static SqlRow sqlRow(ResultSet resultSet, final String dbTrueValue, boolean binaryOptimizedUUID) throws SQLException {
|
||||
return XServiceProvider.rawSql().sqlRow(resultSet, dbTrueValue, binaryOptimizedUUID);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,10 @@ public interface SpiRawSqlService {
|
||||
|
||||
/**
|
||||
* Create based on a JDBC ResultSet.
|
||||
* @throws SQLException
|
||||
*
|
||||
* @param resultSet The ResultSet row to read as a SqlRow
|
||||
* @param dbTrueValue The DB true value
|
||||
* @param binaryOptimizedUUID Flag set to true if the UUID value is stored as optimised binary(16)
|
||||
*/
|
||||
SqlRow sqlRow(ResultSet resultSet, String dbTrueValue) throws SQLException;
|
||||
SqlRow sqlRow(ResultSet resultSet, String dbTrueValue, boolean binaryOptimizedUUID) throws SQLException;
|
||||
}
|
||||
|
||||
@@ -34,10 +34,11 @@ public class DRawSqlService implements SpiRawSqlService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqlRow sqlRow(ResultSet resultSet, String dbTrueValue) throws SQLException {
|
||||
public SqlRow sqlRow(ResultSet resultSet, String dbTrueValue, boolean binaryOptimizedUUID) throws SQLException {
|
||||
|
||||
ResultSetMetaData meta = resultSet.getMetaData();
|
||||
int estCap = (int) (meta.getColumnCount() / 0.7f) + 1;
|
||||
DefaultSqlRow ret = new DefaultSqlRow(estCap, 0.75f, dbTrueValue);
|
||||
DefaultSqlRow ret = new DefaultSqlRow(estCap, 0.75f, dbTrueValue, binaryOptimizedUUID);
|
||||
|
||||
for (int i = 1; i <= meta.getColumnCount(); i++) {
|
||||
String name = meta.getColumnLabel(i);
|
||||
|
||||
Reference in New Issue
Block a user