mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Add support for batch of SQL statements (#466)
* Add support for batch of SQL statements
This commit is contained in:
committed by
Dave Conway-Jones
parent
911f739005
commit
e308b0c1f9
@@ -55,10 +55,23 @@ module.exports = function(RED) {
|
||||
});
|
||||
}
|
||||
else {
|
||||
if (typeof msg.topic !== 'string') {
|
||||
node.error("msg.topic : the query is not defined as a string",msg);
|
||||
node.status({fill:"red",shape:"dot",text:"msg.topic error"});
|
||||
}
|
||||
node.error("msg.topic : the query is not defined as a string",msg);
|
||||
node.status({fill:"red",shape:"dot",text:"msg.topic error"});
|
||||
}
|
||||
}
|
||||
if (this.sqlquery == "batch") {
|
||||
if (typeof msg.topic === 'string') {
|
||||
node.mydbConfig.db.exec(msg.topic, function(err) {
|
||||
if (err) { node.error(err,msg);}
|
||||
else {
|
||||
msg.payload = [];
|
||||
node.send(msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
node.error("msg.topic : the query is not defined as string", msg);
|
||||
node.status({fill:"red", shape:"dot",text:"msg.topic error"});
|
||||
}
|
||||
}
|
||||
if (this.sqlquery == "fixed"){
|
||||
|
||||
Reference in New Issue
Block a user