gitlab.com/CoiaPrant/sqlite3@v1.19.1/testdata/tcl/ovfl.test (about) 1 # 2014 October 01 2 # 3 # The author disclaims copyright to this source code. In place of 4 # 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. The 12 # focus of this file is testing the SQLITE_DIRECT_OVERFLOW_READ logic. 13 # 14 15 set testdir [file dirname $argv0] 16 source $testdir/tester.tcl 17 set testprefix ovfl 18 19 # Populate table t2: 20 # 21 # CREATE TABLE t1(c1 TEXT, c2 TEXT); 22 # 23 # with 2000 rows. In each row, c2 spans multiple overflow pages. The text 24 # value of c1 ranges in size from 1 to 2000 bytes. The idea is to create 25 # at least one row where the first byte of c2 is also the first byte of 26 # an overflow page. This was at one point exposing an obscure bug in the 27 # SQLITE_DIRECT_OVERFLOW_READ logic. 28 # 29 do_test 1.1 { 30 set c2 [string repeat abcdefghij 200] 31 execsql { 32 PRAGMA cache_size = 10; 33 CREATE TABLE t1(c1 TEXT, c2 TEXT); 34 BEGIN; 35 } 36 for {set i 1} {$i <= 2000} {incr i} { 37 set c1 [string repeat . $i] 38 execsql { INSERT INTO t1 VALUES($c1, $c2) } 39 } 40 execsql COMMIT 41 } {} 42 43 do_execsql_test 1.2 { 44 SELECT sum(length(c2)) FROM t1; 45 } [expr 2000 * 2000] 46 47 finish_test