/ Check-in [b7d2a477]
Login

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

Overview
Comment:Fix a problem with committing a transaction while there are other active statements. Sometimes, the database change counter was not being updated. (CVS 6176)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b7d2a477aa2c3dbbb81d18fba1faa6835711b5c3
User & Date: danielk1977 2009-01-14 17:45:58
Context
2009-01-14
18:59
Increment the version number in preparation for yet another release. (CVS 6177) check-in: dce60ea7 user: drh tags: trunk
17:45
Fix a problem with committing a transaction while there are other active statements. Sometimes, the database change counter was not being updated. (CVS 6176) check-in: b7d2a477 user: danielk1977 tags: trunk
04:09
Version 3.6.9 (CVS 6175) check-in: b6ce8199 user: drh tags: trunk, release
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/pager.c.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
....
1101
1102
1103
1104
1105
1106
1107

1108
1109
1110
1111
1112
1113
1114
** The pager is used to access a database disk file.  It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file.  The pager also implements file
** locking to prevent two processes from writing the same database
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.549 2009/01/13 16:03:44 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"

/*
** Macros for troubleshooting.  Normally turned off
*/
................................................................................
  }else{
    assert( pPager->pInJournal==0 );
  }

  if( !pPager->exclusiveMode ){
    rc2 = osUnlock(pPager->fd, SHARED_LOCK);
    pPager->state = PAGER_SHARED;

  }else if( pPager->state==PAGER_SYNCED ){
    pPager->state = PAGER_EXCLUSIVE;
  }
  pPager->dbOrigSize = 0;
  pPager->setMaster = 0;
  pPager->needSync = 0;
  /* lruListSetFirstSynced(pPager); */







|







 







>







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
....
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
** The pager is used to access a database disk file.  It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file.  The pager also implements file
** locking to prevent two processes from writing the same database
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.550 2009/01/14 17:45:58 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"

/*
** Macros for troubleshooting.  Normally turned off
*/
................................................................................
  }else{
    assert( pPager->pInJournal==0 );
  }

  if( !pPager->exclusiveMode ){
    rc2 = osUnlock(pPager->fd, SHARED_LOCK);
    pPager->state = PAGER_SHARED;
    pPager->changeCountDone = 0;
  }else if( pPager->state==PAGER_SYNCED ){
    pPager->state = PAGER_EXCLUSIVE;
  }
  pPager->dbOrigSize = 0;
  pPager->setMaster = 0;
  pPager->needSync = 0;
  /* lruListSetFirstSynced(pPager); */

Changes to test/lock.test.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
345
346
347
348
349
350
351








































352
353
354
355
356
357
#    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.  The
# focus of this script is database locks.
#
# $Id: lock.test,v 1.34 2008/11/21 22:21:51 drh Exp $


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

# Create an alternative connection to the database
#
................................................................................
  } {0 {}}
  do_test lock-5.9 {
    execsql {
      SELECT * FROM t3;
    }
  } {9}
}









































do_test lock-999.1 {
  rename db2 {}
} {}

finish_test







|







 







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






7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
345
346
347
348
349
350
351
352
353
354
355
356
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
#    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.  The
# focus of this script is database locks.
#
# $Id: lock.test,v 1.35 2009/01/14 17:45:58 danielk1977 Exp $


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

# Create an alternative connection to the database
#
................................................................................
  } {0 {}}
  do_test lock-5.9 {
    execsql {
      SELECT * FROM t3;
    }
  } {9}
}

do_test lock-6.1 {
  execsql {
    CREATE TABLE t4(a PRIMARY KEY, b);
    INSERT INTO t4 VALUES(1, 'one');
    INSERT INTO t4 VALUES(2, 'two');
    INSERT INTO t4 VALUES(3, 'three');
  }

  set STMT [sqlite3_prepare $DB "SELECT * FROM sqlite_master" -1 TAIL]
  sqlite3_step $STMT

  execsql { DELETE FROM t4 }
  execsql { SELECT * FROM sqlite_master } db2
  execsql { SELECT * FROM t4 } db2
} {}

do_test lock-6.2 {
  execsql { 
    BEGIN;
    INSERT INTO t4 VALUES(1, 'one');
    INSERT INTO t4 VALUES(2, 'two');
    INSERT INTO t4 VALUES(3, 'three');
    COMMIT;
  }

  execsql { SELECT * FROM t4 } db2
} {1 one 2 two 3 three}

do_test lock-6.3 {
  execsql { SELECT a FROM t4 ORDER BY a } db2
} {1 2 3}

do_test lock-6.4 {
  execsql { PRAGMA integrity_check } db2
} {ok}

do_test lock-6.5 {
  sqlite3_finalize $STMT
} {SQLITE_OK}

do_test lock-999.1 {
  rename db2 {}
} {}

finish_test