/ Check-in [4697249f]
Login

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

Overview
Comment:Make sure dot-lock is fully enabled when SQLITE_ENABLE_LOCKING_STYLE is disabled. Fix compiler warnings when SQLITE_ENABLE_LOCKING_STYLE is disabled. (CVS 5976)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4697249fcc6041ba7d2fb89589c855a8bec71eb2
User & Date: drh 2008-12-04 12:34:16
Context
2008-12-04
20:40
Replace the VDBE Fifo object with the new RowSet object. (CVS 5977) check-in: 39a0750b user: drh tags: trunk
12:34
Make sure dot-lock is fully enabled when SQLITE_ENABLE_LOCKING_STYLE is disabled. Fix compiler warnings when SQLITE_ENABLE_LOCKING_STYLE is disabled. (CVS 5976) check-in: 4697249f user: drh tags: trunk
12:26
Fix a memory leak in the shell that occurs when a ".import" command fails. Ticket #3517 (CVS 5975) check-in: cb9c1543 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_unix.c.

    39     39   **   *  Definitions of sqlite3_io_methods objects for all locking
    40     40   **      methods plus "finder" functions for each locking method.
    41     41   **   *  sqlite3_vfs method implementations.
    42     42   **   *  Locking primitives for the proxy uber-locking-method. (MacOSX only)
    43     43   **   *  Definitions of sqlite3_vfs objects for all locking methods
    44     44   **      plus implementations of sqlite3_os_init() and sqlite3_os_end().
    45     45   **
    46         -** $Id: os_unix.c,v 1.228 2008/12/03 22:48:33 drh Exp $
           46  +** $Id: os_unix.c,v 1.229 2008/12/04 12:34:16 drh Exp $
    47     47   */
    48     48   #include "sqliteInt.h"
    49     49   #if SQLITE_OS_UNIX              /* This file is used on unix only */
    50     50   
    51     51   /*
    52     52   ** There are various methods for file locking used for concurrency
    53     53   ** control:
................................................................................
  2935   2935     */
  2936   2936     if( *pSize==1 ) *pSize = 0;
  2937   2937   
  2938   2938   
  2939   2939     return SQLITE_OK;
  2940   2940   }
  2941   2941   
         2942  +#if SQLITE_ENABLE_LOCKING_MODE && defined(__DARWIN__)
  2942   2943   /*
  2943   2944   ** Handler for proxy-locking file-control verbs.  Defined below in the
  2944   2945   ** proxying locking division.
  2945   2946   */
  2946   2947   static int proxyFileControl(sqlite3_file*,int,void*);
         2948  +#endif
  2947   2949   
  2948   2950   
  2949   2951   /*
  2950   2952   ** Information and control of an open file handle.
  2951   2953   */
  2952   2954   static int unixFileControl(sqlite3_file *id, int op, void *pArg){
  2953   2955     switch( op ){
................................................................................
  3281   3283         unixEnterMutex();
  3282   3284         rc = findLockInfo(pNew, NULL, &pNew->pOpen);
  3283   3285         unixLeaveMutex();        
  3284   3286       }
  3285   3287     }
  3286   3288   #endif
  3287   3289   
  3288         -#if SQLITE_ENABLE_LOCKING_STYLE
  3289   3290     else if( pLockingStyle == &dotlockIoMethods ){
  3290   3291       /* Dotfile locking uses the file path so it needs to be included in
  3291   3292       ** the dotlockLockingContext 
  3292   3293       */
  3293   3294       char *zLockFile;
  3294   3295       int nFilename;
  3295   3296       nFilename = strlen(zFilename) + 6;
................................................................................
  3297   3298       if( zLockFile==0 ){
  3298   3299         rc = SQLITE_NOMEM;
  3299   3300       }else{
  3300   3301         sqlite3_snprintf(nFilename, zLockFile, "%s" DOTLOCK_SUFFIX, zFilename);
  3301   3302       }
  3302   3303       pNew->lockingContext = zLockFile;
  3303   3304     }
  3304         -#endif
  3305   3305   
  3306   3306   #if OS_VXWORKS
  3307   3307     else if( pLockingStyle == &semIoMethods ){
  3308   3308       /* Named semaphore locking uses the file path so it needs to be
  3309   3309       ** included in the semLockingContext
  3310   3310       */
  3311   3311       unixEnterMutex();
................................................................................
  3433   3433         zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
  3434   3434       }
  3435   3435       zBuf[j] = 0;
  3436   3436     }while( access(zBuf,0)==0 );
  3437   3437     return SQLITE_OK;
  3438   3438   }
  3439   3439   
         3440  +#if SQLITE_ENABLE_LOCKING_MODE && defined(__DARWIN__)
  3440   3441   /*
  3441   3442   ** Routine to transform a unixFile into a proxy-locking unixFile.
  3442   3443   ** Implementation in the proxy-lock division, but used by unixOpen()
  3443   3444   ** if SQLITE_PREFER_PROXY_LOCKING is defined.
  3444   3445   */
  3445   3446   static int proxyTransformUnixFile(unixFile*, const char*);
         3447  +#endif
  3446   3448   
  3447   3449   
  3448   3450   /*
  3449   3451   ** Open the file zPath.
  3450   3452   ** 
  3451   3453   ** Previously, the SQLite OS layer used three functions in place of this
  3452   3454   ** one:

Changes to test/lock5.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is database locks.
    13     13   #
    14         -# $Id: lock5.test,v 1.5 2008/11/29 02:20:27 drh Exp $
           14  +# $Id: lock5.test,v 1.6 2008/12/04 12:34:16 drh Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   # This file is only run if using the unix backend compiled with the
    20     20   # SQLITE_ENABLE_LOCKING_STYLE macro.
    21     21   db close
................................................................................
    97     97     db close
    98     98     file exists test.db.lock
    99     99   } {0}
   100    100   
   101    101   #####################################################################
   102    102   
   103    103   file delete -force test.db
          104  +if {[catch {sqlite3 db test.db -vfs unix-flock} msg]} {
          105  +  finish_test
          106  +  return
          107  +}
   104    108   
   105    109   do_test lock5-flock.1 {
   106    110     sqlite3 db test.db -vfs unix-flock
   107    111     execsql {
   108    112       CREATE TABLE t1(a, b);
   109    113       BEGIN;
   110    114       INSERT INTO t1 VALUES(1, 2);