Whenever we need to collect data by forms, saving Tabular data or simple account handling tasks, we always have the need of an database, and with interplay, it is simple as walk in park! You don't even have to do anything new, simple SQL Queries are enough to manipulate data.
- 1) As we are implementing PostgreSQL, a deployed PostgreSQL Server with valid credentials.
1) Search for 'inject' which look like this:
and drag-and-drop in editor.
Search and drop the 'function' node which look like this:
Search and drop the 'MySQL' Node which look like this:
Finally search 'Console' and drop:
2) Connect them as shown
So we explain what the flow and their node actually do:
- Inject triggers the SQL query to database server.
- Node.js function used to set MySQL Query to msg.topic.
- MySQL node simply takes the query and returns its output as standard JSON.
3 ) Double Click on 'Inject' Node, To reveal window as:
Here We injecting a query
SELECT * From USER;
Where in Node.js function it is converted as a string input and parsed as parameter.
4) Edit 'MySQL' Node By simply Double-clicking 'MySQL' Node:
As we are creating a new Database profile click on
Then Credentials: 6) After Connection Database, the 'MySQL' node should be tagged with 'OK' as Shown Below.
Else if 'Connection Refused' Tag is displayed, please check the database permissions and database settings.
(For this example This database consists of one table named 'USER' and defined as)
7) By double clicking 'Console' Node, modify its settings as given below:
8) The console Node is required for the viewing output of given payload output, By default it shows 'msg.payload' output.
8) Now simply deploy and trigger the inject node, by clicking square left of 'Inject Node'.
7) you may think about the result simply click on
and then click on
You could see the output similar like this:
Here Object 'msg.payload' parses output which the query response returns in JSON, as depending on query.
As this example We can use our SQL Queries, Generate queries by functions, even running scripts.