/ Check-in [4f521b5b]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:When using mmap mode on Win32, use a read-only mapping by default. Write to the database file using WriteFile(). Unless SQLITE_MMAP_READWRITE is defined, in which case use a read/write mapping and write into the file using memcpy().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4f521b5bb36a1117db324e92dcf80abd2f1a5bc1
User & Date: mistachkin 2015-11-17 21:42:32
Context
2015-11-19
13:21
Fix a 10-year-old misguided attempt at parser performance improvement that actually made parsing slightly slower. check-in: 3833cbac user: drh tags: trunk
2015-11-18
18:43
If a table column name begins with "__hidden__" then do not include that column in "*" expansions in SELECT statements, nor fill in that column in an INSERT INTO that omits the column list. This branch is a proof-of-concept only and is not intended to ever be merged into trunk. check-in: 2dbffb3a user: drh tags: hidden-columns-in-tables
2015-11-17
21:42
When using mmap mode on Win32, use a read-only mapping by default. Write to the database file using WriteFile(). Unless SQLITE_MMAP_READWRITE is defined, in which case use a read/write mapping and write into the file using memcpy(). check-in: 4f521b5b user: mistachkin tags: trunk
20:56
When using mmap mode on unix, use a read-only mapping by default. Write to the database file using write(). Unless SQLITE_MMAP_READWRITE is defined, in which case use a read/write mapping and write into the file using memcpy(). check-in: 67c5d3c6 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_win.c.

  2598   2598     SimulateIOError(return SQLITE_IOERR_WRITE);
  2599   2599     SimulateDiskfullError(return SQLITE_FULL);
  2600   2600   
  2601   2601     OSTRACE(("WRITE pid=%lu, pFile=%p, file=%p, buffer=%p, amount=%d, "
  2602   2602              "offset=%lld, lock=%d\n", osGetCurrentProcessId(), pFile,
  2603   2603              pFile->h, pBuf, amt, offset, pFile->locktype));
  2604   2604   
  2605         -#if SQLITE_MAX_MMAP_SIZE>0
         2605  +#if defined(SQLITE_MMAP_READWRITE) && SQLITE_MAX_MMAP_SIZE>0
  2606   2606     /* Deal with as much of this write request as possible by transfering
  2607   2607     ** data from the memory mapping using memcpy().  */
  2608   2608     if( offset<pFile->mmapSize ){
  2609   2609       if( offset+amt <= pFile->mmapSize ){
  2610   2610         memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, amt);
  2611   2611         OSTRACE(("WRITE-MMAP pid=%lu, pFile=%p, file=%p, rc=SQLITE_OK\n",
  2612   2612                  osGetCurrentProcessId(), pFile, pFile->h));
................................................................................
  4092   4092     }
  4093   4093     if( nMap!=pFd->mmapSize ){
  4094   4094       void *pNew = 0;
  4095   4095       DWORD protect = PAGE_READONLY;
  4096   4096       DWORD flags = FILE_MAP_READ;
  4097   4097   
  4098   4098       winUnmapfile(pFd);
         4099  +#ifdef SQLITE_MMAP_READWRITE
  4099   4100       if( (pFd->ctrlFlags & WINFILE_RDONLY)==0 ){
  4100   4101         protect = PAGE_READWRITE;
  4101   4102         flags |= FILE_MAP_WRITE;
  4102   4103       }
         4104  +#endif
  4103   4105   #if SQLITE_OS_WINRT
  4104   4106       pFd->hMap = osCreateFileMappingFromApp(pFd->h, NULL, protect, nMap, NULL);
  4105   4107   #elif defined(SQLITE_WIN32_HAS_WIDE)
  4106   4108       pFd->hMap = osCreateFileMappingW(pFd->h, NULL, protect,
  4107   4109                                   (DWORD)((nMap>>32) & 0xffffffff),
  4108   4110                                   (DWORD)(nMap & 0xffffffff), NULL);
  4109   4111   #elif defined(SQLITE_WIN32_HAS_ANSI)