mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-06 01:34:21 +01:00
81 lines
1.9 KiB
Tcl
Executable File
81 lines
1.9 KiB
Tcl
Executable File
#!/usr/bin/env tclsh
|
|
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
|
|
source $testdir/coalesce.test
|
|
source $testdir/join.test
|
|
source $testdir/where.test
|
|
|
|
do_execsql_test select-const-1 {
|
|
SELECT 1
|
|
} {1}
|
|
|
|
do_execsql_test select-const-2 {
|
|
SELECT 2
|
|
} {2}
|
|
|
|
do_execsql_test select-avg {
|
|
SELECT avg(age) FROM users;
|
|
} {50.396}
|
|
|
|
do_execsql_test select-sum {
|
|
SELECT sum(age) FROM users;
|
|
} {503960}
|
|
|
|
do_execsql_test select-total {
|
|
SELECT sum(age) FROM users;
|
|
} {503960}
|
|
|
|
do_execsql_test select-limit {
|
|
SELECT id FROM users LIMIT 1;
|
|
} {1}
|
|
|
|
do_execsql_test select-count {
|
|
SELECT count(id) FROM users;
|
|
} {10000}
|
|
|
|
do_execsql_test select-max {
|
|
SELECT max(age) FROM users;
|
|
} {100}
|
|
|
|
do_execsql_test select-min {
|
|
SELECT min(age) FROM users;
|
|
} {1}
|
|
|
|
do_execsql_test select-group-concat {
|
|
SELECT group_concat(name) FROM products;
|
|
} {hat,cap,shirt,sweater,sweatshirt,shorts,jeans,sneakers,boots,coat,accessories}
|
|
|
|
do_execsql_test select-group-concat-with-delimiter {
|
|
SELECT group_concat(name, ';') FROM products;
|
|
} {hat;cap;shirt;sweater;sweatshirt;shorts;jeans;sneakers;boots;coat;accessories}
|
|
|
|
do_execsql_test select-group-concat-with-column-delimiter {
|
|
SELECT group_concat(name, id) FROM products;
|
|
} {hat2cap3shirt4sweater5sweatshirt6shorts7jeans8sneakers9boots10coat11accessories}
|
|
|
|
do_execsql_test select-string-agg-with-delimiter {
|
|
SELECT string_agg(name, ',') FROM products;
|
|
} {hat,cap,shirt,sweater,sweatshirt,shorts,jeans,sneakers,boots,coat,accessories}
|
|
|
|
do_execsql_test select-string-agg-with-column-delimiter {
|
|
SELECT string_agg(name, id) FROM products;
|
|
} {hat2cap3shirt4sweater5sweatshirt6shorts7jeans8sneakers9boots10coat11accessories}
|
|
|
|
do_execsql_test select-limit-0 {
|
|
SELECT id FROM users LIMIT 0;
|
|
} {}
|
|
|
|
do_execsql_test pragma-cache-size {
|
|
PRAGMA cache_size
|
|
} {-2000}
|
|
|
|
do_execsql_test realify {
|
|
select price from products limit 1;
|
|
} {79.0}
|
|
|
|
do_execsql_test select-add {
|
|
select u.age + 1 from users u where u.age = 91 limit 1;
|
|
} {92}
|