nsmcp::AccessRecordStoreSQLite method scope (public)

 <instance of nsmcp::AccessRecordStoreSQLite[i]> scope files

Defined in /usr/local/ns/tcl/nsmcp/log-traffic-record-store.tcl

Parameters:
files (required)

Testcases:
No testcase defined.
Source code:
if {${:mode} eq "reader"} {${:db} execute {PRAGMA query_only=OFF}}
${:db} execute {DROP VIEW IF EXISTS temp.nsmcp_record_window; DROP TABLE IF EXISTS temp.nsmcp_record_scope;
    CREATE TEMP TABLE nsmcp_record_scope(fid INTEGER PRIMARY KEY,lo INTEGER,hi INTEGER)}
foreach file $files {
    if {![dict exists $file archiveFid] || [dict get $file status] eq "outside-window"} continue
    set fid [dict get $file archiveFid]; set lo [dict get $file archiveLo]; set hi [dict get $file offset]
    ${:db} execute {INSERT INTO temp.nsmcp_record_scope VALUES($fid,$lo,$hi)}
}
${:db} execute BEGIN; set :querying true
foreach file $files {
    if {[dict exists $file archiveFid]} {
        set fid [dict get $file archiveFid]
        if {$fid>=0 && ![${:db} scalar {SELECT count(*) FROM nsmcp_records.files WHERE fid=$fid}]} {error "record-store-generation-changed"}
    }
}
${:db} execute {CREATE TEMP VIEW nsmcp_record_window AS SELECT r.* FROM nsmcp_records.rows r
    JOIN temp.nsmcp_record_scope s ON r.fid=s.fid AND r.off>=s.lo AND r.off<s.hi AND r.stop<=s.hi}
if {${:mode} eq "reader"} {${:db} execute {PRAGMA query_only=ON}}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: