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

com.sap.cds.jdbc.postgresql.PostgresSqlMapping Maven / Gradle / Ivy

The newest version!
/*******************************************************************
 * © 2024 SAP SE or an SAP affiliate company. All rights reserved. *
 *******************************************************************/
package com.sap.cds.jdbc.postgresql;

import java.util.function.Function;

import com.sap.cds.impl.sql.SQLHelper;
import com.sap.cds.impl.sql.SqlMappingImpl;
import com.sap.cds.reflect.CdsStructuredType;

public class PostgresSqlMapping extends SqlMappingImpl {

	public PostgresSqlMapping(CdsStructuredType rowType, Function casing) {
		super(rowType, casing);
	}

	@Override
	public String jsonQuery(String json, String jsonPath) {
		/*
		 * Returns all JSON items returned by the JSON path for the specified JSON
		 * value. For SQL-standard JSON path expressions it returns the JSON values
		 * selected from target.
		 * 
		 * https://www.postgresql.org/docs/current/functions-json.html
		 */
		return "jsonb_path_query(" + json + ", " + SQLHelper.literal(jsonPath) + ")";
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy