Please take a look at this simple C interface program. I created table
object tbl from dict and I tried to inspect tbl using debugger and I
could not see valid data member in tbl. Can someone tell me in which
data member of tbl, the table data is saved?
dbtouch
#include “k.h” #include #include int main(int argc, char* argv) { K err; I kdbSocketHandle = khp(argv[1], (short)atoi(argv[2]));
if (kdbSocketHandle > 0) { K columns = ktn(KC, 2); kC(columns)[0]=‘a’; kC(columns)[1]=‘b’;
K data = ktn(KI, 2); kI(data)[0]=1; kI(data)[1]=2; K dict=xD(columns, data); K tbl=xT(dict); K kBoolean=ki(100); return EXIT_SUCCESS; } }
Date: Tue, 10 Mar 2009 14:15:14 +0000Message-ID: <1855e77f0903100715i426f8421j89da3ba365a61065@mail.gmail.com>Subject: Re: [personal kdb+] inspect table object in C interfaceFrom: Attila Vrabecz <attila.vrabecz>To: personal-kdbplus@googlegroups.comtbl->k is the dictionary which maps column-names to column-vectorskK(tbl->k)[0] is keys (column-names)kK(tbl->k)[0] is values (column-vectors)it all becomes a lot easier if you use x for a tablename because thenyou can use the shortcuts (xk, xx, xy, etc) defined in k.h AttilaOn Tue, Mar 10, 2009 at 1:58 PM, dbtouch wrote:>> Dear K programmers,>> Please take a look at this simple C interface program. I created table> object tbl from dict and I tried to inspect tbl using debugger and I> could not see valid data member in tbl. Can someone tell me in which> data member of tbl, the table data is saved?>> dbtouch>> ?#include “k.h”> #include > #include > int main(int argc, char* argv)> {> ? ? ? ?K err;> ? ? ? ?I kdbSocketHandle = khp(argv[1], (short)atoi(argv[2]));>> ? ? ? ?if (kdbSocketHandle > 0) {> ? ? ? ? ? ? ? ?K columns = ktn(KC, 2);> ? ? ? ? ? ? ? ?kC(columns)[0]=‘a’;> ? ? ? ? ? ? ? ?kC(columns)[1]=‘b’;>> ? ? ? ? ? ? ? ?K data = ktn(KI, 2);> ? ? ? ? ? ? ? ?kI(data)[0]=1;> ? ? ? ? ? ? ? ?kI(data)[1]=2;> ? ? ? ? ? ? ? ?K dict=xD(columns, data);> ? ? ? ? ? ? ? ?K tbl=xT(dict);> ? ? ? ? ? ? ? ?K kBoolean=ki(100);> ? ? ? ? ? ? ? ?return EXIT_SUCCESS;> ? ? ? ?}> }> >></attila.vrabecz>
Thanks, Attila. I found out in my program, tbl is NULL. So the flipfailed. Could you suggest what is possibly wrong with my program. Iinspect dict and it is good.Thanks,dbtouchOn Mar 10, 10:15?am, Attila Vrabecz <attila.vrab…> wrote:> tbl->k is the dictionary which maps column-names to column-vectors> kK(tbl->k)[0] is keys (column-names)> kK(tbl->k)[0] is values (column-vectors)>> it all becomes a lot easier if you use x for a tablename because then> you can use the shortcuts (xk, xx, xy, etc) defined in k.h> ? Attila>>>> On Tue, Mar 10, 2009 at 1:58 PM, dbtouch <dbto…> wrote:>> > Dear K programmers,>> > Please take a look at this simple C interface program. I created table> > object tbl from dict and I tried to inspect tbl using debugger and I> > could not see valid data member in tbl. Can someone tell me in which> > data member of tbl, the table data is saved?>> > dbtouch>> > ?#include “k.h”> > #include > > #include > > int main(int argc, char* argv)> > {> > ? ? ? ?K err;> > ? ? ? ?I kdbSocketHandle = khp(argv[1], (short)atoi(argv[2]));>> > ? ? ? ?if (kdbSocketHandle > 0) {> > ? ? ? ? ? ? ? ?K columns = ktn(KC, 2);> > ? ? ? ? ? ? ? ?kC(columns)[0]=‘a’;> > ? ? ? ? ? ? ? ?kC(columns)[1]=‘b’;>> > ? ? ? ? ? ? ? ?K data = ktn(KI, 2);> > ? ? ? ? ? ? ? ?kI(data)[0]=1;> > ? ? ? ? ? ? ? ?kI(data)[1]=2;> > ? ? ? ? ? ? ? ?K dict=xD(columns, data);> > ? ? ? ? ? ? ? ?K tbl=xT(dict);> > ? ? ? ? ? ? ? ?K kBoolean=ki(100);> > ? ? ? ? ? ? ? ?return EXIT_SUCCESS;> > ? ? ? ?}> > }- Hide quoted text ->> - Show quoted text -</dbto…></attila.vrab…>
Date: Tue, 10 Mar 2009 14:50:43 +0000Message-ID: <1855e77f0903100750s4bc95796y8ea1ed7f6d2dde07@mail.gmail.com>Subject: Re: [personal kdb+] Re: inspect table object in C interfaceFrom: Attila Vrabecz <attila.vrabecz>To: personal-kdbplus@googlegroups.comcolumn names has to be a vector of symbols (S), not characters (C)K columns = ktn(KS, 2);kS(columns)[0]=ss(“a”);kS(columns)[1]=ss(“b”);or something like that AttilaOn Tue, Mar 10, 2009 at 2:39 PM, dbtouch wrote:>> Thanks, Attila. I found out in my program, tbl is NULL. So the flip> failed. Could you suggest what is possibly wrong with my program. I> inspect dict and it is good.>> Thanks,>> dbtouch>> On Mar 10, 10:15?am, Attila Vrabecz <attila.vrab…> wrote:>> tbl->k is the dictionary which maps column-names to column-vectors>> kK(tbl->k)[0] is keys (column-names)>> kK(tbl->k)[0] is values (column-vectors)>>>> it all becomes a lot easier if you use x for a tablename because then>> you can use the shortcuts (xk, xx, xy, etc) defined in k.h>> ? Attila>>>>>>>> On Tue, Mar 10, 2009 at 1:58 PM, dbtouch <dbto…> wrote:>>>> > Dear K programmers,>>>> > Please take a look at this simple C interface program. I created table>> > object tbl from dict and I tried to inspect tbl using debugger and I>> > could not see valid data member in tbl. Can someone tell me in which>> > data member of tbl, the table data is saved?>>>> > dbtouch>>>> > ?#include “k.h”>> > #include >> > #include >> > int main(int argc, char* argv)>> > {>> > ? ? ? ?K err;>> > ? ? ? ?I kdbSocketHandle = khp(argv[1], (short)atoi(argv[2]));>>>> > ? ? ? ?if (kdbSocketHandle > 0) {>> > ? ? ? ? ? ? ? ?K columns = ktn(KC, 2);>> > ? ? ? ? ? ? ? ?kC(columns)[0]=‘a’;>> > ? ? ? ? ? ? ? ?kC(columns)[1]=‘b’;>>>> > ? ? ? ? ? ? ? ?K data = ktn(KI, 2);>> > ? ? ? ? ? ? ? ?kI(data)[0]=1;>> > ? ? ? ? ? ? ? ?kI(data)[1]=2;>> > ? ? ? ? ? ? ? ?K dict=xD(columns, data);>> > ? ? ? ? ? ? ? ?K tbl=xT(dict);>> > ? ? ? ? ? ? ? ?K kBoolean=ki(100);>> > ? ? ? ? ? ? ? ?return EXIT_SUCCESS;>> > ? ? ? ?}>> > }- Hide quoted text ->>>> - Show quoted text -> >></dbto…></attila.vrab…></attila.vrabecz>
Thanks a lot, Attila.dbtouchOn Mar 10, 10:50?am, Attila Vrabecz <attila.vrab…> wrote:> column names has to be a vector of symbols (S), not characters (C)> K columns = ktn(KS, 2);> kS(columns)[0]=ss(“a”);> kS(columns)[1]=ss(“b”);> or something like that> ? Attila>>>> On Tue, Mar 10, 2009 at 2:39 PM, dbtouch <dbto…> wrote:>> > Thanks, Attila. I found out in my program, tbl is NULL. So the flip> > failed. Could you suggest what is possibly wrong with my program. I> > inspect dict and it is good.>> > Thanks,>> > dbtouch>> > On Mar 10, 10:15?am, Attila Vrabecz <attila.vrab…> wrote:> >> tbl->k is the dictionary which maps column-names to column-vectors> >> kK(tbl->k)[0] is keys (column-names)> >> kK(tbl->k)[0] is values (column-vectors)>> >> it all becomes a lot easier if you use x for a tablename because then> >> you can use the shortcuts (xk, xx, xy, etc) defined in k.h> >> ? Attila>> >> On Tue, Mar 10, 2009 at 1:58 PM, dbtouch <dbto…> wrote:>> >> > Dear K programmers,>> >> > Please take a look at this simple C interface program. I created table> >> > object tbl from dict and I tried to inspect tbl using debugger and I> >> > could not see valid data member in tbl. Can someone tell me in which> >> > data member of tbl, the table data is saved?>> >> > dbtouch>> >> > ?#include “k.h”> >> > #include > >> > #include > >> > int main(int argc, char* argv)> >> > {> >> > ? ? ? ?K err;> >> > ? ? ? ?I kdbSocketHandle = khp(argv[1], (short)atoi(argv[2]));>> >> > ? ? ? ?if (kdbSocketHandle > 0) {> >> > ? ? ? ? ? ? ? ?K columns = ktn(KC, 2);> >> > ? ? ? ? ? ? ? ?kC(columns)[0]=‘a’;> >> > ? ? ? ? ? ? ? ?kC(columns)[1]=‘b’;>> >> > ? ? ? ? ? ? ? ?K data = ktn(KI, 2);> >> > ? ? ? ? ? ? ? ?kI(data)[0]=1;> >> > ? ? ? ? ? ? ? ?kI(data)[1]=2;> >> > ? ? ? ? ? ? ? ?K dict=xD(columns, data);> >> > ? ? ? ? ? ? ? ?K tbl=xT(dict);> >> > ? ? ? ? ? ? ? ?K kBoolean=ki(100);> >> > ? ? ? ? ? ? ? ?return EXIT_SUCCESS;> >> > ? ? ? ?}> >> > }- Hide quoted text ->> >> - Show quoted text – Hide quoted text ->> - Show quoted text -</dbto…></attila.vrab…></dbto…></attila.vrab…>