CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
memdb2.test77 linesDownload Raw Back to test
1# 2022-12-052#3# The author disclaims copyright to this source code.  In place of4# a legal notice, here is a blessing:5#6#    May you do good and not evil.7#    May you find forgiveness for yourself and forgive others.8#    May you share freely, never taking more than you give.9#10#***********************************************************************11# This file implements regression tests for SQLite library.  The12# focus of this file is the "memdb" VFS13#14 15set testdir [file dirname $argv0]16source $testdir/tester.tcl17set testprefix memdb218do_not_use_codec19 20ifcapable !deserialize {21  finish_test22  return23}24 25db close26 27#-------------------------------------------------------------------------28# Test that when using a memdb database, it is not possible to upgrade29# to an EXCLUSIVE lock if some other client is holding SHARED.30#31foreach {tn fname} {32    1   file:/test.db?vfs=memdb33    2   file:\\test.db?vfs=memdb34} {35  if {$tn==2} breakpoint36  sqlite3 db  $fname -uri 137  sqlite3 db2 $fname -uri 138 39  40  do_execsql_test 1.$tn.1 {41    CREATE TABLE t1(x, y);42    INSERT INTO t1 VALUES(1, 2);43  }44  45  do_execsql_test -db db2 1.$tn.2 {46    BEGIN;47      SELECT * FROM t1;48  } {1 2}49  50  do_execsql_test 1.$tn.3 {51    BEGIN;52      INSERT INTO t1 VALUES(3, 4);53  }54  55  do_catchsql_test 1.$tn.4 {56    COMMIT57  } {1 {database is locked}}58  59  do_execsql_test -db db2 1.$tn.5 {60      SELECT * FROM t1;61    END;62  } {1 2}63  64  do_execsql_test 1.$tn.6 {65    COMMIT66  } {}67  68  do_execsql_test -db db2 1.$tn.7 {69    SELECT * FROM t170  } {1 2 3 4}71  72  db close73  db2 close74}75 76finish_test77