Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Make sure count(*) works on the sqlite_master table of an empty database. Ticket #3774. (CVS 6443) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
e0c1a780f5a356c48b2a4cc66fab988f |
User & Date: | drh 2009-04-02 20:27:28.000 |
Context
2009-04-03
| ||
01:43 | Fix the PRAGMA parser so that it can accept negative numbers in parentheses, like the syntax diagrams say it should be able to. (CVS 6444) (check-in: 286e83178d user: drh tags: trunk) | |
2009-04-02
| ||
20:27 | Make sure count(*) works on the sqlite_master table of an empty database. Ticket #3774. (CVS 6443) (check-in: e0c1a780f5 user: drh tags: trunk) | |
20:16 | Make sure the VACUUM statement locks down the page_size and auto_vacuum modes after it runs. Otherwise, pragmas might change these settings on a populated database, resulting in problems. (CVS 6442) (check-in: 85e6a4740d user: drh tags: trunk) | |
Changes
Changes to src/vdbe.c.
︙ | ︙ | |||
39 40 41 42 43 44 45 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** ** $Id: vdbe.c,v 1.829 2009/04/02 20:27:28 drh Exp $ */ #include "sqliteInt.h" #include "vdbeInt.h" /* ** The following global variable is incremented every time a cursor ** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test |
︙ | ︙ | |||
2361 2362 2363 2364 2365 2366 2367 | ** Store the number of entries (an integer value) in the table or index ** opened by cursor P1 in register P2 */ #ifndef SQLITE_OMIT_BTREECOUNT case OP_Count: { /* out2-prerelease */ i64 nEntry; BtCursor *pCrsr = p->apCsr[pOp->p1]->pCursor; | > | > > > | 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 | ** Store the number of entries (an integer value) in the table or index ** opened by cursor P1 in register P2 */ #ifndef SQLITE_OMIT_BTREECOUNT case OP_Count: { /* out2-prerelease */ i64 nEntry; BtCursor *pCrsr = p->apCsr[pOp->p1]->pCursor; if( pCrsr ){ rc = sqlite3BtreeCount(pCrsr, &nEntry); }else{ nEntry = 0; } pOut->flags = MEM_Int; pOut->u.i = nEntry; break; } #endif /* Opcode: Statement P1 * * * * |
︙ | ︙ |
Changes to test/count.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2009 February 24 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing "SELECT count(*)" statements. # | | > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | # 2009 February 24 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing "SELECT count(*)" statements. # # $Id: count.test,v 1.4 2009/04/02 20:27:28 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Test plan: # # count-0.*: Make sure count(*) works on an empty database. (Ticket #3774) # # count-1.*: Test that the OP_Count instruction appears to work on both # tables and indexes. Test both when they contain 0 entries, # when all entries are on the root page, and when the b-tree # forms a structure 2 and 3 levels deep. # # count-2.*: Test that # # do_test count-0.1 { db eval { SELECT count(*) FROM sqlite_master; } } {0} set iTest 0 foreach zIndex [list { /* no-op */ } { CREATE INDEX i1 ON t1(a); }] { |
︙ | ︙ | |||
178 179 180 181 182 183 184 | CREATE INDEX t4i1 ON t4(b, a); SELECT count(*) FROM t4; } } {1} finish_test | < | 186 187 188 189 190 191 192 | CREATE INDEX t4i1 ON t4(b, a); SELECT count(*) FROM t4; } } {1} finish_test |