Category=Database Maintenance - CAUTION
Name=Load Apoc Segments Into Database
Description=Loads Apoc Segments Into Database from revsegments.csv

Heading=Add Segment
ImportDupCheck=SELECT * FROM SEGMENTS WHERE VERSE={0} AND CONTEXTDESCRIPTION='{1}'
ImportFile=revsegments.csv|INSERT INTO SEGMENT (SEGMENTVIEWID, VERSE, CONTEXTDESCRIPTION, WORDSTART, WORDEND) VALUES (1, {0}, '{1}', 0, 0)
SQL=NA

Heading2=Add Readings for Segment
ImportFile2=revsegments.csv|[{2}/+]INSERT INTO SEGMENTREADING (SEGMENTID, READING) select SEGMENTID, '{0}' FROM SEGMENT WHERE SEGMENTVIEWID=1 AND VERSE={1} AND CONTEXTDESCRIPTION='{2}'
SQL2=NA

Heading3=Add Segments to Segment Group
ImportFile3=revsegments.csv|INSERT INTO SEGMENTGROUPSEGMENT (SEGMENTGROUPID, SEGMENTID) select 1, SEGMENTID FROM SEGMENT WHERE SEGMENTVIEWID=1 AND VERSE={0} AND CONTEXTDESCRIPTION='{1}'
SQL3=NA

