1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Add Name field to mysql server config so can be made unique

to close #635
This commit is contained in:
Dave Conway-Jones 2020-03-20 14:59:08 +00:00
parent 73d2b7fb71
commit e3e6c41030
No known key found for this signature in database
GPG Key ID: 302A6725C594817F
3 changed files with 10 additions and 5 deletions

View File

@ -24,12 +24,17 @@
<label for="node-config-input-tz"><i class="fa fa-clock-o"></i> Timezone</label>
<input type="text" id="node-config-input-tz">
</div>
<div class="form-row">
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-config-input-name" placeholder="Name">
</div>
</script>
<script type="text/javascript">
RED.nodes.registerType('MySQLdatabase',{
category: 'config',
defaults: {
name: {value:""},
host: {value:"127.0.0.1",required:true},
port: {value:"3306",required:true},
//user: {value:"",required:true},
@ -42,7 +47,7 @@
password: {type: "password"}
},
label: function() {
return this.db;
return this.name || this.db;
}
});
</script>

View File

@ -7,7 +7,7 @@ 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 install node-red-node-mysql
npm i node-red-node-mysql
Usage
@ -17,7 +17,7 @@ Allows basic access to a MySQL database.
This node uses the <b>query</b> operation against the configured database. This does allow both INSERTS and DELETES.
By it's very nature it allows SQL injection... so <i>be careful out there...</i>
By its very nature it allows SQL injection... so <i>be careful out there...</i>
The `msg.topic` must hold the <i>query</i> for the database, and the result is returned in `msg.payload`.

View File

@ -1,6 +1,6 @@
{
"name": "node-red-node-mysql",
"version": "0.0.2-",
"version": "0.0.20",
"description": "A Node-RED node to read and write to a MySQL database",
"dependencies": {
"mysql": "^2.18.1"