Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:APIJSON APIJSON Demo DemoFunctionParser RawSQL

From Leeroopedia
Knowledge Sources
Domains Database, SQL_Execution, Business_Logic
Last Updated 2026-10-14 00:00 GMT

Overview

Concrete tool for executing raw SQL queries and manipulating request keys via remote functions in the APIJSON RawSQL demo.

Description

The DemoFunctionParser class (RawSQL variant) extends APIJSONFunctionParser<String> and provides remotely callable functions: getCurrentUserId (session-based), sayHello (demo greeting), rawSQL (executes pre-defined SQL from the Request table's sqlauto field with parameterized prepared statements), and removeKeys (deletes keys from the current request object, supporting both array and semicolon-delimited formats).

Usage

Use these functions in APIJSON request bodies when the RawSQL demo needs server-side raw SQL execution or request key manipulation.

Code Reference

Source Location

Signature

public class DemoFunctionParser extends APIJSONFunctionParser<String> {
    public String getCurrentUserId(@NotNull JSONObject current) throws IllegalAccessException;
    public String sayHello(@NotNull JSONObject current, @NotNull String name) throws Exception;
    public Object rawSQL(@NotNull JSONObject current, @NotNull String paramName);
    public void removeKeys(@NotNull JSONObject current, String keys);
    private Object buildSearchData(JSONObject current, String datasource, String sqlauto, String paramName);
}

Import

import apijson.demo.DemoFunctionParser;

I/O Contract

Inputs

Name Type Required Description
current JSONObject Yes Current request node
paramName String Yes Parameter array key for prepared statement params
name String No Key name for sayHello function
keys String No Key name(s) for removeKeys function

Outputs

Name Type Description
rawSQL() returns Object List of JSONObject rows from prepared statement
sayHello() returns String Greeting string
getCurrentUserId() returns String Session visitor ID

Usage Examples

Execute Raw SQL via APIJSON

// APIJSON request using rawSQL function
{
  "[]": {
    "User": {
      "list()": "rawSQL(paramName)"
    },
    "paramName": ["name"],
    "name": "test"
  }
}
// Executes: SELECT * FROM ... WHERE name = ? with param "test"

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment