-
Notifications
You must be signed in to change notification settings - Fork 4
/
sqldbs.html
117 lines (117 loc) · 5.01 KB
/
sqldbs.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!--
Copyright 2013 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="sqldbsdatabase">
<div class="form-row">
<label for="node-config-input-host"><i class="fa fa-globe"></i> Host</label>
<input type="text" id="node-config-input-host" placeholder="Database Server Name">
</div>
<div class="form-row">
<label for="node-config-input-port"><i class="fa fa-globe"></i> Port</label>
<input type="text" id="node-config-input-port" placeholder="Database Server Port">
</div>
<div class="form-row">
<label for="node-config-input-user"><i class="fa fa-user"></i> User</label>
<input type="text" id="node-config-input-user" placeholder="Username">
</div>
<div class="form-row">
<label for="node-config-input-password"><i class="fa fa-lock"></i> Password</label>
<input type="password" id="node-config-input-password" placeholder="Password">
</div>
<div class="form-row">
<label for="node-config-input-db"><i class="fa fa-database"></i> Database</label>
<input type="text" id="node-config-input-db" placeholder="Database Name">
</div>
<div class="form-row">
<label for="node-config-input-dialect"><i class="fa fa-language"></i> Dialect</label>
<select type="text" id="node-config-input-dialect" style="width:70%;">
<option value="mssql">MSSQL</option>
<option value="mysql">MySQL</option>
<option value="sqlite">SQLite</option>
<option value="postgres">PostgreSQL</option>
</select>
</div>
</script>
<script type="text/javascript">
RED.nodes.registerType('sqldbsdatabase',{
category: 'config',
defaults: {
host: {value:"127.0.0.1",required:true},
port: {value:1433, required:false},
db: {value:"",required:true},
dialect: {value:"mssql",required:true}
},
credentials: {
user: {type: "text"},
password: {type: "password"}
},
label: function() {
if (this.name)
return this.name;
else if (this.db)
return this.db;
else
return "sqldbs";
}
});
</script>
<script type="text/x-red" data-template-name="sqldbs">
<div class="form-row">
<label for="node-input-mydb"><i class="fa fa-database"></i> Database</label>
<input type="text" id="node-input-mydb">
</div>
<div class="form-row">
<label for="node-input-querytype"><i class="fa fa-filter"></i> Query Type</label>
<select type="text" id="node-input-querytype" style="width:70%;">
<option value="select">Select</option>
<option value="Insert">Insert</option>
<option value="update">Update</option>
<option value="delete">Delete</option>
</select>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/x-red" data-help-name="sqldbs">
<p>Allows basic access to a sqldbs database.</p>
<p>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></p>
<p><b>msg.topic</b> must hold the <i>query</i> for the database, and the result is returned in <b>msg.payload</b>.</p>
<p><b>msg.payload</b> can contain an array of values to bind to the topic.</p>
<p>Typically the returned payload will be an array of the result rows.</p>
<p>If nothing is found for the key then <i>null</i> is returned,</p>
<p>The reconnect timeout in milliseconds can be changed by adding a line to <b>settings.js</b>
<pre>sqldbsReconnectTime: 30000,</pre></p>
</script>
<script type="text/javascript">
RED.nodes.registerType('sqldbs',{
category: 'storage-input',
color:"#e97b00",
defaults: {
mydb: {type:"sqldbsdatabase",required:true},
querytype: {value:"select", required:true},
name: {value:""}
},
inputs:1,
outputs:1,
icon: "db.png",
label: function() {
var levelNode = RED.nodes.node(this.mydb);
return this.name||(levelNode?levelNode.label():"sqldbs");
},
labelStyle: function() {
return this.name?"node_label_italic":"";
}
});
</script>