SQLite

Check-in [84077fa160]
Login

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

Overview
Comment:Cover a corrupt-db case in pager.c. (CVS 3794)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 84077fa1602756339a262bc4ab51b6b487edc637
User & Date: danielk1977 2007-04-02 12:28:28.000
Context
2007-04-02
12:29
Fix for #2281. This was a problem with the test-case only. (CVS 3795) (check-in: c036db6251 user: danielk1977 tags: trunk)
12:28
Cover a corrupt-db case in pager.c. (CVS 3794) (check-in: 84077fa160 user: danielk1977 tags: trunk)
12:22
In the amalgamation, put date.c before os.c so that the time_t typedef can be correctly resolved by windows compilers. (CVS 3793) (check-in: 9c5697c70f user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/misc7.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 2006 September 4
#
# 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.
#
# $Id: misc7.test,v 1.11 2007/04/02 11:08:59 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

do_test misc7-1 {
  c_misuse_test
} {}












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 2006 September 4
#
# 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.
#
# $Id: misc7.test,v 1.12 2007/04/02 12:28:28 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

do_test misc7-1 {
  c_misuse_test
} {}
357
358
359
360
361
362
363

364
365
366

367

368
369
370
371
372
373
374
375
376
377
378
























379
  }
  copy_file test.db bak.db
  copy_file test.db-journal bak.db-journal
  execsql {
    COMMIT;
  }


  copy_file bak.db test.db
  copy_file bak.db-journal test.db-journal
  file attributes test.db-journal -permissions r--------



  catchsql {
    SELECT count(*) FROM t3;
  }
} {1 {database is locked}}
do_test misc7-17.2 {
  file attributes test.db-journal -permissions rw-------
  catchsql {
    SELECT count(*) FROM t3;
  }
} {0 28}

























finish_test







>


<
>

>









|

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

357
358
359
360
361
362
363
364
365
366

367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
  }
  copy_file test.db bak.db
  copy_file test.db-journal bak.db-journal
  execsql {
    COMMIT;
  }

  db close
  copy_file bak.db test.db
  copy_file bak.db-journal test.db-journal

  sqlite3 db test.db

  file attributes test.db-journal -permissions r--------
  catchsql {
    SELECT count(*) FROM t3;
  }
} {1 {database is locked}}
do_test misc7-17.2 {
  file attributes test.db-journal -permissions rw-------
  catchsql {
    SELECT count(*) FROM t3;
  }
} {0 32}

set ::pending_byte_page [expr ($::sqlite_pending_byte / 1024) + 1]
do_test misc7-17.3 {
  db eval {
    pragma writable_schema = true;
    UPDATE sqlite_master 
      SET rootpage = $pending_byte_page
      WHERE type = 'table' AND name = 't3';
  }
  execsql {
    SELECT rootpage FROM sqlite_master WHERE type = 'table' AND name = 't3';
  }
} $::pending_byte_page

do_test misc7-17.4 {
  db close
  sqlite3 db test.db
  catchsql {
    SELECT count(*) FROM t3;
  } 
} {1 {database disk image is malformed}}

db close
file delete -force test.db

finish_test