| 1 |
# 2022-01-21 |
| 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 |
# This file implements tests for sqlite3_vtab_distinct() interface. |
| 13 |
# |
| 14 |
|
| 15 |
set testdir [file dirname $argv0] |
| 16 |
source $testdir/tester.tcl |
| 17 |
set testprefix vtabdistinct |
| 18 |
|
| 19 |
ifcapable !vtab { |
| 20 |
finish_test |
| 21 |
return |
| 22 |
} |
| 23 |
load_static_extension db qpvtab |
| 24 |
|
| 25 |
do_execsql_test 1.1 { |
| 26 |
SELECT ix FROM qpvtab WHERE vn='sqlite3_vtab_distinct'; |
| 27 |
} {0} |
| 28 |
do_execsql_test 1.2 { |
| 29 |
SELECT DISTINCT ix FROM qpvtab WHERE vn='sqlite3_vtab_distinct'; |
| 30 |
} {2} |
| 31 |
do_execsql_test 1.3 { |
| 32 |
SELECT distinct vn, ix FROM qpvtab(3) |
| 33 |
WHERE +vn IN ('sqlite3_vtab_distinct','nOrderBy'); |
| 34 |
} {nOrderBy 2 sqlite3_vtab_distinct 2} |
| 35 |
do_execsql_test 1.4 { |
| 36 |
SELECT vn, ix FROM qpvtab |
| 37 |
GROUP BY vn |
| 38 |
HAVING vn='sqlite3_vtab_distinct'; |
| 39 |
} {sqlite3_vtab_distinct 1} |
| 40 |
|
| 41 |
finish_test |