diff options
author | larrybr <larrybr@noemail.net> | 2021-07-26 19:49:01 +0000 |
---|---|---|
committer | larrybr <larrybr@noemail.net> | 2021-07-26 19:49:01 +0000 |
commit | 1ae057d8735b85bc97346c0b6a83b8f86c4d949b (patch) | |
tree | 1c81a30948d8d3bc51369ba6095fa1e8cc46c88f /tool/sqldiff.c | |
parent | e40875d21123bcae130570624961109a07b54864 (diff) | |
download | sqlite-1ae057d8735b85bc97346c0b6a83b8f86c4d949b.tar.gz sqlite-1ae057d8735b85bc97346c0b6a83b8f86c4d949b.zip |
Remove sqldiff --visible-controls option, make it always happen. Add test cases for controls made visible
FossilOrigin-Name: ff74c0cc4cefa5271b12ecfff3f2fd4749852d9d1d01f4ae64a07a26decc001b
Diffstat (limited to 'tool/sqldiff.c')
-rw-r--r-- | tool/sqldiff.c | 53 |
1 files changed, 19 insertions, 34 deletions
diff --git a/tool/sqldiff.c b/tool/sqldiff.c index fea40b9fe..b8b9e005b 100644 --- a/tool/sqldiff.c +++ b/tool/sqldiff.c @@ -34,7 +34,6 @@ struct GlobalVars { int bSchemaOnly; /* Only show schema differences */ int bSchemaPK; /* Use the schema-defined PK, not the true PK */ int bHandleVtab; /* Handle fts3, fts4, fts5 and rtree vtabs */ - int bDarkCtl; /* Render controls in text as blob literals */ unsigned fDebug; /* Debug flags */ sqlite3 *db; /* The database connection */ } g; @@ -381,45 +380,35 @@ static void printQuoted(FILE *out, sqlite3_value *X){ } case SQLITE_TEXT: { const unsigned char *zArg = sqlite3_value_text(X); - int i, j; if( zArg==0 ){ fprintf(out, "NULL"); }else{ + int inctl = 0; + int i, j; fprintf(out, "'"); - if( !g.bDarkCtl ){ - for(i=j=0; zArg[i]; i++){ - if( zArg[i]=='\'' ){ - fprintf(out, "%.*s'", i-j+1, &zArg[j]); - j = i+1; + for(i=j=0; zArg[i]; i++){ + char c = zArg[i]; + int ctl = iscntrl(c); + if( ctl>inctl ){ + inctl = ctl; + fprintf(out, "%.*s'||X'%02x", i-j, &zArg[j], c); + j = i+1; + }else if( ctl ){ + fprintf(out, "%02x", c); + j = i+1; + }else{ + if( inctl ){ + inctl = 0; + fprintf(out, "'\n||'"); } - } - fprintf(out, "%s'", &zArg[j]); - }else{ - int inctl = 0; - for(i=j=0; zArg[i]; i++){ - char c = zArg[i]; - int ctl = iscntrl(c); - if( ctl>inctl ){ - inctl = ctl; - fprintf(out, "%.*s'||X'%02x", i-j, &zArg[j], c); - j = i+1; - }else if( ctl ){ - fprintf(out, "%02x", c); + if( c=='\'' ){ + fprintf(out, "%.*s'", i-j+1, &zArg[j]); j = i+1; - }else{ - if( inctl ){ - inctl = 0; - fprintf(out, "'\n||'"); - } - if( c=='\'' ){ - fprintf(out, "%.*s'", i-j+1, &zArg[j]); - j = i+1; - } } } - fprintf(out, "%s'", &zArg[j]); } + fprintf(out, "%s'", &zArg[j]); } break; } @@ -1902,7 +1891,6 @@ static void showHelp(void){ " --table TAB Show only differences in table TAB\n" " --transaction Show SQL output inside a transaction\n" " --vtab Handle fts3, fts4, fts5 and rtree tables\n" -" --visible-controls Render controls in text as blob literals\n" ); } @@ -1976,9 +1964,6 @@ int main(int argc, char **argv){ if( strcmp(z,"vtab")==0 ){ g.bHandleVtab = 1; }else - if( strcmp(z, "visible-controls")==0 ){ - g.bDarkCtl = 1; - }else { cmdlineError("unknown option: %s", argv[i]); } |