SQLite

Check-in [5debf12fa4]
Login

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

Overview
Comment:On windows, avoid running those tests in exclusive.test that require the journal file to be externally accessed while SQLite is holding it open. This doesn't work on windows. (CVS 5742)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5debf12fa46520946ac5da44c03448fffbc9940c
User & Date: danielk1977 2008-09-24 14:03:43.000
Context
2008-09-26
17:31
Performance enhancement: avoid calling reparentChildPages() from balance_nonroot(). (CVS 5743) (check-in: 28fd0a50ca user: danielk1977 tags: trunk)
2008-09-24
14:03
On windows, avoid running those tests in exclusive.test that require the journal file to be externally accessed while SQLite is holding it open. This doesn't work on windows. (CVS 5742) (check-in: 5debf12fa4 user: danielk1977 tags: trunk)
09:58
Add file fts3_icu.c to the amalgamation. Because of the way header files are included into sqlite3.c, fts3_icu.c has to appear after all the other fts3 and icu extension files. Ticket #3398. (CVS 5741) (check-in: 0acca5842f user: danielk1977 tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/exclusive.test.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library. The focus
# of these tests is exclusive access mode (i.e. the thing activated by 
# "PRAGMA locking_mode = EXCLUSIVE").
#
# $Id: exclusive.test,v 1.8 2008/04/17 14:16:42 drh Exp $

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

ifcapable {!pager_pragmas} {
  finish_test
  return







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library. The focus
# of these tests is exclusive access mode (i.e. the thing activated by 
# "PRAGMA locking_mode = EXCLUSIVE").
#
# $Id: exclusive.test,v 1.9 2008/09/24 14:03:43 danielk1977 Exp $

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

ifcapable {!pager_pragmas} {
  finish_test
  return
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
db2 close

#----------------------------------------------------------------------
# Tests exclusive-3.X - test that a connection in exclusive mode 
# truncates instead of deletes the journal file when committing 
# a transaction.
#





proc filestate {fname} {
  set exists 0
  set content 0
  if {[file exists $fname]} {
    set exists 1
    set hdr [hexio_read $fname 0 28]
    set content \
      [expr {$hdr!="00000000000000000000000000000000000000000000000000000000"}]
  }
  list $exists $content
}
do_test exclusive-3.0 {
  filestate test.db-journal
} {0 0}
do_test exclusive-3.1 {
  execsql {
    PRAGMA locking_mode = exclusive;
    BEGIN;
    DELETE FROM abc;
  }
  filestate test.db-journal
} {1 1}
do_test exclusive-3.2 {
  execsql {
    COMMIT;
  }
  filestate test.db-journal
} {1 0}
do_test exclusive-3.3 {
  execsql {
    INSERT INTO abc VALUES('A', 'B', 'C');
    SELECT * FROM abc;
  }
} {A B C}
do_test exclusive-3.4 {
  execsql {
    BEGIN;
    UPDATE abc SET a = 1, b = 2, c = 3;
    ROLLBACK;
    SELECT * FROM abc;
  }
} {A B C}
do_test exclusive-3.5 {
  filestate test.db-journal
} {1 0}
do_test exclusive-3.6 {
  execsql {
    PRAGMA locking_mode = normal;
    SELECT * FROM abc;
  }
  filestate test.db-journal
} {0 0}


#----------------------------------------------------------------------
# Tests exclusive-4.X - test that rollback works correctly when
# in exclusive-access mode.
#

# The following procedure computes a "signature" for table "t3".  If







>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>







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
db2 close

#----------------------------------------------------------------------
# Tests exclusive-3.X - test that a connection in exclusive mode 
# truncates instead of deletes the journal file when committing 
# a transaction.
#
# These tests are not run on windows because the windows backend
# opens the journal file for exclusive access, preventing its contents 
# from being inspected externally.
#
if {$tcl_platform(platform) != "windows"} {
  proc filestate {fname} {
    set exists 0
    set content 0
    if {[file exists $fname]} {
      set exists 1
      set hdr [hexio_read $fname 0 28]
      set content \
       [expr {$hdr!="00000000000000000000000000000000000000000000000000000000"}]
    }
    list $exists $content
  }
  do_test exclusive-3.0 {
    filestate test.db-journal
  } {0 0}
  do_test exclusive-3.1 {
    execsql {
      PRAGMA locking_mode = exclusive;
      BEGIN;
      DELETE FROM abc;
    }
    filestate test.db-journal
  } {1 1}
  do_test exclusive-3.2 {
    execsql {
      COMMIT;
    }
    filestate test.db-journal
  } {1 0}
  do_test exclusive-3.3 {
    execsql {
      INSERT INTO abc VALUES('A', 'B', 'C');
      SELECT * FROM abc;
    }
  } {A B C}
  do_test exclusive-3.4 {
    execsql {
      BEGIN;
      UPDATE abc SET a = 1, b = 2, c = 3;
      ROLLBACK;
      SELECT * FROM abc;
    }
  } {A B C}
  do_test exclusive-3.5 {
    filestate test.db-journal
  } {1 0}
  do_test exclusive-3.6 {
    execsql {
      PRAGMA locking_mode = normal;
      SELECT * FROM abc;
    }
    filestate test.db-journal
  } {0 0}
}

#----------------------------------------------------------------------
# Tests exclusive-4.X - test that rollback works correctly when
# in exclusive-access mode.
#

# The following procedure computes a "signature" for table "t3".  If