GlobalsDB 2012.2 release

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

    What's new?
    Added expected by many Node.JS API interface for Windows, and immediately for Windows 64-bit.
    Small additions have been implemented and some bugs have been fixed.
    About this and the rest.

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

    GlobalsDB Node.JS API


    Node.js for Windows

    This version adds the expected support for Node.js for Windows. The API works with the node.js 0.6x version family. Node js API documentation is available here .
    The extension for Windows 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 not currently supported, as no stable version of this branch node.js. has been released yet

    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 an 'undefined' error.
    Nevertheless, if you use JSON (recommended), you can determine in which node there really is 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 value:
    {
    "ok" 1,
    "global": "Customer",
    "subscripts": [1, "first-name"],
    "data": "",
    "defined": 0
    }
    


    Implementation of Globals $ Query () functionality in Node.JS method previouse_node ()


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

    This method returns the previous node in the sorting sequence of nodes at the current level or at the parent, if at the current level the nodes have run out. The method returns the name of the global, the full link 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: Example 2

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




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

    Result Note that the result of the call will be exactly the city node, since in the sorting sequence the country node is in front of the city node. Asynchronous Call Signature
    previous_node(): {
    ok: 1,
    global: "company",
    subscripts: [1, "address", "city"],
    defined: 1,
    data: "Cambridge"
    }







    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 Example 2

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




    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"
    }


    Solved “anomaly” 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 when only the global name is passed - in this case the increment will be 1.
    If JSON is used to pass parameters to increment (), the increment value will be taken from the increment property, or equal to 1 if it is not set.

    Synchronous operations

    Explicitly specifying increment

    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 can be either a positive or a 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: totVal = global node value equal to the value before the call + increment Asynchronous call Signature
    increment(): {
    ok: 1,
    global: "company",
    subscripts: [
    "counter"
    ],
    data: "totVal"
    }






    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 Example:
    {
    ok: [0 | 1],
    global: "global-name",
    subscripts: [[list-of-subscripts-]],
    data: "totVal"
    }



    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 bug fixes

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

    2. Globals behaves correctly with 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 top of a node) and the connection remains active when an error occurs.

    Changes in Globals + .NET

    Added example for Visual Basic

    The Visual Basic Example repeats the functionality of the examples for C # and Java.
    An example can be found in the installation directory: Here you can download the new version of Globals for various platforms and APIs.

    /dev/dotnet/samples/globals/vb



    Also popular now: