MCPcopy Create free account
hub / github.com/MariaDB/server / MakeTypedValue

Function MakeTypedValue

storage/connect/jsonudf.cpp:2024–2054  ·  view source on GitHub ↗

/ Try making a JSON value of the passed type from the passed argument. */ /

Source from the content-addressed store, hash-verified

2022/* Try making a JSON value of the passed type from the passed argument. */
2023/*********************************************************************************/
2024static PJVAL MakeTypedValue(PGLOBAL g, UDF_ARGS *args, uint i,
2025 JTYP type, PJSON *top = NULL)
2026{
2027 char *sap;
2028 PJSON jsp;
2029 PJVAL jvp = MakeValue(g, args, i, top);
2030
2031 //if (type == TYPE_JSON) {
2032 // if (jvp->GetValType() >= TYPE_JSON)
2033 // return jvp;
2034
2035 //} else if (jvp->GetValType() == type)
2036 // return jvp;
2037
2038 if (jvp->GetValType() == TYPE_STRG) {
2039 sap = jvp->GetString(g);
2040
2041 if ((jsp = ParseJson(g, sap, strlen(sap)))) {
2042 if ((type == TYPE_JSON && jsp->GetType() != TYPE_JVAL) || jsp->GetType() == type) {
2043 if (top)
2044 *top = jsp;
2045
2046 jvp->SetValue(jsp);
2047 } // endif Type
2048
2049 } // endif jsp
2050
2051 } // endif Type
2052
2053 return jvp;
2054} // end of MakeTypedValue
2055
2056/* ------------------------------ The JSON UDF's ------------------------------- */
2057

Callers 9

json_array_add_valuesFunction · 0.85
json_array_addFunction · 0.85
json_array_deleteFunction · 0.85
json_get_itemFunction · 0.85
jsonlocateFunction · 0.85
jbin_array_add_valuesFunction · 0.85
jbin_array_addFunction · 0.85
jbin_array_deleteFunction · 0.85
jbin_get_itemFunction · 0.85

Calls 6

MakeValueFunction · 0.85
ParseJsonFunction · 0.85
GetValTypeMethod · 0.80
GetStringMethod · 0.45
GetTypeMethod · 0.45
SetValueMethod · 0.45

Tested by

no test coverage detected