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 OOM error handling within the built-in
13 # group_concat() and string_agg() functions.
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
18 set testprefix gcfault
26 sqlite3_db_config_lookaside db 0 0 0
27 execsql "PRAGMA encoding = $enc"
29 do_execsql_test 1.$enc.1 {
31 INSERT INTO s VALUES(1, ',0123456789,');
32 INSERT INTO s VALUES(2, X'2c303132333435363738392c');
35 INSERT INTO e VALUES('v1'), ('v2');
38 do_faultsim_test 1.$enc.1 -faults oom* -body {
39 execsql { SELECT group_concat(e, (SELECT s FROM s WHERE i=1)) FROM e }
42 do_faultsim_test 1.$enc.2 -faults oom-t* -body {
43 execsql { SELECT string_agg(e, (SELECT s FROM s WHERE i=2)) FROM e }
46 do_faultsim_test 1.$enc.3 -faults oom-t* -prep {
47 set ::STMT [sqlite3_prepare db {SELECT group_concat(e, ?) FROM e} -1 dummy]
48 sqlite3_bind_text $::STMT 1 ",0123456789," 12
50 while { "SQLITE_ROW"==[sqlite3_step $::STMT] } { }
52 sqlite3_finalize $::STMT