/ Check-in [30392985]
Login

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

Overview
Comment:Add another test case to cover a previously uncovered branch in the RBU module.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 30392985612c51d4583a905f8fe766f08cd31b86d0e30a977adc6a6705649e00
User & Date: dan 2019-05-08 21:14:48
Context
2019-05-08
23:53
This is part of the previous check-in that didn't get committed for some reason - probably because I failed to press the "Save" button on the text editor. check-in: 51d32173 user: drh tags: trunk
21:14
Add another test case to cover a previously uncovered branch in the RBU module. check-in: 30392985 user: dan tags: trunk
19:55
Fix another pattern for which the LIKE optimization does not work for a non-TEXT affinity. Case found by Manuel Rigger. check-in: 74020110 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/rbu/rbumisc.test.

    39     39       CREATE TABLE data_(a, b, c, rbu_control);
    40     40   
    41     41       INSERT INTO "data x1" VALUES(3, 3, 3, 0);
    42     42       INSERT INTO datax1 VALUES(3, 3, 3, 0);
    43     43       INSERT INTO data_ VALUES(3, 3, 3, 0);
    44     44       INSERT INTO dat VALUES(3, 3, 3, 0);
    45     45     }
           46  +  rbu close
    46     47   } {}
    47     48   
    48     49   do_test 1.2 {
    49     50     step_rbu test.db rbu.db
    50     51     db eval { SELECT * FROM x1 }
    51     52   } {1 1 1 2 2 2}
    52     53   
           54  +do_test 1.3 {
           55  +  db eval { DELETE FROM x1 }
           56  +  sqlite3 rbu rbu.db
           57  +  rbu eval { DELETE FROM rbu_state }
           58  +  rbu close
           59  +  step_rbu test.db rbu.db
           60  +  db eval { SELECT * FROM x1 }
           61  +} {1 1 1 2 2 2}
           62  +
           63  +do_test 1.4 {
           64  +  db eval { DELETE FROM x1 }
           65  +  sqlite3 rbu rbu.db
           66  +  rbu eval { DELETE FROM rbu_state }
           67  +  rbu close
           68  +
           69  +  sqlite3rbu rbu test.db rbu.db
           70  +  rbu step
           71  +  rbu step
           72  +  rbu close
           73  +
           74  +  forcecopy test.db-oal test.db-wal
           75  +  sqlite3rbu rbu test.db rbu.db
           76  +  rbu step
           77  +  list [catch { rbu close } msg] $msg
           78  +} {1 {SQLITE_ERROR - cannot update wal mode database}}
           79  +
    53     80   finish_test

Changes to ext/rbu/sqlite3rbu.c.

  5046   5046     **   b) if the *-wal file does not exist, claim that it does anyway,
  5047   5047     **      causing SQLite to call xOpen() to open it. This call will also
  5048   5048     **      be intercepted (see the rbuVfsOpen() function) and the *-oal
  5049   5049     **      file opened instead.
  5050   5050     */
  5051   5051     if( rc==SQLITE_OK && flags==SQLITE_ACCESS_EXISTS ){
  5052   5052       rbu_file *pDb = rbuFindMaindb(pRbuVfs, zPath, 1);
  5053         -    if( pDb && pDb->pRbu && pDb->pRbu->eStage==RBU_STAGE_OAL ){
         5053  +    if( pDb && pDb->pRbu->eStage==RBU_STAGE_OAL ){
         5054  +      assert( pDb->pRbu );
  5054   5055         if( *pResOut ){
  5055   5056           rc = SQLITE_CANTOPEN;
  5056   5057         }else{
  5057   5058           sqlite3_int64 sz = 0;
  5058   5059           rc = rbuVfsFileSize(&pDb->base, &sz);
  5059   5060           *pResOut = (sz>0);
  5060   5061         }