kadler / db2sock-test

1 stars 0 forks source link

Multiple action execution order not guaranteed #36

Open kadler opened 6 years ago

kadler commented 6 years ago

Original report by me.


Due to the format of the JSON that db2sock uses, it seems that when specifying multiple actions there is no way to ensure the actions will be performed in a specific order. The problem is that it uses the key in the parent object to define the action to be performed, but JSON keys are not defined to be in a specified order. Thus when it is parsed, it could be executed in any order:

eg. The following json could call DB2JSON/HELLO or some other HELLO:


{
    "cmd": {
        "exec": "ADDLIBLE DB2JSON"
    },
    "pgm": [{
            "name": "HELLO"
        },
        {
            "s": {
                "name": "char",
                "type": "128a",
                "value": "Hi there"
            }
        }
    ]
}
kadler commented 6 years ago

Making the top level object an array would ensure the ordering. Basically the same solution as https://bitbucket.org/litmis/db2sock/issues/35/calling-multiple-actions-of-the-same-type#comment-46887751