TubList

TubList

Named collection of parameters.

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

Constructor

new TubList()

Extends

Members

asJSON: String

Stringified JSON representation of named collection

count: Number

Number of named collection items

items: Array

Array of collection items

strings: Array

Array of collection item names

Methods

clear()

Delete all elements from list

setBLOBValue(paramName, data, encodingopt)

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:
  1. paramName (String)  Name of a parameter to add BLOB to
  2. data (ArrayBuffer|Object|String)  Data to write. If Object - it stringify before write
  3. [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".
Example
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);

byName(name)Number|String|TubList

Get list element by name
Arguments:
  1. name