refix copy results array

This commit is contained in:
Dave Conway-Jones 2021-03-21 10:10:45 +00:00
parent ef5b577f7f
commit a194c56acb
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
2 changed files with 4 additions and 1 deletions

View File

@ -153,6 +153,9 @@ module.exports = function(RED) {
if ((rows.constructor.name === "OkPacket") || (rows.constructor.name === "Array")) {
msg.payload = JSON.parse(JSON.stringify(rows));
}
else if ((rows.constructor.name === "OkPacket") || (rows.constructor.name === "Array")) {
msg.payload = rows.map(v => Object.assign({}, v));
}
else { msg.payload = rows; }
node.send(msg);
status = {fill:"green",shape:"dot",text:"OK"};

View File

@ -1,6 +1,6 @@
{
"name": "node-red-node-mysql",
"version": "0.1.4",
"version": "0.1.5",
"description": "A Node-RED node to read and write to a MySQL database",
"dependencies": {
"mysql": "^2.18.1"