SQLite

Check-in [f0cdfb547b]
Login

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

Overview
Comment:Add a test case that calls sqlite3_db_cacheflush() on an in-memory database.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | cacheflush
Files: files | file ages | folders
SHA1: f0cdfb547b0976e753e94958f29cb294edf31bed
User & Date: dan 2015-10-29 20:57:06.654
Context
2015-10-29
21:11
Do not attempt to flush the pages of an in-memory database to disk if sqlite3_db_cacheflush() is called. (check-in: 9b79a39044 user: dan tags: cacheflush)
20:57
Add a test case that calls sqlite3_db_cacheflush() on an in-memory database. (check-in: f0cdfb547b user: dan tags: cacheflush)
18:16
Avoid automatically rolling back the transaction if an SQLITE_IOERR or SQLITE_FULL error occurs within sqlite3_db_cacheflush(). (check-in: 370b5d520c user: dan tags: cacheflush)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/cacheflush.test.
197
198
199
200
201
202
203




























204
205
206
207
} {A B C D E F}
do_test 2.2.6 {
  db2 close
  sqlite3_db_cacheflush db
  diskquery test.db { SELECT * FROM t1; }
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14}
do_execsql_test 2.2.7 { COMMIT }





























test_restore_config_pagecache
finish_test








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
} {A B C D E F}
do_test 2.2.6 {
  db2 close
  sqlite3_db_cacheflush db
  diskquery test.db { SELECT * FROM t1; }
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14}
do_execsql_test 2.2.7 { COMMIT }

#-------------------------------------------------------------------------
# Test that nothing terrible happens if sqlite3_db_cacheflush() is
# called on an in-memory database.
#
do_test 3.0 {
  db close
  sqlite3 db :memory:
  db eval {
    CREATE TABLE t1(x PRIMARY KEY);
    CREATE TABLE t2(y PRIMARY KEY);
    BEGIN;
      INSERT INTO t1 VALUES(randomblob(100));
      INSERT INTO t2 VALUES(randomblob(100));
      INSERT INTO t1 VALUES(randomblob(100));
      INSERT INTO t2 VALUES(randomblob(100));
  }
  sqlite3_db_cacheflush db
} {}

do_execsql_test 3.1 { PRAGMA integrity_check } ok
do_execsql_test 3.2 { COMMIT }
do_execsql_test 3.3 { PRAGMA integrity_check } ok
do_execsql_test 3.4 { 
  SELECT count(*) FROM t1;
  SELECT count(*) FROM t2;
} {2 2}


test_restore_config_pagecache
finish_test