SQLite is a lightweight, Single file and simplest form of SQL database, we can implement an SQLite database for small scale purpose(Eg. a phone book).
1) Search for 'inject' which look like this:
and drop in the editor.
Search and drop the 'function' node which looks like this:
Search and drop the 'SQLite' Node which looks 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 the database server.
- Node.js function used to set SQLite Query to msg.topic.
- MySQL node simply takes the query and returns its output as standard JSON.
- Console named 'msg.payload' is used for displaying results in the console.
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 a parameter.
4) Before we use a database, we upload our database (.db) file in managed storage
click on the storage icon on the left hand menu
to reveal the storage option.
Here we drop our 'DemoSQL.db' file.
4) Edit 'SQLite' Node By simply Double-clicking 'SQLite' Node:
As we creating a new Database profile click on
and next, give the path of your .db file.
6) After Connection Database, the 'SQLite' node should be tagged with 'OK' as Shown Below.
(For this example This database consists of one table named 'USER' and defined as)
7) By double-clicking the '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.
9) Now simply Click on 'Deploy' and trigger the inject node, by clicking square left of 'Inject Node'.
7) you may think about the result simply click on the info icon on the left hand menu
And then click on the "bug" icon in the pop up
You could see the output similar to this:
Here Object 'msg.payload' parses output which the query response returned in JSON, as Depends on the query.
As this example We can use our SQL Queries, Generate queries by functions, even running stacked queries.