доброе утро
я новичок в узле red и javascript, так что это может быть простой проблемой. Я пытаюсь вставить ip-адрес в таблицу mysql в mysql. Я установил для поля значение varchar (20)
9/28/2019, 9:08:38 AMnode: 7bfc4d89.726dbc
msg: error
"Ошибка: ER_PARSE_ERROR: в вашем ошибкеСинтаксис SQL; проверьте руководство, соответствующее вашей версии сервера MySQL, чтобы узнать правильный синтаксис для использования рядом с '[object Object])' в строке 1 "
. Основные потоки следующие:
[
{
"id": "df624ad9.0db0f8",
"type": "function",
"z": "661acf87.d0306",
"name": "Defining inside ip",
"func": "global.set(\"inside_ip\",msg.payload);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 530,
"y": 120,
"wires": [
[]
]
},
{
"id": "400e4f07.42965",
"type": "inject",
"z": "661acf87.d0306",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "1",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"x": 190,
"y": 120,
"wires": [
[
"f3f24f92.29582"
]
]
},
{
"id": "f3f24f92.29582",
"type": "ip",
"z": "661acf87.d0306",
"name": "ip",
"https": false,
"timeout": "5000",
"internalIPv4": true,
"internalIPv6": false,
"publicIPv4": false,
"publicIPv6": false,
"x": 330,
"y": 120,
"wires": [
[
"df624ad9.0db0f8"
]
]
},
{
"id": "47202c3d.71ebfc",
"type": "inject",
"z": "661acf87.d0306",
"name": "",
"topic": "",
"payload": "1",
"payloadType": "num",
"repeat": "1",
"crontab": "",
"once": true,
"onceDelay": "5",
"x": 230,
"y": 180,
"wires": [
[
"20c745e0.57fb2a"
]
]
},
{
"id": "7bfc4d89.726dbc",
"type": "mysql",
"z": "661acf87.d0306",
"mydb": "ca2479e3.1dda58",
"name": "",
"x": 510,
"y": 180,
"wires": [
[]
]
},
{
"id": "20c745e0.57fb2a",
"type": "function",
"z": "661acf87.d0306",
"name": "",
"func": "msg.topic =\"INSERT INTO`node`(`inside_ip`) VALUES(\" + global.get(\"inside_ip\") + \")\";\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 350,
"y": 180,
"wires": [
[
"7bfc4d89.726dbc"
]
]
},
{
"id": "ca2479e3.1dda58",
"type": "MySQLdatabase",
"z": "",
"host": "72.90.182.40",
"port": "3306",
"db": "mysql_test",
"tz": "eastern"
}
]
Однако, если я установлю "ip" следующим образом, он будет работать:
[
{
"id": "1f5e06b6.76e931",
"type": "function",
"z": "87908bbe.239128",
"name": "Defining inside ip",
"func": "global.set(\"inside_ip\",msg.payload);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 645,
"y": 228,
"wires": [
[]
]
},
{
"id": "4dd624b5.e58f34",
"type": "inject",
"z": "87908bbe.239128",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "1",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"x": 305,
"y": 228,
"wires": [
[
"b9528c26.ceca2"
]
]
},
{
"id": "b9528c26.ceca2",
"type": "ip",
"z": "87908bbe.239128",
"name": "ip",
"https": false,
"timeout": "5000",
"internalIPv4": true,
"internalIPv6": false,
"publicIPv4": false,
"publicIPv6": false,
"x": 445,
"y": 228,
"wires": [
[]
]
},
{
"id": "215d3000.15a8b8",
"type": "inject",
"z": "87908bbe.239128",
"name": "",
"topic": "",
"payload": "1",
"payloadType": "num",
"repeat": "1",
"crontab": "",
"once": true,
"onceDelay": "5",
"x": 345,
"y": 288,
"wires": [
[
"fdcd98f2.a35838"
]
]
},
{
"id": "17946cb4.862c23",
"type": "mysql",
"z": "87908bbe.239128",
"mydb": "59bd1ef5.938c2",
"name": "",
"x": 625,
"y": 288,
"wires": [
[]
]
},
{
"id": "fdcd98f2.a35838",
"type": "function",
"z": "87908bbe.239128",
"name": "",
"func": "msg.topic =\"INSERT INTO`node`(`inside_ip`) VALUES(\" + global.get(\"inside_ip\") + \")\";\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 465,
"y": 288,
"wires": [
[
"17946cb4.862c23"
]
]
},
{
"id": "a248bafe.b02ac",
"type": "inject",
"z": "87908bbe.239128",
"name": "",
"topic": "",
"payload": "\"192.168.1.1\"",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"x": 341,
"y": 145,
"wires": [
[
"1f5e06b6.76e931"
]
]
},
{
"id": "59bd1ef5.938c2",
"type": "MySQLdatabase",
"z": "",
"host": "72.90.182.40",
"port": "3306",
"db": "mysql_test",
"tz": "eastern"
}
]
любой совет будет отличным
Относительно Майка