summaryrefslogtreecommitdiffstats
path: root/third_party/sqlite/tool/speedtest8.c
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/sqlite/tool/speedtest8.c')
-rw-r--r--third_party/sqlite/tool/speedtest8.c91
1 files changed, 0 insertions, 91 deletions
diff --git a/third_party/sqlite/tool/speedtest8.c b/third_party/sqlite/tool/speedtest8.c
index 5972947..051fc89 100644
--- a/third_party/sqlite/tool/speedtest8.c
+++ b/third_party/sqlite/tool/speedtest8.c
@@ -90,89 +90,6 @@ static void prepareAndRun(sqlite3 *db, const char *zSql, int bQuiet){
}
}
-/***************************************************************************
-** The "overwrite" VFS is an overlay over the default VFS. It modifies
-** the xTruncate operation on journal files so that xTruncate merely
-** writes zeros into the first 50 bytes of the file rather than truely
-** truncating the file.
-**
-** The following variables are initialized to be the virtual function
-** tables for the overwrite VFS.
-*/
-static sqlite3_vfs overwrite_vfs;
-static sqlite3_io_methods overwrite_methods;
-
-/*
-** The truncate method for journal files in the overwrite VFS.
-*/
-static int overwriteTruncate(sqlite3_file *pFile, sqlite_int64 size){
- int rc;
- static const char buf[50];
- if( size ){
- return SQLITE_IOERR;
- }
- rc = pFile->pMethods->xWrite(pFile, buf, sizeof(buf), 0);
- if( rc==SQLITE_OK ){
- rc = pFile->pMethods->xSync(pFile, SQLITE_SYNC_NORMAL);
- }
- return rc;
-}
-
-/*
-** The delete method for journal files in the overwrite VFS.
-*/
-static int overwriteDelete(sqlite3_file *pFile){
- return overwriteTruncate(pFile, 0);
-}
-
-/*
-** The open method for overwrite VFS. If the file being opened is
-** a journal file then substitute the alternative xTruncate method.
-*/
-static int overwriteOpen(
- sqlite3_vfs *pVfs,
- const char *zName,
- sqlite3_file *pFile,
- int flags,
- int *pOutFlags
-){
- int rc;
- sqlite3_vfs *pRealVfs;
- int isJournal;
-
- isJournal = (flags & (SQLITE_OPEN_MAIN_JOURNAL|SQLITE_OPEN_TEMP_JOURNAL))!=0;
- pRealVfs = (sqlite3_vfs*)pVfs->pAppData;
- rc = pRealVfs->xOpen(pRealVfs, zName, pFile, flags, pOutFlags);
- if( rc==SQLITE_OK && isJournal ){
- if( overwrite_methods.xTruncate==0 ){
- sqlite3_io_methods temp;
- memcpy(&temp, pFile->pMethods, sizeof(temp));
- temp.xTruncate = overwriteTruncate;
- memcpy(&overwrite_methods, &temp, sizeof(temp));
- }
- pFile->pMethods = &overwrite_methods;
- }
- return rc;
-}
-
-/*
-** Overlay the overwrite VFS over top of the current default VFS
-** and make the overlay VFS the new default.
-**
-** This routine can only be evaluated once. On second and subsequent
-** executions it becomes a no-op.
-*/
-static void registerOverwriteVfs(void){
- sqlite3_vfs *pBase;
- if( overwrite_vfs.iVersion ) return;
- pBase = sqlite3_vfs_find(0);
- memcpy(&overwrite_vfs, pBase, sizeof(overwrite_vfs));
- overwrite_vfs.pAppData = pBase;
- overwrite_vfs.xOpen = overwriteOpen;
- overwrite_vfs.zName = "overwriteVfs";
- sqlite3_vfs_register(&overwrite_vfs, 1);
-}
-
int main(int argc, char **argv){
sqlite3 *db;
int rc;
@@ -199,13 +116,6 @@ int main(int argc, char **argv){
while (argc>3)
{
- if( argc>3 && strcmp(argv[1], "-overwrite")==0 ){
- registerOverwriteVfs();
- argv++;
- argc--;
- continue;
- }
-
#ifdef HAVE_OSINST
if( argc>4 && (strcmp(argv[1], "-log")==0) ){
pVfs = sqlite3_instvfs_binarylog("oslog", 0, argv[2]);
@@ -264,7 +174,6 @@ int main(int argc, char **argv){
fprintf(stderr, "Usage: %s [options] FILENAME SQL-SCRIPT\n"
"Runs SQL-SCRIPT against a UTF8 database\n"
"\toptions:\n"
- "\t-overwrite\n"
#ifdef HAVE_OSINST
"\t-log <log>\n"
#endif