From: drh Date: Thu, 16 Apr 2015 15:05:04 +0000 (+0000) Subject: Add the --backslash option to the command-line shell for testing purposes. X-Git-Tag: version-3.8.10~112 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9569f60e18282e33dd78c63c8b842c3392bb576d;p=thirdparty%2Fsqlite.git Add the --backslash option to the command-line shell for testing purposes. FossilOrigin-Name: dd96211e8022365637286b146120cc5db44a9923 --- diff --git a/manifest b/manifest index 86969a411c..93103be3ba 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sfaulty\sassert()\sin\sthe\scompound\sselect\scode\sgenerator. -D 2015-04-16T14:33:35.359 +C Add\sthe\s--backslash\soption\sto\sthe\scommand-line\sshell\sfor\stesting\spurposes. +D 2015-04-16T15:05:04.946 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5f78b1ab81b64e7c57a75d170832443e66c0880a F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -231,7 +231,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c 66cfe49a9c3b449ef13b89a8c47036a4ed167eab F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c b7b91db829464db6ebba4cd6a878a0ef688b847d -F src/shell.c 72b61a9d41ba12b67ea06fe9267abcc012c6c5bb +F src/shell.c 28b3e1174a7fc00155d7d00880a33589a88508c9 F src/sqlite.h.in ca27603a36fcacdaac5a19d8ee35aaff8ce8516f F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d @@ -1250,7 +1250,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ec5a493ad27593ca78899b3001630c1898b940ff -R 11ac4c431272562d678d3132e12f4ff6 +P 9d336be1b16aa9bd5c9e4132bb645874993c7d96 +R 5fbffaa37b14ccf06bc3b95dfad9c618 U drh -Z 9969aaea0bee219926e4d05bec4ccd67 +Z e400cf12f450b0a1df16da05ddca199b diff --git a/manifest.uuid b/manifest.uuid index 523f920fa3..57720c5916 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9d336be1b16aa9bd5c9e4132bb645874993c7d96 \ No newline at end of file +dd96211e8022365637286b146120cc5db44a9923 \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 0f7234c47f..0d83084741 100644 --- a/src/shell.c +++ b/src/shell.c @@ -527,6 +527,7 @@ struct ShellState { int autoEQP; /* Run EXPLAIN QUERY PLAN prior to seach SQL stmt */ int statsOn; /* True to display memory stats before each finalize */ int scanstatsOn; /* True to display scan stats before each finalize */ + int backslashOn; /* Resolve C-style \x escapes in SQL input text */ int outCount; /* Revert to stdout when reaching zero */ int cnt; /* Number of records displayed so far */ FILE *out; /* Write results here */ @@ -4111,6 +4112,7 @@ static int process_input(ShellState *p, FILE *in){ && sqlite3_complete(zSql) ){ p->cnt = 0; open_db(p, 0); + if( p->backslashOn ) resolve_backslashes(zSql); BEGIN_TIMER; rc = shell_exec(p->db, zSql, shell_callback, p, &zErrMsg); END_TIMER; @@ -4577,6 +4579,13 @@ int SQLITE_CDECL main(int argc, char **argv){ data.statsOn = 1; }else if( strcmp(z,"-scanstats")==0 ){ data.scanstatsOn = 1; + }else if( strcmp(z,"-backslash")==0 ){ + /* Undocumented command-line option: -backslash + ** Causes C-style backslash escapes to be evaluated in SQL statements + ** prior to sending the SQL into SQLite. Useful for injecting + ** crazy bytes in the middle of SQL statements for testing and debugging. + */ + data.backslashOn = 1; }else if( strcmp(z,"-bail")==0 ){ bail_on_error = 1; }else if( strcmp(z,"-version")==0 ){