-C Allow\sa\suser\scolumn\sname\sto\sbe\sused\son\sthe\sLHS\sof\sa\sMATCH\soperator\sin\sFTS5.
-D 2017-04-13T09:45:21.225
+C Update\sthe\scode\sin\stest_delete.c\sto\suse\sthe\s"win32"\sVFS\sif\sSQLITE_OS_WIN\sis\ndefined.
+D 2017-04-13T15:36:47.128
F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc a4c0613a18663bda56d8cf76079ab6590a7c3602e54befb4bbdef76bcaa38b6a
F src/test_blob.c f65ac717da2618691cf9dad094e6da0219dcd208
F src/test_btree.c 8b2dc8b8848cf3a4db93f11578f075e82252a274
F src/test_config.c edcba290248dc18736dd814c9b95863c6762e0b35753048d8cbe5bf65f7abfbb
-F src/test_delete.c af7eab5702f853fb1c62a5f7665e2234cf1ae17b
+F src/test_delete.c e9c5a8556970f320ec7d5c10adbe33361c565553896ad443d0d5219146fe7308
F src/test_demovfs.c a0c3bdd45ed044115c2c9f7779e56eafff18741e
F src/test_devsym.c 4e58dec2602d8e139ca08659f62a62450587cb58
F src/test_fs.c e16cbe68d3b107e00a907c20a9a02629870eb69b
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 8e7b611863247a3bf46a96ec4b47d24c0ae0d60c9cee968a1cfd1da157e7c9bb
-R c8c7d138fdb377c6e26ca103486be93e
+P 6f54ffd151b0eca6f9ef57ac54802584a839cfc7373f10c100fc18c855edcc0a
+R 059cacbdb1a4697b56b848d2127e6b17
U dan
-Z 1fddd5a6b11f63b38f6de23209c4c2b7
+Z 0315456a90ada783d6692c926030f70c
** above.
*/
-#if SQLITE_OS_WIN
-# include <io.h>
-# define F_OK 0
-#else
+#ifndef SQLITE_OS_WIN
# include <unistd.h>
+# include <errno.h>
#endif
#include <string.h>
-#include <errno.h>
+#include <assert.h>
#include "sqlite3.h"
/* The following #defines are copied from test_multiplex.c */
** set *pbExists to true and unlink it. Or, if the file does not exist,
** set *pbExists to false before returning.
**
-** If an error occurs, the value of errno is returned. Or, if no error
-** occurs, zero is returned.
+** If an error occurs, non-zero is returned. Or, if no error occurs, zero.
*/
-static int sqlite3DeleteUnlinkIfExists(const char *zFile, int *pbExists){
- int rc;
+static int sqlite3DeleteUnlinkIfExists(
+ sqlite3_vfs *pVfs,
+ const char *zFile,
+ int *pbExists
+){
+ int rc = SQLITE_ERROR;
+#if SQLITE_OS_WIN
+ if( pVfs ){
+ if( pbExists ) *pbExists = 1;
+ rc = pVfs->xDelete(pVfs, zFile, 0);
+ if( rc==SQLITE_IOERR_DELETE_NOENT ){
+ if( pbExists ) *pbExists = 0;
+ rc = SQLITE_OK;
+ }
+ }
+#else
+ assert( pVfs==0 );
rc = access(zFile, F_OK);
if( rc ){
if( errno==ENOENT ){
if( pbExists ) *pbExists = 0;
- return 0;
+ rc = SQLITE_OK;
}
- return errno;
+ }else{
+ if( pbExists ) *pbExists = 1;
+ rc = unlink(zFile);
}
- if( pbExists ) *pbExists = 1;
- rc = unlink(zFile);
- if( rc ) return errno;
- return 0;
+#endif
+ return rc;
}
/*
** Delete the database file identified by the string argument passed to this
** function. The string must contain a filename, not an SQLite URI.
*/
-SQLITE_API int sqlite3_delete_database(
+int sqlite3_delete_database(
const char *zFile /* File to delete */
){
char *zBuf; /* Buffer to sprintf() filenames to */
{ "%s-wal%03d", SQLITE_MULTIPLEX_WAL_8_3_OFFSET, 1 },
};
+#ifdef SQLITE_OS_WIN
+ sqlite3_vfs *pVfs = sqlite3_vfs_find("win32");
+#else
+ sqlite3_vfs *pVfs = 0;
+#endif
+
/* Allocate a buffer large enough for any of the files that need to be
** deleted. */
nBuf = (int)strlen(zFile) + 100;
** journal, wal and shm files. */
for(i=0; rc==0 && i<sizeof(azFmt)/sizeof(azFmt[0]); i++){
sqlite3_snprintf(nBuf, zBuf, azFmt[i], zFile);
- rc = sqlite3DeleteUnlinkIfExists(zBuf, 0);
+ rc = sqlite3DeleteUnlinkIfExists(pVfs, zBuf, 0);
if( rc==0 && i!=0 ){
sqlite3Delete83Name(zBuf);
- rc = sqlite3DeleteUnlinkIfExists(zBuf, 0);
+ rc = sqlite3DeleteUnlinkIfExists(pVfs, zBuf, 0);
}
}
int bExists;
sqlite3_snprintf(nBuf, zBuf, p->zFmt, zFile, iChunk+p->iOffset);
if( p->b83 ) sqlite3Delete83Name(zBuf);
- rc = sqlite3DeleteUnlinkIfExists(zBuf, &bExists);
+ rc = sqlite3DeleteUnlinkIfExists(pVfs, zBuf, &bExists);
if( bExists==0 || rc!=0 ) break;
}
}