1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-10-28 19:36:04 +03:00

Changes to support linking without a parser and without a disk I/O interface. (CVS 2504)

FossilOrigin-Name: 62a7353d4af4886b1561832e8b36e8e788b38834
This commit is contained in:
drh
2005-06-07 22:22:50 +00:00
parent 80f93bf41f
commit 0ccebe7e2d
6 changed files with 108 additions and 112 deletions

View File

@@ -1,5 +1,5 @@
C In\sthe\sdocumentation,\samplify\sthe\sfact\sthat\sencodings\scannot\sbe\schanged\non\sa\sdatabase\sthat\salready\sexists.\s\sTicket\s#1277.\s(CVS\s2503)
D 2005-06-07T20:07:24
C Changes\sto\ssupport\slinking\swithout\sa\sparser\sand\swithout\sa\sdisk\sI/O\sinterface.\s(CVS\s2504)
D 2005-06-07T22:22:51
F Makefile.in 8129e7f261d405db783676f9ca31e0841768c652
F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -45,18 +45,18 @@ F src/insert.c 34c25c33f51a43644a42cc091ac967b070c6b6d5
F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b
F src/main.c f61bdb0a1afeb2eff7285f4f3752e1085ecc55ed
F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
F src/os.h e5438be25cf96858787bf9b60fc7a2420e139ee3
F src/os.h c4b34bd4d6fea51a420f337468b907f4edecb161
F src/os_common.h 0e7f428ba0a6c40a61bc56c4e96f493231301b73
F src/os_test.c 91e5f22dd89491e5e1554820e715805f43fa4ece
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
F src/os_unix.c 443ca9d19945a08ba1e325f00e13633b3daa5bfa
F src/os_unix.c 45540d7ee5095566da6685d584598edee5be857c
F src/os_unix.h 39a393252e69e72b06715c9958df05ddbc4aa971
F src/os_win.c 2bbbe6fbb010763c3fa79d5e951afca9b138c6b5
F src/os_win.c fe7b99cfcfb61d9bf54493ddf5857885a657fb89
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c 841a2cdddd4275de36cda26ed9dc54ae942660ce
F src/pager.h 0d9153d6269d60d04af3dd84a0cc0a96253cf4a4
F src/parse.y 72cd7553f05fbc7b63ea9476108d0da6237f2818
F src/pragma.c 0ed94a1aa982802a9cf2a932c48d99b60683fa53
F src/pragma.c 344e50166437194c21332ada036671a3ac95652c
F src/prepare.c d53602d2f8e097225ae7c76ec764ae68f759ba47
F src/printf.c 3d20b21cfecadacecac3fb7274e746cb81d3d357
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
@@ -281,7 +281,7 @@ F www/tclsqlite.tcl 425be741b8ae664f55cb1ef2371aab0a75109cf9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 528299b8316726dbcc5548e9aa0648c8b1bd055b
P 59960a59151ae6c711dee404e60e12d4edaa3dda
R 7ea160d72256bceb147ad6d0504408dd
P 4704f3a19af73261ec03c0192c74a0416aeba794
R 85f6631c1bb94d9cca30c0626cafa234
U drh
Z ad33796489b4694e8b4b6ddd2c758430
Z 3dbbf934a5d9b8a10bcf167378c57366

View File

@@ -1 +1 @@
4704f3a19af73261ec03c0192c74a0416aeba794
62a7353d4af4886b1561832e8b36e8e788b38834

View File

@@ -23,7 +23,8 @@
** N.B. MacOS means Mac Classic (or Carbon). Treat Darwin (OS X) as Unix.
** The MacOS build is designed to use CodeWarrior (tested with v8)
*/
#if !defined(OS_UNIX) && !defined(OS_TEST) && !defined(OS_MEM)
#if !defined(OS_UNIX) && !defined(OS_TEST) && !defined(OS_OTHER)
# define OS_OTHER 0
# ifndef OS_WIN
# if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__)
# define OS_WIN 1
@@ -40,9 +41,6 @@
# define OS_WIN 0
# endif
#endif
#ifndef OS_MEM
# define OS_MEM 0
#endif
/*
** Invoke the appropriate operating-system specific header file.
@@ -56,8 +54,13 @@
#if OS_WIN
# include "os_win.h"
#endif
#if OS_MEM
# include "os_mem.h"
/* os_other.c and os_other.h are not delivered with SQLite. These files
** are place-holders that can be filled in by third-party developers to
** implement backends to their on proprietary operating systems.
*/
#if OS_OTHER
# include "os_other.h"
#endif
/* If the SET_FULLSYNC macro is not defined above, then make it
@@ -181,15 +184,19 @@ int sqlite3OsSeek(OsFile*, i64 offset);
int sqlite3OsSync(OsFile*);
int sqlite3OsTruncate(OsFile*, i64 size);
int sqlite3OsFileSize(OsFile*, i64 *pSize);
int sqlite3OsRandomSeed(char*);
int sqlite3OsSleep(int ms);
int sqlite3OsCurrentTime(double*);
int sqlite3OsFileModTime(OsFile*, double*);
void sqlite3OsEnterMutex(void);
void sqlite3OsLeaveMutex(void);
char *sqlite3OsFullPathname(const char*);
int sqlite3OsLock(OsFile*, int);
int sqlite3OsUnlock(OsFile*, int);
int sqlite3OsCheckReservedLock(OsFile *id);
/* The interface for file I/O is above. Other miscellaneous functions
** are below */
int sqlite3OsRandomSeed(char*);
int sqlite3OsSleep(int ms);
int sqlite3OsCurrentTime(double*);
void sqlite3OsEnterMutex(void);
void sqlite3OsLeaveMutex(void);
#endif /* _SQLITE_OS_H_ */

View File

@@ -20,6 +20,18 @@
#include <time.h>
#include <errno.h>
#include <unistd.h>
/*
** Do not include any of the File I/O interface procedures if the
** SQLITE_OMIT_DISKIO macro is defined (indicating that there database
** will be in-memory only)
*/
#ifndef SQLITE_OMIT_DISKIO
/*
** Define various macros that are missing from some systems.
*/
#ifndef O_LARGEFILE
# define O_LARGEFILE 0
#endif
@@ -34,7 +46,6 @@
# define O_BINARY 0
#endif
/*
** The DJGPP compiler environment looks mostly like Unix, but it
** lacks the fcntl() system call. So redefine fcntl() to be something
@@ -1199,6 +1210,33 @@ int sqlite3OsClose(OsFile *id){
return SQLITE_OK;
}
/*
** Turn a relative pathname into a full pathname. Return a pointer
** to the full pathname stored in space obtained from sqliteMalloc().
** The calling function is responsible for freeing this space once it
** is no longer needed.
*/
char *sqlite3OsFullPathname(const char *zRelative){
char *zFull = 0;
if( zRelative[0]=='/' ){
sqlite3SetString(&zFull, zRelative, (char*)0);
}else{
char zBuf[5000];
zBuf[0] = 0;
sqlite3SetString(&zFull, getcwd(zBuf, sizeof(zBuf)), "/", zRelative,
(char*)0);
}
return zFull;
}
#endif /* SQLITE_OMIT_DISKIO */
/***************************************************************************
** Everything above deals with file I/O. Everything that follows deals
** with other miscellanous aspects of the operating system interface
****************************************************************************/
/*
** Get information to seed the random number generator. The seed
** is written into the buffer zBuf[256]. The calling function must
@@ -1279,25 +1317,6 @@ void sqlite3OsLeaveMutex(){
#endif
}
/*
** Turn a relative pathname into a full pathname. Return a pointer
** to the full pathname stored in space obtained from sqliteMalloc().
** The calling function is responsible for freeing this space once it
** is no longer needed.
*/
char *sqlite3OsFullPathname(const char *zRelative){
char *zFull = 0;
if( zRelative[0]=='/' ){
sqlite3SetString(&zFull, zRelative, (char*)0);
}else{
char zBuf[5000];
zBuf[0] = 0;
sqlite3SetString(&zFull, getcwd(zBuf, sizeof(zBuf)), "/", zRelative,
(char*)0);
}
return zFull;
}
/*
** The following variable, if set to a non-zero value, becomes the result
** returned from sqlite3OsCurrentTime(). This is used for testing.
@@ -1323,24 +1342,4 @@ int sqlite3OsCurrentTime(double *prNow){
return 0;
}
#if 0 /* NOT USED */
/*
** Find the time that the file was last modified. Write the
** modification time and date as a Julian Day number into *prNow and
** return SQLITE_OK. Return SQLITE_ERROR if the modification
** time cannot be found.
*/
int sqlite3OsFileModTime(OsFile *id, double *prNow){
int rc;
struct stat statbuf;
if( fstat(id->h, &statbuf)==0 ){
*prNow = statbuf.st_mtime/86400.0 + 2440587.5;
rc = SQLITE_OK;
}else{
rc = SQLITE_ERROR;
}
return rc;
}
#endif /* NOT USED */
#endif /* OS_UNIX */

View File

@@ -34,6 +34,13 @@
*/
#include "os_common.h"
/*
** Do not include any of the File I/O interface procedures if the
** SQLITE_OMIT_DISKIO macro is defined (indicating that there database
** will be in-memory only)
*/
#ifndef SQLITE_OMIT_DISKIO
/*
** Delete the named file
*/
@@ -625,6 +632,36 @@ int sqlite3OsUnlock(OsFile *id, int locktype){
return rc;
}
/*
** Turn a relative pathname into a full pathname. Return a pointer
** to the full pathname stored in space obtained from sqliteMalloc().
** The calling function is responsible for freeing this space once it
** is no longer needed.
*/
char *sqlite3OsFullPathname(const char *zRelative){
char *zNotUsed;
char *zFull;
int nByte;
#ifdef __CYGWIN__
nByte = strlen(zRelative) + MAX_PATH + 1001;
zFull = sqliteMalloc( nByte );
if( zFull==0 ) return 0;
if( cygwin_conv_to_full_win32_path(zRelative, zFull) ) return 0;
#else
nByte = GetFullPathNameA(zRelative, 0, 0, &zNotUsed) + 1;
zFull = sqliteMalloc( nByte );
if( zFull==0 ) return 0;
GetFullPathNameA(zRelative, nByte, zFull, &zNotUsed);
#endif
return zFull;
}
#endif /* SQLITE_OMIT_DISKIO */
/***************************************************************************
** Everything above deals with file I/O. Everything that follows deals
** with other miscellanous aspects of the operating system interface
****************************************************************************/
/*
** Get information to seed the random number generator. The seed
** is written into the buffer zBuf[256]. The calling function must
@@ -697,30 +734,6 @@ void sqlite3OsLeaveMutex(){
#endif
}
/*
** Turn a relative pathname into a full pathname. Return a pointer
** to the full pathname stored in space obtained from sqliteMalloc().
** The calling function is responsible for freeing this space once it
** is no longer needed.
*/
char *sqlite3OsFullPathname(const char *zRelative){
char *zNotUsed;
char *zFull;
int nByte;
#ifdef __CYGWIN__
nByte = strlen(zRelative) + MAX_PATH + 1001;
zFull = sqliteMalloc( nByte );
if( zFull==0 ) return 0;
if( cygwin_conv_to_full_win32_path(zRelative, zFull) ) return 0;
#else
nByte = GetFullPathNameA(zRelative, 0, 0, &zNotUsed) + 1;
zFull = sqliteMalloc( nByte );
if( zFull==0 ) return 0;
GetFullPathNameA(zRelative, nByte, zFull, &zNotUsed);
#endif
return zFull;
}
/*
** The following variable, if set to a non-zero value, becomes the result
** returned from sqlite3OsCurrentTime(). This is used for testing.
@@ -751,27 +764,4 @@ int sqlite3OsCurrentTime(double *prNow){
return 0;
}
/*
** Find the time that the file was last modified. Write the
** modification time and date as a Julian Day number into *prNow and
** return SQLITE_OK. Return SQLITE_ERROR if the modification
** time cannot be found.
*/
int sqlite3OsFileModTime(OsFile *id, double *prMTime){
int rc;
FILETIME ft;
/* FILETIME structure is a 64-bit value representing the number of
** 100-nanosecond intervals since January 1, 1601 (= JD 2305813.5).
*/
if( GetFileTime(id->h, 0, 0, &ft) ){
double t;
t = ((double)ft.dwHighDateTime) * 4294967296.0;
*prMTime = (t + ft.dwLowDateTime)/864000000000.0 + 2305813.5;
rc = SQLITE_OK;
}else{
rc = SQLITE_ERROR;
}
return rc;
}
#endif /* OS_WIN */

View File

@@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
** $Id: pragma.c,v 1.93 2005/05/22 06:49:57 danielk1977 Exp $
** $Id: pragma.c,v 1.94 2005/06/07 22:22:51 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -19,7 +19,7 @@
/* Ignore this whole file if pragmas are disabled
*/
#ifndef SQLITE_OMIT_PRAGMA
#if !defined(SQLITE_OMIT_PRAGMA) && !defined(SQLITE_OMIT_PARSER)
#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
# include "pager.h"
@@ -930,4 +930,4 @@ pragma_out:
sqliteFree(zRight);
}
#endif /* SQLITE_OMIT_PRAGMA */
#endif /* SQLITE_OMIT_PRAGMA || SQLITE_OMIT_PARSER */