com.sap.cds.jdbc.sqlite.SqliteSqlMapping Maven / Gradle / Ivy
The newest version!
/*******************************************************************
* © 2024 SAP SE or an SAP affiliate company. All rights reserved. *
*******************************************************************/
package com.sap.cds.jdbc.sqlite;
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 SqliteSqlMapping extends SqlMappingImpl {
public SqliteSqlMapping(CdsStructuredType rowType, Function casing) {
super(rowType, casing);
}
@Override
public String jsonQuery(String json, String jsonPath) {
/*
* The -> operator returns a text JSON representation of the selected
* subcomponent or NULL if that subcomponent does not exist.
*
* https://www.sqlite.org/json1.html#jptr
*/
return "(" + json + ") -> " + SQLHelper.literal(jsonPath);
}
}