-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade to latest std lib. Save found 'outOfProcess' access record fi…
…eld.
- Loading branch information
1 parent
c0a5617
commit 0d67a75
Showing
4 changed files
with
13 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { DB } from 'https://deno.land/x/[email protected]/mod.ts'; | ||
import { AccessRecord, checkAccessRecord, checkDomainRecord, DomainRecord, isAccessRecordBeta1, isDomainRecordBeta1 } from './model.ts'; | ||
|
||
const VERSION = 2; | ||
const VERSION = 3; | ||
|
||
export class Database { | ||
private readonly _db: DB; | ||
|
@@ -21,6 +21,7 @@ export class Database { | |
timestamp text not null, | ||
version integer null, | ||
category text null, | ||
outOfProcess text null, | ||
primary key (filename, line)) without rowid`); | ||
|
||
this._db.query(`create table if not exists domain${VERSION}( | ||
|
@@ -66,13 +67,12 @@ export class Database { | |
this._db.query(`delete from access${VERSION} where filename = ?`, [ filename ]); | ||
} | ||
|
||
insertAccess(filename: string, line: number, record: AccessRecord, category: string | undefined) { | ||
insertAccess(filename: string, line: number, record: AccessRecord, category: string | undefined, outOfProcess: string | undefined) { | ||
const timestamp = checkAccessRecord(record); | ||
const version = isAccessRecordBeta1(record) ? record.version : undefined; | ||
const stream = isAccessRecordBeta1(record) ? record.stream : undefined; | ||
|
||
this._db.query(`insert into access${VERSION}(filename, line, stream, accessorIdentifier, accessorIdentifierType, tccService, identifier, kind, timestamp, version, category) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, | ||
[filename, line, stream, record.accessor.identifier, record.accessor.identifierType, record.tccService, record.identifier, record.kind, timestamp, version, category]); | ||
this._db.query(`insert into access${VERSION}(filename, line, stream, accessorIdentifier, accessorIdentifierType, tccService, identifier, kind, timestamp, version, category, outOfProcess) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, | ||
[filename, line, stream, record.accessor.identifier, record.accessor.identifierType, record.tccService, record.identifier, record.kind, timestamp, version, category, outOfProcess]); | ||
if (this._db.changes !== 1) throw new Error(`Failed to insert access record`); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters