1# 2019-04-11 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_dbpage virtual table. 13# 14 15set testdir [file dirname $argv0] 16source $testdir/tester.tcl 17set testprefix dbdata 18 19ifcapable !vtab||!compound { 20 finish_test 21 return 22} 23db enable_load_extension 1 24if { [catch { db eval { SELECT load_extension('../dbdata') } }] } { 25 finish_test 26 return 27} 28 29do_execsql_test 1.0 { 30 CREATE TABLE T1(a, b); 31 INSERT INTO t1(rowid, a ,b) VALUES(5, 'v', 'five'); 32 INSERT INTO t1(rowid, a, b) VALUES(10, 'x', 'ten'); 33} 34 35do_execsql_test 1.1 { 36 SELECT pgno, cell, field, quote(value) FROM sqlite_dbdata WHERE pgno=2; 37} { 38 2 0 -1 5 39 2 0 0 'v' 40 2 0 1 'five' 41 2 1 -1 10 42 2 1 0 'x' 43 2 1 1 'ten' 44} 45 46set big [string repeat big 2000] 47do_execsql_test 1.2 { 48 INSERT INTO t1 VALUES(NULL, $big); 49 SELECT value FROM sqlite_dbdata WHERE pgno=2 AND cell=2 AND field=1; 50} $big 51 52 53 54finish_test 55