| 1 |
# 2023 May 28 |
| 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 |
# |
| 12 |
|
| 13 |
source [file join [file dirname [info script]] fts5_common.tcl] |
| 14 |
set testprefix fts5bigid |
| 15 |
|
| 16 |
# If SQLITE_ENABLE_FTS5 is not defined, omit this file. |
| 17 |
ifcapable !fts5 { |
| 18 |
finish_test |
| 19 |
return |
| 20 |
} |
| 21 |
|
| 22 |
set nRow 20000 |
| 23 |
|
| 24 |
proc do_ascdesc_test {tn query} { |
| 25 |
set ::lAsc [db eval { SELECT rowid FROM x1($query) }] |
| 26 |
set ::lDesc [db eval { SELECT rowid FROM x1($query) ORDER BY rowid DESC }] |
| 27 |
do_test $tn.1 { lsort -integer $::lAsc } $::lAsc |
| 28 |
do_test $tn.2 { lsort -integer -decr $::lDesc } $::lDesc |
| 29 |
do_test $tn.3 { lsort -integer $::lDesc } $::lAsc |
| 30 |
} |
| 31 |
|
| 32 |
do_execsql_test 1.0 { |
| 33 |
CREATE VIRTUAL TABLE x1 USING fts5(a); |
| 34 |
} |
| 35 |
|
| 36 |
do_test 1.1 { |
| 37 |
for {set ii 0} {$ii < $nRow} {incr ii} { |
| 38 |
db eval { |
| 39 |
REPLACE INTO x1(rowid, a) VALUES(random(), 'movement at the station'); |
| 40 |
} |
| 41 |
} |
| 42 |
} {} |
| 43 |
|
| 44 |
do_ascdesc_test 1.2 "the" |
| 45 |
|
| 46 |
do_execsql_test 1.3 { |
| 47 |
DELETE FROM x1 |
| 48 |
} |
| 49 |
|
| 50 |
do_test 1.4 { |
| 51 |
for {set ii 0} {$ii < $nRow} {incr ii} { |
| 52 |
db eval { |
| 53 |
INSERT INTO x1(rowid, a) VALUES( |
| 54 |
$ii + 0x6FFFFFFFFFFFFFFF, 'movement at the station' |
| 55 |
); |
| 56 |
} |
| 57 |
} |
| 58 |
} {} |
| 59 |
|
| 60 |
do_ascdesc_test 1.5 "movement" |
| 61 |
|
| 62 |
finish_test |