How to use ms.parms with SQLite node?

#1

Hello,

After hours of trying, I can't work out how to use params with the SQLite node?

I'm using this simple test flow...

[
    {
        "id": "100169b1.407656",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": ""
    },
    {
        "id": "252ba977.f97126",
        "type": "function",
        "z": "100169b1.407656",
        "name": "",
        "func": "msg.params = {\n    $user_id:54334534,\n    $chat_id:5435345,\n    $message_id:21323,\n    $verification_status:0\n}\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 410,
        "y": 260,
        "wires": [
            [
                "7ca1cb23.a982a4",
                "7bc87b9b.f3c794"
            ]
        ]
    },
    {
        "id": "27ec8c26.64c064",
        "type": "inject",
        "z": "100169b1.407656",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 240,
        "y": 220,
        "wires": [
            [
                "252ba977.f97126"
            ]
        ]
    },
    {
        "id": "cade2390.67313",
        "type": "debug",
        "z": "100169b1.407656",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 790,
        "y": 220,
        "wires": []
    },
    {
        "id": "7ca1cb23.a982a4",
        "type": "sqlite",
        "z": "100169b1.407656",
        "mydb": "940ad6a7.b56d58",
        "sqlquery": "fixed",
        "sql": "INSERT INTO anti_spam_test (\n    user_id,\n    chat_id,\n    message_id, \n    verification_status\n) \nvalues (\n    $user_id,\n    $chat_id,\n    $message_id, \n    $verification_status\n)",
        "name": "anti_spam_test",
        "x": 600,
        "y": 220,
        "wires": [
            [
                "cade2390.67313"
            ]
        ]
    },
    {
        "id": "7bc87b9b.f3c794",
        "type": "debug",
        "z": "100169b1.407656",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 570,
        "y": 160,
        "wires": []
    },
    {
        "id": "940ad6a7.b56d58",
        "type": "sqlitedb",
        "z": "",
        "db": "/data/butler.sql",
        "mode": "RWC"
    }
]

Can anyone point me in the right direction please?

Thank you!

#2

Urgh, I had the node set to 'fixed statement' rather than prepared!

It's working now...

1 Like