/ Check-in [62a7353d]
Login

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

Overview
Comment:Changes to support linking without a parser and without a disk I/O interface. (CVS 2504)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 62a7353d4af4886b1561832e8b36e8e788b38834
User & Date: drh 2005-06-07 22:22:51
Context
2005-06-12
12:01
Elminiate a VM opcode that was no longer needed. (CVS 2505) check-in: 97b348a5 user: drh tags: trunk
2005-06-07
22:22
Changes to support linking without a parser and without a disk I/O interface. (CVS 2504) check-in: 62a7353d user: drh tags: trunk
20:07
In the documentation, amplify the fact that encodings cannot be changed on a database that already exists. Ticket #1277. (CVS 2503) check-in: 4704f3a1 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to src/os.h.

    19     19   
    20     20   /*
    21     21   ** Figure out if we are dealing with Unix, Windows or MacOS.
    22     22   **
    23     23   ** N.B. MacOS means Mac Classic (or Carbon). Treat Darwin (OS X) as Unix.
    24     24   **      The MacOS build is designed to use CodeWarrior (tested with v8)
    25     25   */
    26         -#if !defined(OS_UNIX) && !defined(OS_TEST) && !defined(OS_MEM)
           26  +#if !defined(OS_UNIX) && !defined(OS_TEST) && !defined(OS_OTHER)
           27  +# define OS_OTHER 0
    27     28   # ifndef OS_WIN
    28     29   #   if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__)
    29     30   #     define OS_WIN 1
    30     31   #     define OS_UNIX 0
    31     32   #   else
    32     33   #     define OS_WIN 0
    33     34   #     define OS_UNIX 1
................................................................................
    36     37   #  define OS_UNIX 0
    37     38   # endif
    38     39   #else
    39     40   # ifndef OS_WIN
    40     41   #  define OS_WIN 0
    41     42   # endif
    42     43   #endif
    43         -#ifndef OS_MEM
    44         -# define OS_MEM 0
    45         -#endif
    46     44   
    47     45   /*
    48     46   ** Invoke the appropriate operating-system specific header file.
    49     47   */
    50     48   #if OS_TEST
    51     49   # include "os_test.h"
    52     50   #endif
    53     51   #if OS_UNIX
    54     52   # include "os_unix.h"
    55     53   #endif
    56     54   #if OS_WIN
    57     55   # include "os_win.h"
    58     56   #endif
    59         -#if OS_MEM
    60         -# include "os_mem.h"
           57  +
           58  +/* os_other.c and os_other.h are not delivered with SQLite.  These files
           59  +** are place-holders that can be filled in by third-party developers to
           60  +** implement backends to their on proprietary operating systems.
           61  +*/
           62  +#if OS_OTHER
           63  +# include "os_other.h"
    61     64   #endif
    62     65   
    63     66   /* If the SET_FULLSYNC macro is not defined above, then make it
    64     67   ** a no-op
    65     68   */
    66     69   #ifndef SET_FULLSYNC
    67     70   # define SET_FULLSYNC(x,y)
................................................................................
   177    180   int sqlite3OsClose(OsFile*);
   178    181   int sqlite3OsRead(OsFile*, void*, int amt);
   179    182   int sqlite3OsWrite(OsFile*, const void*, int amt);
   180    183   int sqlite3OsSeek(OsFile*, i64 offset);
   181    184   int sqlite3OsSync(OsFile*);
   182    185   int sqlite3OsTruncate(OsFile*, i64 size);
   183    186   int sqlite3OsFileSize(OsFile*, i64 *pSize);
   184         -int sqlite3OsRandomSeed(char*);
   185         -int sqlite3OsSleep(int ms);
   186         -int sqlite3OsCurrentTime(double*);
   187         -int sqlite3OsFileModTime(OsFile*, double*);
   188         -void sqlite3OsEnterMutex(void);
   189         -void sqlite3OsLeaveMutex(void);
   190    187   char *sqlite3OsFullPathname(const char*);
   191    188   int sqlite3OsLock(OsFile*, int);
   192    189   int sqlite3OsUnlock(OsFile*, int);
   193    190   int sqlite3OsCheckReservedLock(OsFile *id);
   194    191   
          192  +
          193  +/* The interface for file I/O is above.  Other miscellaneous functions
          194  +** are below */
          195  +
          196  +int sqlite3OsRandomSeed(char*);
          197  +int sqlite3OsSleep(int ms);
          198  +int sqlite3OsCurrentTime(double*);
          199  +void sqlite3OsEnterMutex(void);
          200  +void sqlite3OsLeaveMutex(void);
          201  +
   195    202   #endif /* _SQLITE_OS_H_ */

Changes to src/os_unix.c.

    16     16   #include "os.h"
    17     17   #if OS_UNIX              /* This file is used on unix only */
    18     18   
    19     19   
    20     20   #include <time.h>
    21     21   #include <errno.h>
    22     22   #include <unistd.h>
           23  +
           24  +/*
           25  +** Do not include any of the File I/O interface procedures if the
           26  +** SQLITE_OMIT_DISKIO macro is defined (indicating that there database
           27  +** will be in-memory only)
           28  +*/
           29  +#ifndef SQLITE_OMIT_DISKIO
           30  +
           31  +
           32  +/*
           33  +** Define various macros that are missing from some systems.
           34  +*/
    23     35   #ifndef O_LARGEFILE
    24     36   # define O_LARGEFILE 0
    25     37   #endif
    26     38   #ifdef SQLITE_DISABLE_LFS
    27     39   # undef O_LARGEFILE
    28     40   # define O_LARGEFILE 0
    29     41   #endif
    30     42   #ifndef O_NOFOLLOW
    31     43   # define O_NOFOLLOW 0
    32     44   #endif
    33     45   #ifndef O_BINARY
    34     46   # define O_BINARY 0
    35     47   #endif
    36         -
    37     48   
    38     49   /*
    39     50   ** The DJGPP compiler environment looks mostly like Unix, but it
    40     51   ** lacks the fcntl() system call.  So redefine fcntl() to be something
    41     52   ** that always succeeds.  This means that locking does not occur under
    42     53   ** DJGPP.  But its DOS - what did you expect?
    43     54   */
................................................................................
  1194   1205     releaseOpenCnt(id->pOpen);
  1195   1206     sqlite3OsLeaveMutex();
  1196   1207     id->isOpen = 0;
  1197   1208     TRACE2("CLOSE   %-3d\n", id->h);
  1198   1209     OpenCounter(-1);
  1199   1210     return SQLITE_OK;
  1200   1211   }
         1212  +
         1213  +/*
         1214  +** Turn a relative pathname into a full pathname.  Return a pointer
         1215  +** to the full pathname stored in space obtained from sqliteMalloc().
         1216  +** The calling function is responsible for freeing this space once it
         1217  +** is no longer needed.
         1218  +*/
         1219  +char *sqlite3OsFullPathname(const char *zRelative){
         1220  +  char *zFull = 0;
         1221  +  if( zRelative[0]=='/' ){
         1222  +    sqlite3SetString(&zFull, zRelative, (char*)0);
         1223  +  }else{
         1224  +    char zBuf[5000];
         1225  +    zBuf[0] = 0;
         1226  +    sqlite3SetString(&zFull, getcwd(zBuf, sizeof(zBuf)), "/", zRelative,
         1227  +                    (char*)0);
         1228  +  }
         1229  +  return zFull;
         1230  +}
         1231  +
         1232  +
         1233  +#endif /* SQLITE_OMIT_DISKIO */
         1234  +/***************************************************************************
         1235  +** Everything above deals with file I/O.  Everything that follows deals
         1236  +** with other miscellanous aspects of the operating system interface
         1237  +****************************************************************************/
         1238  +
  1201   1239   
  1202   1240   /*
  1203   1241   ** Get information to seed the random number generator.  The seed
  1204   1242   ** is written into the buffer zBuf[256].  The calling function must
  1205   1243   ** supply a sufficiently large buffer.
  1206   1244   */
  1207   1245   int sqlite3OsRandomSeed(char *zBuf){
................................................................................
  1275   1313     assert( inMutex );
  1276   1314     inMutex = 0;
  1277   1315   #ifdef SQLITE_UNIX_THREADS
  1278   1316     pthread_mutex_unlock(&mutex);
  1279   1317   #endif
  1280   1318   }
  1281   1319   
  1282         -/*
  1283         -** Turn a relative pathname into a full pathname.  Return a pointer
  1284         -** to the full pathname stored in space obtained from sqliteMalloc().
  1285         -** The calling function is responsible for freeing this space once it
  1286         -** is no longer needed.
  1287         -*/
  1288         -char *sqlite3OsFullPathname(const char *zRelative){
  1289         -  char *zFull = 0;
  1290         -  if( zRelative[0]=='/' ){
  1291         -    sqlite3SetString(&zFull, zRelative, (char*)0);
  1292         -  }else{
  1293         -    char zBuf[5000];
  1294         -    zBuf[0] = 0;
  1295         -    sqlite3SetString(&zFull, getcwd(zBuf, sizeof(zBuf)), "/", zRelative,
  1296         -                    (char*)0);
  1297         -  }
  1298         -  return zFull;
  1299         -}
  1300         -
  1301   1320   /*
  1302   1321   ** The following variable, if set to a non-zero value, becomes the result
  1303   1322   ** returned from sqlite3OsCurrentTime().  This is used for testing.
  1304   1323   */
  1305   1324   #ifdef SQLITE_TEST
  1306   1325   int sqlite3_current_time = 0;
  1307   1326   #endif
................................................................................
  1319   1338     if( sqlite3_current_time ){
  1320   1339       *prNow = sqlite3_current_time/86400.0 + 2440587.5;
  1321   1340     }
  1322   1341   #endif
  1323   1342     return 0;
  1324   1343   }
  1325   1344   
  1326         -#if 0 /* NOT USED */
  1327         -/*
  1328         -** Find the time that the file was last modified.  Write the
  1329         -** modification time and date as a Julian Day number into *prNow and
  1330         -** return SQLITE_OK.  Return SQLITE_ERROR if the modification
  1331         -** time cannot be found.
  1332         -*/
  1333         -int sqlite3OsFileModTime(OsFile *id, double *prNow){
  1334         -  int rc;
  1335         -  struct stat statbuf;
  1336         -  if( fstat(id->h, &statbuf)==0 ){
  1337         -    *prNow = statbuf.st_mtime/86400.0 + 2440587.5;
  1338         -    rc = SQLITE_OK;
  1339         -  }else{
  1340         -    rc = SQLITE_ERROR;
  1341         -  }
  1342         -  return rc;
  1343         -}
  1344         -#endif /* NOT USED */
  1345         -
  1346   1345   #endif /* OS_UNIX */

Changes to src/os_win.c.

    30     30   #endif
    31     31   
    32     32   /*
    33     33   ** Include code that is common to all os_*.c files
    34     34   */
    35     35   #include "os_common.h"
    36     36   
           37  +/*
           38  +** Do not include any of the File I/O interface procedures if the
           39  +** SQLITE_OMIT_DISKIO macro is defined (indicating that there database
           40  +** will be in-memory only)
           41  +*/
           42  +#ifndef SQLITE_OMIT_DISKIO
           43  +
    37     44   /*
    38     45   ** Delete the named file
    39     46   */
    40     47   int sqlite3OsDelete(const char *zFilename){
    41     48     DeleteFileA(zFilename);
    42     49     TRACE2("DELETE \"%s\"\n", zFilename);
    43     50     return SQLITE_OK;
................................................................................
   621    628     if( type>=PENDING_LOCK ){
   622    629       UnlockFile(id->h, PENDING_BYTE, 0, 1, 0);
   623    630     }
   624    631     id->locktype = locktype;
   625    632     return rc;
   626    633   }
   627    634   
          635  +/*
          636  +** Turn a relative pathname into a full pathname.  Return a pointer
          637  +** to the full pathname stored in space obtained from sqliteMalloc().
          638  +** The calling function is responsible for freeing this space once it
          639  +** is no longer needed.
          640  +*/
          641  +char *sqlite3OsFullPathname(const char *zRelative){
          642  +  char *zNotUsed;
          643  +  char *zFull;
          644  +  int nByte;
          645  +#ifdef __CYGWIN__
          646  +  nByte = strlen(zRelative) + MAX_PATH + 1001;
          647  +  zFull = sqliteMalloc( nByte );
          648  +  if( zFull==0 ) return 0;
          649  +  if( cygwin_conv_to_full_win32_path(zRelative, zFull) ) return 0;
          650  +#else
          651  +  nByte = GetFullPathNameA(zRelative, 0, 0, &zNotUsed) + 1;
          652  +  zFull = sqliteMalloc( nByte );
          653  +  if( zFull==0 ) return 0;
          654  +  GetFullPathNameA(zRelative, nByte, zFull, &zNotUsed);
          655  +#endif
          656  +  return zFull;
          657  +}
          658  +
          659  +#endif /* SQLITE_OMIT_DISKIO */
          660  +/***************************************************************************
          661  +** Everything above deals with file I/O.  Everything that follows deals
          662  +** with other miscellanous aspects of the operating system interface
          663  +****************************************************************************/
          664  +
   628    665   /*
   629    666   ** Get information to seed the random number generator.  The seed
   630    667   ** is written into the buffer zBuf[256].  The calling function must
   631    668   ** supply a sufficiently large buffer.
   632    669   */
   633    670   int sqlite3OsRandomSeed(char *zBuf){
   634    671     /* We have to initialize zBuf to prevent valgrind from reporting
................................................................................
   693    730     assert( inMutex );
   694    731     inMutex = 0;
   695    732   #ifdef SQLITE_W32_THREADS
   696    733     LeaveCriticalSection(&cs);
   697    734   #endif
   698    735   }
   699    736   
   700         -/*
   701         -** Turn a relative pathname into a full pathname.  Return a pointer
   702         -** to the full pathname stored in space obtained from sqliteMalloc().
   703         -** The calling function is responsible for freeing this space once it
   704         -** is no longer needed.
   705         -*/
   706         -char *sqlite3OsFullPathname(const char *zRelative){
   707         -  char *zNotUsed;
   708         -  char *zFull;
   709         -  int nByte;
   710         -#ifdef __CYGWIN__
   711         -  nByte = strlen(zRelative) + MAX_PATH + 1001;
   712         -  zFull = sqliteMalloc( nByte );
   713         -  if( zFull==0 ) return 0;
   714         -  if( cygwin_conv_to_full_win32_path(zRelative, zFull) ) return 0;
   715         -#else
   716         -  nByte = GetFullPathNameA(zRelative, 0, 0, &zNotUsed) + 1;
   717         -  zFull = sqliteMalloc( nByte );
   718         -  if( zFull==0 ) return 0;
   719         -  GetFullPathNameA(zRelative, nByte, zFull, &zNotUsed);
   720         -#endif
   721         -  return zFull;
   722         -}
   723         -
   724    737   /*
   725    738   ** The following variable, if set to a non-zero value, becomes the result
   726    739   ** returned from sqlite3OsCurrentTime().  This is used for testing.
   727    740   */
   728    741   #ifdef SQLITE_TEST
   729    742   int sqlite3_current_time = 0;
   730    743   #endif
................................................................................
   747    760     if( sqlite3_current_time ){
   748    761       *prNow = sqlite3_current_time/86400.0 + 2440587.5;
   749    762     }
   750    763   #endif
   751    764     return 0;
   752    765   }
   753    766   
   754         -/*
   755         -** Find the time that the file was last modified.  Write the
   756         -** modification time and date as a Julian Day number into *prNow and
   757         -** return SQLITE_OK.  Return SQLITE_ERROR if the modification
   758         -** time cannot be found.
   759         -*/
   760         -int sqlite3OsFileModTime(OsFile *id, double *prMTime){
   761         -  int rc;
   762         -  FILETIME ft;
   763         -  /* FILETIME structure is a 64-bit value representing the number of 
   764         -  ** 100-nanosecond intervals since January 1, 1601 (= JD 2305813.5). 
   765         -  */
   766         -  if( GetFileTime(id->h, 0, 0, &ft) ){
   767         -    double t;
   768         -    t = ((double)ft.dwHighDateTime) * 4294967296.0; 
   769         -    *prMTime = (t + ft.dwLowDateTime)/864000000000.0 + 2305813.5;
   770         -    rc = SQLITE_OK;
   771         -  }else{
   772         -    rc = SQLITE_ERROR;
   773         -  }
   774         -  return rc;
   775         -}
   776         -
   777    767   #endif /* OS_WIN */

Changes to src/pragma.c.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code used to implement the PRAGMA command.
    13     13   **
    14         -** $Id: pragma.c,v 1.93 2005/05/22 06:49:57 danielk1977 Exp $
           14  +** $Id: pragma.c,v 1.94 2005/06/07 22:22:51 drh Exp $
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   #include "os.h"
    18     18   #include <ctype.h>
    19     19   
    20     20   /* Ignore this whole file if pragmas are disabled
    21     21   */
    22         -#ifndef SQLITE_OMIT_PRAGMA
           22  +#if !defined(SQLITE_OMIT_PRAGMA) && !defined(SQLITE_OMIT_PARSER)
    23     23   
    24     24   #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
    25     25   # include "pager.h"
    26     26   # include "btree.h"
    27     27   #endif
    28     28   
    29     29   /*
................................................................................
   926    926       sqlite3VdbeAddOp(v, OP_Expire, 1, 0);
   927    927     }
   928    928   pragma_out:
   929    929     sqliteFree(zLeft);
   930    930     sqliteFree(zRight);
   931    931   }
   932    932   
   933         -#endif /* SQLITE_OMIT_PRAGMA */
          933  +#endif /* SQLITE_OMIT_PRAGMA || SQLITE_OMIT_PARSER */