Small performance optimization in sqlite3VdbeRecordCompareWithSkip() for
[sqlite.git] / test / ovfl.test
blob4be75685469fc149b4d194643bdc5633e09f1cd0
1 # 2014 October 01
3 # The author disclaims copyright to this source code.  In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library.  The
12 # focus of this file is testing the SQLITE_DIRECT_OVERFLOW_READ logic.
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
17 set testprefix ovfl
19 # Populate table t2:
21 #   CREATE TABLE t1(c1 TEXT, c2 TEXT);
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.
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 } {}
43 do_execsql_test 1.2 {
44   SELECT sum(length(c2)) FROM t1;
45 } [expr 2000 * 2000]
47 finish_test