libdoltlite-sys 0.38.26

Native bindings to the DoltLite SQLite-compatible library
Documentation
#
# 25-Feb-2022
#
#-------------------------------------------------------------------------
# Check that prefetch works with secure databases.
#

source [file join [file dirname [info script]] test_common.tcl]
set testprefix dmn_secure2

bcv_create_container cont1
bcv_upload_new_db cont1 t1.db {
  CREATE TABLE t1(a, b);
  WITH s(i) AS (
    SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<1000
  )
  INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM s;
}

start_new_daemon 0 
set cmd [bcvfs_create testdir.0 "bcvfs"]
bcvfs_attach -secure $cmd cont1

sqlite3 db /cont1/t1.db -vfs bcvfs

do_execsql_test 1.0 {
  SELECT sql FROM sqlite_schema
} {{CREATE TABLE t1(a, b)}}

do_test 1.1 {
  $cmd prefetch_new pf cont1 t1.db
  while {0==[pf run 1 1000]} { }
  pf destroy
} {}

do_execsql_test 1.2 {
  PRAGMA integrity_check
} {ok}

db close
$cmd destroy
wait_daemon 0

bcv_mkdir testdir.0

finish_test