new 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


asJSON: Stringinstance #

Stringified JSON representation of named collection

count: Numberinstance #

Number of named collection items

items: Arrayinstance #

Array of collection items

strings: Arrayinstance #

Array of collection item names


byName(name)→Number | String | TubListinstance#

Get list element by name


Delete all elements from list

setBLOBValue(paramName: String, data: ArrayBuffer, encodingopt: String)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 info:

  • paramName: String

    Name of a parameter to add BLOB to

  • data: ArrayBuffer

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


    store = new TubDataStore('tst_blob'),
    l = new TubList(),
    fs = require('fs'),
 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);