use of org.dbflute.jdbc.ValueType in project dbflute-core by dbflute.
the class TnAbstractPropertyTypeFactory method findValueTypeByName.
protected ValueType findValueTypeByName(String propertyName, Class<?> propertyType, String keyName) {
final ValueType valueType = TnValueTypes.getPluginValueType(keyName);
if (valueType != null) {
return valueType;
}
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("Not found the plug-in value type by the name.");
br.addItem("Bean Type");
br.addElement(_beanClass.getName());
br.addItem("Property");
br.addElement(propertyName);
br.addElement(propertyType.getName());
br.addItem("Key Name");
br.addElement(keyName);
final String msg = br.buildExceptionMessage();
throw new PluginValueTypeNotFoundException(msg);
}
use of org.dbflute.jdbc.ValueType in project dbflute-core by dbflute.
the class TnProcedureValueTypeProvider method findValueTypeByName.
// ===================================================================================
// By Name
// =======
protected ValueType findValueTypeByName(Class<?> pmbType, String paramName, Class<?> paramType, String keyName) {
final ValueType valueType = TnValueTypes.getPluginValueType(keyName);
if (valueType != null) {
return valueType;
}
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("Not found a plug-in value type by the name.");
br.addItem("ProcedurePmb");
br.addElement(pmbType.getName());
br.addItem("Parameter");
br.addElement(paramName);
br.addElement(paramType.getName());
br.addItem("Key Name");
br.addElement(keyName);
final String msg = br.buildExceptionMessage();
throw new PluginValueTypeNotFoundException(msg);
}
use of org.dbflute.jdbc.ValueType in project dbflute-core by dbflute.
the class DfLReverseDataExtractor method processNormalData.
// ===================================================================================
// Normal Data
// ===========
protected DfLReverseDataResult processNormalData(Table table, List<String> sqlList) {
final DfJdbcFacade facade = createJdbcFacade();
final Map<String, ValueType> valueTypeMap = createColumnValueTypeMap(table.getColumnList());
final DfJFadStringConverter converter = createStringConverter();
final Integer limit = _extractingLimit;
final List<Map<String, String>> resultList = facade.selectStringList(sqlList, valueTypeMap, converter, limit);
return new DfLReverseDataResult(resultList);
}
use of org.dbflute.jdbc.ValueType in project dbflute-core by dbflute.
the class TnProcedureHandler method handleOutParameter.
/**
* Handle result set for out-parameter.
* @param conn The connection for the database. (NotNull)
* @param cs The statement of procedure. (NotNull)
* @param pmb The parameter bean from arguments. (NotNull)
* @param executed The return value of execute() that means whether the first result is a result set.
* @throws SQLException When it fails to handle the SQL.
*/
protected void handleOutParameter(Connection conn, CallableStatement cs, Object pmb, boolean executed) throws SQLException {
if (pmb == null) {
return;
}
int index = 0;
for (TnProcedureParameterType ppt : _procedureMetaData.getBindParameterTypeList()) {
final ValueType valueType = ppt.getValueType();
if (ppt.isOutType()) {
Object value = valueType.getValue(cs, index + 1);
if (value instanceof ResultSet) {
final ResultSet rs = wrapResultSetIfNeeds(pmb, (ResultSet) value);
final TnResultSetHandler handler = createResultSetHandler(pmb, ppt);
try {
value = handler.handle(rs);
} finally {
if (rs != null) {
rs.close();
}
}
}
ppt.setValue(pmb, value);
}
++index;
}
}
use of org.dbflute.jdbc.ValueType in project dbflute-core by dbflute.
the class TnCommandContextHandler method bindFirstScope.
// ===================================================================================
// Bind Scope
// ==========
protected int bindFirstScope(Connection conn, PreparedStatement ps, Object[] bindVariables, Class<?>[] bindVariableTypes) {
final List<Object> firstVariableList = new ArrayList<Object>();
final List<ValueType> firstValueTypeList = new ArrayList<ValueType>();
int index = 0;
for (TnPropertyType propertyType : _firstBoundPropTypeList) {
firstVariableList.add(bindVariables[index]);
firstValueTypeList.add(propertyType.getValueType());
++index;
}
bindArgs(conn, ps, firstVariableList.toArray(), firstValueTypeList.toArray(new ValueType[0]));
return index;
}
Aggregations