diff options
author | drh <> | 2025-04-30 14:37:00 +0000 |
---|---|---|
committer | drh <> | 2025-04-30 14:37:00 +0000 |
commit | f23a61258bf9f9e346fe33ad6f740834455ade56 (patch) | |
tree | e49799090c98c15cbbbe51bbab19a77fc287d55f | |
parent | 88ed1806a4dae310ea08a9c2e6c5631e87c4fabb (diff) | |
download | sqlite-f23a61258bf9f9e346fe33ad6f740834455ade56.tar.gz sqlite-f23a61258bf9f9e346fe33ad6f740834455ade56.zip |
Fix a harmless problem in the CLI in which SQL errors that occur during
the ".schema" command are properly ignored, yes still appear in the ".log"
output. [forum:/forumpost/42fe6520b803be51|Forum post 42fe6520b8]
FossilOrigin-Name: 20abf1ec107f942e4527901685d61283c9c2fe7bcefad63dbf5c6cbf050da849
-rw-r--r-- | manifest | 12 | ||||
-rw-r--r-- | manifest.uuid | 2 | ||||
-rw-r--r-- | src/shell.c.in | 59 |
3 files changed, 41 insertions, 32 deletions
@@ -1,5 +1,5 @@ -C Fix\san\sissue\sin\sBloom\sfilters\son\sRHS\ssubsqueries\sto\sIN\soperators.\nSee\s[forum:/forumpost/792a09cb3df9e69f|forum\spost\s792a09cb3d]\sfor\na\sdescription\sof\sthe\sproblem.\s\sAlso\simprove\scomments\srelated\nto\s[baa83b460c677c21]\swhich\swas\sorigin\sof\sthe\sproblem. -D 2025-04-30T12:48:20.768 +C Fix\sa\sharmless\sproblem\sin\sthe\sCLI\sin\swhich\sSQL\serrors\sthat\soccur\sduring\nthe\s".schema"\scommand\sare\sproperly\signored,\syes\sstill\sappear\sin\sthe\s".log"\noutput.\s[forum:/forumpost/42fe6520b803be51|Forum\spost\s42fe6520b8] +D 2025-04-30T14:37:00.121 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -786,7 +786,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 20e1fbe8f840ffc0cd835e33f68a802a22e34faa918d7a269f3de242fda02f99 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 1a5956231f7c57571288eaad61e5c37aaf0f3acb5c8a5ea0b896938166b62fa2 -F src/shell.c.in 1e8b9bf369e80cdf9b029142e773038bc12bd38aea1c56df4af6bf7b46cae955 +F src/shell.c.in 2c904da4431fed365e7d5029b8cb2da46cb3e8cf8a09305d1478836a2301ea96 F src/sqlite.h.in 22882ddd3a70751aa8864c81993ee4562ed54c2c508b6270f75e223ffee38e1b F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ca0d30a43b3dfb95dd6b491f592031a053b0b5e95361ffe01ec8bd56d5e2d110 -R a016079ed04d648dbdfc37d62a0ccf45 +P cdef486e212fe4b26605065d9cff08f608cb80df48ee64e4be63637769bdfacc +R ff4dbf6198636e450976250aaa2d8234 U drh -Z 4df416cb1305012d324f8e35a43340cd +Z 88680290faafcb12b4513cbfd1fe3d4f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 4a25d7d52..3d3fb0bd6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cdef486e212fe4b26605065d9cff08f608cb80df48ee64e4be63637769bdfacc +20abf1ec107f942e4527901685d61283c9c2fe7bcefad63dbf5c6cbf050da849 diff --git a/src/shell.c.in b/src/shell.c.in index ca76e4a6e..7af8f79b8 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -1243,30 +1243,6 @@ static void shellDtostr( sqlite3_result_text(pCtx, z, -1, SQLITE_TRANSIENT); } - -/* -** SQL function: shell_module_schema(X) -** -** Return a fake schema for the table-valued function or eponymous virtual -** table X. -*/ -static void shellModuleSchema( - sqlite3_context *pCtx, - int nVal, - sqlite3_value **apVal -){ - const char *zName; - char *zFake; - UNUSED_PARAMETER(nVal); - zName = (const char*)sqlite3_value_text(apVal[0]); - zFake = zName? shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName) : 0; - if( zFake ){ - sqlite3_result_text(pCtx, sqlite3_mprintf("/* %s */", zFake), - -1, sqlite3_free); - free(zFake); - } -} - /* ** SQL function: shell_add_schema(S,X) ** @@ -5710,6 +5686,39 @@ static void shellUSleepFunc( sqlite3_result_int(context, sleep); } +/* +** SQL function: shell_module_schema(X) +** +** Return a fake schema for the table-valued function or eponymous virtual +** table X. +*/ +static void shellModuleSchema( + sqlite3_context *pCtx, + int nVal, + sqlite3_value **apVal +){ + const char *zName; + char *zFake; + ShellState *p = (ShellState*)sqlite3_user_data(pCtx); + FILE *pSavedLog = p->pLog; + UNUSED_PARAMETER(nVal); + zName = (const char*)sqlite3_value_text(apVal[0]); + + /* Temporarily disable the ".log" when calling shellFakeSchema() because + ** shellFakeSchema() might generate failures for some ephemeral virtual + ** tables due to missing arguments. Example: fts4aux. + ** https://sqlite.org/forum/forumpost/42fe6520b803be51 */ + p->pLog = 0; + zFake = zName? shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName) : 0; + p->pLog = pSavedLog; + + if( zFake ){ + sqlite3_result_text(pCtx, sqlite3_mprintf("/* %s */", zFake), + -1, sqlite3_free); + free(zFake); + } +} + /* Flags for open_db(). ** ** The default behavior of open_db() is to exit(1) if the database fails to @@ -5853,7 +5862,7 @@ static void open_db(ShellState *p, int openFlags){ shellDtostr, 0, 0); sqlite3_create_function(p->db, "shell_add_schema", 3, SQLITE_UTF8, 0, shellAddSchemaName, 0, 0); - sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, 0, + sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, p, shellModuleSchema, 0, 0); sqlite3_create_function(p->db, "shell_putsnl", 1, SQLITE_UTF8, p, shellPutsFunc, 0, 0); |