com.sap.cds.jdbc.h2.H2Binder Maven / Gradle / Ivy
The newest version!
/*******************************************************************
* © 2024 SAP SE or an SAP affiliate company. All rights reserved. *
*******************************************************************/
package com.sap.cds.jdbc.h2;
import static com.sap.cds.util.CdsModelUtils.element;
import java.util.TimeZone;
import com.sap.cds.jdbc.generic.GenericBinder;
import com.sap.cds.ql.cqn.CqnElementRef;
import com.sap.cds.ql.cqn.CqnSelectListValue;
import com.sap.cds.reflect.CdsBaseType;
import com.sap.cds.reflect.CdsStructuredType;
import com.sap.cds.reflect.CdsType;
class H2Binder extends GenericBinder {
H2Binder(TimeZone timeZone) {
super(7, timeZone);
}
@Override
public Getter getter(CdsStructuredType targetType, CqnSelectListValue slv) {
if (slv.value().isRef() && slv.asRef().type().isPresent()) {
CqnElementRef ref = slv.asRef();
CdsType type = element(targetType, ref).getType();
if (type.isSimpleType(CdsBaseType.MAP)) {
// Other types fail on H2: ignore the ref type
return super.getter(CdsBaseType.MAP, false);
}
}
return super.getter(targetType, slv);
}
}