DOC 2.3.3
Statement

Like all languages, you have the classic statements functions.

evalparallelifif forcecaseswitchforwhilerepeatbreakcontinueexceptiontry

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

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

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


MentDB © 2012 - 2020 - Legal Notice