node-red-contrib-iris

Downloads6
Subscribe
1
Bookmark
1
This application is not supported by InterSystems Corporation. Please be notified that you use it at your own responsibility.
Details
Releases
Reviews
Issues

What's new in this version

initial realease

node-red-contrib-iris

General

An interface for Node-RED to InterSystems IRIS Data Platform.

Required

Install

Either use the Node-RED Menu - Manage Palette - Install, or run the following command in your Node-RED user directory - typically ~/.node-red

npm i node-red-contrib-iris
Import Native API

In ~/.node-red/settings.js add module in (already existing) functionGlobalContext:

functionGlobalContext: {
    // os:require('os'),
    iris:require('./node_modules/node-red-contrib-iris/intersystems-iris-native')
}

You can find the API package under .node-red/node_modules/node-red-contrib-iris/intersystems-iris-native. Please check the README file for supported operating systems. If your OS is not supported you can get the API from your Intersystems IRIS instance under: ~/IRIS/dev/nodejs/intersystems-iris-native.

See the documentation for how to load additional modules into Node-RED.

Download Node.IRISInterface

Go to raw.githubusercontent. Do a right click on the page and choose Save Page As... . Afterwards go to the InterSystems Management Portal and navigate to System Explorer > Classes and click on Import. There you select the file you just downloaded and click Import.
When you only operate in one namespace, import the class into this namespace. When you have multiple namespaces you want to have access to, map the class to namespace %ALL.

Connect to IRIS

Set connection properties via the node properties. The Node will build a connection when you deploy and will hold that connection up until you redeploy or disconnect manually.

You can set the default properties in ~/.node-red/node_modules/node-red-contrib-iris/ServerProperties.json. Or use the SetServerProperties flow under Import > Examples > node-red-contrib-iris > SetServerProperties.

Usage

The nodes are secure against SQL injection by parametrize the statements.

Pass the SQL statement as a string in the msg.data field and the nodes will parameterize the statement itself.

msg.data = "SELECT * FROM NodeRed.Person WHERE Age >= 42 AND Name = 'Max' "
Or parameterized statement:
msg.data = { 
    "sql": "SELECT * FROM NodeRed.Person WHERE Age >= ? AND Name = ? ",
    "values": [42, "Max"]
}
Nodes

  • IRIS: A Node for executing DML statements such as SELECT, UPDATE, INSERT and DELETE and DDL statements such as CREATE, ALTER and DROP in Intersystems IRIS.
  • IRIS_CREATE: Creates a class in Intersystems IRIS.
  • IRIS_DELETE_CLASS: Deletes a class in Intersystems IRIS.
  • IRIS_INSERT: A Node for only SQL-INSERT-Statements. Can also generate the class, if it does not already exists, based on the statement.
  • IRIS_OO: Can insert a hierarchical JSON-Object.
  • IRIS_CALL: Call Intersystems IRIS classmethods.
<a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/phil1436/node-red-contrib-iris/master/src/NodesOverview.png"><img src="https://raw.githubusercontent.com/phil1436/node-red-contrib-iris/master/src/NodesOverview.png" width="200" style="max-width: 100%;"></a>

See Node description for further informations.

Bugs

  • Currently does not work in Docker Container!
  • The statement will be parametrized wrong if whitespaces and commas used in strings. Please parametrize the Statement before. Example:
    Does not work:
    msg.data = "SELECT * FROM NodeRed.Person WHERE Name = 'Smith, John'"
    
    Will work:
    msg.data = {
        "sql":"SELECT * FROM NodeRed.Person WHERE Name = ?,
        "values":["Smith, John"]
        }
    


npm
GitHub
nodered.org
CHANGELOG
InterSystems Developer Community


by Philipp Bonin
Powered by InterSystems.

Rating
0 (0)
Category
Integration
Works with
InterSystems IRIS
Tags
Info
Version
1.0.0
Last updated
2022-10-20
Repository
Open
Documentation
Open
License
Link