xref: /sqlite-3.40.0/test/vtabdistinct.test (revision 68dc8151)
1ec778d27Sdrh# 2022-01-21
2ec778d27Sdrh#
3ec778d27Sdrh# The author disclaims copyright to this source code.  In place of
4ec778d27Sdrh# a legal notice, here is a blessing:
5ec778d27Sdrh#
6ec778d27Sdrh#    May you do good and not evil.
7ec778d27Sdrh#    May you find forgiveness for yourself and forgive others.
8ec778d27Sdrh#    May you share freely, never taking more than you give.
9ec778d27Sdrh#
10ec778d27Sdrh#***********************************************************************
11ec778d27Sdrh#
12ec778d27Sdrh# This file implements tests for sqlite3_vtab_distinct() interface.
13ec778d27Sdrh#
14ec778d27Sdrh
15ec778d27Sdrhset testdir [file dirname $argv0]
16ec778d27Sdrhsource $testdir/tester.tcl
17ec778d27Sdrhset testprefix vtabdistinct
18ec778d27Sdrh
19ec778d27Sdrhifcapable !vtab {
20ec778d27Sdrh  finish_test
21ec778d27Sdrh  return
22ec778d27Sdrh}
23ec778d27Sdrhload_static_extension db qpvtab
24ec778d27Sdrh
25ec778d27Sdrhdo_execsql_test 1.1 {
26ec778d27Sdrh  SELECT ix FROM qpvtab WHERE vn='sqlite3_vtab_distinct';
27ec778d27Sdrh} {0}
28ec778d27Sdrhdo_execsql_test 1.2 {
29ec778d27Sdrh  SELECT DISTINCT ix FROM qpvtab WHERE vn='sqlite3_vtab_distinct';
30*68dc8151Sdrh} {2}
31ec778d27Sdrhdo_execsql_test 1.3 {
32ec778d27Sdrh  SELECT distinct vn, ix FROM qpvtab(3)
33ec778d27Sdrh   WHERE +vn IN ('sqlite3_vtab_distinct','nOrderBy');
34*68dc8151Sdrh} {nOrderBy 2 sqlite3_vtab_distinct 2}
35*68dc8151Sdrhdo_execsql_test 1.4 {
36*68dc8151Sdrh  SELECT vn, ix FROM qpvtab
37*68dc8151Sdrh   GROUP BY vn
38*68dc8151Sdrh  HAVING vn='sqlite3_vtab_distinct';
39*68dc8151Sdrh} {sqlite3_vtab_distinct 1}
40ec778d27Sdrh
41ec778d27Sdrhfinish_test
42