From: drh <> Date: Fri, 7 Nov 2025 17:48:14 +0000 (+0000) Subject: Incremental check-in. QRF is working, but there are many test failures X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2424338b05f2766034f91c03009c8f0d78bc937;p=thirdparty%2Fsqlite.git Incremental check-in. QRF is working, but there are many test failures in the shell test modules. FossilOrigin-Name: de7fc9afc43d4bd5f5995832cd698633e0e7213c190fa044856c9f82512161f9 --- diff --git a/Makefile.msc b/Makefile.msc index 1a26f1abad..d2a8686147 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -2332,7 +2332,7 @@ window.lo: $(TOP)\src\window.c $(HDR) $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\window.c tclsqlite.lo: tclsqlite-ex.c $(HDR) $(SQLITE_TCL_DEP) - $(LTCOMPILE) $(NO_WARN) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c tclsqlite-ex.c + $(LTCOMPILE) $(NO_WARN) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c tclsqlite-ex.c /OUT:tclsqlite.lo tclsqlite-shell.lo: tclsqlite-ex.c $(HDR) $(SQLITE_TCL_DEP) $(LTCOMPILE) $(NO_WARN) -DTCLSH -DBUILD_sqlite -I$(TCLINCDIR) -c tclsqlite-ex.c diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 1c61e88ee3..7d515936ce 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -805,7 +805,8 @@ proc sqlite-handle-common-feature-flags {} { sqlite-add-feature-flag -DSQLITE_ENABLE_MEMSYS3 } } - scanstatus -DSQLITE_ENABLE_STMT_SCANSTATUS {} + bytecode-vtab -DSQLITE_ENABLE_BYTECODE_VTAB {} + scanstatus {-DSQLITE_ENABLE_STMT_SCANSTATUS -DSQLITE_ENABLE_BYTECODE_VTAB} {} column-metadata -DSQLITE_ENABLE_COLUMN_METADATA {} dbpage -DSQLITE_ENABLE_DBPAGE_VTAB {} dbstat -DSQLITE_ENABLE_DBSTAT_VTAB {} diff --git a/ext/qrf/README.md b/ext/qrf/README.md index 000f2cc36d..a379103e14 100644 --- a/ext/qrf/README.md +++ b/ext/qrf/README.md @@ -72,8 +72,8 @@ struct sqlite3_qrf_spec { const char *zRowSep; /* Alternative row separator */ const char *zTableName; /* Output table name */ const char *zNull; /* Rendering of NULL */ - char *(*xRender)(void*,sqlite3_value*); /* Render a value */ - sqlite3_int64 (*xWrite)(void*,const unsigned char*,sqlite3_int64); + char *(*xRender)(void*,sqlite3_value*); /* Render a value */ + int (*xWrite)(void*,const char*,sqlite3_int64); /* Write output */ void *pRenderArg; /* First argument to the xRender callback */ void *pWriteArg; /* First argument to the xWrite callback */ char **pzOutput; /* Storage location for output string */ @@ -113,6 +113,10 @@ sqlite3_realloc() and the new text is appended. One of either sqlite3_qrf_spec.xWrite and sqlite3_qrf_spec.pzOutput must be non-NULL and the other must be NULL. +The return value from xWrite is an SQLITE result code. The usual return +should be SQLITE_OK. But if for some reason the write fails, a different +value might be returned. + ### 2.3 Output Format The sqlite3_qrf_spec.eStyle field is an integer code that defines the diff --git a/ext/qrf/qrf.c b/ext/qrf/qrf.c index 1f5590bbb7..3650cfa78e 100644 --- a/ext/qrf/qrf.c +++ b/ext/qrf/qrf.c @@ -343,10 +343,13 @@ static void qrfResetStmt(Qrf *p){ static void qrfWrite(Qrf *p){ int n; if( p->spec.xWrite && (n = sqlite3_str_length(p->pOut))>0 ){ - p->spec.xWrite(p->spec.pWriteArg, - (const unsigned char*)sqlite3_str_value(p->pOut), - (sqlite3_int64)n); + int rc = p->spec.xWrite(p->spec.pWriteArg, + sqlite3_str_value(p->pOut), + (sqlite3_int64)n); sqlite3_str_reset(p->pOut); + if( rc ){ + qrfError(p, rc, "Failed to write %d bytes of output", n); + } } } @@ -1624,6 +1627,7 @@ static void qrfScanStatusVm(Qrf *p){ } sqlite3_bind_pointer(pExplain, 1, pOrigStmt, "stmt-pointer", 0); p->pStmt = pExplain; + p->nCol = 10; qrfExplain(p); sqlite3_finalize(pExplain); p->pStmt = pOrigStmt; diff --git a/ext/qrf/qrf.h b/ext/qrf/qrf.h index 223a2ec304..79db316387 100644 --- a/ext/qrf/qrf.h +++ b/ext/qrf/qrf.h @@ -39,8 +39,8 @@ struct sqlite3_qrf_spec { const char *zRowSep; /* Alternative row separator */ const char *zTableName; /* Output table name */ const char *zNull; /* Rendering of NULL */ - char *(*xRender)(void*,sqlite3_value*); /* Render a value */ - sqlite3_int64 (*xWrite)(void*,const unsigned char*,sqlite3_int64); + char *(*xRender)(void*,sqlite3_value*); /* Render a value */ + int (*xWrite)(void*,const char*,sqlite3_int64); /* Write output */ void *pRenderArg; /* First argument to the xRender callback */ void *pWriteArg; /* First argument to the xWrite callback */ char **pzOutput; /* Storage location for output string */ diff --git a/main.mk b/main.mk index 9ed96aab6a..7ebb196f6a 100644 --- a/main.mk +++ b/main.mk @@ -1411,7 +1411,7 @@ window.o: $(TOP)/src/window.c $(DEPS_OBJ_COMMON) tclsqlite.o: $(T.tcl.env.sh) tclsqlite-ex.c $(DEPS_OBJ_COMMON) $(T.compile.tcl) -DUSE_TCL_STUBS=1 $$TCL_INCLUDE_SPEC \ - -c tclsqlite-ex.c + -c tclsqlite-ex.c -o tclsqlite.o tclsqlite-shell.o: $(T.tcl.env.sh) tclsqlite-ex.c $(DEPS_OBJ_COMMON) $(T.compile.tcl) -DTCLSH -o $@ -c tclsqlite-ex.c $$TCL_INCLUDE_SPEC diff --git a/manifest b/manifest index 21d8803608..99f699e58b 100644 --- a/manifest +++ b/manifest @@ -1,12 +1,12 @@ -C Begin\sthe\sprocess\sof\sintegrating\sQRF\sinto\sthe\sCLI.\s\sAdjust\smakefiles.\nInclude\sthe\sQRF\scode\sin\sshell.c.\s\sBut\sQRF\sis\snot\syet\sused\sby\sthe\sCLI. -D 2025-11-07T14:31:17.711 +C Incremental\scheck-in.\s\sQRF\sis\sworking,\sbut\sthere\sare\smany\stest\sfailures\nin\sthe\sshell\stest\smodules. +D 2025-11-07T17:48:14.716 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md 6bc480fc673fb4acbc4094e77edb326267dd460162d7723c7f30bee2d3d9e97d F Makefile.in 3ce07126d7e87c7464301482e161fdae6a51d0a2aa06b200b8f0000ef4d6163b F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 -F Makefile.msc dd05d27472da51ecabf01dee8c1b06ae6e1b55740d0966bfe9dc663c78e6a240 +F Makefile.msc 8c5ed7173ee4cc3c03ba8e21065128f7ca5292c83d68f3bf971786e21fc6e382 F README.md dae499194b75deed76a13a4a83c82493f2530331882d7dfe5754d63287d3f8f7 F VERSION 16eddb43056a79c1977427ab7a05f3457c373fa159dcdced8754eb89ce7e06b8 F art/icon-243x273.gif 9750b734f82fdb3dc43127753d5e6fbf3b62c9f4e136c2fbf573b2f57ea87af5 @@ -47,7 +47,7 @@ F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1 F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl 6fc14ef82b19b77a95788ffbcfad7989b4e3cb4ce96a21dcb5cf7312f362fba9 -F autosetup/sqlite-config.tcl 1fd7c55394051fbfba2fb9fa9192c027ee7d74612dbf772b06e27feb9f1de5df +F autosetup/sqlite-config.tcl 97dc76d332ae3344d02d15c99c57db0ac063537e9133cbee0520d48ba0eddc08 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F autosetup/teaish/README.txt b40071e6f8506500a2f7f71d5fc69e0bf87b9d7678dd9da1e5b4d0acbf40b1ca F autosetup/teaish/core.tcl e014dd95900c7f9a34e8e0f460f47e94841059827bce8b4c49668b0c7ae3f1a0 @@ -416,9 +416,9 @@ F ext/misc/wholenumber.c 0fa0c082676b7868bf2fa918e911133f2b349bcdceabd1198bba5f6 F ext/misc/windirent.h 02211ce51f3034c675f2dbf4d228194d51b3ee05734678bad5106fff6292e60c F ext/misc/zipfile.c 09e6e3a3ff40a99677de3c0bc6569bd5f4709b1844ac3d1c1452a456c5a62f1c F ext/misc/zorder.c bddff2e1b9661a90c95c2a9a9c7ecd8908afab5763256294dd12d609d4664eee -F ext/qrf/README.md d91dccf517075567048e510b527cb7785d2ac73a5dd0e9076b1ccd513de9f6cf -F ext/qrf/qrf.c 074fc3f4f9e484a3bbf948e8360e52877556111d9948e2a197a6c67725972c16 -F ext/qrf/qrf.h c795d389f71c00c612ce3e4d428c5030288f57a6cde53e84675662363ddf66b9 +F ext/qrf/README.md 550c99ea5f9db2580ec66c12260b28feddc1c8a9b22396bb01bd9c3faaf720b6 +F ext/qrf/qrf.c ac6efea5dcd21c30a6182d772b517245a2b8a11a5a37a2da4cab31e9e1464652 +F ext/qrf/qrf.h 642c717aa5a88074f17712a59763f80c9d83e356c3c165953c3f9ba648511087 F ext/rbu/rbu.c 801450b24eaf14440d8fd20385aacc751d5c9d6123398df41b1b5aa804bf4ce8 F ext/rbu/rbu1.test 25870dd7db7eb5597e2b4d6e29e7a7e095abf332660f67d89959552ce8f8f255 F ext/rbu/rbu10.test 7c22caa32c2ff26983ca8320779a31495a6555737684af7aba3daaf762ef3363 @@ -657,7 +657,7 @@ F ext/wasm/tests/opfs/sahpool/index.html be736567fd92d3ecb9754c145755037cbbd2bca F ext/wasm/tests/opfs/sahpool/sahpool-pausing.js f264925cfc82155de38cecb3d204c36e0f6991460fff0cb7c15079454679a4e2 F ext/wasm/tests/opfs/sahpool/sahpool-worker.js bd25a43fc2ab2d1bafd8f2854ad3943ef673f7c3be03e95ecf1612ff6e8e2a61 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 9ee54d4a0eb6c78ba6a3065a70831a9a016c8b1c92337b88492089eee4a49fcf +F main.mk 27a0769b40a813343f19e8fca2e9d55405f0311cb3cc5327f5702640df0182a0 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -735,7 +735,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 5616fbcf3b833c7c705b24371828215ad0925d0c0073216c4f153348d5753f0a F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c ba9cd07ffa3277883c1986085f6ddc4320f4d35d5f212ab58df79a7ecc1a576a -F src/shell.c.in 7d1786d6173d7b1699b95edf135d596ba4544ee6585823d3abee26ba3ca31a81 +F src/shell.c.in 767763acc62d90814c70b678ac7d57855a4ab3252438b147337ad09b79d2e22c F src/sqlite.h.in 43f60117ce68847b9d4e7fa43c2ac42bb324185e66b924d3114b24d4037fc263 F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479 F src/sqlite3ext.h 7f236ca1b175ffe03316d974ef57df79b3938466c28d2f95caef5e08c57f3a52 @@ -1601,7 +1601,7 @@ F test/sharedA.test 64bdd21216dda2c6a3bd3475348ccdc108160f34682c97f2f51c19fc0e21 F test/sharedB.test 1a84863d7a2204e0d42f2e1606577c5e92e4473fa37ea0f5bdf829e4bf8ee707 F test/shared_err.test 32634e404a3317eeb94abc7a099c556a346fdb8fb3858dbe222a4cbb8926a939 F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304 -F test/shell1.test ebe953d64c937ad42a0f33170ac0d2d2568faae26813fc7a95203756446d54aa +F test/shell1.test 1c968056fa4579b7036257c1b7035fe43bd36e8008802d035fb108ba98652aab F test/shell2.test ab23f01ea2347e4b72bb2399af7ee82aa00f9c059141749f7c4064abca5ad728 F test/shell3.test 603b448e917537cf77be0f265c05c6f63bc677c63a533c8e96aae923b56f4a0e F test/shell4.test 03593fa7908a55f255916ffeda707cdf55680c777736e3da62b1d78cde0d684d @@ -2173,8 +2173,8 @@ F tool/version-info.c 33d0390ef484b3b1cb685d59362be891ea162123cea181cb8e6d2cf6dd F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P c25806fc5491554f1cd55174c6cf98b509d619e3011b8e26abdf05b24133a6e8 -R 7544920a37eca1e4feb4987f63beb1a3 +P 7596fc32b371e5e657e830c2e80e61b0947320a7359833e915a888a438c2e935 +R 9afc4ad39bbb2e2f476eec0945e613ea U drh -Z 7d3a34f734ef8b065b7851ca62716052 +Z 86aaea013274b68cb46dbbf7c4e3c80e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1cb2887217..80da10129e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7596fc32b371e5e657e830c2e80e61b0947320a7359833e915a888a438c2e935 +de7fc9afc43d4bd5f5995832cd698633e0e7213c190fa044856c9f82512161f9 diff --git a/src/shell.c.in b/src/shell.c.in index 8ffed17e33..d027f62442 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -1360,23 +1360,6 @@ struct ExpertInfo { }; #endif -/* A single line in the EQP output */ -typedef struct EQPGraphRow EQPGraphRow; -struct EQPGraphRow { - int iEqpId; /* ID for this row */ - int iParentId; /* ID of the parent row */ - EQPGraphRow *pNext; /* Next row in sequence */ - char zText[1]; /* Text to display for this row */ -}; - -/* All EQP output is collected into an instance of the following */ -typedef struct EQPGraph EQPGraph; -struct EQPGraph { - EQPGraphRow *pRow; /* Linked list of all rows of the EQP output */ - EQPGraphRow *pLast; /* Last element of the pRow list */ - char zPrefix[100]; /* Graph prefix */ -}; - /* Parameters affecting columnar mode result display (defaulting together) */ typedef struct ColModeOpts { int iWrap; /* In columnar modes, wrap lines reaching this limit */ @@ -1439,8 +1422,8 @@ struct ShellState { char rowSeparator[20]; /* Row separator character for MODE_Ascii */ char colSepPrior[20]; /* Saved column separator */ char rowSepPrior[20]; /* Saved row separator */ - int *colWidth; /* Requested width of each column in columnar modes */ - int *actualWidth; /* Actual width of each column */ + short int *colWidth; /* Requested width of each column in columnar modes */ + short int *actualWidth;/* Actual width of each column */ int nWidth; /* Number of slots in colWidth[] and actualWidth[] */ char nullValue[20]; /* The text to print when a NULL comes back from ** the database */ @@ -1461,7 +1444,6 @@ struct ShellState { int nIndent; /* Size of array aiIndent[] */ int iIndent; /* Index of current op in aiIndent[] */ char *zNonce; /* Nonce for temporary safe-mode escapes */ - EQPGraph sGraph; /* Information for the graphical EXPLAIN QUERY PLAN */ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_AUTHORIZATION) ExpertInfo expert; /* Valid if previous command was ".expert OPT..." */ #endif @@ -1588,6 +1570,31 @@ static const char *modeDescr[] = { "www", }; +/* Translation from legacy CLI output modes into QRF styles */ +static const unsigned char aQrfStyle[] = { + /* line */ QRF_STYLE_Line, + /* column */ QRF_STYLE_Column, + /* list */ QRF_STYLE_List, + /* semi */ 101, + /* html */ QRF_STYLE_Html, + /* insert */ QRF_STYLE_Insert, + /* quote */ QRF_STYLE_Quote, + /* tcl */ 102, + /* csv */ QRF_STYLE_Csv, + /* explain */ 103, + /* ascii */ 104, + /* prettyprint */ 105, + /* eqp */ 106, + /* json */ QRF_STYLE_Json, + /* markdown */ QRF_STYLE_Markdown, + /* table */ QRF_STYLE_Table, + /* box */ QRF_STYLE_Box, + /* count */ QRF_STYLE_Count, + /* off */ QRF_STYLE_Off, + /* scanexp */ 107, + /* www */ 108, +}; + /* ** These are the column/row/line separators used by the various ** import/export modes. @@ -2450,98 +2457,6 @@ static int wsToEol(const char *z){ return 1; } -/* -** Add a new entry to the EXPLAIN QUERY PLAN data -*/ -static void eqp_append(ShellState *p, int iEqpId, int p2, const char *zText){ - EQPGraphRow *pNew; - i64 nText; - if( zText==0 ) return; - nText = strlen(zText); - if( p->autoEQPtest ){ - sqlite3_fprintf(p->out, "%d,%d,%s\n", iEqpId, p2, zText); - } - pNew = sqlite3_malloc64( sizeof(*pNew) + nText ); - shell_check_oom(pNew); - pNew->iEqpId = iEqpId; - pNew->iParentId = p2; - memcpy(pNew->zText, zText, nText+1); - pNew->pNext = 0; - if( p->sGraph.pLast ){ - p->sGraph.pLast->pNext = pNew; - }else{ - p->sGraph.pRow = pNew; - } - p->sGraph.pLast = pNew; -} - -/* -** Free and reset the EXPLAIN QUERY PLAN data that has been collected -** in p->sGraph. -*/ -static void eqp_reset(ShellState *p){ - EQPGraphRow *pRow, *pNext; - for(pRow = p->sGraph.pRow; pRow; pRow = pNext){ - pNext = pRow->pNext; - sqlite3_free(pRow); - } - memset(&p->sGraph, 0, sizeof(p->sGraph)); -} - -/* Return the next EXPLAIN QUERY PLAN line with iEqpId that occurs after -** pOld, or return the first such line if pOld is NULL -*/ -static EQPGraphRow *eqp_next_row(ShellState *p, int iEqpId, EQPGraphRow *pOld){ - EQPGraphRow *pRow = pOld ? pOld->pNext : p->sGraph.pRow; - while( pRow && pRow->iParentId!=iEqpId ) pRow = pRow->pNext; - return pRow; -} - -/* Render a single level of the graph that has iEqpId as its parent. Called -** recursively to render sublevels. -*/ -static void eqp_render_level(ShellState *p, int iEqpId){ - EQPGraphRow *pRow, *pNext; - i64 n = strlen(p->sGraph.zPrefix); - char *z; - for(pRow = eqp_next_row(p, iEqpId, 0); pRow; pRow = pNext){ - pNext = eqp_next_row(p, iEqpId, pRow); - z = pRow->zText; - sqlite3_fprintf(p->out, "%s%s%s\n", p->sGraph.zPrefix, - pNext ? "|--" : "`--", z); - if( n<(i64)sizeof(p->sGraph.zPrefix)-7 ){ - memcpy(&p->sGraph.zPrefix[n], pNext ? "| " : " ", 4); - eqp_render_level(p, pRow->iEqpId); - p->sGraph.zPrefix[n] = 0; - } - } -} - -/* -** Display and reset the EXPLAIN QUERY PLAN data -*/ -static void eqp_render(ShellState *p, i64 nCycle){ - EQPGraphRow *pRow = p->sGraph.pRow; - if( pRow ){ - if( pRow->zText[0]=='-' ){ - if( pRow->pNext==0 ){ - eqp_reset(p); - return; - } - sqlite3_fprintf(p->out, "%s\n", pRow->zText+3); - p->sGraph.pRow = pRow->pNext; - sqlite3_free(pRow); - }else if( nCycle>0 ){ - sqlite3_fprintf(p->out, "QUERY PLAN (cycles=%lld [100%%])\n", nCycle); - }else{ - sqlite3_fputs("QUERY PLAN\n", p->out); - } - p->sGraph.zPrefix[0] = 0; - eqp_render_level(p, 0); - eqp_reset(p); - } -} - #ifndef SQLITE_OMIT_PROGRESS_CALLBACK /* ** Progress handler callback. @@ -3020,7 +2935,6 @@ static int shell_callback( break; } case MODE_EQP: { - eqp_append(p, atoi(azArg[0]), atoi(azArg[1]), azArg[3]); break; } } @@ -3113,11 +3027,7 @@ static void set_table_name(ShellState *p, const char *zName){ p->zDestTable = 0; } if( zName==0 ) return; - if( quoteChar(zName) ){ - p->zDestTable = sqlite3_mprintf("\"%w\"", zName); - }else{ - p->zDestTable = sqlite3_mprintf("%s", zName); - } + p->zDestTable = sqlite3_mprintf("%s", zName); shell_check_oom(p->zDestTable); } @@ -3473,267 +3383,8 @@ static int display_stats( return 0; } - -#ifdef SQLITE_ENABLE_STMT_SCANSTATUS -static int scanStatsHeight(sqlite3_stmt *p, int iEntry){ - int iPid = 0; - int ret = 1; - sqlite3_stmt_scanstatus_v2(p, iEntry, - SQLITE_SCANSTAT_SELECTID, SQLITE_SCANSTAT_COMPLEX, (void*)&iPid - ); - while( iPid!=0 ){ - int ii; - for(ii=0; 1; ii++){ - int iId; - int res; - res = sqlite3_stmt_scanstatus_v2(p, ii, - SQLITE_SCANSTAT_SELECTID, SQLITE_SCANSTAT_COMPLEX, (void*)&iId - ); - if( res ) break; - if( iId==iPid ){ - sqlite3_stmt_scanstatus_v2(p, ii, - SQLITE_SCANSTAT_PARENTID, SQLITE_SCANSTAT_COMPLEX, (void*)&iPid - ); - } - } - ret++; - } - return ret; -} -#endif - -#ifdef SQLITE_ENABLE_STMT_SCANSTATUS -static void display_explain_scanstats( - sqlite3 *db, /* Database to query */ - ShellState *pArg /* Pointer to ShellState */ -){ - static const int f = SQLITE_SCANSTAT_COMPLEX; - sqlite3_stmt *p = pArg->pStmt; - int ii = 0; - i64 nTotal = 0; - int nWidth = 0; - eqp_reset(pArg); - - for(ii=0; 1; ii++){ - const char *z = 0; - int n = 0; - if( sqlite3_stmt_scanstatus_v2(p,ii,SQLITE_SCANSTAT_EXPLAIN,f,(void*)&z) ){ - break; - } - n = (int)strlen(z) + scanStatsHeight(p, ii)*3; - if( n>nWidth ) nWidth = n; - } - nWidth += 4; - - sqlite3_stmt_scanstatus_v2(p, -1, SQLITE_SCANSTAT_NCYCLE, f, (void*)&nTotal); - for(ii=0; 1; ii++){ - i64 nLoop = 0; - i64 nRow = 0; - i64 nCycle = 0; - int iId = 0; - int iPid = 0; - const char *zo = 0; - const char *zName = 0; - char *zText = 0; - double rEst = 0.0; - - if( sqlite3_stmt_scanstatus_v2(p,ii,SQLITE_SCANSTAT_EXPLAIN,f,(void*)&zo) ){ - break; - } - sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_EST,f,(void*)&rEst); - sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NLOOP,f,(void*)&nLoop); - sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NVISIT,f,(void*)&nRow); - sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NCYCLE,f,(void*)&nCycle); - sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_SELECTID,f,(void*)&iId); - sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_PARENTID,f,(void*)&iPid); - sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NAME,f,(void*)&zName); - - zText = sqlite3_mprintf("%s", zo); - if( nCycle>=0 || nLoop>=0 || nRow>=0 ){ - char *z = 0; - if( nCycle>=0 && nTotal>0 ){ - z = sqlite3_mprintf("%zcycles=%lld [%d%%]", z, - nCycle, ((nCycle*100)+nTotal/2) / nTotal - ); - } - if( nLoop>=0 ){ - z = sqlite3_mprintf("%z%sloops=%lld", z, z ? " " : "", nLoop); - } - if( nRow>=0 ){ - z = sqlite3_mprintf("%z%srows=%lld", z, z ? " " : "", nRow); - } - - if( zName && pArg->scanstatsOn>1 ){ - double rpl = (double)nRow / (double)nLoop; - z = sqlite3_mprintf("%z rpl=%.1f est=%.1f", z, rpl, rEst); - } - - zText = sqlite3_mprintf( - "% *z (%z)", -1*(nWidth-scanStatsHeight(p, ii)*3), zText, z - ); - } - - eqp_append(pArg, iId, iPid, zText); - sqlite3_free(zText); - } - - eqp_render(pArg, nTotal); -} -#endif - - -/* -** Parameter azArray points to a zero-terminated array of strings. zStr -** points to a single nul-terminated string. Return non-zero if zStr -** is equal, according to strcmp(), to any of the strings in the array. -** Otherwise, return zero. -*/ -static int str_in_array(const char *zStr, const char **azArray){ - int i; - for(i=0; azArray[i]; i++){ - if( 0==cli_strcmp(zStr, azArray[i]) ) return 1; - } - return 0; -} - -/* -** If compiled statement pSql appears to be an EXPLAIN statement, allocate -** and populate the ShellState.aiIndent[] array with the number of -** spaces each opcode should be indented before it is output. -** -** The indenting rules are: -** -** * For each "Next", "Prev", "VNext" or "VPrev" instruction, indent -** all opcodes that occur between the p2 jump destination and the opcode -** itself by 2 spaces. -** -** * Do the previous for "Return" instructions for when P2 is positive. -** See tag-20220407a in wherecode.c and vdbe.c. -** -** * For each "Goto", if the jump destination is earlier in the program -** and ends on one of: -** Yield SeekGt SeekLt RowSetRead Rewind -** or if the P1 parameter is one instead of zero, -** then indent all opcodes between the earlier instruction -** and "Goto" by 2 spaces. -*/ -static void explain_data_prepare(ShellState *p, sqlite3_stmt *pSql){ - int *abYield = 0; /* True if op is an OP_Yield */ - int nAlloc = 0; /* Allocated size of p->aiIndent[], abYield */ - int iOp; /* Index of operation in p->aiIndent[] */ - - const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext", - "Return", 0 }; - const char *azYield[] = { "Yield", "SeekLT", "SeekGT", "RowSetRead", - "Rewind", 0 }; - const char *azGoto[] = { "Goto", 0 }; - - /* The caller guarantees that the leftmost 4 columns of the statement - ** passed to this function are equivalent to the leftmost 4 columns - ** of EXPLAIN statement output. In practice the statement may be - ** an EXPLAIN, or it may be a query on the bytecode() virtual table. */ - assert( sqlite3_column_count(pSql)>=4 ); - assert( 0==sqlite3_stricmp( sqlite3_column_name(pSql, 0), "addr" ) ); - assert( 0==sqlite3_stricmp( sqlite3_column_name(pSql, 1), "opcode" ) ); - assert( 0==sqlite3_stricmp( sqlite3_column_name(pSql, 2), "p1" ) ); - assert( 0==sqlite3_stricmp( sqlite3_column_name(pSql, 3), "p2" ) ); - - for(iOp=0; SQLITE_ROW==sqlite3_step(pSql); iOp++){ - int i; - int iAddr = sqlite3_column_int(pSql, 0); - const char *zOp = (const char*)sqlite3_column_text(pSql, 1); - int p1 = sqlite3_column_int(pSql, 2); - int p2 = sqlite3_column_int(pSql, 3); - - /* Assuming that p2 is an instruction address, set variable p2op to the - ** index of that instruction in the aiIndent[] array. p2 and p2op may be - ** different if the current instruction is part of a sub-program generated - ** by an SQL trigger or foreign key. */ - int p2op = (p2 + (iOp-iAddr)); - - /* Grow the p->aiIndent array as required */ - if( iOp>=nAlloc ){ - nAlloc += 100; - p->aiIndent = (int*)sqlite3_realloc64(p->aiIndent, nAlloc*sizeof(int)); - shell_check_oom(p->aiIndent); - abYield = (int*)sqlite3_realloc64(abYield, nAlloc*sizeof(int)); - shell_check_oom(abYield); - } - - abYield[iOp] = str_in_array(zOp, azYield); - p->aiIndent[iOp] = 0; - p->nIndent = iOp+1; - if( str_in_array(zOp, azNext) && p2op>0 ){ - for(i=p2op; iaiIndent[i] += 2; - } - if( str_in_array(zOp, azGoto) && p2opaiIndent[i] += 2; - } - } - - p->iIndent = 0; - sqlite3_free(abYield); - sqlite3_reset(pSql); -} - -/* -** Free the array allocated by explain_data_prepare(). -*/ -static void explain_data_delete(ShellState *p){ - sqlite3_free(p->aiIndent); - p->aiIndent = 0; - p->nIndent = 0; - p->iIndent = 0; -} - static void exec_prepared_stmt(ShellState*, sqlite3_stmt*); -/* -** Display scan stats. -*/ -static void display_scanstats( - sqlite3 *db, /* Database to query */ - ShellState *pArg /* Pointer to ShellState */ -){ -#ifndef SQLITE_ENABLE_STMT_SCANSTATUS - UNUSED_PARAMETER(db); - UNUSED_PARAMETER(pArg); -#else - if( pArg->scanstatsOn==3 ){ - const char *zSql = - " SELECT addr, opcode, p1, p2, p3, p4, p5, comment, nexec," - " format('% 6s (%.2f%%)'," - " CASE WHEN ncycle<100_000 THEN ncycle || ' '" - " WHEN ncycle<100_000_000 THEN (ncycle/1_000) || 'K'" - " WHEN ncycle<100_000_000_000 THEN (ncycle/1_000_000) || 'M'" - " ELSE (ncycle/1000_000_000) || 'G' END," - " ncycle*100.0/(sum(ncycle) OVER ())" - " ) AS cycles" - " FROM bytecode(?)"; - - int rc = SQLITE_OK; - sqlite3_stmt *pStmt = 0; - rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); - if( rc==SQLITE_OK ){ - sqlite3_stmt *pSave = pArg->pStmt; - pArg->pStmt = pStmt; - sqlite3_bind_pointer(pStmt, 1, pSave, "stmt-pointer", 0); - - pArg->cnt = 0; - pArg->cMode = MODE_ScanExp; - explain_data_prepare(pArg, pStmt); - exec_prepared_stmt(pArg, pStmt); - explain_data_delete(pArg); - - sqlite3_finalize(pStmt); - pArg->pStmt = pSave; - } - }else{ - display_explain_scanstats(db, pArg); - } -#endif -} - /* ** Disable and restore .wheretrace and .treetrace/.selecttrace settings. */ @@ -4170,15 +3821,17 @@ static void exec_prepared_stmt_columnar( abRowDiv = sqlite3_malloc64( nAlloc/nColumn ); shell_check_oom(abRowDiv); if( nColumn>p->nWidth ){ - p->colWidth = realloc(p->colWidth, (nColumn+1)*2*sizeof(int)); + sqlite3_int64 nByte = (nColumn+1)*2*(sizeof(short int)); + p->colWidth = realloc(p->colWidth, nByte); shell_check_oom(p->colWidth); for(i=p->nWidth; icolWidth[i] = 0; p->nWidth = nColumn; p->actualWidth = &p->colWidth[nColumn]; } - memset(p->actualWidth, 0, nColumn*sizeof(int)); + memset(p->actualWidth, 0, nColumn*sizeof(short int)); for(i=0; icolWidth[i]; + if( w==QRF_MINUS_ZERO ) w = 0; if( w<0 ) w = -w; p->actualWidth[i] = w; } @@ -4238,7 +3891,13 @@ static void exec_prepared_stmt_columnar( if( z==0 ) z = (char*)zEmpty; n = strlenChar(z); j = i%nColumn; - if( n>p->actualWidth[j] ) p->actualWidth[j] = n; + if( n>p->actualWidth[j] ){ + if( n>QRF_MX_WIDTH ){ + p->actualWidth[j] = QRF_MX_WIDTH; + }else { + p->actualWidth[j] = n; + } + } } if( seenInterrupt ) goto columnar_end; switch( p->cMode ){ @@ -4571,6 +4230,15 @@ static int expertDotCommand( } #endif /* !SQLITE_OMIT_VIRTUALTABLE && !SQLITE_OMIT_AUTHORIZATION */ +/* +** QRF write callback +*/ +static int shellWriteQR(void *pX, const char *z, sqlite3_int64 n){ + ShellState *pArg = (ShellState*)pX; + sqlite3_fprintf(pArg->out, "%.*s", (int)n, z); + return SQLITE_OK; +} + /* ** Execute a statement or set of statements. Print ** any result rows/columns depending on the current mode @@ -4590,10 +4258,46 @@ static int shell_exec( int rc2; const char *zLeftover; /* Tail of unprocessed SQL */ sqlite3 *db = pArg->db; + unsigned char eStyle; + sqlite3_qrf_spec spec; if( pzErrMsg ){ *pzErrMsg = NULL; } + memset(&spec, 0, sizeof(spec)); + spec.iVersion = 1; + spec.xWrite = shellWriteQR; + spec.pWriteArg = (void*)pArg; + spec.nWidth = pArg->nWidth; + spec.aWidth = pArg->colWidth; + spec.zRowSep = pArg->rowSeparator; + spec.zColumnSep = pArg->colSeparator; + spec.zNull = pArg->nullValue; + spec.zTableName = pArg->zDestTable; + spec.bWordWrap = pArg->cmOpts.bWordWrap; + spec.mxColWidth = pArg->cmOpts.iWrap; + switch( pArg->eEscMode ){ + case SHELL_ESC_ASCII: spec.eEsc = QRF_ESC_Ascii; break; + case SHELL_ESC_SYMBOL: spec.eEsc = QRF_ESC_Symbol; break; + default: spec.eEsc = QRF_ESC_Off; break; + } + spec.bColumnNames = pArg->showHeader!=0 ? QRF_SW_On : QRF_SW_Off; + if( pArg->cMode==MODE_Box + || pArg->cMode==MODE_Table + || pArg->cMode==MODE_Markdown + ){ + spec.bColumnNames = QRF_SW_On; + } + if( sqlite3_stmt_isexplain(pStmt) ){ + eStyle = QRF_STYLE_Auto; + }else if( pArg->cMode>=0 + && pArg->cModecMode]<100 + ){ + eStyle = aQrfStyle[pArg->cMode]; + }else{ + eStyle = 199; + } #if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_AUTHORIZATION) if( pArg->expert.pExpert ){ @@ -4628,41 +4332,16 @@ static int shell_exec( /* Show the EXPLAIN QUERY PLAN if .eqp is on */ if( pArg && pArg->autoEQP && sqlite3_stmt_isexplain(pStmt)==0 ){ - sqlite3_stmt *pExplain; int triggerEQP = 0; disable_debug_trace_modes(); sqlite3_db_config(db, SQLITE_DBCONFIG_TRIGGER_EQP, -1, &triggerEQP); if( pArg->autoEQP>=AUTOEQP_trigger ){ sqlite3_db_config(db, SQLITE_DBCONFIG_TRIGGER_EQP, 1, 0); } - pExplain = pStmt; - sqlite3_reset(pExplain); - rc = sqlite3_stmt_explain(pExplain, 2); - if( rc==SQLITE_OK ){ - bind_prepared_stmt(pArg, pExplain); - while( sqlite3_step(pExplain)==SQLITE_ROW ){ - const char *zEQPLine = (const char*)sqlite3_column_text(pExplain,3); - int iEqpId = sqlite3_column_int(pExplain, 0); - int iParentId = sqlite3_column_int(pExplain, 1); - if( zEQPLine==0 ) zEQPLine = ""; - if( zEQPLine[0]=='-' ) eqp_render(pArg, 0); - eqp_append(pArg, iEqpId, iParentId, zEQPLine); - } - eqp_render(pArg, 0); - } - if( pArg->autoEQP>=AUTOEQP_full ){ - /* Also do an EXPLAIN for ".eqp full" mode */ - sqlite3_reset(pExplain); - rc = sqlite3_stmt_explain(pExplain, 1); - if( rc==SQLITE_OK ){ - pArg->cMode = MODE_Explain; - assert( sqlite3_stmt_isexplain(pExplain)==1 ); - bind_prepared_stmt(pArg, pExplain); - explain_data_prepare(pArg, pExplain); - exec_prepared_stmt(pArg, pExplain); - explain_data_delete(pArg); - } - } + sqlite3_reset(pStmt); + spec.eStyle = QRF_STYLE_Auto; + sqlite3_stmt_explain(pStmt, 2-(pArg->autoEQP>=AUTOEQP_full)); + sqlite3_format_query_result(pStmt, &spec, 0); if( pArg->autoEQP>=AUTOEQP_trigger && triggerEQP==0 ){ sqlite3_db_config(db, SQLITE_DBCONFIG_TRIGGER_EQP, 0, 0); } @@ -4671,29 +4350,13 @@ static int shell_exec( restore_debug_trace_modes(); } - if( pArg ){ - int bIsExplain = (sqlite3_stmt_isexplain(pStmt)==1); - pArg->cMode = pArg->mode; - if( pArg->autoExplain ){ - if( bIsExplain ){ - pArg->cMode = MODE_Explain; - } - if( sqlite3_stmt_isexplain(pStmt)==2 ){ - pArg->cMode = MODE_EQP; - } - } - - /* If the shell is currently in ".explain" mode, gather the extra - ** data required to add indents to the output.*/ - if( pArg->cMode==MODE_Explain && bIsExplain ){ - explain_data_prepare(pArg, pStmt); - } - } - bind_prepared_stmt(pArg, pStmt); - exec_prepared_stmt(pArg, pStmt); - explain_data_delete(pArg); - eqp_render(pArg, 0); + if( eStyle<100 ){ + spec.eStyle = eStyle; + sqlite3_format_query_result(pStmt, &spec, 0); + }else{ + exec_prepared_stmt(pArg, pStmt); + } /* print usage stats if stats on */ if( pArg && pArg->statsOn ){ @@ -4702,7 +4365,18 @@ static int shell_exec( /* print loop-counters if required */ if( pArg && pArg->scanstatsOn ){ - display_scanstats(db, pArg); + char *zErr = 0; + switch( pArg->scanstatsOn ){ + case 1: spec.eStyle = QRF_STYLE_Stats; break; + case 2: spec.eStyle = QRF_STYLE_StatsEst; break; + default: spec.eStyle = QRF_STYLE_StatsVm; break; + } + sqlite3_reset(pStmt); + rc = sqlite3_format_query_result(pStmt, &spec, &zErr); + if( rc ){ + sqlite3_fprintf(stderr, "Stats query failed: %s\n", zErr); + sqlite3_free(zErr); + } } /* Finalize the statement just executed. If this fails, save a @@ -4935,6 +4609,7 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azNotUsed){ int i; char *savedDestTable; int savedMode; + int savedShowHdr; azCol = tableColumnList(p, zTable); if( azCol==0 ){ @@ -4979,8 +4654,10 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azNotUsed){ savedDestTable = p->zDestTable; savedMode = p->mode; - p->zDestTable = sTable.zTxt; + savedShowHdr = p->showHeader; + p->zDestTable = (char*)zTable; p->mode = p->cMode = MODE_Insert; + p->showHeader = 1; rc = shell_exec(p, sSelect.zTxt, 0); if( (rc&0xff)==SQLITE_CORRUPT ){ sqlite3_fputs("/****** CORRUPTION ERROR *******/\n", p->out); @@ -4990,6 +4667,7 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azNotUsed){ } p->zDestTable = savedDestTable; p->mode = savedMode; + p->showHeader = savedShowHdr; freeText(&sTable); freeText(&sSelect); if( rc ) p->nErr++; @@ -11534,7 +11212,7 @@ static int do_meta_command(char *zLine, ShellState *p){ sqlite3_fprintf(p->out, "%12.12s: %s\n","stats", zOut); sqlite3_fprintf(p->out, "%12.12s: ", "width"); for (i=0;inWidth;i++) { - sqlite3_fprintf(p->out, "%d ", p->colWidth[i]); + sqlite3_fprintf(p->out, "%d ", (int)p->colWidth[i]); } sqlite3_fputs("\n", p->out); sqlite3_fprintf(p->out, "%12.12s: %s\n", "filename", @@ -12335,14 +12013,14 @@ static int do_meta_command(char *zLine, ShellState *p){ int j; assert( nArg<=ArraySize(azArg) ); p->nWidth = nArg-1; - p->colWidth = realloc(p->colWidth, (p->nWidth+1)*sizeof(int)*2); + p->colWidth = realloc(p->colWidth, (p->nWidth+1)*sizeof(short int)*2); if( p->colWidth==0 && p->nWidth>0 ) shell_out_of_memory(); if( p->nWidth ) p->actualWidth = &p->colWidth[p->nWidth]; for(j=1; j +30000 ) w = +30000; - p->colWidth[j-1] = (int)w; + if( w < QRF_MN_WIDTH ) w = QRF_MN_WIDTH; + if( w > QRF_MX_WIDTH ) w = QRF_MX_WIDTH; + p->colWidth[j-1] = (short int)w; } }else @@ -13535,6 +13213,9 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ data.mode = MODE_Line; }else if( cli_strcmp(z,"-column")==0 ){ data.mode = MODE_Column; + if( (data.shellFlgs & SHFLG_HeaderSet)==0 ){ + data.showHeader = 1; + } }else if( cli_strcmp(z,"-json")==0 ){ data.mode = MODE_Json; }else if( cli_strcmp(z,"-markdown")==0 ){ diff --git a/test/shell1.test b/test/shell1.test index abf214a907..8f7d923571 100644 --- a/test/shell1.test +++ b/test/shell1.test @@ -803,14 +803,14 @@ INSERT INTO t1 VALUES(''); INSERT INTO t1 VALUES(1); INSERT INTO t1 VALUES(2.25); INSERT INTO t1 VALUES('hello'); -INSERT INTO t1 VALUES(X'807f'); +INSERT INTO t1 VALUES(x'807f'); CREATE TABLE t3(x,y); INSERT INTO t3 VALUES(1,NULL); INSERT INTO t3 VALUES(2,''); INSERT INTO t3 VALUES(3,1); INSERT INTO t3 VALUES(4,2.25); INSERT INTO t3 VALUES(5,'hello'); -INSERT INTO t3 VALUES(6,X'807f'); +INSERT INTO t3 VALUES(6,x'807f'); COMMIT;}} @@ -828,14 +828,14 @@ INSERT INTO t1(rowid,x) VALUES(2,''); INSERT INTO t1(rowid,x) VALUES(3,1); INSERT INTO t1(rowid,x) VALUES(4,2.25); INSERT INTO t1(rowid,x) VALUES(5,'hello'); -INSERT INTO t1(rowid,x) VALUES(6,X'807f'); +INSERT INTO t1(rowid,x) VALUES(6,x'807f'); CREATE TABLE t3(x,y); INSERT INTO t3(rowid,x,y) VALUES(1,1,NULL); INSERT INTO t3(rowid,x,y) VALUES(2,2,''); INSERT INTO t3(rowid,x,y) VALUES(3,3,1); INSERT INTO t3(rowid,x,y) VALUES(4,4,2.25); INSERT INTO t3(rowid,x,y) VALUES(5,5,'hello'); -INSERT INTO t3(rowid,x,y) VALUES(6,6,X'807f'); +INSERT INTO t3(rowid,x,y) VALUES(6,6,x'807f'); COMMIT;}} # If the table contains an INTEGER PRIMARY KEY, do not record a separate @@ -859,7 +859,7 @@ INSERT INTO t1 VALUES(2,''); INSERT INTO t1 VALUES(3,1); INSERT INTO t1 VALUES(4,2.25); INSERT INTO t1 VALUES(5,'hello'); -INSERT INTO t1 VALUES(6,X'807f'); +INSERT INTO t1 VALUES(6,x'807f'); COMMIT;}} # Verify that the table named [table] is correctly quoted and that @@ -883,7 +883,7 @@ INSERT INTO "table"(rowid,x,y) VALUES(2,12,''); INSERT INTO "table"(rowid,x,y) VALUES(3,23,1); INSERT INTO "table"(rowid,x,y) VALUES(4,34,2.25); INSERT INTO "table"(rowid,x,y) VALUES(5,45,'hello'); -INSERT INTO "table"(rowid,x,y) VALUES(6,56,X'807f'); +INSERT INTO "table"(rowid,x,y) VALUES(6,56,x'807f'); COMMIT;}} # Do not record rowids for a WITHOUT ROWID table. Also check correct quoting @@ -907,7 +907,7 @@ INSERT INTO "ta<>ble" VALUES(12,''); INSERT INTO "ta<>ble" VALUES(23,1); INSERT INTO "ta<>ble" VALUES(34,2.25); INSERT INTO "ta<>ble" VALUES(45,'hello'); -INSERT INTO "ta<>ble" VALUES(56,X'807f'); +INSERT INTO "ta<>ble" VALUES(56,x'807f'); COMMIT;}} # Do not record rowids if the rowid is inaccessible @@ -926,7 +926,7 @@ BEGIN TRANSACTION; CREATE TABLE t1(_ROWID_,rowid,oid); INSERT INTO t1 VALUES(1,NULL,'alpha'); INSERT INTO t1 VALUES(12,'',99); -INSERT INTO t1 VALUES(23,1,X'b0b1b2'); +INSERT INTO t1 VALUES(23,1,x'b0b1b2'); COMMIT;}} } else { @@ -1020,7 +1020,7 @@ INSERT INTO t1 VALUES(''); INSERT INTO t1 VALUES(1); INSERT INTO t1 VALUES(2.25); INSERT INTO t1 VALUES('hello'); -INSERT INTO t1 VALUES(X'807f');}} +INSERT INTO t1 VALUES(x'807f');}} # Test the output of ".mode insert" with headers # @@ -1031,7 +1031,7 @@ INSERT INTO t1(x) VALUES(''); INSERT INTO t1(x) VALUES(1); INSERT INTO t1(x) VALUES(2.25); INSERT INTO t1(x) VALUES('hello'); -INSERT INTO t1(x) VALUES(X'807f');}} +INSERT INTO t1(x) VALUES(x'807f');}} # Test the output of ".mode insert" # @@ -1042,7 +1042,7 @@ INSERT INTO t3 VALUES(2,''); INSERT INTO t3 VALUES(3,1); INSERT INTO t3 VALUES(4,2.25); INSERT INTO t3 VALUES(5,'hello'); -INSERT INTO t3 VALUES(6,X'807f');}} +INSERT INTO t3 VALUES(6,x'807f');}} # Test the output of ".mode insert" with headers # @@ -1053,7 +1053,7 @@ INSERT INTO t3(x,y) VALUES(2,''); INSERT INTO t3(x,y) VALUES(3,1); INSERT INTO t3(x,y) VALUES(4,2.25); INSERT INTO t3(x,y) VALUES(5,'hello'); -INSERT INTO t3(x,y) VALUES(6,X'807f');}} +INSERT INTO t3(x,y) VALUES(6,x'807f');}} # Test the output of ".mode tcl" # @@ -1115,7 +1115,7 @@ do_test shell1-4.6 { # do_test shell1-4.7 { catchcmd test.db ".mode quote\nselect x'0123456789ABCDEF';" -} {0 X'0123456789abcdef'} +} {0 x'0123456789abcdef'} # Test using arbitrary byte data with the shell via standard input/output. #