/ Check-in [6cb537bd]
Login

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

Overview
Comment:Fix the SQLITE_ENABLE_APPLE_SPI compile-time option.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | apple-osx
Files: files | file ages | folders
SHA3-256: 6cb537bdce85e08810ac952b753ecd97b656cc0885cfda443b810b9242bf9c79
User & Date: drh 2018-10-12 22:02:27
Context
2018-10-25
16:58
Merge bug fixes from trunk. check-in: 1e973f65 user: drh tags: apple-osx
2018-10-12
22:02
Fix the SQLITE_ENABLE_APPLE_SPI compile-time option. check-in: 6cb537bd user: drh tags: apple-osx
2018-10-11
18:45
Fix issues with the new textkey pragma from the previous check-in. check-in: d1008b07 user: drh tags: apple-osx
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btreeInt.h.

   229    229   #define MX_CELL(pBt) ((pBt->pageSize-8)/6)
   230    230   
   231    231   /* Forward declarations */
   232    232   typedef struct MemPage MemPage;
   233    233   typedef struct BtLock BtLock;
   234    234   typedef struct CellInfo CellInfo;
   235    235   
   236         -/*
   237         -** This is a magic string that appears at the beginning of every
   238         -** SQLite database in order to identify the file as a real database.
   239         -**
   240         -** You can change this value at compile-time by specifying a
   241         -** -DSQLITE_FILE_HEADER="..." on the compiler command-line.  The
   242         -** header must be exactly 16 bytes including the zero-terminator so
   243         -** the string itself should be 15 characters long.  If you change
   244         -** the header, then your custom library will not be able to read 
   245         -** databases generated by the standard tools and the standard tools
   246         -** will not be able to read databases created by your custom library.
   247         -*/
   248         -#ifndef SQLITE_FILE_HEADER /* 123456789 123456 */
   249         -#  define SQLITE_FILE_HEADER "SQLite format 3"
   250         -#endif
   251         -
   252    236   /*
   253    237   ** Page type flags.  An ORed combination of these flags appear as the
   254    238   ** first byte of on-disk image of every BTree page.
   255    239   */
   256    240   #define PTF_INTKEY    0x01
   257    241   #define PTF_ZERODATA  0x02
   258    242   #define PTF_LEAFDATA  0x04

Changes to src/os_unix.c.

  5724   5724         
  5725   5725         /* Check to see if the shm file is already opened for this pFile */
  5726   5726         if( j==2 ){
  5727   5727           unixEnterMutex(); /* Because pFile->pInode is shared across threads */
  5728   5728           unixShmNode *pShmNode = pFile->pInode->pShmNode;
  5729   5729           if( pShmNode && !pShmNode->isReadonly ){
  5730   5730             struct stat sStat;
  5731         -          sqlite3_mutex_enter(pShmNode->mutex);
         5731  +          sqlite3_mutex_enter(pShmNode->pShmMutex);
  5732   5732             
  5733         -          if( pShmNode->h>=0 && !osFstat(pShmNode->h, &sStat) ){
         5733  +          if( pShmNode->hShm>=0 && !osFstat(pShmNode->hShm, &sStat) ){
  5734   5734               unsigned long size = (sStat.st_size<4) ? sStat.st_size : 4;
  5735   5735               if( size>0 ){
  5736   5736                 bzero(pShmNode->apRegion[0], size);
  5737         -              sqlite3_mutex_leave(pShmNode->mutex);
         5737  +              sqlite3_mutex_leave(pShmNode->pShmMutex);
  5738   5738                 unixLeaveMutex();
  5739   5739                 continue;
  5740   5740               }
  5741   5741             }
  5742         -          sqlite3_mutex_leave(pShmNode->mutex);
         5742  +          sqlite3_mutex_leave(pShmNode->pShmMutex);
  5743   5743           }
  5744   5744           unixLeaveMutex();
  5745   5745         }
  5746   5746         jLen = strlcpy(&jPath[zLen], extensions[j], 9);
  5747   5747         if( jLen < 9 ){
  5748   5748           int jflags = (j<2) ? O_TRUNC : O_RDWR;
  5749   5749           int jfd = open(jPath, jflags);
................................................................................
  6069   6069     }
  6070   6070     if( nLock==0 && isWal!=0 ){
  6071   6071       /* lookup the file descriptor for the shared memory file if we have it open
  6072   6072       ** in this process */
  6073   6073       unixEnterMutex(); /* Because pFile->pInode is shared across threads */
  6074   6074       unixShmNode *pShmNode = pFile->pInode->pShmNode;
  6075   6075       if( pShmNode ){
  6076         -      sqlite3_mutex_enter(pShmNode->mutex);
         6076  +      sqlite3_mutex_enter(pShmNode->pShmMutex);
  6077   6077         
  6078         -      hShm = pShmNode->h;
         6078  +      hShm = pShmNode->hShm;
  6079   6079         if( hShm >= 0){
  6080   6080           if( unixIsLocked(pid, hShm, F_RDLCK, SHM_RECOVER, 1, "WAL-RECOVERY") ||
  6081   6081              unixIsLocked(pid, hShm, F_RDLCK, SHM_WRITE, 1, "WAL-WRITE") ){
  6082   6082             nLock = 1;
  6083   6083           }
  6084   6084         }
  6085   6085         
  6086         -      sqlite3_mutex_leave(pShmNode->mutex);
         6086  +      sqlite3_mutex_leave(pShmNode->pShmMutex);
  6087   6087       } 
  6088   6088       
  6089   6089       if( hShm<0 ){
  6090   6090         /* the shared memory file isn't open in this process space, open our
  6091   6091         ** own FD */
  6092   6092         char zShm[MAXPATHLEN];
  6093   6093         

Changes to src/sqliteInt.h.

   327    327   #if defined(SQLITE_SYSTEM_MALLOC) \
   328    328     + defined(SQLITE_WIN32_MALLOC) \
   329    329     + defined(SQLITE_ZERO_MALLOC) \
   330    330     + defined(SQLITE_MEMDEBUG)==0
   331    331   # define SQLITE_SYSTEM_MALLOC 1
   332    332   #endif
   333    333   
          334  +/*
          335  +** This is a magic string that appears at the beginning of every
          336  +** SQLite database in order to identify the file as a real database.
          337  +**
          338  +** You can change this value at compile-time by specifying a
          339  +** -DSQLITE_FILE_HEADER="..." on the compiler command-line.  The
          340  +** header must be exactly 16 bytes including the zero-terminator so
          341  +** the string itself should be 15 characters long.  If you change
          342  +** the header, then your custom library will not be able to read 
          343  +** databases generated by the standard tools and the standard tools
          344  +** will not be able to read databases created by your custom library.
          345  +*/
          346  +#ifndef SQLITE_FILE_HEADER /* 123456789 123456 */
          347  +#  define SQLITE_FILE_HEADER "SQLite format 3"
          348  +#endif
          349  +
   334    350   /*
   335    351   ** If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the
   336    352   ** sizes of memory allocations below this value where possible.
   337    353   */
   338    354   #if !defined(SQLITE_MALLOC_SOFT_LIMIT)
   339    355   # define SQLITE_MALLOC_SOFT_LIMIT 1024
   340    356   #endif