Named collection of parameters.

Think of it as an plain JavaScript object with property values that are stored in the native code, not inside a JavaScript runtime

# new TubList ()

Members

# asJSON : String instance

Stringified JSON representation of named collection

# count : Number instance

Number of named collection items

# items : Array instance

Array of collection items

# strings : Array instance

Array of collection item names

Methods

# byName (name) → Number | String | TubList instance

Get list element by name

Arguments:
  • name:

# clear () instance

Delete all elements from list

# getUniqKey () instance

Generate unique (not used yet) key name of length 3

# setBLOBValue (paramNameString, dataArrayBuffer | Object | String, encodingoptString) instance

Add parameter with name paramName, set it type to Blob and value to data. In case parameter with same name exists - replace it.

After call content of JavaScript variable is copied to server memory, so to avoid memory overflow developer can set JS variable to NULL to allow GC to free memory.

Use this feature to pass BLOB's as database operation parameter value.

Arguments:
  • paramName: String

    Name of a parameter to add BLOB to

  • data: ArrayBuffer| Object| String

    Data to write. If Object - it stringify before write

  • encoding: String

    Encode data to encoding before write. Default to utf-8 in case data is String or bin in case data is ArrayBuffer. One of "utf-8"|"ucs2"|"bin"|"base64".

  
      var
    store = new TubDataStore('tst_blob'),
    l = new TubList(),
    fs = require('fs'),
    arr;
 arr = fs.readFileSync(process.binPath + 'UB.exe', {encoding: 'bin'}); // get content of binary file as array buffer
 l.ID = store.generateID();
 l.description = 'test1';
 l.setBLOBValue('blb', arr); // set BLOB type parameter value.
 // in case we sure arr is === ArrayBuffer can be simplified to: l.blb = arr;
 arr = null; // give a GC chance to release array memory
 store.execSQL('insert into tst_blob(id, description, blb) values(:ID:, :description:, :blb:)', l);