Hello Experts,
I have trolled the archives looking for a solution, to no avail. Apologies if this has been answered before.
I am attempting a bulk insert from C to Q.
here is the Q script:
quote:( date:date$(); sym:
$();time:time$(); mkt:
$(); bidpx: long$(); bidsize:
int$(); bidcount:int$(); askpx:
long$(); asksize:int$(); askcount:
int$(); mkttimestamp:`timestamp$())
.u.upd:{[t;d] t insert d}
…
In C++, I do:
…
enum FieldList
{
DATE,
SYM,
TIME,
…
FieldCount
};
K q = ktn(0, FieldCount);
QuoteList::size_type count = quotes.size();
K date = kK(q)[DATE] = ktn(KD, count);
K sym = kK(q)[SYM] = ktn(KS, count);
K time = kK(q)[TIME] = ktn(KT, count);
…
QuoteList::const_iterator s = quotes.begin(), f = quotes.end();
int i = 0;
for(;s!=f;++s,++i)
{
const KdbQuote& quote = (*s);
kI(date)[i] = kLocalDate(quote.eventTime);
kS(sym)[i] = ss((char*)quote.symbol.c_str());
…
}
//finally
K r = k(0,(char*)“.u.upd”, ks(ss((char*)“quote”)), q, (K)0 );
… the problem is …
Here, q throws a segv in r0()
Program received signal SIGSEGV, Segmentation fault.
0x00000000004156eb in r0 ()
(gdb) where
#0 0x00000000004156eb in r0 ()
#1 0x0000000000415866 in r0 ()
#2 0x0000000000415866 in r0 ()
#3 0x0000000000419c5a in k ()
#4 0x00002aaaafc599b3 in Accumulator::pub (this=0x7fffffffd9c0, quotes=…) at /home/n596524/workspace/FXGATEWAYS/trunk/kdb/Accumulator.cpp:123
On the surface it appears like a reference count problem, but I’m not sure what the issue is. Perhaps the inner lists need their references incremented?
Thanks.