Ejemplo n.º 1
0
 @Override
 public int hash(
     StoreAdapter adapter,
     TEvaluatableExpression evaluation,
     Row row,
     AkCollator collator) {
   evaluation.with(row);
   evaluation.evaluate();
   return ValueSources.hash(evaluation.resultValue(), collator);
 }
 public ValueSource valuefromObject(Object value, ServerType type) {
   if (value instanceof Date) {
     TInstance dateType = javaDateTInstance(value);
     Value dateValue = new Value(dateType);
     typesTranslator.setTimestampMillisValue(
         dateValue,
         ((Date) value).getTime(),
         (value instanceof java.sql.Timestamp) ? ((java.sql.Timestamp) value).getNanos() : 0);
     TInstance targetType = type.getType();
     if (dateType.equals(targetType)) return dateValue;
     TExecutionContext context =
         new TExecutionContext(Collections.singletonList(dateType), targetType, null);
     Value result = new Value(targetType);
     targetType.typeClass().fromObject(context, dateValue, result);
     return result;
   } else {
     // TODO this is inefficient, but I want to get it working.
     return ValueSources.valuefromObject(value, type.getType());
   }
 }