util::json::json_value_to_sql_value (public)

 util::json::json_value_to_sql_value value

Defined in packages/acs-tcl/tcl/json-procs.tcl

While mysql happily treats false as 0, real SQL does not. And we need to protect against apostrophes in strings. And handle null. You get the idea.

Parameters:
value (required)
A value from a parsed JSON string
Returns:
Something that works in Real SQL, not to be confused with MySQL. This includes not trying to insert '' into columns of type real, when "null" is meant (we mimic Oracle bindvar/PG bindvar emulation semantics). The Ilias RTE JavaScript returns '' rather than null for JS null variables.

Partial Call Graph (max 5 caller/called nodes):
%3 ns_dbquotevalue ns_dbquotevalue util::json::json_value_to_sql_value util::json::json_value_to_sql_value util::json::json_value_to_sql_value->ns_dbquotevalue

Testcases:
No testcase defined.
Source code:
    switch -- $value {
        false { return 0 }
        true { return 1 }
        null -
        "" { return null }
        default { return "[::ns_dbquotevalue $value]" }
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: