module

Krikri::PluginHelpers::MysqlVariables

MysqlVariables - pure logic for the mysql_variables plugin: the real module's typedvalue conversion, its ON/OFF boolean normalization, the variable-name validation, and SET statement construction (backtick-quoted identifier like the real module's mysql_quote_identifier(..., 'vars')). Split out so this logic is unit-spec-able (execution needs a real MySQL/MariaDB server).

Class methods

convert_bool(value : String | Int64 | Float64) : String | Int64 | Float64

Converts 0/1/on/off wanted values to ON/OFF when the server's current representation is ON/OFF (the real module's convert_bool_setting_value_wanted).

Source
set_statement(variable : String, value : String | Int64 | Float64, mode : String) : String

SET statement construction: SET GLOBAL/PERSIST/PERSIST_ONLY variable = value. Booleans sent as ON/OFF strings, numbers as bare literals, everything else as a quoted literal.

Source
typed_value(value : String) : String | Int64 | Float64

Convert value to number whenever possible, keep strings as-is (the real module's typedvalue).

Source
valid_name?(variable : String) : Bool

The real module's validation: ^[0-9A-Za-z_.]+$ on the variable name, failing with "invalid variable name "X"".

Source
values_equal?(wanted : String | Int64 | Float64, actual : String | Int64 | Float64) : Bool

Numeric-looking strings compare equal to the server's numeric strings ("1" == 1 == 1.0) without issuing a SET.

Source