AryaWu/sqlite
0
1# 2014 October 012#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 testing the SQLITE_DIRECT_OVERFLOW_READ logic.13#14 15set testdir [file dirname $argv0]16source $testdir/tester.tcl17set testprefix ovfl18 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 text24# value of c1 ranges in size from 1 to 2000 bytes. The idea is to create25# at least one row where the first byte of c2 is also the first byte of26# an overflow page. This was at one point exposing an obscure bug in the27# SQLITE_DIRECT_OVERFLOW_READ logic.28#29do_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 COMMIT41} {}42 43do_execsql_test 1.2 {44 SELECT sum(length(c2)) FROM t1;45} [expr 2000 * 2000]46 47finish_test48 