From: drh <> Date: Fri, 10 Apr 2026 20:29:35 +0000 (+0000) Subject: Fix prompt for in-memory databases. Fix the continuation mechanism so that X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=70868a5ae3c55d60d556f62b0eb5fb7c84fddab0;p=thirdparty%2Fsqlite.git Fix prompt for in-memory databases. Fix the continuation mechanism so that it looks at all accumulated lines, not just the most recent line. FossilOrigin-Name: 166894725569cafa96c434aa14db0428db6791a8296fcc2990bec4ec819fd876 --- diff --git a/manifest b/manifest index 02d304d612..7f18f4eedc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Replace\sthe\sformer\sdynamic-continuation\sprompt\slogic\swith\sbackslash-escape\nprompt\sexpansion,\sinclude\ssome\sexpansions\sthat\sserve\sthe\ssame\srole\sas\sthe\nold\sdynamic-continuation\sprompts.\s\sThis\sallows\sgreater\suser\nconfigurability. -D 2026-04-10T20:14:16.225 +C Fix\sprompt\sfor\sin-memory\sdatabases.\s\sFix\sthe\scontinuation\smechanism\sso\sthat\nit\slooks\sat\sall\saccumulated\slines,\snot\sjust\sthe\smost\srecent\sline. +D 2026-04-10T20:29:35.946 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -735,7 +735,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 928ff887f2a7c64275182060d94d06fdddbe32226c569781cf7e7edc6f58d7fd F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c ffe199f025a0dd74670d2a77232bdea364a4d7b36f32c64a6572d39ba6a11576 -F src/shell.c.in ccadf849cfa03871c93f2869e27af177408ad028a4897626a1550d3fdbdcca18 +F src/shell.c.in 335a0c427f7de16a574c40683e79f9d5e7efcd2764168b00f7bdf76dfa349818 F src/sqlite.h.in a5605faa9479bbaac16c4ab43eb09ff50632004a8e05084d3fde56063ef73766 F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479 F src/sqlite3ext.h 1b7a0ee438bb5c2896d0609c537e917d8057b3340f6ad004d2de44f03e3d3cca @@ -2197,9 +2197,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c -P e2c9d4c6b731ea9afbb9cb22f86a3db3670ca67968f15891dc46ae1fc9ba34dc 354325b6f396bda38bbb82e7d38aa50d3d6441e1ebb9b578aed8e0bcf62f9911 -R 10023fb5872b0939880b2eb9aec2ef11 -T +closed 354325b6f396bda38bbb82e7d38aa50d3d6441e1ebb9b578aed8e0bcf62f9911 +P 052631202e4dd930d93434b7003e73b23557934421ace5d2f382f041638d5518 +R db2a870af126f19369636d4e3aa1216f U drh -Z 0caf1772228f87bb1b8b817e19db97e9 +Z af6eb6bd5da5f6fa8530eefe13136eb2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 80d801332e..538f1770ec 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -052631202e4dd930d93434b7003e73b23557934421ace5d2f382f041638d5518 +166894725569cafa96c434aa14db0428db6791a8296fcc2990bec4ec819fd876 diff --git a/src/shell.c.in b/src/shell.c.in index 5170c2dde0..3b8731f7c5 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -1020,8 +1020,9 @@ static char *expand_prompt( /* \~ becomes the full pathname relative to $HOME */ if( onoff ){ sqlite3_filename pFN = p->db ? sqlite3_db_filename(p->db,0) : 0; - const char *zFN = pFN ? sqlite3_filename_database(pFN) : ":memory:"; + const char *zFN = pFN ? sqlite3_filename_database(pFN) : ""; if( zFN ){ + if( zFN[0]==0 ) zFN = "in-memory"; if( c=='f' ){ const char *zTail = strrchr(zFN,'/'); if( zTail && zTail[1] ) zFN = &zTail[1]; @@ -1129,14 +1130,19 @@ static char *expand_prompt( ** zPrior argument for reuse. */ #ifndef SQLITE_SHELL_FIDDLE -static char *one_input_line(ShellState *p, char *zPrior, int bContinue){ +static char *one_input_line( + ShellState *p, /* Shell state */ + char *zPrior, /* Just the previous line */ + const char *zAll, /* All statement text accumulated so far */ + int bContinue /* True for a continuation prompt */ +){ char *zResult; FILE *in = p->in; if( in!=0 ){ zResult = local_getline(zPrior, in); }else{ const char *zBase = bContinue ? p->contPrompt : p->mainPrompt; - char *zPrompt = expand_prompt(p, zPrior, zBase); + char *zPrompt = expand_prompt(p, zAll, zBase); shell_check_oom(zPrompt); #if SHELL_USE_LOCAL_GETLINE sputz(stdout, zPrompt); @@ -12414,7 +12420,12 @@ static void echo_group_input(ShellState *p, const char *zDo){ ** impl because we need the global shellState and cannot access it from that ** function without moving lots of code around (creating a larger/messier diff). */ -static char *one_input_line(ShellState *p, char *zPrior, int bContinue){ +static char *one_input_line( + ShellState *p, /* Shell state */ + char *zPrior, /* Just the prior line of text */ + const char *zAll, /* All accumulated statement text */ + int bContinue /* True if this is an accumulation */ +){ /* Parse the next line from shellState.wasm.zInput. */ const char *zBegin = shellState.wasm.zPos; const char *z = zBegin; @@ -12477,7 +12488,7 @@ static int process_input(ShellState *p, const char *zSrc){ p->lineno = 0; while( errCnt==0 || !bail_on_error || (p->in==0 && stdin_is_interactive) ){ fflush(p->out); - zLine = one_input_line(p, zLine, nSql>0); + zLine = one_input_line(p, zLine, zSql, nSql>0); if( zLine==0 ){ /* End of input */ if( p->in==0 && stdin_is_interactive ) cli_puts("\n", p->out); @@ -12848,7 +12859,7 @@ static void main_init(ShellState *p) { #endif sqlite3_config(SQLITE_CONFIG_URI, 1); sqlite3_config(SQLITE_CONFIG_MULTITHREAD); - sqlite3_snprintf(sizeof(p->mainPrompt), p->mainPrompt,"SQLite:\\f> "); + sqlite3_snprintf(sizeof(p->mainPrompt), p->mainPrompt,"SQLite \\f> "); sqlite3_snprintf(sizeof(p->contPrompt), p->contPrompt,"\\B...\\H> "); }