SQLite

Check-in [0e09e4a269]
Login

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

Overview
Comment:Test that calling sqlite3_db_cacheflush() does not interfere with savepoints.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | cacheflush
Files: files | file ages | folders
SHA1: 0e09e4a26938cfe0f573449526a8f0f527cef921
User & Date: dan 2015-10-30 09:13:29.814
Context
2015-10-30
14:28
Return immediately if sqlite3PagerWrite() is called when the pager is in PAGER_ERROR state. (Closed-Leaf check-in: a6695b0084 user: dan tags: cacheflush)
09:13
Test that calling sqlite3_db_cacheflush() does not interfere with savepoints. (check-in: 0e09e4a269 user: dan tags: cacheflush)
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)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/cacheflush.test.
225
226
227
228
229
230
231

























































































232
233
234
235
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








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




225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
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 that calling sqlite3_db_cacheflush() does not interfere with
# savepoint transactions.
#
do_test 4.0 {
  reset_db
  execsql {
    CREATE TABLE ta(a, aa);
    CREATE TABLE tb(b, bb);
    INSERT INTO ta VALUES('a', randomblob(500));
    INSERT INTO tb VALUES('b', randomblob(500));
    BEGIN;
      UPDATE ta SET a = 'A';
      SAVEPOINT one;
        UPDATE tb SET b = 'B';
  }

  sqlite3_db_cacheflush db
  diskquery test.db {
    SELECT a FROM ta;
    SELECT b FROM tb;
  }
} {A B}

do_test 4.1 {
  execsql { 
    ROLLBACK TO one;
  }
  sqlite3_db_cacheflush db
  diskquery test.db {
    SELECT a FROM ta;
    SELECT b FROM tb;
  }
} {A b}

do_test 4.2 {
  execsql { 
    INSERT INTO tb VALUES('c', randomblob(10));
    INSERT INTO tb VALUES('d', randomblob(10));
    INSERT INTO tb VALUES('e', randomblob(10));
  }
  sqlite3_db_cacheflush db
  diskquery test.db {
    SELECT a FROM ta;
    SELECT b FROM tb;
  }
} {A b c d e}

do_test 4.3 {
  execsql { 
    SAVEPOINT two;
    UPDATE tb SET b = upper(b);
  }
  sqlite3_db_cacheflush db
  diskquery test.db {
    SELECT a FROM ta;
    SELECT b FROM tb;
  }
} {A B C D E}

do_test 4.4 {
  execsql { 
    ROLLBACK TO two;
  }
  sqlite3_db_cacheflush db
  diskquery test.db {
    SELECT a FROM ta;
    SELECT b FROM tb;
  }
} {A b c d e}

do_test 4.4 {
  execsql { 
    ROLLBACK TO one;
  }
  sqlite3_db_cacheflush db
  diskquery test.db {
    SELECT a FROM ta;
    SELECT b FROM tb;
  }
} {A b}

do_test 4.5 {
  execsql { 
    ROLLBACK;
    SELECT a FROM ta;
    SELECT b FROM tb;
  }
} {a b}

test_restore_config_pagecache
finish_test