File tree 6 files changed +85
-13
lines changed
6 files changed +85
-13
lines changed Original file line number Diff line number Diff line change 2
2
"files.associations" : {
3
3
"*.ifc" : " ifc" ,
4
4
"*.json" : " json" ,
5
- "string" : " cpp"
5
+ "string" : " cpp" ,
6
+ "vector" : " cpp" ,
7
+ "memory" : " cpp" ,
8
+ "ostream" : " cpp" ,
9
+ "__bit_reference" : " cpp" ,
10
+ "__hash_table" : " cpp" ,
11
+ "__locale" : " cpp" ,
12
+ "__node_handle" : " cpp" ,
13
+ "__split_buffer" : " cpp" ,
14
+ "__threading_support" : " cpp" ,
15
+ "__verbose_abort" : " cpp" ,
16
+ "array" : " cpp" ,
17
+ "bitset" : " cpp" ,
18
+ "cctype" : " cpp" ,
19
+ "clocale" : " cpp" ,
20
+ "cmath" : " cpp" ,
21
+ "complex" : " cpp" ,
22
+ "cstdarg" : " cpp" ,
23
+ "cstddef" : " cpp" ,
24
+ "cstdint" : " cpp" ,
25
+ "cstdio" : " cpp" ,
26
+ "cstdlib" : " cpp" ,
27
+ "cstring" : " cpp" ,
28
+ "ctime" : " cpp" ,
29
+ "cwchar" : " cpp" ,
30
+ "cwctype" : " cpp" ,
31
+ "deque" : " cpp" ,
32
+ "execution" : " cpp" ,
33
+ "initializer_list" : " cpp" ,
34
+ "ios" : " cpp" ,
35
+ "iosfwd" : " cpp" ,
36
+ "istream" : " cpp" ,
37
+ "limits" : " cpp" ,
38
+ "locale" : " cpp" ,
39
+ "mutex" : " cpp" ,
40
+ "new" : " cpp" ,
41
+ "optional" : " cpp" ,
42
+ "print" : " cpp" ,
43
+ "queue" : " cpp" ,
44
+ "ratio" : " cpp" ,
45
+ "sstream" : " cpp" ,
46
+ "stack" : " cpp" ,
47
+ "stdexcept" : " cpp" ,
48
+ "streambuf" : " cpp" ,
49
+ "string_view" : " cpp" ,
50
+ "tuple" : " cpp" ,
51
+ "typeinfo" : " cpp" ,
52
+ "unordered_map" : " cpp" ,
53
+ "variant" : " cpp" ,
54
+ "algorithm" : " cpp"
6
55
}
7
56
}
Original file line number Diff line number Diff line change 99
99
console . log ( "\nCrossDB Simulation Complete." ) ;
100
100
db . close ( ) ;
101
101
console . log ( "Database connection closed." ) ;
102
+ const version = db . version ( )
103
+ console . log ( "CroosDB version: " , version ) ;
104
+
102
105
}
Original file line number Diff line number Diff line change 1
1
// Import the 'bindings' module to link the compiled native addon 'crossdb'
2
- const crossdb = require ( 'bindings' ) ( 'crossdb' ) ; // Link the compiled addon
2
+ const crossdb = require ( 'bindings' ) ( 'crossdb' ) ; // Link the compiled addon
3
3
4
4
// Define the CrossDB class to manage database operations
5
5
class CrossDB {
@@ -9,6 +9,7 @@ class CrossDB {
9
9
*/
10
10
constructor ( dbPath ) {
11
11
this . conn = new crossdb . Connection ( dbPath ) ; // Create a new connection to the database
12
+ this . pkgVersion = require ( './package.json' ) . version ;
12
13
}
13
14
14
15
/**
@@ -40,13 +41,24 @@ class CrossDB {
40
41
commit ( ) {
41
42
this . conn . commit ( ) ; // Commit the transaction
42
43
}
43
-
44
- /**
45
- * Rollsback the current transaction
46
- */
47
- rollback ( ) {
48
- this . conn . rollback ( ) ; // Rollback the transaction
49
- }
44
+
45
+ /**
46
+ * Rollsback the current transaction
47
+ */
48
+ rollback ( ) {
49
+ this . conn . rollback ( ) ; // Rollback the transaction
50
+ }
51
+
52
+ /**
53
+ * Get CroosDB version
54
+ */
55
+ version ( ) {
56
+ return {
57
+ "CroosDB" : this . conn . version ( ) , // Get CroosDB version
58
+ "Package" : this . pkgVersion , // Node.js package version
59
+ "Platform" : process . platform // Platform information
60
+ } ;
61
+ }
50
62
}
51
63
52
64
// Export the CrossDB class as a module
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @croosdb/crossdb-nodejs" ,
3
- "version" : " 1.3.1 " ,
3
+ "version" : " 1.4.0 " ,
4
4
"main" : " index.js" ,
5
5
"author" : " Efrem Ropelato" ,
6
6
"contributors" :[
Original file line number Diff line number Diff line change @@ -30,7 +30,8 @@ class Connection : public Napi::ObjectWrap<Connection>
30
30
InstanceMethod (" close" , &Connection::Close),
31
31
InstanceMethod (" begin" , &Connection::Begin),
32
32
InstanceMethod (" commit" , &Connection::Commit),
33
- InstanceMethod (" rollback" , &Connection::Rollback)});
33
+ InstanceMethod (" rollback" , &Connection::Rollback),
34
+ InstanceMethod (" version" , &Connection::Version)});
34
35
35
36
exports.Set (" Connection" , func);
36
37
return exports;
@@ -174,6 +175,13 @@ class Connection : public Napi::ObjectWrap<Connection>
174
175
}
175
176
return info.Env ().Null ();
176
177
}
178
+
179
+ Napi::Value Version (const Napi::CallbackInfo &info)
180
+ {
181
+ Napi::Env env = info.Env ();
182
+ std::string vv = xdb_version ();
183
+ return Napi::String::New (env, vv);
184
+ }
177
185
};
178
186
179
187
Napi::Object InitAll (Napi::Env env, Napi::Object exports)
You can’t perform that action at this time.
0 commit comments