MENTDB  
BACK
MQL Functions | MentDB Weak
Statement

Like all languages, you have the classic statements functions.

evalparallelifif forcecaseswitchmodeforwhilerepeatsynchronizedbreakcontinueexceptiontrystack flow_initstack flow_stepstack flow_json_getstack flow_json_setstack var_show

eval <mql>

Description

    Eval a MQL expression

Parameters

    mql:   The MQL source code - string - required
admin
eval "log trace OK!;";
mentdb
1

parallel <mql1> <mqlN>

Description

    Execute many commands in the same time

Parameters

    mql1:   The first MQL command - String - required
    mqlN:   The N MQL command - String - required
admin
parallel { log trace "1"; } { log trace "2"; } { log trace "3"; };
mentdb
[ { "result": "1", "status": "OK" }, { "result": "1", "status": "OK" }, { "result": "1", "status": "OK" } ]

if <condition> <trueAction> <falseAction>

Description

    IF statement

Parameters

    condition:   The condition - string - required
    trueAction:   The true action - boolean - required
    falseAction:   The false action - boolean - not required
admin
if (true) { log trace OK! } { log trace KO! };
mentdb
1
admin
if (true) { log trace hello! };
mentdb
1

if force <condition> <trueAction> <falseAction>

Description

    IF statement (force true and false execution)

Parameters

    condition:   The condition - string - required
    trueAction:   The true action - boolean - required
    falseAction:   The false action - boolean - required
admin
if force (true) { log trace OK! } { log trace KO! };
mentdb
1

case <condition1> <action1> <conditionN> <actionN> <elseAction>

Description

    CASE statement

Parameters

    condition1:   The condition 1 - boolean - required
    action1:   The action 1 - string - required
    conditionN:   The condition N - boolean - required
    actionN:   The action N - string - required
    elseAction:   The else action - string - not required
admin
case (true) {A} (false) {B} {C} ;
mentdb
A

switch <valueToSearch> <condition1> <action1> <conditionN> <actionN> <elseAction>

Description

    SWITCH statement

Parameters

    valueToSearch:   The value to search - boolean - required
    condition1:   The condition 1 - boolean - required
    action1:   The action 1 - string - required
    conditionN:   The condition N - boolean - required
    actionN:   The action N - string - required
    elseAction:   The else action - string - not required
admin
switch (A) (A) {A} (B) {B} {C} ;
mentdb
A

mode <paramMode> <condition1> <action1> <conditionN> <actionN> <elseAction>

Description

    SWITCH statement

Parameters

    paramMode:   The parameter mode - string - required
    condition1:   The condition 1 - boolean - required
    action1:   The action 1 - string - required
    conditionN:   The condition N - boolean - required
    actionN:   The action N - string - required
    elseAction:   The else action - string - not required
admin
mode SERVER_MODE (PROD) {A} (DEV) {B} {C} ;
mentdb
A

for <init> <condition> <increment> <action>

Description

    FOR statement

Parameters

    init:   The init mql source code - string - required
    condition:   The condition - boolean - required
    increment:   The increment - string - required
    action:   The action - string - required
admin
for (-> "[i]" 0) (< [i] 45) (++ "[i]") { log trace [i]; };
mentdb

while <condition> <action>

Description

    WHILE statement

Parameters

    condition:   The condition - boolean - required
    action:   The action - string - required
admin
-> "[i]" 0; while (< [i] 45) { log trace [i]; ++ "[i]"; };
mentdb

repeat <condition> <action>

Description

    REPEAT statement

Parameters

    condition:   The condition - boolean - required
    action:   The action - string - required
admin
-> "[i]" 0; repeat (< [i] 45) { log trace [i]; ++ "[i]"; };
mentdb

synchronized <key> <action>

Description

    Synchronized MQL block

Parameters

    key:   The synchronized key - string - required
    action:   The action - string - required
admin
synchronized ("KEY") { log trace "OK"; }
mentdb

break

Description

    Break a FOR/WHILE/REPEAT/SQL_PARSE/CSV_PARSE/HTML_PARSE/JSON_PARSE_OBJ/JSON_PARSE_ARRAY statement

admin
break
mentdb
BREAK

continue

Description

    Stop the sub action and continue the loop : FOR/WHILE/REPEAT/SQL_PARSE/CSV_PARSE/HTML_PARSE/JSON_PARSE_OBJ/JSON_PARSE_ARRAY statement

admin
continue
mentdb
CONTINUE

exception <id> <message>

Description

    EXCEPTION statement

Parameters

    id:   The error message id - string - required
    message:   The error message - string - required
admin
exception (1) ("your message ...");
mentdb
1: your message ...

try <action> <errorAction> <idException>

Description

    TRY statement

Parameters

    action:   The main action - string - required
    errorAction:   The error action if an error was generated - string - required
    idException:   The variable to save the error message - string - required
admin
try { exception (1) ("your messffage ..."); } { log trace [err]; } "[err]";
mentdb
1

stack flow_init <pid> <nameFlow> <json>

Description

    Initialize the name of a flow process

Parameters

    pid:   The pid of the flow - string - required
    nameFlow:   The name of the flow - string - required
    json:   The JSON object to save - string - required
admin
stack flow_init [PID] "name_of_the_flow" "{}";
mentdb
1

stack flow_step <pid> <position> <posName>

Description

    Mark a new step for the specified flow

Parameters

    pid:   The pid of the flow - string - required
    position:   The step position - number - required
    posName:   The position name - string - required
admin
stack flow_step [PID] 1 "Begin_of_the_flow";
mentdb
1

stack flow_json_get <pid>

Description

    Put a couple of key/value into a specified flow (stack process)

Parameters

    pid:   The pid of the flow - string - required
admin
json load "flow_json" (stack flow_json_get [PID]);
mentdb
1

stack flow_json_set <pid> <json>

Description

    Put a couple of key/value into a specified flow (stack process)

Parameters

    pid:   The pid of the flow - string - required
    json:   The JSON object to save - string - required
admin
stack flow_json_set [PID] (json doc "flow_json");
mentdb
1

stack var_show <pid>

Description

    Get variables for a specific process

Parameters

    pid:   The pid of the process - string - required
admin
stack var_show 1
mentdb
{}

© 2012 - 2022