Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
    Page
Library
Module
Module type
Parameter
Class
Class type
Source
TblStorage.ml1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44(** {1 STORAGETYPE_storage} *) open Sqlite3Ops module Stmts = struct type t = { storagetype : StorageType.t } let create storagetype = { storagetype } let ddl_CREATE_TABLE { storagetype } = Printf.sprintf {| CREATE TABLE IF NOT EXISTS %s_storage ( id INTEGER PRIMARY KEY CHECK (id = 0), -- only one record allowed in table storagedir TEXT -- the absolute path to the cache directory ) STRICT |} (StorageType.name storagetype) let dml_INSERT_INTO { storagetype } = Printf.sprintf {| INSERT OR IGNORE INTO %s_storage (id, storagedir) VALUES (0, :storagedir) |} (StorageType.name storagetype) end (** Create the [STORAGETYPE_storage] table *) let upgrade_table ~db ~schema_version:_ ~storagetype ~storagedir = let open Sqlite3 in let stmts = { Stmts.storagetype } in let name = StorageType.name storagetype in exec_ddl_exn ~errbrief:(Printf.sprintf "Could not CREATE TABLE %s_storage." name) db (Stmts.ddl_CREATE_TABLE stmts); (* Insert into the version record *) exec_dml_exn ~errbrief:(Printf.sprintf "Could not INSERT INTO %s_storage." name) db (Stmts.dml_INSERT_INTO stmts) [ (":storagedir", Data.TEXT (Fpath.to_string storagedir)) ]; Ok ()