1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-10-27 08:52:26 +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

@@ -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 */