#!/usr/local/bin/apl --script -- ⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝ ⍝ ⍝ ComponentFiles 2014-07-14 12:26:28 (GMT-5) ⍝ ⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝ )copy 5 SQL ∇cid←data CF_APPEND fh;r;tbl;⎕IO;i;n;data2 ⎕IO←1 ⎕ES((~(fh←''⍴fh)∊_CF_MAP[;1])∨(1≠⍴,fh)∨1<≡fh)/'INVALID FILE HANDLE' ⎕ES(0=⎕NC'data')/'MISSING DATA' cid←_CF_MAP[i←''⍴(fh=_CF_MAP[;1])/⍳1↑⍴_CF_MAP;3] tbl←⊃_CF_MAP[i;2] data2←14 ⎕CR data n←0 LOOP:→(2000<⍴data2)/BIG∆NEW '→TRY∆AGAIN'⎕EA'r←(''insert into '',tbl,'' (ikey, sdata) values (?, ?);'')SQL∆Exec[_CF_DB] cid data2' _CF_MAP[i;3]←cid+1 →0 BIG∆NEW:'→TRY∆AGAIN'⎕EA'r←(''insert into '',tbl,'' (ikey, ldata) values (?, ?);'')SQL∆Exec[_CF_DB] cid data2' _CF_MAP[i;3]←cid+1 →0 ⍝ It is possible that some other application appended a new component and our max is out-of-sync. ⍝ Update component ID and try again. TRY∆AGAIN:⎕ES(_CF_MAX_TRIES