Creates an index on a column.


vtc.ensureIndex ( columnName );
ExampleGlobal Functions


columnNameThe name of the column to index.

vtc.ensureIndex creates a column index. If a column is not indexed, the time required to execute a vtc.sendIfUnique call increases with the number of rows. If the column is indexed, the time for 'send if unique' operations is constant. For large databases, we recommend that you index columns you want to perform 'send if unique' operations.

A column is locked while an index is being built on it. Any function calls that change the column are queued until the index build completes.

If the index exists, this function has no effect.

Return Values

Returns zero on success or one of the Error Codes.


All string input arguments can be passed using standard parameterization.


function callback(){
    var name = 'x' + arguments.callee.caller.arguments.callee.caller;
    lr.message( name.match(',(.*)_wrapper')[1] + '\'s callback arg:');
    for(var i=0 ;i<arguments.length; ++i){
        lr.message( 'arg[' + i + '] type: ' + typeof arguments[i] + ' =' + arguments[i]);

function Action()
    var handle2 = vtc.connect('321.321.321.321', 8889, vtc.VTOPT_KEEP_ALIVE);
    var handle1 = vtc.connect('', 8888, vtc.VTOPT_KEEP_ALIVE);  
    lr.message('handle1: '+ handle1.handle + ' handle2: ' + handle2.handle);
        handle2.createColumn('CID_2', callback );  
        handle2.updateMessage('CID_2', 1, 'bbbb', callback );       
        handle1.createColumn('CID_1', callback );
        handle1.sendMessage('CID_1', '111', callback );
        handle1.sendMessage('CID_1', '2222', callback );
        handle1.updateMessage('CID_1', 1, 'aaaaa', callback );
        handle1.columnSize('CID_1', callback );
        handle1.queryColumn('CID_1', 1, callback );     
        handle1.rotateRow(vtc.VTSEND_SAME_ROW, callback );
        handle1.queryRow(1, callback ); 
        handle1.rotateMessage('CID_1', vtc.VTSEND_SAME_ROW, callback );
        handle1.rotateMessages1('CustomerID,CompanyName', ',', vtc.VTSEND_SAME_ROW, callback );
        handle1.clearColumn('CID_1', callback );        
        handle1.getLastError( callback );
        handle1.disconnect( callback );
        handle2.disconnect( callback );