Editing Query in Sqlite

[
    {
        "id": "b6a400ad4103aa9a",
        "type": "tab",
        "label": "Flow 6",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "36a45ee7decc3ea4",
        "type": "template",
        "z": "b6a400ad4103aa9a",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "<!DOCTYPE html>\n<html>\n    <head>\n    <link href=\"https://cdn.jsdelivr.net/npm/bootswatch@4.5.2/dist/slate/bootstrap.min.css\" rel=\"stylesheet\"></link>\n    </head>\n<body>\n  <div class=\"container\">\n<table class=\"table table-hover\">\n  <thead>\n    <tr>\n      <th scope=\"col\">Name</th>\n      <th scope=\"col\">Url</th>\n      <th scope=\"col\"></th>\n    </tr>\n  </thead>\n  <tbody>\n    {{#payload}}\n    <tr class=\"table-active\">\n      <td>{{name}}</td>\n      <td>{{url}}</td>\n      <td><a href=\"/monitor/feed/delete/{{rowid}}\" class=\"btn btn-danger\">Delete</a></td>\n      <td><a href=\"/monitor/feed/update/{{rowid}}\" class=\"btn btn-info\">Update</a></td>\n    </tr>\n    {{/payload}}\n  </tbody>\n</table>\n<form method=\"post\" action=\"/monitor/feed\">\n<label for=\"name\">Name</label>\n<input class=\"form-control\" id=\"name\" name=\"name\">\n<label for=\"url\">Url</label>\n<input class=\"form-control\" id=\"url\" name=\"url\">\n<button type=\"submit\" class=\"btn btn-primary\">Submit</button>\n</form>\n</div>\n</body>\n</html>",
        "output": "str",
        "x": 400,
        "y": 100,
        "wires": [
            [
                "e12ad503e2802482",
                "d388bdb7ebed77bd"
            ]
        ]
    },
    {
        "id": "3e31539271bac692",
        "type": "http in",
        "z": "b6a400ad4103aa9a",
        "name": "",
        "url": "/monitor/feed",
        "method": "get",
        "upload": false,
        "swaggerDoc": "",
        "x": 170,
        "y": 80,
        "wires": [
            [
                "4fca18d8bfe64d48"
            ]
        ]
    },
    {
        "id": "e12ad503e2802482",
        "type": "http response",
        "z": "b6a400ad4103aa9a",
        "name": "",
        "statusCode": "",
        "headers": {},
        "x": 630,
        "y": 100,
        "wires": []
    },
    {
        "id": "4fca18d8bfe64d48",
        "type": "sqlite",
        "z": "b6a400ad4103aa9a",
        "mydb": "daa251e133e46125",
        "sqlquery": "fixed",
        "sql": "SELECT rowid,* From feed;",
        "name": "",
        "x": 250,
        "y": 140,
        "wires": [
            [
                "36a45ee7decc3ea4"
            ]
        ]
    },
    {
        "id": "c11ae811ee0b3a2e",
        "type": "inject",
        "z": "b6a400ad4103aa9a",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "CREATE TABLE feed(name,url) ",
        "payload": "",
        "payloadType": "date",
        "x": 160,
        "y": 460,
        "wires": [
            [
                "222065ce84a4d675"
            ]
        ]
    },
    {
        "id": "222065ce84a4d675",
        "type": "sqlite",
        "z": "b6a400ad4103aa9a",
        "mydb": "daa251e133e46125",
        "sqlquery": "msg.topic",
        "sql": "",
        "name": "",
        "x": 330,
        "y": 480,
        "wires": [
            [
                "75107e6f171430e5"
            ]
        ]
    },
    {
        "id": "75107e6f171430e5",
        "type": "debug",
        "z": "b6a400ad4103aa9a",
        "name": "debug 2",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 500,
        "y": 460,
        "wires": []
    },
    {
        "id": "d388bdb7ebed77bd",
        "type": "debug",
        "z": "b6a400ad4103aa9a",
        "name": "debug 3",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 700,
        "y": 260,
        "wires": []
    },
    {
        "id": "fd70fc0559a38834",
        "type": "http in",
        "z": "b6a400ad4103aa9a",
        "name": "",
        "url": "/monitor/feed",
        "method": "post",
        "upload": false,
        "swaggerDoc": "",
        "x": 90,
        "y": 240,
        "wires": [
            [
                "58aa4ecb409af1d5"
            ]
        ]
    },
    {
        "id": "58aa4ecb409af1d5",
        "type": "template",
        "z": "b6a400ad4103aa9a",
        "name": "INSERT",
        "field": "topic",
        "fieldType": "msg",
        "format": "sql",
        "syntax": "mustache",
        "template": "INSERT INTO feed values ('{{payload.name}}','{{payload.url}}');",
        "output": "str",
        "x": 300,
        "y": 240,
        "wires": [
            [
                "68add7222294ed17"
            ]
        ]
    },
    {
        "id": "68add7222294ed17",
        "type": "sqlite",
        "z": "b6a400ad4103aa9a",
        "mydb": "daa251e133e46125",
        "sqlquery": "msg.topic",
        "sql": "SELECT * From feed;",
        "name": "",
        "x": 490,
        "y": 240,
        "wires": [
            [
                "4fca18d8bfe64d48"
            ]
        ]
    },
    {
        "id": "c341b4f6b8da48f4",
        "type": "http in",
        "z": "b6a400ad4103aa9a",
        "name": "",
        "url": "/monitor/feed/delete/:rowid",
        "method": "get",
        "upload": false,
        "swaggerDoc": "",
        "x": 150,
        "y": 300,
        "wires": [
            [
                "c5e828a6a4bdcac6"
            ]
        ]
    },
    {
        "id": "c5e828a6a4bdcac6",
        "type": "template",
        "z": "b6a400ad4103aa9a",
        "name": "DELETE",
        "field": "topic",
        "fieldType": "msg",
        "format": "sql",
        "syntax": "mustache",
        "template": "DELETE from feed where rowid={{req.params.rowid}};",
        "output": "str",
        "x": 380,
        "y": 300,
        "wires": [
            [
                "68add7222294ed17"
            ]
        ]
    },
    {
        "id": "78575cd0a687da9d",
        "type": "http in",
        "z": "b6a400ad4103aa9a",
        "name": "",
        "url": "/monitor/feed/update/:rowid",
        "method": "put",
        "upload": false,
        "swaggerDoc": "",
        "x": 150,
        "y": 380,
        "wires": [
            [
                "2ab2453ff2c3b7c5"
            ]
        ]
    },
    {
        "id": "2ab2453ff2c3b7c5",
        "type": "template",
        "z": "b6a400ad4103aa9a",
        "name": "UPDATE",
        "field": "topic",
        "fieldType": "msg",
        "format": "sql",
        "syntax": "mustache",
        "template": "UPDATE feed SET name={{payload.name}},url={{payload.url}} where rowid={{req.params.rowid}};",
        "output": "str",
        "x": 400,
        "y": 380,
        "wires": [
            [
                "68add7222294ed17"
            ]
        ]
    },
    {
        "id": "daa251e133e46125",
        "type": "sqlitedb",
        "db": "demo",
        "mode": "RWC"
    }
]

Dear NodeRed Community,
We would require some support in Updating Functionality(CRUD) for values stored in using Sqlite Database.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.