SQLite

Check-in [ee966af8ff]
Login

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

Overview
Comment:Avoid invoking system call unlink() directly from RBU code. Use the xDelete method of the default VFS instead.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ee966af8ff79189f8b90f3557dea21059517dfe2
User & Date: dan 2015-08-13 11:46:21.944
Context
2015-08-13
18:26
Add the sqlite3rbu_savestate() function to the rbu extension. To force rbu to save its state to disk without closing the sqlite3rbu* handle. (check-in: 851a875ad6 user: dan tags: trunk)
11:46
Avoid invoking system call unlink() directly from RBU code. Use the xDelete method of the default VFS instead. (check-in: ee966af8ff user: dan tags: trunk)
2015-08-12
15:36
Minor optimization for fts5 API xInst(). (check-in: efb7c9c5d0 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/rbu/sqlite3rbu.c.
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
** 
*/

#include <assert.h>
#include <string.h>
#include <stdio.h>

#if !defined(_WIN32)
#  include <unistd.h>
#endif

#include "sqlite3.h"

#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU)
#include "sqlite3rbu.h"

/* Maximum number of prepared UPDATE statements held by this module */
#define SQLITE_RBU_UPDATE_CACHESIZE 16







<
<
<
<







80
81
82
83
84
85
86




87
88
89
90
91
92
93
** 
*/

#include <assert.h>
#include <string.h>
#include <stdio.h>





#include "sqlite3.h"

#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU)
#include "sqlite3rbu.h"

/* Maximum number of prepared UPDATE statements held by this module */
#define SQLITE_RBU_UPDATE_CACHESIZE 16
2924
2925
2926
2927
2928
2929
2930
2931


2932
2933
2934

2935
2936
2937
2938
2939
2940
2941

/*
** If there is a "*-oal" file in the file-system corresponding to the
** target database in the file-system, delete it. If an error occurs,
** leave an error code and error message in the rbu handle.
*/
static void rbuDeleteOalFile(sqlite3rbu *p){
  char *zOal = sqlite3_mprintf("%s-oal", p->zTarget);


  assert( p->rc==SQLITE_OK && p->zErrmsg==0 );
  unlink(zOal);
  sqlite3_free(zOal);

}

/*
** Allocate a private rbu VFS for the rbu handle passed as the only
** argument. This VFS will be used unless the call to sqlite3rbu_open()
** specified a URI with a vfs=? option in place of a target database
** file name.







|
>
>
|
|
|
>







2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940

/*
** If there is a "*-oal" file in the file-system corresponding to the
** target database in the file-system, delete it. If an error occurs,
** leave an error code and error message in the rbu handle.
*/
static void rbuDeleteOalFile(sqlite3rbu *p){
  char *zOal = rbuMPrintf(p, "%s-oal", p->zTarget);
  if( zOal ){
    sqlite3_vfs *pVfs = sqlite3_vfs_find(0);
    assert( pVfs && p->rc==SQLITE_OK && p->zErrmsg==0 );
    pVfs->xDelete(pVfs, zOal, 0);
    sqlite3_free(zOal);
  }
}

/*
** Allocate a private rbu VFS for the rbu handle passed as the only
** argument. This VFS will be used unless the call to sqlite3rbu_open()
** specified a URI with a vfs=? option in place of a target database
** file name.