Sha256: 4bd82c000675ce6a83a88733e73c7f84053cf25c3e7940501d8b83e3a623dba0
Contents?: true
Size: 625 Bytes
Versions: 1
Compression:
Stored size: 625 Bytes
Contents
require 'sqlite3' module Docset class IndexDB def initialize(file) @db = SQLite3::Database.new(file) @db.busy_timeout(5000) end def init @db.execute_batch(<<~SQL) DROP TABLE IF EXISTS searchIndex; CREATE TABLE searchIndex(id INTEGER PRIMARY KEY, name TEXT, type TEXT, path TEXT); CREATE UNIQUE INDEX anchor ON searchIndex (name, type, path); SQL end def add_index(name, type, path) @db.prepare("INSERT OR IGNORE INTO searchIndex(name, type, path) VALUES (?, ?, ?);") do |stmt| stmt.execute([name, type, path]) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
docset-0.1.0 | lib/docset/index_db.rb |