1*ac79fa1cSdan# 2022 October 18 2*ac79fa1cSdan# 3*ac79fa1cSdan# The author disclaims copyright to this source code. In place of 4*ac79fa1cSdan# a legal notice, here is a blessing: 5*ac79fa1cSdan# 6*ac79fa1cSdan# May you do good and not evil. 7*ac79fa1cSdan# May you find forgiveness for yourself and forgive others. 8*ac79fa1cSdan# May you share freely, never taking more than you give. 9*ac79fa1cSdan# 10*ac79fa1cSdan#*********************************************************************** 11*ac79fa1cSdan# 12*ac79fa1cSdan 13*ac79fa1cSdanset testdir [file dirname $argv0] 14*ac79fa1cSdansource $testdir/tester.tcl 15*ac79fa1cSdanset testprefix windowE 16*ac79fa1cSdan 17*ac79fa1cSdanproc custom {a b} { return [string compare $a $b] } 18*ac79fa1cSdandb collate custom custom 19*ac79fa1cSdan 20*ac79fa1cSdando_execsql_test 1.0 { 21*ac79fa1cSdan CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT COLLATE custom); 22*ac79fa1cSdan INSERT INTO t1 VALUES(1, 'one'); 23*ac79fa1cSdan INSERT INTO t1 VALUES(2, 'two'); 24*ac79fa1cSdan INSERT INTO t1 VALUES(3, 'three'); 25*ac79fa1cSdan INSERT INTO t1 VALUES(4, 'four'); 26*ac79fa1cSdan INSERT INTO t1 VALUES(5, 'five'); 27*ac79fa1cSdan INSERT INTO t1 VALUES(6, 'six'); 28*ac79fa1cSdan CREATE INDEX t1b ON t1(b); 29*ac79fa1cSdan} 30*ac79fa1cSdan 31*ac79fa1cSdando_execsql_test 1.1 { 32*ac79fa1cSdan SELECT * FROM t1 33*ac79fa1cSdan} { 34*ac79fa1cSdan 1 one 2 two 3 three 4 four 5 five 6 six 35*ac79fa1cSdan} 36*ac79fa1cSdan 37*ac79fa1cSdando_execsql_test 1.2 { 38*ac79fa1cSdan SELECT group_concat(a,',') OVER win FROM t1 39*ac79fa1cSdan WINDOW win AS ( 40*ac79fa1cSdan ORDER BY b RANGE BETWEEN 1 PRECEDING AND 2 PRECEDING 41*ac79fa1cSdan ) 42*ac79fa1cSdan} { 43*ac79fa1cSdan 5 4 1 6 3 2 44*ac79fa1cSdan} 45*ac79fa1cSdan 46*ac79fa1cSdanproc custom {a b} { return [string compare $b $a] } 47*ac79fa1cSdan 48*ac79fa1cSdando_execsql_test 1.3 { 49*ac79fa1cSdan SELECT group_concat(a,',') OVER win FROM t1 50*ac79fa1cSdan WINDOW win AS ( 51*ac79fa1cSdan ORDER BY b RANGE BETWEEN 1 PRECEDING AND 2 PRECEDING 52*ac79fa1cSdan ) 53*ac79fa1cSdan} { 54*ac79fa1cSdan 5 5,4 5,4,1 5,4,1,6 5,4,1,6,3 5,4,1,6,3,2 55*ac79fa1cSdan} 56*ac79fa1cSdan 57*ac79fa1cSdanfinish_test 58*ac79fa1cSdan 59