libdoltlite-sys 0.38.21

Native bindings to the DoltLite SQLite-compatible library
Documentation
#
# 19-July-2020
#
#-------------------------------------------------------------------------
#

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

if {$::C(namebytes)>=24} {

# Test that the VFS uses existing blocks if possible.
set CNAME cont124
bcv_create_container $CNAME

bcv_upload_empty_database $CNAME test.db1
bcv_upload_empty_database $CNAME test.db2

bcv_mkdir testdir
set bcvfs [bcvfs_create testdir bcvfs]
bcvfs_attach $bcvfs $CNAME
set bcv [bcv_open $CNAME]

sqlite3 db  /$CNAME/test.db1 -vfs bcvfs
sqlite3 db2 /$CNAME/test.db2 -vfs bcvfs
sqlite3_bcvfs_register_vtab db

$bcv cleanup 0
$bcvfs poll $CNAME
do_execsql_test 1.0 {
  CREATE TABLE t1(a, b);
  INSERT INTO t1 VALUES(1, 2);
  INSERT INTO t1 VALUES(3, 4);
  PRAGMA bcv_upload;
}

do_test 1.1 {
  $bcv cleanup 0
  execsql { SELECT count(*) FROM bcv_tfs }
} {4}

do_execsql2_test 1.2 {
  CREATE TABLE t1(a, b);
  INSERT INTO t1 VALUES(1, 2);
  INSERT INTO t1 VALUES(3, 4);
  PRAGMA bcv_upload;
}

do_test 1.3 {
  $bcv cleanup 0
  execsql { SELECT count(*) FROM bcv_tfs }
} {3}

db  close
db2 close
$bcvfs destroy
$bcv close

}
finish_test