📜 ⬆️ ⬇️

Release GlobalsDB 2012.2

On May 15, a new version of the free NoSQL DBMS GlobalsDB 2012.2 was released.

What's new?
The interface expected for many by the Node.JS API for Windows and immediately for Windows 64-bit has been added.
Implemented small additions and fixed some bugs.
About this and the rest .

The full version of GlobalsDB 2012.2 Release notes in English is here .
')

GlobalsDB Node.JS API


Node.js for Windows

This version adds the expected support for Node.js under Windows. The API works with the node.js 0.6x family of versions. The Node js API documentation is available by reference .
The Windows extension is called cache061.node (cache061_node.dll). For backward compatibility, the module can be renamed to cache.node and included in javascript as follows:

var globals = require ('cache'); 

Support for Windows 64-bit

Support has also been implemented for 64-bit versions of Windows for node.js version 0.6.13x64.
The version family of node.js 0.7.x is currently not supported, since until no stable version of this node.js branch has been released.

The Get () method returns an empty string for 'undefined' nodes instead of an error.

In this version, for undefined nodes, Get () returns an empty string instead of throwing the error 'undefined'.
However, if you use JSON (recommended), you can determine which node really has no value, and where the value is (even if it is an empty string). This can be determined by the defined key.

Node with value:
 { "ok" 1, "global": "Customer", "subscripts": [1, "name"], "data": "InterSystems", "defined": 1 } 


Node with no value:
 { "ok" 1, "global": "Customer", "subscripts": [1, "first-name"], "data": "", "defined": 0 } 


Implement Globals $ Query () functionality in the Node.JS method previouse_node ()


In this version, the behavior of the GlobalsDB $ Query () function is implemented in the node.js method previouse_node ().

This method returns the previous node in the sorting sequence of nodes at the current level or at the parent if the nodes at the current level have run out. The method returns the name of the global, the full reference of the nodes and the value.

Let the following data be defined in the global:

 company[1]="InterSystems" company[1, "address", "city"]="Cambridge" company[1, "address", "state"]="MA" company[1, "address", "country"]="USA" company[1, "dateOfIncorporation"]="April 1976" 


Synchronous call:
signature

 var result = myData.previous_node({ global: 'myGlobal' [, subscripts: [sub(1) ,...,sub(N) ]] } ); 


Example 1

 var result = myData.previous_node({ global: 'company', subscripts: [2] } ); console.log('\n'); console.log('previous_node(): ' + JSON.stringify(result, null, '\t')); 


Result:

previous_node(): {
ok: 1,
global: "company",
subscripts: ["dateOfIncorporation"],
defined: 1,
data: "April 1976"
}


Example 2

 var result = myData.previous_node({ global: 'company', subscripts: [1, 'address', 'country'] } ); console.log('\n'); console.log('previous_node(): ' + JSON.stringify(result, null, '\t')); 

Result
previous_node(): {
ok: 1,
global: "company",
subscripts: [1, "address", "city"],
defined: 1,
data: "Cambridge"
}


Note that the result of the call will be the city node, since in the sorting sequence, the country is the city node.

Asynchronous call

Signature
 myData.previous_node({ global: 'myGlobal' [, subscripts: [sub(1),...,sub(N)]] },  function(error, result) {  if (!error) {  // --- Success ---  console.log('\n');  console.log('previous_node(): '+JSON.stringify(result, null, '\t'));  }  else {  // --- Error ---  console.log('\n');  console.log('ERROR: previous_node(): '+JSON.stringify(result, null, '\t'));  } } ); 


Example 1
 myData.previous_node({ global: 'company', subscripts: [2] },  function(error, result) {  if (!error) {  // --- Success ---  console.log('\n');  console.log('previous_node(): '+JSON.stringify(result, null, '\t')); }  else {  // --- Error ---  console.log('\n');  console.log('ERROR: previous_node(): ' + JSON.stringify(result, null, '\t'));  } } ); 


Result

previous_node(): {
ok: 1,
global: "company",
subscripts: ["dateOfIncorporation"],
defined: 1,
data: "April 1976"
}


Example 2

 myData.previous_node({ global: 'company', subscripts: [1, 'address', 'country']},  function(error, result) {  if (!error) {  // --- Success ---  console.log('\n');  console.log('previous_node(): '+JSON.stringify(result, null, '\t'));  }  else {  // --- Error ---  console.log('\n');  console.log('ERROR: previous_node(): ' + JSON.stringify(result, null, '\t'));  } } ); 

Result:

previous_node(): {
ok: 1,
global: "company",
subscripts: [1, "address", "state"],
defined: 1,
data: "MA"
}


Anomaly resolved with increment () method

The increment () method fixed the anomaly by adding the increment property when using JSON calls.
If JSON is not used to call increment (), the last argument of the method is interpreted as an increment value, except for the cases when only the global name is passed - in this case the increment will be 1.
If JSON is used to pass parameters in increment (), the increment value will be taken from the increment property, or equal to 1 if it is not specified.

Synchronous operations

Explicitly specifying the increment parameter

 var result = myData.increment(globalName [,sub(1),...,sub(N)], increment); 

in this case, increment is required.
Example
 var result = myData.increment('company','counter',1); console.log('\n'); console.log('increment(): ' + result); 


Implicit indication
 var result = myData.increment({ global: 'myGlobal' [, subscripts: [sub(1) ,...,sub(N) ]][, increment: incVal] } ); 

increment - here it can be either a positive or negative numeric value by which you want to increase / decrease the value of the node (default = 1).

Example:
 var result = myData.increment({ global: 'company', subscripts: ['counter'], increment: 1 } ); console.log('\n'); console.log('increment(): ' + JSON.stringify(result, null, '\t')); 


Result:
increment(): {
ok: 1,
global: "company",
subscripts: [
"counter"
],
data: "totVal"
}

totVal = global node value equal to the value before the call + increment

Asynchronous call

Signature
 myData.increment({ global: 'myGlobal' [, subscripts: [sub(1) ,...,sub(N) ]], increment: incVal },  function(error, result) {  if (!error) {  // --- Success ---  console.log('\n');  console.log('increment(): ' + JSON.stringify(result, null, '\t'));  }  else {  // --- Error ---  console.log('\n');  console.log('ERROR: increment(): ' + JSON.stringify(result, null, '\t'));  } } ); 

Result
{
ok: [0 | 1],
global: "global-name",
subscripts: [[list-of-subscripts-]],
data: "totVal"
}


Example:
 myData.increment({ global: 'company', subscripts: ['counter'], increment: 1 },  function(error, result) {  if (!error) {  // --- Success ---  console.log('\n');  console.log('increment(): ' + JSON.stringify(result, null, '\t'));  }  else {  // --- Error ---  console.log('\n');  console.log('ERROR: increment(): ' + JSON.stringify(result, null, '\t'));  } } ); 

Result

increment(): {
ok: 1,
global: "company",
subscripts: ["counter"],
data: "totVal"
}


Minor changes and fixes

1. Fixed access violation when handling asynchronous global_directory () call errors.

2. Globals behaves correctly when multiple calls to the open () method.

3. The 'Programmers' connection mode has appeared. In this mode, more detailed information is displayed for errors (for example, when trying to write an empty string to the node node) and the connection remains active when an error occurs.

Changes in Globals + .NET

Added example for Visual Basic

An example of working with Visual Basic repeats the functionality of examples for C # and Java.
An example can be found in the installation directory:

<globals-root>/dev/dotnet/samples/globals/vb


Here you can download the new version of Globals for various platforms and APIs.

Source: https://habr.com/ru/post/145444/


All Articles