c++ interface: usage of knk

Hi,
  Can I use knk function like below:

  int number = 5;

  K val = knk(number);

  for(int i=0;i<number;i++)

  {

     switch(type)

     {

        case myInt:

            kI(val)[i] = …;

         …

     }

   }

k(handle, “insert”, ks(S(“tableName”)), val, (K)0);

If I can’t use it like this. how can I do the same thing?

you want ktn - returns a k list from a type and count.
as you have a mixed list, t should be 0:

you’ll need to create k values depending on type 

 - case myInt: create a k int: ki(..) 

       (or maybe a kj() depending on your int size)

int number = 5;

K val = ktn(0,number); // instead of = knk(number);

for(int i=0;i<number;i++)

{

switch(type)

{

case myInt:

kK(val)[i]=ki(…); //instead of kI(val)[i] = …;

}

}

k(handle, “insert”, ks(S(“tableName”)), val, (K)0);

ta, jack (untested code above)