mg-dbx 2.4.27-a → 2.4.27-b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +11 -2
  2. package/bin/winx64/node18/mg-dbx.node +0 -0
  3. package/bin/winx64/node19/mg-dbx.node +0 -0
  4. package/package.json +1 -1
  5. package/src/bm.js +31 -0
  6. package/src/bm1.js +35 -0
  7. package/src/dbx/cm.log +306 -0
  8. package/src/dbx/dir.js +80 -0
  9. package/src/dbx/global.js +113 -0
  10. package/src/dbx/global1.js +113 -0
  11. package/src/dbx/global2.js +114 -0
  12. package/src/dbx/mg.js +74 -0
  13. package/src/dbx/mg1.js +56 -0
  14. package/src/dbx/mgb.js +106 -0
  15. package/src/dbx/mgb1.js +87 -0
  16. package/src/dbx/mgboth.js +44 -0
  17. package/src/dbx/mgboth1.js +46 -0
  18. package/src/dbx/mgc.js +146 -0
  19. package/src/dbx/mgc1.js +66 -0
  20. package/src/dbx/mgc1a.js +95 -0
  21. package/src/dbx/mgc2.js +92 -0
  22. package/src/dbx/mgca.js +91 -0
  23. package/src/dbx/mgevt.js +32 -0
  24. package/src/dbx/mgfun.js +108 -0
  25. package/src/dbx/mgglo.js +77 -0
  26. package/src/dbx/mgi.js +82 -0
  27. package/src/dbx/mgl.js +75 -0
  28. package/src/dbx/mgload.js +75 -0
  29. package/src/dbx/mgmerge.js +79 -0
  30. package/src/dbx/mgn.js +79 -0
  31. package/src/dbx/mgns.js +59 -0
  32. package/src/dbx/mgq.js +98 -0
  33. package/src/dbx/mgq2.js +79 -0
  34. package/src/dbx/mgqr.js +77 -0
  35. package/src/dbx/mgsql.js +90 -0
  36. package/src/dbx/mgsql1.js +81 -0
  37. package/src/dbx/mgsql2.js +90 -0
  38. package/src/dbx/mgsqla.js +83 -0
  39. package/src/dbx/mgsqlio.js +89 -0
  40. package/src/dbx/mgv.js +106 -0
  41. package/src/dbx/mgv1.js +103 -0
  42. package/src/dbx/mgv2.js +61 -0
  43. package/src/dbx/mgva.js +38 -0
  44. package/src/dbx/mgvers.js +14 -0
  45. package/src/dbx/mgvy.js +66 -0
  46. package/src/dbx/mgvy1.js +65 -0
  47. package/src/dbx/pwind.js +99 -0
  48. package/src/dbx/query.js +98 -0
  49. package/src/dbx/trans.js +114 -0
  50. package/src/mg-dbx.cpp +3 -0
package/README.md CHANGED
@@ -3,9 +3,9 @@
3
3
  High speed Synchronous and Asynchronous access to InterSystems Cache/IRIS and YottaDB from Node.js.
4
4
 
5
5
  Chris Munt <cmunt@mgateway.com>
6
- 25 April 2022, M/Gateway Developments Ltd [http://www.mgateway.com](http://www.mgateway.com)
6
+ 4 November 2022, M/Gateway Developments Ltd [http://www.mgateway.com](http://www.mgateway.com)
7
7
 
8
- * Verified to work with Node.js v8 to v18.
8
+ * Verified to work with Node.js v8 to v19.
9
9
  * Two connectivity models to the InterSystems or YottaDB database are provided: High performance via the local database API or network based.
10
10
  * [Release Notes](#RelNotes) can be found at the end of this document.
11
11
 
@@ -61,6 +61,9 @@ Assuming that Node.js is already installed and a C++ compiler is available to th
61
61
 
62
62
  This command will create the **mg-dbx** addon (*mg-dbx.node*).
63
63
 
64
+ ### Enabling the API for InterSystems IRIS and Cache
65
+
66
+ Before connecting to a local (relative to Node.js) InterSystems database via its API, check that the InterSystems ***'Callin API'*** is enabled. From the InterSystems Database Management Portal select ***System Administration***; then ***Security***; then ***Services***. Look for the row containing ***%Service_Callin*** and check that it is ***Enabled***. Edit the row and mark this service as ***Enabled*** if necessary.
64
67
 
65
68
  ### Installing the M support routines (also known as the DB Superserver)
66
69
 
@@ -70,6 +73,8 @@ The M support routines are required for:
70
73
  * Direct access to SQL (either via the API or via the network).
71
74
  * The Merge command under YottaDB (either via the API or via the network).
72
75
 
76
+ If none of the above apply you do not need to install these routines - proceed to [Connecting to the database](#Connect).
77
+
73
78
  Two M routines need to be installed (%zmgsi and %zmgsis). These can be found in the *Service Integration Gateway* (**mgsi**) GitHub source code repository ([https://github.com/chrisemunt/mgsi](https://github.com/chrisemunt/mgsi)). Note that it is not necessary to install the whole *Service Integration Gateway*, just the two M routines held in that repository.
74
79
 
75
80
  #### Installation for InterSystems Cache/IRIS
@@ -1207,3 +1212,7 @@ Unless required by applicable law or agreed to in writing, software distributed
1207
1212
 
1208
1213
  * Verify that **mg-dbx** will build and work with Node.js v18.x.x.
1209
1214
 
1215
+ ### v2.4.27b (4 November 2022)
1216
+
1217
+ * Verify that **mg-dbx** will build and work with Node.js v19.x.x.
1218
+
Binary file
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "Chris Munt <cmunt@mgateway.com> (http://www.gateway.com/)",
3
3
  "name": "mg-dbx",
4
4
  "description": "High speed Synchronous and Asynchronous access to InterSystems Cache/IRIS and YottaDB from Node.js.",
5
- "version": "2.4.27a",
5
+ "version": "2.4.27b",
6
6
  "maintainers": "Chris Munt <cmunt@mgateway.com>",
7
7
  "homepage": "https://github.com/chrisemunt/mg-dbx",
8
8
  "repository": {
package/src/bm.js ADDED
@@ -0,0 +1,31 @@
1
+ //
2
+ // Basic benchmark
3
+ //
4
+
5
+ var mg = require('mg-dbx');
6
+ var db = new mg.dbx();
7
+
8
+ console.log("\nNode.js with mg-dbx ...\n");
9
+
10
+ var n;
11
+ var start = new Date().getTime();
12
+ var max = 100;
13
+ //var max = 1000000;
14
+ var ostring;
15
+ let istring = "input string";
16
+
17
+ for (n = 0; n < max; n ++) {
18
+ //ostring = "output string";
19
+ ostring = db.benchmark(istring);
20
+ console.log("result: " + ostring);
21
+ }
22
+
23
+ var end = new Date().getTime();
24
+ var elap = (end - start)/1000;
25
+
26
+ console.log('time: ' + elap);
27
+ console.log('rate: ' + max/elap + '/sec');
28
+
29
+ //db.close();
30
+ console.log("\n*** end ***\n");
31
+
package/src/bm1.js ADDED
@@ -0,0 +1,35 @@
1
+ //
2
+ // Basic benchmark
3
+ //
4
+
5
+ var mg = require('mg-dbx');
6
+ var db = new mg.dbx();
7
+ console.log("\nNode.js with mg-dbx ...\n");
8
+
9
+ console.log("mg-dbx version => ", db.version());
10
+
11
+ var ret = db.open({type: "Cache", path: "/cache20181/mgr", username: "_SYSTEM", password: "SYS", namespace: "USER"});
12
+
13
+ console.log("mg-dbx open => ", ret);
14
+ //console.log("mg-dbx dbversion (after connecting) => ", db.version());
15
+
16
+ var n;
17
+ var start = new Date().getTime();
18
+ var max = 100;
19
+ //var max = 1000000;
20
+ var ostring;
21
+ let istring = "input string";
22
+
23
+ for (n = 0; n < max; n ++) {
24
+ db.set("CM", n, "Hello World");
25
+ }
26
+
27
+ var end = new Date().getTime();
28
+ var elap = (end - start)/1000;
29
+
30
+ console.log('time: ' + elap);
31
+ console.log('rate: ' + max/elap + '/sec');
32
+
33
+ db.close();
34
+ console.log("\n*** end ***\n");
35
+
package/src/dbx/cm.log ADDED
@@ -0,0 +1,306 @@
1
+ >>> Time: Mon Apr 25 14:21:27 2022; Build: 2.4.27 pid=5664;tid=4816;
2
+ mg-dbx: Function
3
+ dbx::version()
4
+ >>> Time: Mon Apr 25 14:21:27 2022; Build: 2.4.27 pid=5664;tid=4816;
5
+ mg-dbx: Function
6
+ dbx::open({"type":"Cache","path":"/cache20181/mgr","username":"_SYSTEM","password":"SYS","namespace":"USER"})
7
+ >>> Time: Mon Apr 25 14:21:27 2022; Build: 2.4.27 pid=5664;tid=4816;
8
+ mg-dbx: transmission: dbx::open
9
+
10
+ >>> Time: Mon Apr 25 14:21:27 2022; Build: 2.4.27 pid=5664;tid=4816;
11
+ mg-dbx: response: dbx::open
12
+
13
+ >>> Time: Mon Apr 25 14:21:27 2022; Build: 2.4.27 pid=5664;tid=4816;
14
+ mg-dbx: Function
15
+ dbx::version()
16
+ >>> Time: Mon Apr 25 14:21:27 2022; Build: 2.4.27 pid=5664;tid=4816;
17
+ mg-dbx: Function
18
+ dbx::mglobalquery({"global":"CM"}, {"multilevel":true,"getdata":true})
19
+ >>> Time: Mon Apr 25 14:21:27 2022; Build: 2.4.27 pid=5664;tid=4816;
20
+ mg-dbx: Function
21
+ dbx_cursor_reset({"global":"CM"}, {"multilevel":true,"getdata":true})
22
+ >>> Time: Mon Apr 25 14:21:27 2022; Build: 2.4.27 pid=5664;tid=4816;
23
+ mg-dbx: Function
24
+ mcursor::next()
25
+ >>> Time: Mon Apr 25 14:21:27 2022; Build: 2.4.27 pid=5664;tid=4816;
26
+ mg-dbx: transmission: mcursor::next (query)
27
+ \x00\x00\x00\x00\x00CM
28
+ >>> Time: Mon Apr 25 14:21:27 2022; Build: 2.4.27 pid=5664;tid=4816;
29
+ mg-dbx: response: mcursor::next (query)
30
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x001
31
+ >>> Time: Mon Apr 25 14:21:27 2022; Build: 2.4.27 pid=5664;tid=4816;
32
+ mg-dbx: Function
33
+ mcursor::next()
34
+ >>> Time: Mon Apr 25 14:21:27 2022; Build: 2.4.27 pid=5664;tid=4816;
35
+ mg-dbx: transmission: mcursor::next (query)
36
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x001
37
+ >>> Time: Mon Apr 25 14:21:27 2022; Build: 2.4.27 pid=5664;tid=4816;
38
+ mg-dbx: response: mcursor::next (query)
39
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x003
40
+ >>> Time: Mon Apr 25 14:21:27 2022; Build: 2.4.27 pid=5664;tid=4816;
41
+ mg-dbx: Function
42
+ mcursor::next()
43
+ >>> Time: Mon Apr 25 14:21:27 2022; Build: 2.4.27 pid=5664;tid=4816;
44
+ mg-dbx: transmission: mcursor::next (query)
45
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x003
46
+ >>> Time: Mon Apr 25 14:21:27 2022; Build: 2.4.27 pid=5664;tid=4816;
47
+ mg-dbx: response: mcursor::next (query)
48
+ [END]
49
+ >>> Time: Mon Apr 25 14:21:27 2022; Build: 2.4.27 pid=5664;tid=4816;
50
+ mg-dbx: Function
51
+ dbx::close()
52
+ >>> Time: Mon Apr 25 14:21:29 2022; Build: 2.4.27 pid=12648;tid=12172;
53
+ mg-dbx: Function
54
+ dbx::version()
55
+ >>> Time: Mon Apr 25 14:21:29 2022; Build: 2.4.27 pid=12648;tid=12172;
56
+ mg-dbx: Function
57
+ dbx::open({"type":"Cache","path":"/cache20181/mgr","username":"_SYSTEM","password":"SYS","namespace":"USER"})
58
+ >>> Time: Mon Apr 25 14:21:29 2022; Build: 2.4.27 pid=12648;tid=12172;
59
+ mg-dbx: transmission: dbx::open
60
+
61
+ >>> Time: Mon Apr 25 14:21:29 2022; Build: 2.4.27 pid=12648;tid=12172;
62
+ mg-dbx: response: dbx::open
63
+
64
+ >>> Time: Mon Apr 25 14:21:29 2022; Build: 2.4.27 pid=12648;tid=12172;
65
+ mg-dbx: Function
66
+ dbx::version()
67
+ >>> Time: Mon Apr 25 14:21:29 2022; Build: 2.4.27 pid=12648;tid=12172;
68
+ mg-dbx: Function
69
+ dbx::mglobalquery({"global":"CM"}, {"multilevel":true,"getdata":true})
70
+ >>> Time: Mon Apr 25 14:21:29 2022; Build: 2.4.27 pid=12648;tid=12172;
71
+ mg-dbx: Function
72
+ dbx_cursor_reset({"global":"CM"}, {"multilevel":true,"getdata":true})
73
+ >>> Time: Mon Apr 25 14:21:29 2022; Build: 2.4.27 pid=12648;tid=12172;
74
+ mg-dbx: Function
75
+ mcursor::next()
76
+ >>> Time: Mon Apr 25 14:21:29 2022; Build: 2.4.27 pid=12648;tid=12172;
77
+ mg-dbx: transmission: mcursor::next (query)
78
+ \x00\x00\x00\x00\x00CM
79
+ >>> Time: Mon Apr 25 14:21:29 2022; Build: 2.4.27 pid=12648;tid=12172;
80
+ mg-dbx: response: mcursor::next (query)
81
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x001
82
+ >>> Time: Mon Apr 25 14:21:29 2022; Build: 2.4.27 pid=12648;tid=12172;
83
+ mg-dbx: Function
84
+ mcursor::next()
85
+ >>> Time: Mon Apr 25 14:21:29 2022; Build: 2.4.27 pid=12648;tid=12172;
86
+ mg-dbx: transmission: mcursor::next (query)
87
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x001
88
+ >>> Time: Mon Apr 25 14:21:29 2022; Build: 2.4.27 pid=12648;tid=12172;
89
+ mg-dbx: response: mcursor::next (query)
90
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x003
91
+ >>> Time: Mon Apr 25 14:21:29 2022; Build: 2.4.27 pid=12648;tid=12172;
92
+ mg-dbx: Function
93
+ mcursor::next()
94
+ >>> Time: Mon Apr 25 14:21:29 2022; Build: 2.4.27 pid=12648;tid=12172;
95
+ mg-dbx: transmission: mcursor::next (query)
96
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x003
97
+ >>> Time: Mon Apr 25 14:21:29 2022; Build: 2.4.27 pid=12648;tid=12172;
98
+ mg-dbx: response: mcursor::next (query)
99
+ [END]
100
+ >>> Time: Mon Apr 25 14:21:29 2022; Build: 2.4.27 pid=12648;tid=12172;
101
+ mg-dbx: Function
102
+ dbx::close()
103
+ >>> Time: Mon Apr 25 14:21:30 2022; Build: 2.4.27 pid=8084;tid=12724;
104
+ mg-dbx: Function
105
+ dbx::version()
106
+ >>> Time: Mon Apr 25 14:21:30 2022; Build: 2.4.27 pid=8084;tid=12724;
107
+ mg-dbx: Function
108
+ dbx::open({"type":"Cache","path":"/cache20181/mgr","username":"_SYSTEM","password":"SYS","namespace":"USER"})
109
+ >>> Time: Mon Apr 25 14:21:30 2022; Build: 2.4.27 pid=8084;tid=12724;
110
+ mg-dbx: transmission: dbx::open
111
+
112
+ >>> Time: Mon Apr 25 14:21:30 2022; Build: 2.4.27 pid=8084;tid=12724;
113
+ mg-dbx: response: dbx::open
114
+
115
+ >>> Time: Mon Apr 25 14:21:30 2022; Build: 2.4.27 pid=8084;tid=12724;
116
+ mg-dbx: Function
117
+ dbx::version()
118
+ >>> Time: Mon Apr 25 14:21:30 2022; Build: 2.4.27 pid=8084;tid=12724;
119
+ mg-dbx: Function
120
+ dbx::mglobalquery({"global":"CM"}, {"multilevel":true,"getdata":true})
121
+ >>> Time: Mon Apr 25 14:21:30 2022; Build: 2.4.27 pid=8084;tid=12724;
122
+ mg-dbx: Function
123
+ dbx_cursor_reset({"global":"CM"}, {"multilevel":true,"getdata":true})
124
+ >>> Time: Mon Apr 25 14:21:30 2022; Build: 2.4.27 pid=8084;tid=12724;
125
+ mg-dbx: Function
126
+ mcursor::next()
127
+ >>> Time: Mon Apr 25 14:21:30 2022; Build: 2.4.27 pid=8084;tid=12724;
128
+ mg-dbx: transmission: mcursor::next (query)
129
+ \x00\x00\x00\x00\x00CM
130
+ >>> Time: Mon Apr 25 14:21:30 2022; Build: 2.4.27 pid=8084;tid=12724;
131
+ mg-dbx: response: mcursor::next (query)
132
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x001
133
+ >>> Time: Mon Apr 25 14:21:30 2022; Build: 2.4.27 pid=8084;tid=12724;
134
+ mg-dbx: Function
135
+ mcursor::next()
136
+ >>> Time: Mon Apr 25 14:21:30 2022; Build: 2.4.27 pid=8084;tid=12724;
137
+ mg-dbx: transmission: mcursor::next (query)
138
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x001
139
+ >>> Time: Mon Apr 25 14:21:30 2022; Build: 2.4.27 pid=8084;tid=12724;
140
+ mg-dbx: response: mcursor::next (query)
141
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x003
142
+ >>> Time: Mon Apr 25 14:21:30 2022; Build: 2.4.27 pid=8084;tid=12724;
143
+ mg-dbx: Function
144
+ mcursor::next()
145
+ >>> Time: Mon Apr 25 14:21:30 2022; Build: 2.4.27 pid=8084;tid=12724;
146
+ mg-dbx: transmission: mcursor::next (query)
147
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x003
148
+ >>> Time: Mon Apr 25 14:21:30 2022; Build: 2.4.27 pid=8084;tid=12724;
149
+ mg-dbx: response: mcursor::next (query)
150
+ [END]
151
+ >>> Time: Mon Apr 25 14:21:30 2022; Build: 2.4.27 pid=8084;tid=12724;
152
+ mg-dbx: Function
153
+ dbx::close()
154
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=7936;tid=5700;
155
+ mg-dbx: Function
156
+ dbx::version()
157
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=7936;tid=5700;
158
+ mg-dbx: Function
159
+ dbx::open({"type":"Cache","path":"/cache20181/mgr","username":"_SYSTEM","password":"SYS","namespace":"USER"})
160
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=7936;tid=5700;
161
+ mg-dbx: transmission: dbx::open
162
+
163
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=7936;tid=5700;
164
+ mg-dbx: response: dbx::open
165
+
166
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=7936;tid=5700;
167
+ mg-dbx: Function
168
+ dbx::version()
169
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=7936;tid=5700;
170
+ mg-dbx: Function
171
+ dbx::mglobalquery({"global":"CM"}, {"multilevel":true,"getdata":true})
172
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=7936;tid=5700;
173
+ mg-dbx: Function
174
+ dbx_cursor_reset({"global":"CM"}, {"multilevel":true,"getdata":true})
175
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=7936;tid=5700;
176
+ mg-dbx: Function
177
+ mcursor::next()
178
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=7936;tid=5700;
179
+ mg-dbx: transmission: mcursor::next (query)
180
+ \x00\x00\x00\x00\x00CM
181
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=7936;tid=5700;
182
+ mg-dbx: response: mcursor::next (query)
183
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x001
184
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=7936;tid=5700;
185
+ mg-dbx: Function
186
+ mcursor::next()
187
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=7936;tid=5700;
188
+ mg-dbx: transmission: mcursor::next (query)
189
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x001
190
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=7936;tid=5700;
191
+ mg-dbx: response: mcursor::next (query)
192
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x003
193
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=7936;tid=5700;
194
+ mg-dbx: Function
195
+ mcursor::next()
196
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=7936;tid=5700;
197
+ mg-dbx: transmission: mcursor::next (query)
198
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x003
199
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=7936;tid=5700;
200
+ mg-dbx: response: mcursor::next (query)
201
+ [END]
202
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=7936;tid=5700;
203
+ mg-dbx: Function
204
+ dbx::close()
205
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=300;tid=8408;
206
+ mg-dbx: Function
207
+ dbx::version()
208
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=300;tid=8408;
209
+ mg-dbx: Function
210
+ dbx::open({"type":"Cache","path":"/cache20181/mgr","username":"_SYSTEM","password":"SYS","namespace":"USER"})
211
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=300;tid=8408;
212
+ mg-dbx: transmission: dbx::open
213
+
214
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=300;tid=8408;
215
+ mg-dbx: response: dbx::open
216
+
217
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=300;tid=8408;
218
+ mg-dbx: Function
219
+ dbx::version()
220
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=300;tid=8408;
221
+ mg-dbx: Function
222
+ dbx::mglobalquery({"global":"CM"}, {"multilevel":true,"getdata":true})
223
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=300;tid=8408;
224
+ mg-dbx: Function
225
+ dbx_cursor_reset({"global":"CM"}, {"multilevel":true,"getdata":true})
226
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=300;tid=8408;
227
+ mg-dbx: Function
228
+ mcursor::next()
229
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=300;tid=8408;
230
+ mg-dbx: transmission: mcursor::next (query)
231
+ \x00\x00\x00\x00\x00CM
232
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=300;tid=8408;
233
+ mg-dbx: response: mcursor::next (query)
234
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x001
235
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=300;tid=8408;
236
+ mg-dbx: Function
237
+ mcursor::next()
238
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=300;tid=8408;
239
+ mg-dbx: transmission: mcursor::next (query)
240
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x001
241
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=300;tid=8408;
242
+ mg-dbx: response: mcursor::next (query)
243
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x003
244
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=300;tid=8408;
245
+ mg-dbx: Function
246
+ mcursor::next()
247
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=300;tid=8408;
248
+ mg-dbx: transmission: mcursor::next (query)
249
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x003
250
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=300;tid=8408;
251
+ mg-dbx: response: mcursor::next (query)
252
+ [END]
253
+ >>> Time: Mon Apr 25 14:21:31 2022; Build: 2.4.27 pid=300;tid=8408;
254
+ mg-dbx: Function
255
+ dbx::close()
256
+ >>> Time: Mon Apr 25 14:21:32 2022; Build: 2.4.27 pid=1648;tid=12428;
257
+ mg-dbx: Function
258
+ dbx::version()
259
+ >>> Time: Mon Apr 25 14:21:32 2022; Build: 2.4.27 pid=1648;tid=12428;
260
+ mg-dbx: Function
261
+ dbx::open({"type":"Cache","path":"/cache20181/mgr","username":"_SYSTEM","password":"SYS","namespace":"USER"})
262
+ >>> Time: Mon Apr 25 14:21:32 2022; Build: 2.4.27 pid=1648;tid=12428;
263
+ mg-dbx: transmission: dbx::open
264
+
265
+ >>> Time: Mon Apr 25 14:21:32 2022; Build: 2.4.27 pid=1648;tid=12428;
266
+ mg-dbx: response: dbx::open
267
+
268
+ >>> Time: Mon Apr 25 14:21:32 2022; Build: 2.4.27 pid=1648;tid=12428;
269
+ mg-dbx: Function
270
+ dbx::version()
271
+ >>> Time: Mon Apr 25 14:21:32 2022; Build: 2.4.27 pid=1648;tid=12428;
272
+ mg-dbx: Function
273
+ dbx::mglobalquery({"global":"CM"}, {"multilevel":true,"getdata":true})
274
+ >>> Time: Mon Apr 25 14:21:32 2022; Build: 2.4.27 pid=1648;tid=12428;
275
+ mg-dbx: Function
276
+ dbx_cursor_reset({"global":"CM"}, {"multilevel":true,"getdata":true})
277
+ >>> Time: Mon Apr 25 14:21:32 2022; Build: 2.4.27 pid=1648;tid=12428;
278
+ mg-dbx: Function
279
+ mcursor::next()
280
+ >>> Time: Mon Apr 25 14:21:32 2022; Build: 2.4.27 pid=1648;tid=12428;
281
+ mg-dbx: transmission: mcursor::next (query)
282
+ \x00\x00\x00\x00\x00CM
283
+ >>> Time: Mon Apr 25 14:21:32 2022; Build: 2.4.27 pid=1648;tid=12428;
284
+ mg-dbx: response: mcursor::next (query)
285
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x001
286
+ >>> Time: Mon Apr 25 14:21:32 2022; Build: 2.4.27 pid=1648;tid=12428;
287
+ mg-dbx: Function
288
+ mcursor::next()
289
+ >>> Time: Mon Apr 25 14:21:32 2022; Build: 2.4.27 pid=1648;tid=12428;
290
+ mg-dbx: transmission: mcursor::next (query)
291
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x001
292
+ >>> Time: Mon Apr 25 14:21:32 2022; Build: 2.4.27 pid=1648;tid=12428;
293
+ mg-dbx: response: mcursor::next (query)
294
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x003
295
+ >>> Time: Mon Apr 25 14:21:32 2022; Build: 2.4.27 pid=1648;tid=12428;
296
+ mg-dbx: Function
297
+ mcursor::next()
298
+ >>> Time: Mon Apr 25 14:21:32 2022; Build: 2.4.27 pid=1648;tid=12428;
299
+ mg-dbx: transmission: mcursor::next (query)
300
+ \x00\x00\x00\x00\x00CM\x00\x00\x00\x00\x003
301
+ >>> Time: Mon Apr 25 14:21:32 2022; Build: 2.4.27 pid=1648;tid=12428;
302
+ mg-dbx: response: mcursor::next (query)
303
+ [END]
304
+ >>> Time: Mon Apr 25 14:21:32 2022; Build: 2.4.27 pid=1648;tid=12428;
305
+ mg-dbx: Function
306
+ dbx::close()
package/src/dbx/dir.js ADDED
@@ -0,0 +1,80 @@
1
+ //
2
+ // Load cache.node and get the version
3
+ //
4
+
5
+ var dbx = require('mg-dbx').dbx;
6
+ var global = require('mg-dbx').mglobal;
7
+ var mcursor = require('mg-dbx').mcursor;
8
+
9
+ var db = new dbx();
10
+
11
+ var ydb = process.argv[2];
12
+ var net = process.argv[3];
13
+
14
+ if (ydb == 1) {
15
+ if (net == 1)
16
+ console.log("YottaDB (network) ...");
17
+ else
18
+ console.log("YottaDB (API) ...");
19
+ }
20
+ else {
21
+ if (net == 1)
22
+ console.log("Cache (network) ...");
23
+ else
24
+ console.log("Cache (API) ...");
25
+ }
26
+
27
+ console.log("Version (mg-dbx.node): " + db.version());
28
+
29
+ if (ydb == 1) {
30
+ var type = "YottaDB";
31
+ var path = "/usr/local/lib/yottadb/r130";
32
+ var tcp_port = 7041;
33
+ var envvars = "";
34
+ envvars = envvars + "ydb_dir=/root/.yottadb\n"
35
+ envvars = envvars + "ydb_rel=r1.30_x86_64\n"
36
+ envvars = envvars + "ydb_gbldir=/root/.yottadb/r1.30_x86_64/g/yottadb.gld\n"
37
+ envvars = envvars + "ydb_routines=/root/.yottadb/r1.30_x86_64/o*(/root/.yottadb/r1.30_x86_64/r /root/.yottadb/r) /usr/local/lib/yottadb/r130/libyottadbutil.so\n"
38
+ envvars = envvars + "ydb_ci=/usr/local/lib/yottadb/r130/cm.ci\n"
39
+ envvars = envvars + "\n"
40
+ if (net == 1)
41
+ var open = db.open({type: type, host: "127.0.0.1", tcp_port: tcp_port});
42
+ else
43
+ var open = db.open({type: type, path: path, env_vars: envvars});
44
+ }
45
+ else {
46
+ if (process.platform == 'win32') {
47
+ var type = "Cache";
48
+ var path = "/cache20181/mgr";
49
+ var tcp_port = 7041;
50
+ }
51
+ else {
52
+ var type = "Cache";
53
+ var path = "/opt/cache20181/mgr";
54
+ var tcp_port = 7042;
55
+ }
56
+ if (net == 1)
57
+ var open = db.open({type: type, host: "127.0.0.1", tcp_port: tcp_port, username: "_SYSTEM", password: "SYS", namespace: "USER"});
58
+ else
59
+ var open = db.open({type: type, path: path, username: "_SYSTEM", password: "SYS", namespace: "USER"});
60
+ }
61
+
62
+ console.log("open(): " + open);
63
+ //db.setloglevel("c:/c/node.js/src/mg-dbx.log", "ft", "");
64
+ console.log("charset(): " + db.charset('utf8'));
65
+ console.log("Version (mg-dbx.node): " + db.version());
66
+
67
+ query = db.mglobalquery({global: "^"}, {globaldirectory: true});
68
+
69
+ var n = 0;
70
+ while ((result = query.next()) !== null) {
71
+ //while ((result = query.previous()) !== null) {
72
+ console.log("result: " + JSON.stringify(result, null, 2));
73
+ //n = n + 1;
74
+ //if (n > 3) break;
75
+ }
76
+
77
+ db.close();
78
+
79
+ console.log("\n*** the end ***");
80
+
@@ -0,0 +1,113 @@
1
+
2
+ //
3
+ // Load cache.node and get the version
4
+ //
5
+
6
+ var dbx = require('mg-dbx').dbx;
7
+ var global = require('mg-dbx').mglobal;
8
+ var db = new dbx();
9
+
10
+ var ydb = process.argv[2];
11
+ var net = process.argv[3];
12
+
13
+ if (ydb == 1) {
14
+ if (net == 1)
15
+ console.log("YottaDB (network) ...");
16
+ else
17
+ console.log("YottaDB (API) ...");
18
+ }
19
+ else {
20
+ if (net == 1)
21
+ console.log("Cache (network) ...");
22
+ else
23
+ console.log("Cache (API) ...");
24
+ }
25
+
26
+ console.log("Version (mg-dbx.node): " + db.version());
27
+
28
+ if (ydb == 1) {
29
+ var type = "YottaDB";
30
+ var path = "/usr/local/lib/yottadb/r130";
31
+ var tcp_port = 7041;
32
+ var envvars = "";
33
+ envvars = envvars + "ydb_dir=/root/.yottadb\n"
34
+ envvars = envvars + "ydb_rel=r1.30_x86_64\n"
35
+ envvars = envvars + "ydb_gbldir=/root/.yottadb/r1.30_x86_64/g/yottadb.gld\n"
36
+ envvars = envvars + "ydb_routines=/root/.yottadb/r1.30_x86_64/o*(/root/.yottadb/r1.30_x86_64/r /root/.yottadb/r) /usr/local/lib/yottadb/r130/libyottadbutil.so\n"
37
+ envvars = envvars + "ydb_ci=/usr/local/lib/yottadb/r130/cm.ci\n"
38
+ envvars = envvars + "\n"
39
+ if (net == 1)
40
+ var open = db.open({type: type, host: "127.0.0.1", tcp_port: tcp_port});
41
+ else
42
+ var open = db.open({type: type, path: path, env_vars: envvars});
43
+ }
44
+ else {
45
+ if (process.platform == 'win32') {
46
+ var type = "Cache";
47
+ var path = "/cache20181/mgr";
48
+ var tcp_port = 7041;
49
+ }
50
+ else {
51
+ var type = "Cache";
52
+ var path = "/opt/cache20181/mgr";
53
+ var tcp_port = 7042;
54
+ }
55
+ if (net == 1)
56
+ var open = db.open({type: type, host: "127.0.0.1", tcp_port: tcp_port, username: "_SYSTEM", password: "SYS", namespace: "USER"});
57
+ else
58
+ var open = db.open({type: type, path: path, username: "_SYSTEM", password: "SYS", namespace: "USER"});
59
+ }
60
+
61
+
62
+ console.log("open(): " + open);
63
+ //db.setloglevel("/opt/cm/node/cm.log", "eftr", "");
64
+ console.log("charset(): " + db.charset('utf16'));
65
+
66
+ console.log("\nVersion (mg-dbx.node): " + db.version());
67
+
68
+ var wchar = db.function("utf16^cm", "abc");
69
+ var max = 3;
70
+
71
+ var n = 0;
72
+ for (n = 0; n < max; n ++) {
73
+ db.set("^CM", n, n);
74
+ }
75
+ for (n = 0; n < max; n ++) {
76
+ db.set("^CM", "ABC" + n, "DEF" + n);
77
+ }
78
+ db.set("^CM","A" + wchar, "B" + wchar);
79
+
80
+ var x = db.defined("CM", "2");
81
+ console.log("Defined (record 2): " + x);
82
+ var x = db.delete("CM", "2");
83
+ console.log("Delete (record 2): " + x);
84
+ var x = db.defined("CM", "2");
85
+ console.log("Defined (record 2): " + x);
86
+
87
+ var key = "";
88
+ while ((key = db.next("CM", key)) != "") {
89
+ show("next:", key + '=' + db.get("CM", key));
90
+ }
91
+ var key = "";
92
+ while ((key = db.previous("CM", key)) != "") {
93
+ show("previous:", key + '=' + db.get("CM", key));
94
+ }
95
+
96
+ for (n = 0; n < max; n ++) {
97
+ x = db.increment("^CM", 0.5);
98
+ console.log("Increment: " + x);
99
+ }
100
+
101
+ db.close();
102
+ console.log("\n*** the end ***");
103
+
104
+ function show(text, str) {
105
+ var str1 = "";
106
+ for (n = 0; n < str.length; n ++) {
107
+ var cn = str.charCodeAt(n);
108
+ if (n > 0) str1 = str1 + " ";
109
+ str1 = str1 + cn
110
+ //console.log("character at " + n + " is " + cn);
111
+ }
112
+ console.log(text + str + " (" + str1 + ")");
113
+ }