forked from phantom21/node-red-node-firebird
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfirebird-db.html
92 lines (86 loc) · 4.17 KB
/
firebird-db.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
<script type="text/x-red" data-template-name="firebird-database">
<div class="form-row">
<label for="node-config-input-host"><i class="fa fa-globe"></i> <span data-i18n="firebird-db.label.host"></span></label>
<input type="text" id="node-config-input-host">
</div>
<div class="form-row">
<label for="node-config-input-port"><i class="fa fa-random"></i> <span data-i18n="firebird-db.label.port"></span></label>
<input type="text" id="node-config-input-port">
</div>
<div class="form-row">
<label for="node-config-input-user"><i class="fa fa-user"></i> <span data-i18n="firebird-db.label.user"></span></label>
<input type="text" id="node-config-input-user">
</div>
<div class="form-row">
<label for="node-config-input-pass"><i class="fa fa-lock"></i> <span data-i18n="firebird-db.label.password"></span></label>
<input type="password" id="node-config-input-password">
</div>
<div class="form-row">
<label for="node-config-input-db"><i class="fa fa-database"></i> <span data-i18n="firebird-db.label.database"></span></label>
<input type="text" id="node-config-input-db">
</div>
</script>
<script type="text/javascript">
RED.nodes.registerType('firebird-database',{
category: 'config',
defaults: {
host: {value:"127.0.0.1",required:true},
port: {value:"3050",required:true},
db: {value:"",required:true},
},
credentials: {
user: {type: "text"},
password: {type: "password"}
},
label: function() {
return (this.host+":"+this.db);
}
});
</script>
<script type="text/x-red" data-template-name="firebird-db">
<div class="form-row">
<label for="node-input-firebirddb"><i class="fa fa-database"></i> <span data-i18n="firebird-db.label.database"></span></label>
<input type="text" id="node-input-firebirddb">
</div>
<div class="form-row">
<label for="node-input-requesttype"><i class="fa fa-quote-left"></i> <span data-i18n="firebird-db.label.requesttype"></span></label>
<select id="node-input-requesttype" style="width:70%;">
<option value="query" data-i18n="firebird-db.requesttype.query"></option>
<option value="transaction" data-i18n="firebird-db.requesttype.transaction"></option>
</select>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="firebird-db.label.name"></span></label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/x-red" data-help-name="firebird-db">
<p>Allows basic access to a Firebird database.</p>
<p>This node uses the <b>query</b> operation against the configured database. This does allow both INSERTS and DELETES.
By its very nature it allows SQL injection... so <i>be careful out there...</i></p>
<p>For <b>Query type</b> = <b>Simple query</b>: The <code>msg.topic</code> must hold the <i>query</i> for the database, and the result is returned in <code>msg.payload</code>.</p>
<p>For <b>Query type</b> = <b>Transaction</b>: The <code>msg.topic</code> may hold the <i>array of queries</i> in one string, divided by ";" or the <i>simple query</i>. The result for the <b>last querry</b> is returned in <code>msg.payload</code>.</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>
</script>
<script type="text/javascript">
RED.nodes.registerType('firebird-db',{
category: 'storage-input',
color:"#fba70f",
defaults: {
firebirddb: {type:"firebird-database",required:true},
requesttype: {value:"query",required:true},
name: {value:""}
},
inputs:1,
outputs:1,
icon: "db.png",
label: function() {
var levelNode = RED.nodes.node(this.firebirddb);
return this.name||(levelNode?levelNode.label():"firebird-db");
},
labelStyle: function() {
return this.name?"node_label_italic":"";
}
});
</script>