1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Minor changes and coverge tests for "SELECT count(*)" optimization. (CVS 6324)

FossilOrigin-Name: a3695b98f63fb776c3b7f77f0553e8a38bcc6f78
This commit is contained in:
danielk1977
2009-02-25 08:56:47 +00:00
parent 11b57d6929
commit 02f33725d2
5 changed files with 73 additions and 15 deletions

View File

@ -16,7 +16,7 @@
# to see what happens in the library if a malloc were to really fail
# due to an out-of-memory situation.
#
# $Id: malloc.test,v 1.75 2009/02/04 08:17:57 danielk1977 Exp $
# $Id: malloc.test,v 1.76 2009/02/25 08:56:47 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -791,6 +791,32 @@ do_malloc_test 32 -tclprep {
db2 close
}
# The following two OOM tests verify that OOM handling works in the
# code used to optimize "SELECT count(*) FROM <tbl>".
#
do_malloc_test 33 -tclprep {
db eval { PRAGMA cache_size = 10 }
db transaction {
db eval { CREATE TABLE abc(a, b) }
for {set i 0} {$i<500} {incr i} {
db eval {INSERT INTO abc VALUES(randstr(100,100), randstr(1000,1000))}
}
}
} -sqlbody {
SELECT count(*) FROM abc;
}
do_malloc_test 34 -tclprep {
db eval { PRAGMA cache_size = 10 }
db transaction {
db eval { CREATE TABLE abc(a PRIMARY KEY, b) }
for {set i 0} {$i<500} {incr i} {
db eval {INSERT INTO abc VALUES(randstr(100,100), randstr(1000,1000))}
}
}
} -sqlbody {
SELECT count(*) FROM abc;
}
# Ensure that no file descriptors were leaked.
do_test malloc-99.X {
catch {db close}