Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Update the dbtotxt utility program so that it does not output characters that are special to TCL, thus making the output of dbtotxt easier to insert into test scripts. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
48438bb35b48955a1df83ef90f0ef6c9 |
User & Date: | drh 2018-12-21 22:11:37.526 |
Context
2018-12-22
| ||
00:34 | The OP_Eq and OP_Ne operators have a special P5 value SQLITE_NOTNULL that asserts that the values are not null. Except that is not always true for a corrupt database. Adjust the assert() and add a testcase() to make this point clear. (check-in: a3fdb2c78d user: drh tags: trunk) | |
2018-12-21
| ||
22:11 | Update the dbtotxt utility program so that it does not output characters that are special to TCL, thus making the output of dbtotxt easier to insert into test scripts. (check-in: 48438bb35b user: drh tags: trunk) | |
22:08 | Improved detection of shadow table corruption in RTREE. (check-in: b39bf4356e user: drh tags: trunk) | |
Changes
Changes to tool/dbtotxt.c.
︙ | ︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | ** databases be constructed with "zeroblob()" rather than "randomblob()" ** used for filler content and with "PRAGMA secure_delete=ON" selected to ** zero-out deleted content. */ #include <stdio.h> #include <string.h> #include <stdlib.h> /* Return true if the line is all zeros */ static int allZero(unsigned char *aLine){ int i; for(i=0; i<16 && aLine[i]==0; i++){} return i==16; } int main(int argc, char **argv){ int pgsz = 0; /* page size */ long szFile; /* Size of the input file in bytes */ FILE *in; /* Input file */ int i, j; /* Loop counters */ int nErr = 0; /* Number of errors */ const char *zInputFile = 0; /* Name of the input file */ const char *zBaseName = 0; /* Base name of the file */ int lastPage = 0; /* Last page number shown */ int iPage; /* Current page number */ unsigned char aLine[16]; /* A single line of the file */ unsigned char aHdr[100]; /* File header */ for(i=1; i<argc; i++){ if( argv[i][0]=='-' ){ const char *z = argv[i]; z++; if( z[0]=='-' ) z++; if( strcmp(z,"pagesize")==0 ){ i++; | > > > > > > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | ** databases be constructed with "zeroblob()" rather than "randomblob()" ** used for filler content and with "PRAGMA secure_delete=ON" selected to ** zero-out deleted content. */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> /* Return true if the line is all zeros */ static int allZero(unsigned char *aLine){ int i; for(i=0; i<16 && aLine[i]==0; i++){} return i==16; } int main(int argc, char **argv){ int pgsz = 0; /* page size */ long szFile; /* Size of the input file in bytes */ FILE *in; /* Input file */ int i, j; /* Loop counters */ int nErr = 0; /* Number of errors */ const char *zInputFile = 0; /* Name of the input file */ const char *zBaseName = 0; /* Base name of the file */ int lastPage = 0; /* Last page number shown */ int iPage; /* Current page number */ unsigned char aLine[16]; /* A single line of the file */ unsigned char aHdr[100]; /* File header */ unsigned char bShow[256]; /* Characters ok to display */ memset(bShow, '.', sizeof(bShow)); for(i=' '; i<='~'; i++){ if( i!='{' && i!='}' && i!='"' && i!='\\' ) bShow[i] = i; } for(i=1; i<argc; i++){ if( argv[i][0]=='-' ){ const char *z = argv[i]; z++; if( z[0]=='-' ) z++; if( strcmp(z,"pagesize")==0 ){ i++; |
︙ | ︙ | |||
125 126 127 128 129 130 131 | printf("| page %d offset %d\n", iPage, (iPage-1)*pgsz); lastPage = iPage; } printf("| %5d:", i-(iPage-1)*pgsz); for(j=0; j<16; j++) printf(" %02x", aLine[j]); printf(" "); for(j=0; j<16; j++){ | | | | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | printf("| page %d offset %d\n", iPage, (iPage-1)*pgsz); lastPage = iPage; } printf("| %5d:", i-(iPage-1)*pgsz); for(j=0; j<16; j++) printf(" %02x", aLine[j]); printf(" "); for(j=0; j<16; j++){ unsigned char c = (unsigned char)aLine[j]; fputc( bShow[c], stdout); } fputc('\n', stdout); } fclose(in); printf("| end %s\n", zBaseName); return 0; } |