diff options
author | drh <drh@noemail.net> | 2017-04-16 22:41:49 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2017-04-16 22:41:49 +0000 |
commit | b6d5a43b8a7afdbeb391f7ad5cea1e977a27e741 (patch) | |
tree | e8812e03159652ba00ae3b5277fbdc38722dc628 /tool/showwal.c | |
parent | b65b3e429afce35f9bb99788391ca8bfbab339f6 (diff) | |
download | sqlite-b6d5a43b8a7afdbeb391f7ad5cea1e977a27e741.tar.gz sqlite-b6d5a43b8a7afdbeb391f7ad5cea1e977a27e741.zip |
In the showwal command-line tool, for unix builds, if the
auxiliary argument is of
the form "Ntruncate" where "N" is a frame number, then truncate the WAL
file after the N-th frame.
FossilOrigin-Name: 90015df30655d884ecf7ae61e588824696954252dc6b1a5f78cf2de8cb236104
Diffstat (limited to 'tool/showwal.c')
-rw-r--r-- | tool/showwal.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tool/showwal.c b/tool/showwal.c index 33cc21896..b214a288e 100644 --- a/tool/showwal.c +++ b/tool/showwal.c @@ -12,6 +12,7 @@ #if !defined(_MSC_VER) #include <unistd.h> +#include <sys/types.h> #else #include <io.h> #endif @@ -579,6 +580,14 @@ int main(int argc, char **argv){ decode_btree_page(a, iStart, hdrSize, zLeft+1); free(a); continue; +#if !defined(_MSC_VER) + }else if( zLeft && strcmp(zLeft,"truncate")==0 ){ + /* Frame number followed by "truncate" truncates the WAL file + ** after that frame */ + off_t newSize = 32 + iStart*(pagesize+24); + truncate(argv[1], newSize); + continue; +#endif }else{ iEnd = iStart; } |