Java Multi-Connection Example

import lrapi.lr;
import lrapi.vts.Constants;
import lrapi.vts.Vtc;
import lrapi.vts.OutArrOfStrParameter;
import lrapi.vts.OutIntParameter;
import lrapi.vts.OutStrParameter;
public class Actions
{
    private static final String VtsServer = "my_vts_server.my_company.com";
    private static final int nPort = 8890;
    private static int rc = 0;
    private static int pvci = 0;
    private static OutIntParameter outInt = new OutIntParameter();
    private static OutStrParameter outStr = new OutStrParameter();
    private static OutArrOfStrParameter outColArr = new OutArrOfStrParameter();
    private static OutArrOfStrParameter outValArr = new OutArrOfStrParameter();
    private static OutIntParameter colsize = new OutIntParameter();
    private static OutIntParameter colsize2 = new OutIntParameter();
    public int init() throws Throwable {
        pvci = Vtc.connect(VtsServer, nPort, Constants.VTOPT_KEEP_ALIVE);
        rc = Vtc.get_last_error(pvci);
        lr.log_message("rc=" + rc + "\n");
        return 0;
    }// end of init
    public int action() throws Throwable {
        String Message = "";
        lr.start_transaction("create_columns");
 
       // ---create columns---
        rc = Vtc.create_column(pvci, "C_ID", outInt);
        lr.log_message("create_column rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        rc = Vtc.create_column(pvci, "P_ID", outInt);
        lr.log_message("create_column rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        rc = Vtc.create_column(pvci, "P_name", outInt);
        lr.log_message("create_column rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        rc = Vtc.create_column(pvci, "P_info", outInt);
        lr.log_message("create_column rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        rc = Vtc.create_column(pvci, "P_status", outInt);
        lr.log_message("create_column rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        lr.end_transaction("create_columns", lr.AUTO);
        lr.start_transaction("fill_data");
        for (int i = 1; i <= 10; i++) {
            Message = "product" + i + ";productname" + i + ";productinfo" + i
                    + ";instock";
            rc = Vtc.send_row1(pvci, "P_ID;P_name;P_info;P_status", Message, ";",
                    Constants.VTSEND_SAME_ROW, outInt);
            lr.log_message("send_row1 rc=" + rc + " outRc=" + outInt.getValue() + "\n");
            freeOutParam(outInt);
        }
        lr.end_transaction("fill_data", lr.AUTO);
 
       // -- API column_size
        lr.start_transaction("get_colsize");
        rc = Vtc.column_size(pvci, "P_ID", colsize);
        lr.log_message("column_size rc=" + rc + " size of column P_ID=" + colsize.getValue());
        freeOutParam(colsize);
        rc = Vtc.column_size(pvci, "P_name", colsize);
        lr.log_message("column_size rc=" + rc + " size of column P_name=" + colsize.getValue());
        freeOutParam(colsize);
        rc = Vtc.column_size(pvci, "P_info", colsize);
        lr.log_message("column_size rc=" + rc + " size of column P_info=" + colsize.getValue());
        freeOutParam(colsize);
        rc = Vtc.column_size(pvci, "P_status", colsize);
        lr.log_message("column_size rc=" + rc + " size of column P_status=" + colsize.getValue());
        freeOutParam(colsize);
        
        // wrong column name
        rc = Vtc.column_size(pvci, "P_ID1", colsize);
        lr.log_message("column_size rc=" + rc + " size of column P_ID1=" + colsize.getValue());
        freeOutParam(colsize);
        lr.end_transaction("get_colsize", lr.AUTO);
        // end of API column_size --
 
       // -- API ensure_index
        lr.start_transaction("create_index");
 
       // empty column
        rc = Vtc.ensure_index(pvci, "C_ID", outInt);
        lr.log_message("ensure index of empty column rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
 
       // non-empty column
        rc = Vtc.ensure_index(pvci, "P_ID", outInt);
        lr.log_message("ensure index of non-empty column rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        
       // wrong column name
        rc = Vtc.ensure_index(pvci, "P_ID1", outInt);
        lr.log_message("ensure index of wrong column rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        
        lr.end_transaction("create_index", lr.AUTO);
        // end API ensure_index --
 
       // -- API drop_index
        lr.start_transaction("drop_index");
        // empty column
        rc = Vtc.drop_index(pvci, "C_ID", outInt);
        lr.log_message("drop index of empty column rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
 
       // non-empty column
        rc = Vtc.drop_index(pvci, "P_ID", outInt);
        lr.log_message("drop index of non-empty column rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        
        // wrong column name
        rc = Vtc.drop_index(pvci, "P_ID1", outInt);
        lr.log_message("drop index of wrong column rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        lr.end_transaction("drop_index", lr.AUTO);
        // end API drop_index --
 
       // -- API send_if_unique
        lr.start_transaction("send_if_unique");
 
       // insert unique
        Vtc.column_size(pvci, "P_ID", colsize);
        rc = Vtc.send_if_unique(pvci, "P_ID", "product-1234", outInt);
        lr.log_message("send_if_unique rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        Vtc.column_size(pvci, "P_ID", colsize2);
        if (colsize.getValue() == colsize2.getValue() - 1) {
            lr.log_message("send_if_unique (unique) succeed\n");
            //freeOutParam(colsize);
     
       // insert duplicated
            Vtc.column_size(pvci, "P_ID", colsize);
            rc = Vtc.send_if_unique(pvci, "P_ID", "product-1234", outInt);
            lr.log_message("send_if_unique rc=" + rc + " outRc=" + outInt.getValue() + "\n");
            freeOutParam(outInt);
            Vtc.column_size(pvci, "P_ID", colsize2);
            if (colsize.getValue() == colsize2.getValue()) {
                lr.log_message("send_if_unique (duplicated) succeed\n");
         
       // insert into wrong column
                rc = Vtc.send_if_unique(pvci, "P_ID1", "product-1234", outInt);
                lr.log_message("send_if_unique (wrong col) rc=" + rc + " outRc=" + outInt.getValue() + "\n");
                freeOutParam(outInt);
                // --
                lr.end_transaction("send_if_unique", lr.PASS);
            } else {
                lr.error_message("send_if_unique (duplicated) failed\n");
                lr.end_transaction("send_if_unique", lr.FAIL);
            }
        } else {
            lr.error_message("send_if_unique (unique) failed\n");
            lr.end_transaction("send_if_unique", lr.FAIL);
        }
        // end of API send_if_unique --
 
       // -- API clear_message
        lr.start_transaction("clear_message");
        Vtc.column_size(pvci, "P_ID", colsize);
        
        rc = Vtc.clear_message(pvci, "P_ID", colsize.getValue(), outInt);
        lr.log_message("clear_message rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        
        // wrong column name
        rc = Vtc.clear_message(pvci, "P_ID11", 1, outInt);
        lr.log_message("clear_message (wrong col name) rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        
        // wrong row number
        rc = Vtc.clear_message(pvci, "P_ID", colsize.getValue() + 1, outInt);
        lr.log_message("clear_message rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        lr.end_transaction("clear_message", lr.AUTO);
        // end of API clear_message --
 
       // -- API send_message
        lr.start_transaction("send_message");
        rc = Vtc.send_message(pvci, "C_ID", "customer1", outInt);
        lr.log_message("send_message rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        
        // wrong column name
        rc = Vtc.send_message(pvci, "C_ID1", "customer1", outInt);
        lr.log_message("send_message (wrong col name) rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        lr.end_transaction("send_message", lr.AUTO);
        // end of API send_message --
 
       // -- API query_column
        lr.start_transaction("query_column");
        Vtc.column_size(pvci, "P_ID", colsize);
        for (int i = 1; i <= colsize.getValue(); i++) {
            rc = Vtc.query_column(pvci, "P_ID", i, outStr);
            lr.log_message("query_column rc=" + rc + "\n");
            lr.log_message("P_ID[" + i + "]=" + outStr.getValue() + "\n");
            freeOutParam(outStr);
        }
        
        // wrong column name
        rc = Vtc.query_column(pvci, "P_ID12", 1, outStr);
        lr.log_message("query_column (wrong name) rc=" + rc + "\n");
        lr.log_message("P_ID12=" + outStr.getValue() + "\n");
        freeOutParam(outStr);
        
        // wrong row number
        Vtc.column_size(pvci, "P_ID", colsize);
        rc = Vtc.query_column(pvci, "P_ID", colsize.getValue() + 1, outStr);
        lr.log_message("query_column (wrong row num) rc=" + rc + "\n");
        lr.log_message("P_ID=" + outStr.getValue() + "\n");
        freeOutParam(outStr);
        lr.end_transaction("query_column", lr.AUTO);
        // end of API query_column --
 
       // -- API query_row
        lr.start_transaction("query_row");
        Vtc.column_size(pvci, "P_ID", colsize);
        for (int i = 1; i <= colsize.getValue(); i++) {
            rc = Vtc.query_row(pvci, i, outColArr, outValArr);
            lr.log_message("query_row rc=" + rc + "\n");
            /*lr.log_message("Row["
                    + i
                    + "]={"
                    + outColArr.getValue()[0] + "=" + outValArr.getValue()[0] + "\n"
                    + outColArr.getValue()[1] + "=" + outValArr.getValue()[1] + "\n"
                    + outColArr.getValue()[2] + "=" + outValArr.getValue()[2] + "\n"
                    + outColArr.getValue()[3] + "=" + outValArr.getValue()[3] + "\n"
                    + outColArr.getValue()[4] + "=" + outValArr.getValue()[4] + "\n"
                    + "}\n");*/
            log_row1("Row[" + i + "]", outColArr, outValArr);
            freeOutParam(outColArr);
            freeOutParam(outValArr);
        }
        
        // wrong row number
        rc = Vtc.query_row(pvci, colsize.getValue() + 1, outColArr, outValArr);
        lr.log_message("query_row (wrong row num) rc=" + rc + "\n");
        lr.log_message("Row={"
                + outColArr.getValue()[0] + "=" + outValArr.getValue()[0] + "\n"
                + outColArr.getValue()[1] + "=" + outValArr.getValue()[1] + "\n"
                + outColArr.getValue()[2] + "=" + outValArr.getValue()[2] + "\n"
                + outColArr.getValue()[3] + "=" + outValArr.getValue()[3] + "\n"
                + outColArr.getValue()[4] + "=" + outValArr.getValue()[4] + "\n"
                + "}\n");
        freeOutParam(outColArr);
        freeOutParam(outValArr);
        
        lr.end_transaction("query_row", lr.AUTO);
        // end of API query_row --
 
       // -- API retrieve_message
        lr.start_transaction("retrieve_message");
        Vtc.column_size(pvci, "P_status", colsize);
        lr.log_message("size of P_status=" + colsize.getValue());
        rc = Vtc.retrieve_message(pvci, "P_status", outStr);
        lr.log_message("retrieve_message rc=" + rc + "\n");
        lr.log_message("P_status=" + outStr.getValue() + "\n");
        Vtc.column_size(pvci, "P_status", colsize);
        lr.log_message("size of P_status=" + colsize.getValue());
        freeOutParam(outStr);
        
        // wrong column name
        rc = Vtc.retrieve_message(pvci, "P_status1", outStr);
        lr.log_message("retrieve_message (wrong col name) rc=" + rc + "\n");
        lr.log_message("P_status1=" + outStr.getValue() + "\n");
        freeOutParam(outStr);
        lr.end_transaction("retrieve_message", lr.AUTO);
        // end of API retrieve_message --
 
       // -- API retrieve_messages1
        lr.start_transaction("retrieve_messages1");
        Vtc.column_size(pvci, "P_ID", colsize);
        lr.log_message("size of P_ID=" + colsize.getValue());
        Vtc.column_size(pvci, "P_name", colsize);
        lr.log_message("size of P_name=" + colsize.getValue());
        Vtc.column_size(pvci, "P_info", colsize);
        lr.log_message("size of P_info=" + colsize.getValue());
        Vtc.column_size(pvci, "P_status", colsize);
        lr.log_message("size of P_status=" + colsize.getValue());
        rc = Vtc.retrieve_messages1(pvci, "P_ID;P_name;P_info;P_status", ";", outValArr);
        lr.log_message("retrieve_messages1 rc=" + rc + "\n");
        lr.log_message("P_ID=" + outValArr.getValue()[0] + "\n");
        lr.log_message("P_name=" + outValArr.getValue()[1] + "\n");
        lr.log_message("P_info=" + outValArr.getValue()[2] + "\n");
        lr.log_message("P_status=" + outValArr.getValue()[3] + "\n");
        Vtc.column_size(pvci, "P_ID", colsize);
        lr.log_message("size of P_ID=" + colsize.getValue());
        Vtc.column_size(pvci, "P_name", colsize);
        lr.log_message("size of P_name=" + colsize.getValue());
        Vtc.column_size(pvci, "P_info", colsize);
        lr.log_message("size of P_info=" + colsize.getValue());
        Vtc.column_size(pvci, "P_status", colsize);
        lr.log_message("size of P_status=" + colsize.getValue());
        
        // one wrong column
        rc = Vtc.retrieve_messages1(pvci, "P_ID;P_name;P_info;P_status;WR_col", ";", outValArr);
        lr.log_message("retrieve_messages1 (one wrong col) rc=" + rc + "\n");
        lr.log_message("P_ID=" + outValArr.getValue()[0] + "\n");
        lr.log_message("P_name=" + outValArr.getValue()[1] + "\n");
        lr.log_message("P_info=" + outValArr.getValue()[2] + "\n");
        lr.log_message("P_status=" + outValArr.getValue()[3] + "\n");
        lr.log_message("WR_col=" + outValArr.getValue()[4] + "\n");
        
        // all wrong columns
        rc = Vtc.retrieve_messages1(pvci, "P_ID1;P_name1;P_info1;P_status1", ";", outValArr);
        lr.log_message("retrieve_messages1 (all wrong cols) rc=" + rc + "\n");
        lr.log_message("P_ID1=" + outValArr.getValue()[0] + "\n");
        lr.log_message("P_name1=" + outValArr.getValue()[1] + "\n");
        lr.log_message("P_info1=" + outValArr.getValue()[2] + "\n");
        lr.log_message("P_status1=" + outValArr.getValue()[3] + "\n");
        lr.end_transaction("retrieve_messages1", lr.AUTO);
        // end of API retrieve_messages1 --
 
       // -- API retrieve_row
        lr.start_transaction("retrieve_row");
        
        Vtc.column_size(pvci, "C_ID", colsize);
        lr.log_message("size of C_ID=" + colsize.getValue());
        Vtc.column_size(pvci, "P_ID", colsize);
        lr.log_message("size of P_ID=" + colsize.getValue());
        Vtc.column_size(pvci, "P_name", colsize);
        lr.log_message("size of P_name=" + colsize.getValue());
        Vtc.column_size(pvci, "P_info", colsize);
        lr.log_message("size of P_info=" + colsize.getValue());
        Vtc.column_size(pvci, "P_status", colsize);
        lr.log_message("size of P_status=" + colsize.getValue());
        rc = Vtc.retrieve_row(pvci, outColArr, outValArr);
        lr.log_message("retrieve_row rc=" + rc + "\n");
        lr.log_message("Row={"
                + outColArr.getValue()[0] + "=" + outValArr.getValue()[0] + "\n"
                + outColArr.getValue()[1] + "=" + outValArr.getValue()[1] + "\n"
                + outColArr.getValue()[2] + "=" + outValArr.getValue()[2] + "\n"
                + outColArr.getValue()[3] + "=" + outValArr.getValue()[3] + "\n"
                + outColArr.getValue()[4] + "=" + outValArr.getValue()[4] + "\n"
                + "}\n");
        freeOutParam(outColArr);
        freeOutParam(outValArr);
        Vtc.column_size(pvci, "C_ID", colsize);
        lr.log_message("size of C_ID=" + colsize.getValue());
        Vtc.column_size(pvci, "P_ID", colsize);
        lr.log_message("size of P_ID=" + colsize.getValue());
        Vtc.column_size(pvci, "P_name", colsize);
        lr.log_message("size of P_name=" + colsize.getValue());
        Vtc.column_size(pvci, "P_info", colsize);
        lr.log_message("size of P_info=" + colsize.getValue());
        Vtc.column_size(pvci, "P_status", colsize);
        lr.log_message("size of P_status=" + colsize.getValue());
        
        lr.end_transaction("retrieve_row", lr.AUTO);
        // end of API retrieve_row --
 
       // -- API update_message
        lr.start_transaction("update_message");
        rc = Vtc.query_column(pvci, "P_name", 1, outStr);
        lr.log_message("query_column rc=" + rc + "\n");
        if (rc != 0) {
            lr.end_transaction("update_message", lr.FAIL);
        } else {
            lr.log_message("P_name old value=" + outStr.getValue() + "\n");
            rc = Vtc.update_message(pvci, "P_name", 1,
                    outStr.getValue() + "new", outInt);
            lr.log_message("update_message rc=" + rc + " outRc=" + outInt.getValue() + "\n");
            freeOutParam(outInt);
            rc = Vtc.query_column(pvci, "P_name", 1, outStr);
            lr.log_message("P_name new value=" + outStr.getValue() + "\n");
            freeOutParam(outStr);
        }
        
        // wrong column name
        rc = Vtc.update_message(pvci, "P_name2", 1, "P_name_new", outInt);
        lr.log_message("update_message (wrong col) rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        
        // wrong row number
        Vtc.column_size(pvci, "P_name", colsize);
        rc = Vtc.update_message(pvci, "P_name", colsize.getValue() + 10, "P_name_new", outInt);
        lr.log_message("update_message (wrong row num) rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        lr.end_transaction("update_message", lr.AUTO);
        // end of API update_message --
 
       // -- API update_message_ifequals
        lr.start_transaction("update_message_ifequals");
 
       // update_message_ifequals if match
        lr.start_sub_transaction("update_message_ifequals_match",
                "update_message_ifequals");
        rc = Vtc.query_column(pvci, "P_name", 1, outStr);
        lr.log_message("query_column rc=" + rc + "\n");
        if (rc != 0) {
            lr.end_sub_transaction("update_message_ifequals_match", lr.FAIL);
        } else {
            lr.log_message("P_name old value=" + outStr.getValue() + "\n");
            rc = Vtc.update_message_ifequals(pvci, "P_name", 1,
                    outStr.getValue() + "_newestM",
                    outStr.getValue(), outInt);
            lr.log_message("update_message_ifequals rc=" + rc + " outRc=" + outInt.getValue() + "\n");
            freeOutParam(outInt);
            freeOutParam(outStr);
            rc = Vtc.query_column(pvci, "P_name", 1, outStr);
            lr.log_message("P_name new value=" + outStr.getValue() + "\n");
            freeOutParam(outStr);
            lr.end_sub_transaction("update_message_ifequals_match", lr.PASS);
        }
 
       // update_message_ifequals if mismatch
        lr.start_sub_transaction("update_message_ifequals_mismatch",
                "update_message_ifequals");
        rc = Vtc.query_column(pvci, "P_name", 1, outStr);
        lr.log_message("query_column rc=" + rc + "\n");
        if (rc != 0) {
            lr.end_sub_transaction("update_message_ifequals_mismatch", lr.FAIL);
        } else {
            lr.log_message("P_name old value=" + outStr.getValue() + "\n");
            rc = Vtc.update_message_ifequals(pvci, "P_name", 1,
                    outStr.getValue() +"_newestNM",
                    outStr.getValue() + "_mismatch", outInt);
            lr.log_message("update_message_ifequals rc=" + rc + " outRc=" + outInt.getValue() + "\n");
            freeOutParam(outStr);
            freeOutParam(outInt);
            rc = Vtc.query_column(pvci, "P_name", 1, outStr);
            lr.log_message("P_name new value=" + outStr.getValue() + "\n");
            freeOutParam(outStr);
            lr.end_sub_transaction("update_message_ifequals_mismatch", lr.PASS);
        }
 
       // update_message_ifequals if empty
        lr.start_sub_transaction("update_message_ifequals_empty",
                "update_message_ifequals");
        rc = Vtc.clear_message(pvci, "P_name", 1, outInt);
        lr.log_message("query_column rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        if (rc != 0) {
            lr.end_sub_transaction("update_message_ifequals_empty", lr.FAIL);
        } else {
            rc = Vtc.update_message_ifequals(pvci, "P_name", 1,
                    "null_newestE", "", outInt);
            lr.log_message("update_message_ifequals rc=" + rc + " outRc=" + outInt.getValue() + "\n");
            freeOutParam(outInt);
            rc = Vtc.query_column(pvci, "P_name", 1, outStr);
            lr.log_message("P_name new value=" + outStr.getValue() + "\n");
            freeOutParam(outStr);
            lr.end_sub_transaction("update_message_ifequals_empty", lr.PASS);
        }
        
        // wrong column name
        rc = Vtc.update_message_ifequals(pvci, "P_name3", 1, "P_name_newestE", "", outInt);
        lr.log_message("update_message_ifequals (wrong col) rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        
        // wrong row number
        Vtc.column_size(pvci, "P_name", colsize);
        rc = Vtc.update_message_ifequals(pvci, "P_name", colsize.getValue() + 20, "P_name_newestE", "", outInt);
        lr.log_message("update_message_ifequals (wrong row num) rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        lr.end_transaction("update_message_ifequals", lr.AUTO);
        // end of API update_message_ifequals --
 
       // -- API update_row1
        lr.start_transaction("update_row1");
 
       // query current values
        rc = Vtc.query_row(pvci, 1, outColArr, outValArr);
        lr.log_message("query_row (wrong row num) rc=" + rc + "\n");
        lr.log_message("Row={"
                + outColArr.getValue()[0] + "=" + outValArr.getValue()[0] + "\n"
                + outColArr.getValue()[1] + "=" + outValArr.getValue()[1] + "\n"
                + outColArr.getValue()[2] + "=" + outValArr.getValue()[2] + "\n"
                + outColArr.getValue()[3] + "=" + outValArr.getValue()[3] + "\n"
                + outColArr.getValue()[4] + "=" + outValArr.getValue()[4] + "\n"
                + "}\n");
        freeOutParam(outColArr);
        freeOutParam(outValArr);
 
       // update row
        rc = Vtc.update_row1(pvci, 
                        "P_ID;P_name;P_info;P_status", 1,
                        "product1_newest1;productname1_newest1;productinfo1_newest1;instock", ";", outInt);
        lr.log_message("update_row1 rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
 
       // query new values
        rc = Vtc.query_row(pvci, 1, outColArr, outValArr);
        lr.log_message("query_row rc=" + rc + "\n");
        lr.log_message("Row new={"
                + outColArr.getValue()[0] + "=" + outValArr.getValue()[0] + "\n"
                + outColArr.getValue()[1] + "=" + outValArr.getValue()[1] + "\n"
                + outColArr.getValue()[2] + "=" + outValArr.getValue()[2] + "\n"
                + outColArr.getValue()[3] + "=" + outValArr.getValue()[3] + "\n"
                + outColArr.getValue()[4] + "=" + outValArr.getValue()[4] + "\n"
                + "}\n");
        freeOutParam(outColArr);
        freeOutParam(outValArr);
        
        // one wrong column
        rc = Vtc.update_row1(pvci, 
                "P_ID;P_name;P_info;P_status4", 1,
                "product1_newest1;productname1_newest1;productinfo1_newest1;wrong_place", ";", outInt);
        lr.log_message("update_row1 (one wrong col) rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        rc = Vtc.query_row(pvci, 1, outColArr, outValArr);
        lr.log_message("query_row (one wrong col) rc=" + rc + "\n");
        lr.log_message("Row new={"
                + outColArr.getValue()[0] + "=" + outValArr.getValue()[0] + "\n"
                + outColArr.getValue()[1] + "=" + outValArr.getValue()[1] + "\n"
                + outColArr.getValue()[2] + "=" + outValArr.getValue()[2] + "\n"
                + outColArr.getValue()[3] + "=" + outValArr.getValue()[3] + "\n"
                + outColArr.getValue()[4] + "=" + outValArr.getValue()[4] + "\n"
                + "}\n");
        freeOutParam(outColArr);
        freeOutParam(outValArr);
        
        // all wrong columns
        rc = Vtc.update_row1(pvci, 
                "P_ID5;P_name5;P_info5;P_status5", 1,
                "product1_newest1;productname1_newest1;productinfo1_newest1;wrong_place", ";", outInt);
        lr.log_message("update_row1 (all wrong cols) rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        rc = Vtc.query_row(pvci, 1, outColArr, outValArr);
        lr.log_message("query_row (all wrong cols) rc=" + rc + "\n");
        lr.log_message("Row new={"
                + outColArr.getValue()[0] + "=" + outValArr.getValue()[0] + "\n"
                + outColArr.getValue()[1] + "=" + outValArr.getValue()[1] + "\n"
                + outColArr.getValue()[2] + "=" + outValArr.getValue()[2] + "\n"
                + outColArr.getValue()[3] + "=" + outValArr.getValue()[3] + "\n"
                + outColArr.getValue()[4] + "=" + outValArr.getValue()[4] + "\n"
                + "}\n");
        freeOutParam(outColArr);
        freeOutParam(outValArr);
        
        // wrong row number
        Vtc.column_size(pvci, "P_ID", colsize);
        rc = Vtc.update_row1(pvci, 
                "P_ID;P_name;P_info;P_status", colsize.getValue() + 30,
                "product1_newest1;productname1_newest1;productinfo1_newest1;instock", ";", outInt);
        lr.log_message("update_row1 (wrong row num) rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        Vtc.column_size(pvci, "P_ID", colsize);
        rc = Vtc.query_row(pvci, colsize.getValue(), outColArr, outValArr);
        lr.log_message("query_row (wrong row num) rc=" + rc + "\n");
        lr.log_message("Row new={"
                + outColArr.getValue()[0] + "=" + outValArr.getValue()[0] + "\n"
                + outColArr.getValue()[1] + "=" + outValArr.getValue()[1] + "\n"
                + outColArr.getValue()[2] + "=" + outValArr.getValue()[2] + "\n"
                + outColArr.getValue()[3] + "=" + outValArr.getValue()[3] + "\n"
                + outColArr.getValue()[4] + "=" + outValArr.getValue()[4] + "\n"
                + "}\n");
        freeOutParam(outColArr);
        freeOutParam(outValArr);
        
        lr.end_transaction("update_row1", lr.AUTO);
        // end of API update_row1 --
        
        //-- API increment
        
        lr.start_transaction("increment");
        
        // init counter
        rc = Vtc.increment(pvci, "P_ID", 1, 10, outInt);
        lr.log_message("increment init rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        
        // increment counter
        rc = Vtc.increment(pvci, "P_ID", 1, 15, outInt);
        lr.log_message("increment new rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        
        // wrong column name
        rc = Vtc.increment(pvci, "P_ID6", 1, 10, outInt);
        lr.log_message("increment (wrong col) rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        
        // wrong row number
        Vtc.column_size(pvci, "P_ID", colsize);
        rc = Vtc.increment(pvci, "P_ID", colsize.getValue() + 30, 10, outInt);
        lr.log_message("increment (wrong row num) rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        lr.end_transaction("increment", lr.AUTO);   
        // end of API increment --
        
        //-- API clear_row
        lr.start_transaction("clear_row");
        
        rc = Vtc.clear_row(pvci, 1, outInt);
        lr.log_message("clear_row rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        
        // wrong row number
        Vtc.column_size(pvci, "P_ID", colsize);
        rc = Vtc.clear_row(pvci, colsize.getValue() + 1000, outInt);
        lr.log_message("clear_row (wrong row num) rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        
        lr.end_transaction("clear_row", lr.AUTO);
        // end of API clear_row --
        
        //-- API clear_column
        lr.start_transaction("clear_column");
        
        rc = Vtc.clear_column(pvci, "P_info", outInt);
        lr.log_message("clear_column rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        
        // wrong column name
        rc = Vtc.clear_column(pvci, "P_info7", outInt);
        lr.log_message("clear_column (wrong col) rc=" + rc + " outRc=" + outInt.getValue() + "\n");
        freeOutParam(outInt);
        
        lr.end_transaction("clear_column", lr.AUTO);
        // end of API clear_column --
        
        // remove all columns
        rc = Vtc.clear_column(pvci, "C_ID", outInt);        
        rc = Vtc.clear_column(pvci, "P_ID", outInt);        
        rc = Vtc.clear_column(pvci, "P_name", outInt);        
        rc = Vtc.clear_column(pvci, "P_info", outInt);        
        rc = Vtc.clear_column(pvci, "P_status", outInt);        
        return 0;
    }// end of action
	
    public int end() throws Throwable {
        // -- API disconnect
        Vtc.disconnect(pvci);
        // end of API disconnect --
        return 0;
    }// end of end
    
    private void freeOutParam(Object param) {
        Class paramClass = param.getClass();
        param = null;
        
        try {
            param = paramClass.newInstance();
        } catch (InstantiationException e) {
            param = null;
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            param = null;
            e.printStackTrace();
        }
    }
    
    private void log_row1(final String title, final OutArrOfStrParameter paramColArr, final OutArrOfStrParameter paramValArr) {
        lr.log_message(title + "={\n");
        for (int i = 0; i < paramColArr.getValue().length; i++) {
            lr.log_message(paramColArr.getValue()[i] + "=" + paramValArr.getValue()[i] + "\n");
        }
        lr.log_message("}\n");
    }
}