Fun_HasJsonKey.md 1.3 KB

Fun_HasJsonKey (function)

  • Type: FUNCTION
  • Returns: int
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN sJson longtext
2 IN skey varchar(50)
3 IN sValue varchar(50)

Body

Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE FUNCTIONFunHasJsonKey'._

Narrative

Business context: JSON-array contains-key/value probe used by the 生产计划 (production-plan) info-tree builders. Asks: "Does the JSON array sJson contain an object whose property skey equals sValue?". Lets the plan-tree procs gate logic on whether a given sId/flag is already present in an in-memory list.

What it does: validates sJson, iterates JSON_LENGTH slots, for each slot JSON_EXTRACTs $.skey, strips surrounding quotes, compares to sValue. Returns 1 on first match, 0 otherwise (or 0 on invalid JSON).

Invocation: referenced by sp_manufacture_productionplaninfotrace, sp_manufacture_productionplaninfotrace1, Sp_Manufacture_ProductionPlanInfoTree_Base, and Sp_Manufacture_ProductionPlanInfoTree_Base_TC. xly-src copies under script/标版/30100101/schedule/. Cluster sibling of Fun_RemoveJsonKey/Fun_AddJsonKey-style mutators.