/ Check-in [0e3ace39]
Login

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

Overview
Comment:Make the new file test_delete.c portable to MSVC on Windows.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | test_delete
Files: files | file ages | folders
SHA1: 0e3ace39f234c204649ec69c6a69fb0e062c58f7
User & Date: mistachkin 2016-09-09 20:26:27
Context
2016-09-10
14:43
Add test code to delete an SQLite database and its auxiliary files. check-in: 8a9d1281 user: dan tags: trunk
2016-09-09
20:26
Make the new file test_delete.c portable to MSVC on Windows. Closed-Leaf check-in: 0e3ace39 user: mistachkin tags: test_delete
20:00
Add new file test_delete.c, containing test code for deleting an sqlite database. check-in: fb0b95e9 user: dan tags: test_delete
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/test_delete.c.

15
16
17
18
19
20
21
22




23

24
25
26
27
28
29
30
..
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
**   * The journal file.
**   * The wal file.
**   * The SQLITE_ENABLE_8_3_NAMES version of the db, journal or wal files.
**   * Files created by the test_multiplex.c module to extend any of the 
**     above.
*/






#include <unistd.h>

#include <string.h>
#include <errno.h>
#include "sqlite3.h"

/* The following #defines are copied from test_multiplex.c */
#ifndef MX_CHUNK_NUMBER 
# define MX_CHUNK_NUMBER 299
................................................................................
** function. The string must contain a filename, not an SQLite URI.
*/
int sqlite3_delete_database(
  const char *zFile               /* File to delete */
){
  char *zBuf;                     /* Buffer to sprintf() filenames to */
  int nBuf;                       /* Size of buffer in bytes */
  int rc;                         /* System error code */
  int i;                          /* Iterate through azFmt[] and aMFile[] */

  const char *azFmt[] = { "%s", "%s-journal", "%s-wal", "%s-shm" };

  struct MFile {
    const char *zFmt;
    int iOffset;







<
>
>
>
>
|
>







 







|







15
16
17
18
19
20
21

22
23
24
25
26
27
28
29
30
31
32
33
34
..
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
**   * The journal file.
**   * The wal file.
**   * The SQLITE_ENABLE_8_3_NAMES version of the db, journal or wal files.
**   * Files created by the test_multiplex.c module to extend any of the 
**     above.
*/


#if SQLITE_OS_WIN
#  include <io.h>
#  define F_OK 0
#else
#  include <unistd.h>
#endif
#include <string.h>
#include <errno.h>
#include "sqlite3.h"

/* The following #defines are copied from test_multiplex.c */
#ifndef MX_CHUNK_NUMBER 
# define MX_CHUNK_NUMBER 299
................................................................................
** function. The string must contain a filename, not an SQLite URI.
*/
int sqlite3_delete_database(
  const char *zFile               /* File to delete */
){
  char *zBuf;                     /* Buffer to sprintf() filenames to */
  int nBuf;                       /* Size of buffer in bytes */
  int rc = 0;                     /* System error code */
  int i;                          /* Iterate through azFmt[] and aMFile[] */

  const char *azFmt[] = { "%s", "%s-journal", "%s-wal", "%s-shm" };

  struct MFile {
    const char *zFmt;
    int iOffset;