コード例 #1
0
 /**
  * Convert the value as loaded from the SQL table into the expected variable value type (column
  * type may not match exactly the variable value type).
  *
  * @param variable
  * @param value
  * @return
  */
 private Value convertValue(Variable variable, Value value) {
   if (value.getValueType() != variable.getValueType()) {
     return variable.isRepeatable()
         ? convertToSequence(variable, value)
         : variable.getValueType().convert(value);
   }
   if (variable.isRepeatable() && !value.isSequence()) {
     return convertToSequence(variable, value);
   }
   return value;
 }
コード例 #2
0
  private Value getBinaryValue(Variable variable) {
    List<Map<String, Value>> res =
        loadValues(
            Lists.newArrayList(getValueTable().getVariableSqlName(variable.getName())), mapper);

    if (res.isEmpty())
      return variable.isRepeatable()
          ? variable.getValueType().nullSequence()
          : variable.getValueType().nullValue();

    Value value = res.get(0).get(variable.getName());
    return convertValue(variable, value);
  }