/ Check-in [f5f7259d]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add some code to sqlite3VdbeMemSetZeroBlob() so that it works (less efficiently) even when OMIT_INCRBLOB is defined. Ticket #3977. (CVS 6906)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f5f7259d811ce8c2bf0bc64128256c4cd95f676a
User & Date: danielk1977 2009-07-18 14:36:24
Context
2009-07-18
20:01
Code tweaks in support of full-coverage testing. (CVS 6907) check-in: 22c6dbfd user: drh tags: trunk
14:36
Add some code to sqlite3VdbeMemSetZeroBlob() so that it works (less efficiently) even when OMIT_INCRBLOB is defined. Ticket #3977. (CVS 6906) check-in: f5f7259d user: danielk1977 tags: trunk
11:52
When the asynchronous IO backend opens a file with the EXCLUSIVE flag set, make sure only a single file-descriptor is opened (not one for reading and one for writing). This change fixes #3978. (CVS 6905) check-in: 630e669b user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to src/vdbemem.c.

    11     11   *************************************************************************
    12     12   **
    13     13   ** This file contains code use to manipulate "Mem" structure.  A "Mem"
    14     14   ** stores a single value in the VDBE.  Mem is an opaque structure visible
    15     15   ** only within the VDBE.  Interface routines refer to a Mem using the
    16     16   ** name sqlite_value
    17     17   **
    18         -** $Id: vdbemem.c,v 1.150 2009/06/25 01:47:12 drh Exp $
           18  +** $Id: vdbemem.c,v 1.151 2009/07/18 14:36:24 danielk1977 Exp $
    19     19   */
    20     20   #include "sqliteInt.h"
    21     21   #include "vdbeInt.h"
    22     22   
    23     23   /*
    24     24   ** Call sqlite3VdbeMemExpandBlob() on the supplied value (type Mem*)
    25     25   ** P if required.
................................................................................
   494    494     sqlite3VdbeMemRelease(pMem);
   495    495     pMem->flags = MEM_Blob|MEM_Zero;
   496    496     pMem->type = SQLITE_BLOB;
   497    497     pMem->n = 0;
   498    498     if( n<0 ) n = 0;
   499    499     pMem->u.nZero = n;
   500    500     pMem->enc = SQLITE_UTF8;
          501  +
          502  +#ifdef SQLITE_OMIT_INCRBLOB
          503  +  sqlite3VdbeMemGrow(pMem, n, 0);
          504  +  if( pMem->z ){
          505  +    pMem->n = n;
          506  +    memset(pMem->z, 0, n);
          507  +  }
          508  +#endif
   501    509   }
   502    510   
   503    511   /*
   504    512   ** Delete any previous value and set the value stored in *pMem to val,
   505    513   ** manifest type INTEGER.
   506    514   */
   507    515   void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){

Changes to test/memsubsys1.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   #
    12     12   # This file contains tests of the memory allocation subsystem
    13     13   #
    14         -# $Id: memsubsys1.test,v 1.16 2009/07/18 08:30:45 danielk1977 Exp $
           14  +# $Id: memsubsys1.test,v 1.17 2009/07/18 14:36:24 danielk1977 Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   sqlite3_reset_auto_extension
    19     19   
    20     20   # This procedure constructs a new database in test.db.  It fills
    21     21   # this database with many small records (enough to force multiple
................................................................................
   266    266     set pg_used [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_USED 0] 2]
   267    267   } 0
   268    268   do_test memsubsys1-8.2 {
   269    269     set s_ovfl [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_OVERFLOW 0] 2]
   270    270   } 0
   271    271   do_test memsubsys1-8.3 {
   272    272     sqlite3 db :memory:
   273         -  ifcapable !incrblob {
   274         -    db function zeroblob [list string repeat [binary format c 0]]
   275         -  }
   276    273     db eval {
   277    274       CREATE TABLE t1(x);
   278    275       INSERT INTO t1 VALUES(zeroblob(400));
   279    276       INSERT INTO t1 VALUES(zeroblob(400));
   280    277       INSERT INTO t1 SELECT * FROM t1;
   281    278       INSERT INTO t1 SELECT * FROM t1;
   282    279       INSERT INTO t1 SELECT * FROM t1;

Changes to test/pcache2.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   #
    12     12   # This file is focused on testing the pcache module.
    13     13   #
    14         -# $Id: pcache2.test,v 1.4 2009/07/18 08:30:45 danielk1977 Exp $
           14  +# $Id: pcache2.test,v 1.5 2009/07/18 14:36:24 danielk1977 Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   
    20     20   # Set up a pcache memory pool so that we can easily track how many
    21     21   # pages are being used for cache.
................................................................................
    42     42   do_test pcache2-1.3 {
    43     43     file delete -force test2.db test2.db-journal
    44     44     sqlite3 db2 test2.db
    45     45     db2 eval {PRAGMA cache_size=50}
    46     46     lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 1
    47     47   } {4}
    48     48   
    49         -ifcapable !incrblob {
    50         -  db function zeroblob [list string repeat [binary format c 0]]
    51         -}
    52     49   
    53     50   # Make lots of changes on the first connection.  Verify that the
    54     51   # page cache usage does not grow to consume the page space set aside
    55     52   # for the second connection.
    56     53   #
    57     54   do_test pcache2-1.4 {
    58     55     db eval {