mysql, actually make the if else do something sensible...

This commit is contained in:
Dave Conway-Jones 2021-03-21 17:30:14 +00:00
parent a194c56acb
commit c1c82a623e
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
2 changed files with 3 additions and 3 deletions

View File

@ -150,10 +150,10 @@ module.exports = function(RED) {
node.error(err,msg);
}
else {
if ((rows.constructor.name === "OkPacket") || (rows.constructor.name === "Array")) {
if (rows.constructor.name === "OkPacket") {
msg.payload = JSON.parse(JSON.stringify(rows));
}
else if ((rows.constructor.name === "OkPacket") || (rows.constructor.name === "Array")) {
else if (rows.constructor.name === "Array") {
msg.payload = rows.map(v => Object.assign({}, v));
}
else { msg.payload = rows; }

View File

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