CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
fts3fault3.test83 linesDownload Raw Back to test
1# 2023 October 23 2#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#12 13set testdir [file dirname $argv0]14source $testdir/tester.tcl15 16set ::testprefix fts3fault17 18# If SQLITE_ENABLE_FTS3 is not defined, omit this file.19ifcapable !fts3 { finish_test ; return }20 21set ::TMPDBERROR [list 1 \22  {unable to open a temporary database file for storing temporary tables}23]24 25 26# Test error handling in an "ALTER TABLE ... RENAME TO" statement on an27# FTS3 table. Specifically, test renaming the table within a transaction28# after it has been written to.29#30do_execsql_test 1.0 {31  CREATE VIRTUAL TABLE t1 USING fts3(a);32  INSERT INTO t1 VALUES('test renaming the table');33  INSERT INTO t1 VALUES(' after it has been written');34  INSERT INTO t1 VALUES(' actually other stuff instead');35}36faultsim_save_and_close37do_faultsim_test 1 -faults oom* -prep { 38  faultsim_restore_and_reopen39  execsql {40    BEGIN;41      DELETE FROM t1 WHERE rowid=2;42  }43} -body {44  execsql {45    DELETE FROM t1;46  }47} -test {48  catchsql { COMMIT }49  faultsim_integrity_check50  faultsim_test_result {0 {}}51}52 53#-------------------------------------------------------------------54reset_db55 56do_execsql_test 2.0 {57  BEGIN;58  CREATE VIRTUAL TABLE t1 USING fts3(a);59  WITH s(i) AS (60      SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<5061  )62  INSERT INTO t1 SELECT 'abc def ghi jkl mno pqr' FROM s;63  COMMIT;64}65 66faultsim_save_and_close67do_faultsim_test 2 -faults oom-t* -prep { 68  faultsim_restore_and_reopen69  execsql {70    BEGIN;71      CREATE TABLE x1(a PRIMARY KEY);72  }73} -body {74  execsql {75    PRAGMA integrity_check;76  }77} -test {78  faultsim_test_result {0 ok} $::TMPDBERROR79}80 81 82finish_test83