All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sap.cds.jdbc.hana.json.HanaDocStoreScalarValueResolver Maven / Gradle / Ivy

There is a newer version: 3.6.1
Show newest version
/*******************************************************************
 * © 2024 SAP SE or an SAP affiliate company. All rights reserved. *
 *******************************************************************/
package com.sap.cds.jdbc.hana.json;

import com.sap.cds.jdbc.generic.GenericScalarValueResolver;
import com.sap.cds.jdbc.spi.ScalarValueResolver;
import com.sap.cds.ql.cqn.CqnBooleanLiteral;

public class HanaDocStoreScalarValueResolver extends GenericScalarValueResolver {

	private static final String JSON_TRUE = "TO_JSON_BOOLEAN(TRUE)";
	private static final String JSON_FALSE = "TO_JSON_BOOLEAN(FALSE)";

	public static final ScalarValueResolver INSTANCE = new HanaDocStoreScalarValueResolver();

	private HanaDocStoreScalarValueResolver() {
		// empty
	}

	@Override
	public String literal(CqnBooleanLiteral bool) {
		return Boolean.TRUE.equals(bool.value()) ? JSON_TRUE : JSON_FALSE;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy