Fun_getOneByKey (function)
- Type: FUNCTION
-
Returns:
longtext - 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 FUNCTIONFungetOneByKey'._
Narrative
Business context: JSON-array lookup — given a JSON array sJson and a key/value pair (skey, sValue), returns the first array element whose $.skey = sValue, or '' if no match. The companion to Fun_HasJsonKey / Fun_RemoveJsonKey for filter-payload parsing in scheduler procedures.
What it does: Validates sJson is JSON, iterates each top-level element, JSON_EXTRACTs $.skey, strips quotes, compares against sValue; returns the matching element on first hit.
Invocation: Called by sp_manufacture_productionplaninfotrace / sp_manufacture_productionplaninfotrace1, Sp_Manufacture_ProductionPlanInfoTree_Base, Sp_Manufacture_ProductionPlanInfoTree_Base_TC — the production-plan tree-loading procedures that pluck specific filter clauses (e.g. bFilterName='tStartDate') out of the front-end's bFilter JSON before rebuilding the WHERE clause.