#!/usr/bin/env tclsh set testdir [file dirname $argv0] source $testdir/tester.tcl # Things that do work: do_execsql_test_on_specific_db {:memory:} empty-table { CREATE TABLE temp (a integer); ANALYZE temp; SELECT * FROM sqlite_stat1; } {} do_execsql_test_on_specific_db {:memory:} one-row-table { CREATE TABLE temp (a integer); INSERT INTO temp VALUES (1); ANALYZE temp; SELECT * FROM sqlite_stat1; } {temp||1} do_execsql_test_on_specific_db {:memory:} analyze-overwrites { CREATE TABLE temp (a integer); INSERT INTO temp VALUES (1); ANALYZE temp; INSERT INTO temp VALUES (2); ANALYZE temp; SELECT * FROM sqlite_stat1; } {temp||2} # Things that don't work: do_execsql_test_in_memory_error analyze-all-databases-fails { ANALYZE; } {.*ANALYZE.*not supported.*} do_execsql_test_in_memory_error analyze-one-database-fails { ANALYZE main; } {.*ANALYZE.*not supported.*} do_execsql_test_in_memory_error analyze-table-with-pk-fails { CREATE TABLE temp (a integer primary key); ANALYZE temp; } {.*ANALYZE.*not supported.*} do_execsql_test_in_memory_error analyze-table-without-rowid-fails { CREATE TABLE temp (a integer primary key) WITHOUT ROWID; ANALYZE temp; } {.*ANALYZE.*not supported.*} do_execsql_test_in_memory_error analyze-index-fails { CREATE TABLE temp (a integer, b integer); CREATE INDEX temp_b ON temp (b); ANALYZE temp_b; } {.*ANALYZE.*not supported.*}