CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
tkt1873.test73 linesDownload Raw Back to test
1# 2006 June 272#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.12#13# This file implements tests to verify that ticket #1873 has been14# fixed.  15#16#17# $Id: tkt1873.test,v 1.2 2007/10/09 08:29:33 danielk1977 Exp $18 19set testdir [file dirname $argv0]20source $testdir/tester.tcl21 22ifcapable !attach {23  finish_test24  return25}26 27forcedelete test2.db test2.db-journal28 29do_test tkt1873-1.1 {30  execsql {31    CREATE TABLE t1(x, y);32    ATTACH 'test2.db' AS aux;33    CREATE TABLE aux.t2(x, y);34    INSERT INTO t1 VALUES(1, 2);35    INSERT INTO t1 VALUES(3, 4);36    INSERT INTO t2 VALUES(5, 6);37    INSERT INTO t2 VALUES(7, 8);38  }39} {}40 41do_test tkt1873-1.2 {42  set rc [catch {43    db eval {SELECT * FROM t2 LIMIT 1} {44      db eval {DETACH aux}45    }46  } msg]47  list $rc $msg48} {1 {database aux is locked}}49 50do_test tkt1873-1.3 {51  set rc [catch {52    db eval {SELECT * FROM t1 LIMIT 1} {53      db eval {DETACH aux}54    }55  } msg]56  list $rc $msg57} {0 {}}58 59do_test tkt1873-1.4 {60  catchsql {61    select * from t2;62  }63} {1 {no such table: t2}}64 65do_test tkt1873-1.5 {66  catchsql {67    ATTACH 'test2.db' AS aux;68    select * from t2;69  }70} {0 {5 6 7 8}}71 72finish_test73