bulk buffer transfer example

Dear KDB Users,

I am trying out bulk buffer transfer using C intreface and I got an
error “'.u.upd” in KDB console. Could you pls take a look at what I
have missed. My test is:

  1. create table as:
    all_dt:([seq:int$()]cchar:char$();cshort:short$();cint:int$
    ();cfloat:float$();csym:symbol$())

  2. compile program as:
    #include “k.h”
    #include “stdio.h”
    int main(int argc, char* argv)
    {
    K err;
    I kdbSocketHandle = khp(“localhost”, 5001);
    if (kdbSocketHandle > 0)
    {
    int bulkSize=2;
    K x=knk(6, ktn(KI, bulkSize), ktn(KC, bulkSize), ktn(KH, bulkSize),
    ktn(KI, bulkSize), \
    ktn(KF, bulkSize), ktn(KS, bulkSize));
    for(int i=0; i kI(xK[0])[i] = i;
    kC(xK[1])[i] = ‘a’;
    kH(xK[2])[i] = 100;
    kI(xK[3])[i] = 1000;
    kF(xK[4])[i] = 99.9;
    kS(xK[5])[i] = (S)“hello world”;
    }
    err=k(-kdbSocketHandle, “.u.upd”, ks((S)“all_dt”), x, (K)0);
    if (err->t==-128)
    {
    printf(“err: %s\n”, err->s);
    }
    k(kdbSocketHandle,“”,(K)0); // flush
    }
    }


Looking at the code, I can’t see any defintion of .u.upd on your Qside.Something along these lines should do the trick (add it to your Qserver side code): .u.upd:{[t;d] t insert d }Where “t” is the table name as a symbol and “d” is the data to insert.Looking at the line in your code that will do the call:> ? ? ? ? ? ? ? ? err=k(-kdbSocketHandle, “.u.upd”, ks((S)“all_dt”), x, (K)0);we see that first it identifies the function that should be called onthe server side as “.u.upd”, then the table name in ks((S)“all_dt”)and lastly the data to send in x.H?kan