Skip to content

IOT-DSA/dslink-dart-mysql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MySQL DSLink (dslink-dart-mysql)

Overview

A DSLink to make queries to MySQL databases.

If you are not familiar with DSA, an overview can be found at here.

This link was built using the Java DSLink SDK which can be found here.

Link Architecture

These are nodes defined by this link:

  • Main Node - Used to add new MySQL database connections. Default main node name is MySQL.
    • Connection Node - Used to execute queries to the database.

Node Guide

The following section provides descriptions of nodes in the link as well as descriptions of actions, values and child nodes.

Main Node

This is the root node of the link. Use it to create connections to MySQL database servers.

Actions

  1. Create Connection - Adds a connection to MySQL database.

Create Connection

The parameters are:

  • name - What to name the connection node in the tree.
  • host - MySQL server host name or IP.
  • port - MySQL server port. Default: 3306
  • user - User account used to authenticate with the database server.
  • password - Password for the user account.
  • db - Database name to use by default.

Child Nodes

  • Connection Node - Connections configured for specific servers and account.

Connection Node

Each connection node represents a MySQL server and a specific account to access it.

Actions

  1. Query Data - Sends custom query to read information from the database. The parameters are:
    • query - SQL query string.
    • output - resulting table with rows and columns requested.
  2. Execute - Sends a custom query to add or update information in the database. The parameters are:
    • query - SQL query with INSERT, UPDATE, DELETE request.
    • affected - returns number of rows affected by the query.
    • insertId - if the query is an INSERT statement, returns ID of the added record.
  3. List Tables - returns a list of all the tables in the database. The parameters are:
    • output - the resulting table with the list of database tables.
  4. Edit Connection - changes configuration for this connection node. The parameters are exactly the same as for Create Connection action above.
  5. Delete Connection - deletes current connection to the database.

Examples

Query a Table

  1. Create a new connection to your database.
  2. Drag and drop Query Data action to the dataflow.
  3. In the block's query parameter enter your SQL SELECT statement. For example, SELECT * FROM users
  4. Trigger Invoke action on a block.
  5. The resulting table with the rows from the database will be available under output parameter.

Select Query

Insert Record

  1. Create a new connection or use an existing one.
  2. Drag and drop Execute action to the dataflow.
  3. Add a String block to write an SQL INSERT query. You can also add query directly into query parameter of the Execute block. For example, INSERT INTO users (NULL, 'Taylor Swift', 'taylorswift@gmail.com', 'Art')
  4. Link String block to a query parameter.
  5. Trigger Invoke action.
  6. When query is executed you'll see the number of affected rows and new record ID.

Insert Query

Releases

No releases published

Packages

No packages published

Languages