SQLite

Check-in [08bbbd8e38]
Login

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

Overview
Comment:Improvements to comments. No code changes.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | nx-devkit
Files: files | file ages | folders
SHA1: 08bbbd8e38697908ab8ae0f6b512d01c32f7e4da
User & Date: drh 2011-12-14 01:38:12.485
Context
2011-12-14
18:28
Merge the VFSNAME file-control addition into the nx-devkit branch. (check-in: 08c1dc517c user: drh tags: nx-devkit)
17:53
Add a file-control that will discover the name of the bottom-level VFS and all the shims in between. (Closed-Leaf check-in: cdbfb553af user: drh tags: vfsname-filectrl)
01:38
Improvements to comments. No code changes. (check-in: 08bbbd8e38 user: drh tags: nx-devkit)
2011-12-13
19:03
Add a hard limit to the number of chunks a multiplexed database may consist of if ENABLE_8_3_NAMES is defined. (check-in: 43a1264088 user: dan tags: nx-devkit)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/test_multiplex.c.
77
78
79
80
81
82
83

84
85
86
87
88
89
90
#define sqlite3_mutex_enter(X)
#define sqlite3_mutex_try(X)      SQLITE_OK
#define sqlite3_mutex_leave(X)
#define sqlite3_mutex_held(X)     ((void)(X),1)
#define sqlite3_mutex_notheld(X)  ((void)(X),1)
#endif /* SQLITE_THREADSAFE==0 */


#define SQLITE_MULTIPLEX_JOURNAL_8_3_OFFSET 400


/************************ Shim Definitions ******************************/

#ifndef SQLITE_MULTIPLEX_VFS_NAME
# define SQLITE_MULTIPLEX_VFS_NAME "multiplex"







>







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#define sqlite3_mutex_enter(X)
#define sqlite3_mutex_try(X)      SQLITE_OK
#define sqlite3_mutex_leave(X)
#define sqlite3_mutex_held(X)     ((void)(X),1)
#define sqlite3_mutex_notheld(X)  ((void)(X),1)
#endif /* SQLITE_THREADSAFE==0 */

/* First chunk for rollback journal files */
#define SQLITE_MULTIPLEX_JOURNAL_8_3_OFFSET 400


/************************ Shim Definitions ******************************/

#ifndef SQLITE_MULTIPLEX_VFS_NAME
# define SQLITE_MULTIPLEX_VFS_NAME "multiplex"
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
    if( iChunk>0 ){
#ifdef SQLITE_ENABLE_8_3_NAMES
      int i;
      for(i=n-1; i>0 && i>=n-4 && z[i]!='.'; i--){}
      if( i>=n-4 ) n = i+1;
      if( pGroup->flags & (SQLITE_OPEN_MAIN_JOURNAL|SQLITE_OPEN_TEMP_JOURNAL) ){
        /* The extensions on overflow files for main databases are 001, 002,
        ** 003 and so forth.  To avoid name collisions, add 100 to the 
        ** extensions of journal files so that they are 101, 102, 103, ....
        */
        iChunk += SQLITE_MULTIPLEX_JOURNAL_8_3_OFFSET;
      }
#endif
      sqlite3_snprintf(4,&z[n],"%03d",iChunk);
    }
  }







|
|







240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
    if( iChunk>0 ){
#ifdef SQLITE_ENABLE_8_3_NAMES
      int i;
      for(i=n-1; i>0 && i>=n-4 && z[i]!='.'; i--){}
      if( i>=n-4 ) n = i+1;
      if( pGroup->flags & (SQLITE_OPEN_MAIN_JOURNAL|SQLITE_OPEN_TEMP_JOURNAL) ){
        /* The extensions on overflow files for main databases are 001, 002,
        ** 003 and so forth.  To avoid name collisions, add 400 to the 
        ** extensions of journal files so that they are 401, 402, 403, ....
        */
        iChunk += SQLITE_MULTIPLEX_JOURNAL_8_3_OFFSET;
      }
#endif
      sqlite3_snprintf(4,&z[n],"%03d",iChunk);
    }
  }
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
  int *rc,
  int *pOutFlags
){
  sqlite3_file *pSubOpen = 0;
  sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs;        /* Real VFS */

#ifdef SQLITE_ENABLE_8_3_NAMES
  /* If JOURNAL_8_3_OFFSET is set to (say) 500, then any overflow files are 
  ** part of a database journal are named db.501, db.502, and so on. A 
  ** database may therefore not grow to larger than 500 chunks. Attempting
  ** to open chunk 501 indicates the database is full. */
  if( iChunk>=SQLITE_MULTIPLEX_JOURNAL_8_3_OFFSET ){
    *rc = SQLITE_FULL;
    return 0;
  }
#endif

  *rc = multiplexSubFilename(pGroup, iChunk);







|
|
|
|







265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
  int *rc,
  int *pOutFlags
){
  sqlite3_file *pSubOpen = 0;
  sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs;        /* Real VFS */

#ifdef SQLITE_ENABLE_8_3_NAMES
  /* If JOURNAL_8_3_OFFSET is set to (say) 400, then any overflow files are 
  ** part of a database journal are named db.401, db.402, and so on. A 
  ** database may therefore not grow to larger than 400 chunks. Attempting
  ** to open chunk 401 indicates the database is full. */
  if( iChunk>=SQLITE_MULTIPLEX_JOURNAL_8_3_OFFSET ){
    *rc = SQLITE_FULL;
    return 0;
  }
#endif

  *rc = multiplexSubFilename(pGroup, iChunk);