Cover00: {[table;ops;blox;vars;sid;uid;pw;pvlen;ctf;cols;rows] / Process blocks and inserts /`0:"Cover on ",(5:table)," - before process ops are: ",(5:ops),"\n" if[1=#table;.b[`curtab]:table; .b[`suffix]:_n; .b[`curtab_title]:_n; .b[`subtitle]:_n] if[1<#table;.b[`curtab]:*table;.b[`suffix]:table 1;.b[`curtab_title]:table 2;.b[`subtitle]:table 3] if["_"=*$`.b@`curtab;.b[`curtab]:`$1_$`.b@`curtab] /AJK20130605 nofilter marker kludge if[_n~`.b@`curtab_title;.b[`curtab_title]:`$$(~`.b@`curtab)[`W;`l]] .b[`uid]:uid /AJK20130329 may be needed by block code before accum initializes it ops:ops _di &`source~/:*:'ops /20170305 delete tag in ops before macro language processing to avoid pointless extra expansion .opstack,:.((`type;`preprocess);(`ops;ops)) .mdb.setbox[_n;`state; `preprocess] T:_T r:ProcessMacroMacros[ops;blox;vars;sid;uid;pw] if[1~.lim`tmm;`0:"Block processing ",(5:86400000*_T-T),"ms\n"] .opstack:-1_.opstack /`0:"Cover on ",(5:table)," - AFTER process ops are: ",(5:*r),"\n" .opstack,:.((`type;`renumber);(`level;`preprocess);(`map;r 1);(`pre;ops);(`post;*r)) ops:*r blox:*|r ops[w]:{(`note;.();x)}'ops@w:&-3=4::'ops /deal with stray text by making it a note .memo.set[table]ops q:.memo.get[table]ops if[~ops~q 1 u:.+(`sid`uid`pswd;(sid;uid;dbd.dbi.pwe.EncryptPW[.,(`sid;sid);pw])) .memo.res[u]. q .opstack,:.((`type;`memoize);(`pre;(table;ops));(`post;q)) table:*q;ops:q 1] .mdb.setbox[_n;`state; `execute] r:Cover0[table;ops;blox;vars;sid;uid;pw;pvlen;ctf;cols;rows] .mdb.setbox[_n;`state; `_n] .opstack:-1_.opstack r} /END Cover \ / disqualifiers tt:{"_"=*$x} / temp table? bm:{|/`dynamic`loop`do`widget _lin*:'x} / block language macros? / column references col:{:[~-3=4:x;?(,/_f'1_ x)_dv`;.parse.a[`nam]x;,`$x;()]} / column token or ` rcol:{:[rfun y;x;()]} / column state if r_(;.. rfun:{:[4:x;0;~_sm["",*x;"r_*"];|/_f'1_ x;"_n"~x 1;1;|/_f'1_ x]} / r_ function w/ null C / dispersed match: sel:{""} willbe:{""} link:{""} linksel:{(-2_ link[x;y]z)," type=select/>"} table:{"\n",(nl@co'$+x[]),"
"} join:{1_,/x,'y};co:join[","];nl:join["\n"] memoize:{(-2_ materialize x)," memoize=1/>"} materialize:{""} colord:{""} t:.+(`state`city`sel`order`stat (`CA`CA`CA`CA`TX`TX`TX`TX`TX `LA`LA`SF`SF`DA`DS`DS`HO`AS 1 1 0 1 1 1 1 1 0 1 2 2 1 1 2 3 4 5 4 10 0 2 5 0N 5 0N 8)) u:.+(`state`pop;(`CA`TX;1000 2000)) v:.+(`state`pop;(,`CA;,1000)) / store the memoization template in the bag server: d:nl(table t;willbe[`r;"g_sum(city;;stat)";"canselect=state"];memoize`sticky) Q[`default.lonely;d] / memoize: t -> `sticky, o -> select state='CA' r:nl(table t;sel"state='CA'";willbe[`r;"g_sum(city;;stat)";"canselect=state"]) Q[`default.lonely;r] / recursive memoization stored queries: qry:"" query[h;ENV.TAB`autosales;qry;_n] qry:"" query[h;ENV.TAB`autosales;qry;_n] qry:" " query[h;ENV.TAB`auto3;qry;_n] qry:" " query[h;ENV.TAB`auto2;qry;_n] qry:" " query[h;ENV.TAB`autosales;qry;_n] input query: qry:" 1993\"/> " query[h;ENV.TAB`autosales;qry;_n] memoized executable form (abbreviated): (`.db.mdb_regression_tester.mdb_regression_test_folder.abc ((`sel : (`link .((`table2;`.db.mdb_regression_tester.mdb_regression_test_folder.ott;) : (`ops ((`sel : (`link .((`table2;`.db.mdb_regression_tester.mdb_regression_test_folder.xyz;) : (`ops ,(`sel : (`willbe .((`name;`abc;) : from before accum call: (`.db.mdb_regression_tester.mdb_regression_test_folder.auto3 ((`sel .((`value;"year<1996";) (`SOURCE_;"3 1 0";))) (`willbe .((`name;`xx;) (`SOURCE_;"3 1 1";))) (`willbe .((`name;`xy;) (`SOURCE_;"3 1 2";))) (`willbe .((`name;`xz;) (`SOURCE_;"3 1 3";))))) -> (`.db.mdb_regression_tester.mdb_regression_test_folder.xyz ,(`sel .((`value;"year<1996";) (`SOURCE_;"3 1 0";)))) ====== (`.db.mdb_regression_tester.mdb_regression_test_folder.auto2 ((`sel .((`value;"year>1993";) (`SOURCE_;"3 0";))) (`link .((`table2;`.db.temp_tables.t0;) (`SOURCE_;"3 1";))) (`willbe .((`name;`xone;) (`SOURCE_;"3 2";))) (`willbe .((`name;`xtwo;) (`SOURCE_;"3 3";))) (`willbe .((`name;`xthree;) (`SOURCE_;"3 4";))))) -> Cache[1;1] (`.db.mdb_regression_tester.mdb_regression_test_folder.ott ((`sel .((`value;"year>1993";) (`SOURCE_;"3 0";))) (`link .((`table2;`.db.temp_tables.t0;) (`SOURCE_;"3 1";))))) ======== (`.db.mdb_regression_tester.mdb_regression_test_folder.autosales ((`willbe .((`name;`xc;) (`SOURCE_;",0";))) (`willbe .((`name;`xb;) (`SOURCE_;",1";))) (`willbe .((`name;`xa;) (`SOURCE_;",2";))) (`link .((`table2;`.db.temp_tables.t1;) (`SOURCE_;",3";))))) (`willbe .((`name;`abc;) (`SOURCE_;",4";)))))) -> (`.db.mdb_regression_tester.mdb_regression_test_folder.abc ((`link .((`table2;`.db.temp_tables.t1;) (`SOURCE_;",3";))) (`willbe .((`name;`abc;) (`SOURCE_;",4";)))))