0
0
mirror of https://github.com/sqlite/sqlite.git synced 2024-11-22 12:17:40 +01:00

Add base64() and base85() text/blob conversions to the CLI.

FossilOrigin-Name: 4bc98a2d9520efa9b80142163cbfab72a5f2fe9854cd6ba8291dcefdb872e657
This commit is contained in:
larrybr 2022-12-23 19:04:59 +00:00
parent ace682e149
commit 0953c5354a
9 changed files with 170 additions and 141 deletions

View File

@ -437,7 +437,7 @@ TESTSRC = \
$(TOP)/ext/recover/sqlite3recover.c \
$(TOP)/ext/recover/dbdata.c \
$(TOP)/ext/recover/test_recover.c \
$(TOP)/ext/rbu/test_rbu.c
$(TOP)/ext/rbu/test_rbu.c
# Statically linked extensions
#
@ -1118,6 +1118,9 @@ SHELL_SRC = \
$(TOP)/ext/misc/appendvfs.c \
$(TOP)/ext/misc/completion.c \
$(TOP)/ext/misc/decimal.c \
$(TOP)/ext/misc/basexx.c \
$(TOP)/ext/misc/base64.c \
$(TOP)/ext/misc/base85.c \
$(TOP)/ext/misc/fileio.c \
$(TOP)/ext/misc/ieee754.c \
$(TOP)/ext/misc/regexp.c \

View File

@ -53,9 +53,7 @@
#include <assert.h>
#ifndef SQLITE_SHELL_EXTFUNCS /* Guard for #include as built-in extension. */
#include "sqlite3ext.h"
#endif
SQLITE_EXTENSION_INIT1;
@ -64,12 +62,12 @@ SQLITE_EXTENSION_INIT1;
#define ND 0x82 /* Not above or digit-value */
#define PAD_CHAR '='
#ifndef UBYTE_TYPEDEF
typedef unsigned char ubyte;
# define UBYTE_TYPEDEF
#ifndef U8_TYPEDEF
typedef unsigned char u8;
#define U8_TYPEDEF
#endif
static const ubyte b64DigitValues[128] = {
static const u8 b64DigitValues[128] = {
/* HT LF VT FF CR */
ND,ND,ND,ND, ND,ND,ND,ND, ND,WS,WS,WS, WS,WS,ND,ND,
/* US */
@ -92,18 +90,18 @@ static const char b64Numerals[64+1]
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
#define BX_DV_PROTO(c) \
((((ubyte)(c))<0x80)? (ubyte)(b64DigitValues[(ubyte)(c)]) : 0x80)
#define IS_BX_DIGIT(bdp) (((ubyte)(bdp))<0x80)
((((u8)(c))<0x80)? (u8)(b64DigitValues[(u8)(c)]) : 0x80)
#define IS_BX_DIGIT(bdp) (((u8)(bdp))<0x80)
#define IS_BX_WS(bdp) ((bdp)==WS)
#define IS_BX_PAD(bdp) ((bdp)==PC)
#define BX_NUMERAL(dv) (b64Numerals[(ubyte)(dv)])
#define BX_NUMERAL(dv) (b64Numerals[(u8)(dv)])
/* Width of base64 lines. Should be an integer multiple of 4. */
#define B64_DARK_MAX 72
/* Encode a byte buffer into base64 text with linefeeds appended to limit
** encoded group lengths to B64_DARK_MAX or to terminate the last group.
*/
static char* toBase64( ubyte *pIn, int nbIn, char *pOut ){
static char* toBase64( u8 *pIn, int nbIn, char *pOut ){
int nCol = 0;
while( nbIn >= 3 ){
/* Do the bit-shuffle, exploiting unsigned input to avoid masking. */
@ -128,7 +126,7 @@ static char* toBase64( ubyte *pIn, int nbIn, char *pOut ){
if( nbe<nbIn ) qv |= *pIn++;
}
for( nbe=3; nbe>=0; --nbe ){
char ce = (nbe<nco)? BX_NUMERAL((ubyte)(qv & 0x3f)) : PAD_CHAR;
char ce = (nbe<nco)? BX_NUMERAL((u8)(qv & 0x3f)) : PAD_CHAR;
qv >>= 6;
pOut[nbe] = ce;
}
@ -147,7 +145,7 @@ static char * skipNonB64( char *s ){
}
/* Decode base64 text into a byte buffer. */
static ubyte* fromBase64( char *pIn, int ncIn, ubyte *pOut ){
static u8* fromBase64( char *pIn, int ncIn, u8 *pOut ){
if( ncIn>0 && pIn[ncIn-1]=='\n' ) --ncIn;
while( ncIn>0 && *pIn!=PAD_CHAR ){
static signed char nboi[] = { 0, 0, 1, 2, 3 };
@ -162,7 +160,7 @@ static ubyte* fromBase64( char *pIn, int ncIn, ubyte *pOut ){
if( nbo==0 ) break;
for( nac=0; nac<4; ++nac ){
char c = (nac<nti)? *pIn++ : b64Numerals[0];
ubyte bdp = BX_DV_PROTO(c);
u8 bdp = BX_DV_PROTO(c);
switch( bdp ){
case ND:
/* Treat dark non-digits as pad, but they terminate decode too. */
@ -200,7 +198,7 @@ static void base64(sqlite3_context *context, int na, sqlite3_value *av[]){
int nvMax = sqlite3_limit(sqlite3_context_db_handle(context),
SQLITE_LIMIT_LENGTH, -1);
char *cBuf;
ubyte *bBuf;
u8 *bBuf;
assert(na==1);
switch( sqlite3_value_type(av[0]) ){
case SQLITE_BLOB:
@ -213,7 +211,7 @@ static void base64(sqlite3_context *context, int na, sqlite3_value *av[]){
}
cBuf = sqlite3_malloc(nc);
if( !cBuf ) goto memFail;
bBuf = (ubyte*)sqlite3_value_blob(av[0]);
bBuf = (u8*)sqlite3_value_blob(av[0]);
nc = (int)(toBase64(bBuf, nb, cBuf) - cBuf);
sqlite3_result_text(context, cBuf, nc, sqlite3_free);
break;

View File

@ -85,9 +85,7 @@
#ifndef BASE85_STANDALONE
#ifndef SQLITE_SHELL_EXTFUNCS /* Guard for #include as built-in extension. */
# include "sqlite3ext.h"
#endif
SQLITE_EXTENSION_INIT1;
@ -113,9 +111,9 @@ static void sayHelp(){
}
#endif
#ifndef UBYTE_TYPEDEF
typedef unsigned char ubyte;
# define UBYTE_TYPEDEF
#ifndef U8_TYPEDEF
typedef unsigned char u8;
#define U8_TYPEDEF
#endif
/* Classify c according to interval within USASCII set w.r.t. base85
@ -124,15 +122,15 @@ typedef unsigned char ubyte;
#define B85_CLASS( c ) (((c)>='#')+((c)>'&')+((c)>='*')+((c)>'z'))
/* Provide digitValue to b85Numeral offset as a function of above class. */
static ubyte b85_cOffset[] = { 0, '#', 0, '*'-4, 0 };
static u8 b85_cOffset[] = { 0, '#', 0, '*'-4, 0 };
#define B85_DNOS( c ) b85_cOffset[B85_CLASS(c)]
/* Say whether c is a base85 numeral. */
#define IS_B85( c ) (B85_CLASS(c) & 1)
#if 0 /* Not used, */
static ubyte base85DigitValue( char c ){
ubyte dv = (ubyte)(c - '#');
static u8 base85DigitValue( char c ){
u8 dv = (u8)(c - '#');
if( dv>87 ) return 0xff;
return (dv > 3)? dv-3 : dv;
}
@ -151,7 +149,7 @@ static char * skipNonB85( char *s ){
/* Convert small integer, known to be in 0..84 inclusive, to base85 numeral.
* Do not use the macro form with argument expression having a side-effect.*/
#if 0
static char base85Numeral( ubyte b ){
static char base85Numeral( u8 b ){
return (b < 4)? (char)(b + '#') : (char)(b - 4 + '*');
}
#else
@ -169,7 +167,7 @@ static char *putcs(char *pc, char *s){
** to be appended to encoded groups to limit their length to B85_DARK_MAX
** or to terminate the last group (to aid concatenation.)
*/
static char* toBase85( ubyte *pIn, int nbIn, char *pOut, char *pSep ){
static char* toBase85( u8 *pIn, int nbIn, char *pOut, char *pSep ){
int nCol = 0;
while( nbIn >= 4 ){
int nco = 5;
@ -197,7 +195,7 @@ static char* toBase85( ubyte *pIn, int nbIn, char *pOut, char *pSep ){
}
nCol += nco;
while( nco > 0 ){
ubyte dv = (ubyte)(qv % 85);
u8 dv = (u8)(qv % 85);
qv /= 85;
pOut[--nco] = base85Numeral(dv);
}
@ -209,7 +207,7 @@ static char* toBase85( ubyte *pIn, int nbIn, char *pOut, char *pSep ){
}
/* Decode base85 text into a byte buffer. */
static ubyte* fromBase85( char *pIn, int ncIn, ubyte *pOut ){
static u8* fromBase85( char *pIn, int ncIn, u8 *pOut ){
if( ncIn>0 && pIn[ncIn-1]=='\n' ) --ncIn;
while( ncIn>0 ){
static signed char nboi[] = { 0, 0, 1, 2, 3, 4 };
@ -223,7 +221,7 @@ static ubyte* fromBase85( char *pIn, int ncIn, ubyte *pOut ){
if( nbo==0 ) break;
while( nti>0 ){
char c = *pIn++;
ubyte cdo = B85_DNOS(c);
u8 cdo = B85_DNOS(c);
--ncIn;
if( cdo==0 ) break;
qv = 85 * qv + (c - cdo);
@ -287,7 +285,7 @@ static void base85(sqlite3_context *context, int na, sqlite3_value *av[]){
int nvMax = sqlite3_limit(sqlite3_context_db_handle(context),
SQLITE_LIMIT_LENGTH, -1);
char *cBuf;
ubyte *bBuf;
u8 *bBuf;
assert(na==1);
switch( sqlite3_value_type(av[0]) ){
case SQLITE_BLOB:
@ -300,7 +298,7 @@ static void base85(sqlite3_context *context, int na, sqlite3_value *av[]){
}
cBuf = sqlite3_malloc(nc);
if( !cBuf ) goto memFail;
bBuf = (ubyte*)sqlite3_value_blob(av[0]);
bBuf = (u8*)sqlite3_value_blob(av[0]);
nc = (int)(toBase85(bBuf, nb, cBuf, "\n") - cBuf);
sqlite3_result_text(context, cBuf, nc, sqlite3_free);
break;
@ -370,7 +368,7 @@ static int sqlite3_base85_init
int main(int na, char *av[]){
int cin;
int rc = 0;
ubyte bBuf[4*(B85_DARK_MAX/5)];
u8 bBuf[4*(B85_DARK_MAX/5)];
char cBuf[5*(sizeof(bBuf)/4)+2];
size_t nio;
# ifndef OMIT_BASE85_CHECKER

View File

@ -49,6 +49,9 @@ static void init_api_ptr(const sqlite3_api_routines *pApi){
#undef SQLITE_EXTENSION_INIT2
#define SQLITE_EXTENSION_INIT2(v) (void)v
typedef unsigned char u8;
#define U8_TYPEDEF
/* These next 2 undef's are only needed because the entry point names
* collide when formulated per the rules stated for loadable extension
* entry point names that will be deduced from the file basenames.

View File

@ -1,9 +1,9 @@
C Explicitly\somit\sthreading\sand\sextension\sloading\sfrom\sthe\sext/wasm/c-pp\sbinary\sbuild\sto\savoid\sa\slink\serror\son\ssome\ssystems.
D 2022-12-23T18:38:14.809
C Add\sbase64()\sand\sbase85()\stext/blob\sconversions\sto\sthe\sCLI.
D 2022-12-23T19:04:59.875
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F Makefile.in c223963d7b0828f26cb62ea3e0f583d26839b7d3ef0d1cca87f35c4b222ff01b
F Makefile.in 341f02570d220695100004c447773ecb6c082e24178fc45dcbc0a212abaa0655
F Makefile.linux-gcc f609543700659711fbd230eced1f01353117621dccae7b9fb70daa64236c5241
F Makefile.msc e86ec21328921721dd6f777da435c62a5469cda1a654f5ecefacf87ddb3dfeb3
F README.md 8b8df9ca852aeac4864eb1e400002633ee6db84065bd01b78c33817f97d31f5e
@ -289,9 +289,9 @@ F ext/misc/README.md d6dd0fe1d8af77040216798a6a2b0c46c73054d2f0ea544fbbcdccf6f23
F ext/misc/amatch.c e3ad5532799cee9a97647f483f67f43b38796b84b5a8c60594fe782a4338f358
F ext/misc/anycollseq.c 5ffdfde9829eeac52219136ad6aa7cd9a4edb3b15f4f2532de52f4a22525eddb
F ext/misc/appendvfs.c 9642c7a194a2a25dca7ad3e36af24a0a46d7702168c4ad7e59c9f9b0e16a3824
F ext/misc/base64.c 1ad313d38dc081abe5a87fa51e44f07ec6cfb618aa9606a77e42bd2fe706a67f x
F ext/misc/base85.c ace591246855806a70e63eb6705ce8736f4b782da2137bdbb5d39cc337346e0d
F ext/misc/basexx.c 58f72b3c159e875bfd2d30a56254e7f2098961c31dc733773a9270de7066aa4c
F ext/misc/base64.c d9bcb499d4edf42d1d981cc49af0a084532af288f982facb83e23c2e46f7c009 x
F ext/misc/base85.c 4b53d66c50e120e8697dd2a8ea6ddbc8750a4a1f6bcc6e0b7202a3998b0852bc
F ext/misc/basexx.c 5e859e1820620aa8080fb9145eb47089de426ae808f6abb01a8e12921c3a8e67
F ext/misc/blobio.c a867c4c4617f6ec223a307ebfe0eabb45e0992f74dd47722b96f3e631c0edb2a
F ext/misc/btreeinfo.c d28ce349b40054eaa9473e835837bad7a71deec33ba13e39f963d50933bfa0f9
F ext/misc/carray.c b752f46411e4e47e34dce6f0c88bc8e51bb821ba9e49bfcd882506451c928f69
@ -646,7 +646,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c efea4e5fbecfd6d0a9071b0be0d952620991673391b6ffaaf4c277b0bb674633
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 83de67e4857be2866d048c98e93f65461d8a0408ca4ce88fec68ebfe030997ae
F src/shell.c.in fb29e3fb40c84a453b5f5d7bf32b5c2fb9f2207b1a97ff76490c5d8a2ec22575
F src/shell.c.in 01816a1e0eb3a2e9a9a4b11570d68058969c88b2ec5ecaf80c57d6ca1b8d46a4
F src/sqlite.h.in e752f82b9d71f1d42b259b1900e4b1caf0965e844d756cd5cc91cc2cf45ed925
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h c4b9fa7a7e2bcdf850cfeb4b8a91d5ec47b7a00033bc996fd2ee96cbf2741f5f
@ -1501,7 +1501,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 e4b4de56f454708e0747b52915135baa2cbfec4965406d6eaf02a4a5c22a9880
F test/shell1.test ab88e763854ea4734796067e20e258589b4d5bb9e77d70d8c4c8e99cf77c8b64
F test/shell2.test 1190b951373fdfe719bc6ac16962bc743dfa4355db8ae546c0bb9bf559a28d4a
F test/shell3.test 91febeac0412812bf6370abb8ed72700e32bf8f9878849414518f662dfd55e8a
F test/shell4.test 9abd0c12a7e20a4c49e84d5be208d2124fa6c09e728f56f1f4bee0f02853935f
@ -1999,7 +1999,7 @@ F tool/mkopcodec.tcl 33d20791e191df43209b77d37f0ff0904620b28465cca6990cf8d60da61
F tool/mkopcodeh.tcl 769d9e6a8b462323150dc13a8539d6064664b72974f7894befe2491cc73e05cd
F tool/mkopts.tcl 680f785fdb09729fd9ac50632413da4eadbdf9071535e3f26d03795828ab07fa
F tool/mkpragmatab.tcl bd07bd59d45d0f3448e123d6937e9811195f9908a51e09d774609883055bfd3d
F tool/mkshellc.tcl 02d0de8349ef830c0fb20d29680320bde2466e2ec422e5bd94c4317a7a7e8cc9
F tool/mkshellc.tcl b7adf08b82de60811d2cb6af05ff59fc17e5cd6f3e98743c14eaaa3f8971fed0
F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
F tool/mksqlite3c-noext.tcl 4f7cfef5152b0c91920355cbfc1d608a4ad242cb819f1aea07f6d0274f584a7f
@ -2067,8 +2067,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 58503cd148c9613abfaf7c1386c34806150bd521966864ccbb821ea7dede8e5a
R 074fed6133dc78bb8d0d984f37c88d73
U stephan
Z 7a321f6978c55ea122099ade7e707faf
P 5d9a14715c25efcd81cadafabf03aad7213251bd1b3dc181939c2dba8d942fb6
R f473ce0dc90c010b804e2b9eefdd163f
U larrybr
Z 3ee7c528f374ab6814608dd44133cc19
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
5d9a14715c25efcd81cadafabf03aad7213251bd1b3dc181939c2dba8d942fb6
4bc98a2d9520efa9b80142163cbfab72a5f2fe9854cd6ba8291dcefdb872e657

View File

@ -21,7 +21,7 @@ typedef unsigned short int u16;
/*
** Optionally #include a user-defined header, whereby compilation options
** may be set prior to where they take effect, but after platform setup.
** may be set prior to where they take effect, but after platform setup.
** If SQLITE_CUSTOM_INCLUDE=? is defined, its value names the #include
** file. Note that this macro has a like effect on sqlite3.c compilation.
*/
@ -535,7 +535,8 @@ static char *dynamicContinuePrompt(void){
return continuePrompt;
}else{
if( dynPrompt.zScannerAwaits ){
size_t ncp = strlen(continuePrompt), ndp = strlen(dynPrompt.zScannerAwaits);
size_t ncp = strlen(continuePrompt);
size_t ndp = strlen(dynPrompt.zScannerAwaits);
if( ndp > ncp-3 ) return continuePrompt;
strcpy(dynPrompt.dynamicPrompt, dynPrompt.zScannerAwaits);
while( ndp<3 ) dynPrompt.dynamicPrompt[ndp++] = ' ';
@ -1033,7 +1034,7 @@ static void shellModuleSchema(
char *zFake;
UNUSED_PARAMETER(nVal);
zName = (const char*)sqlite3_value_text(apVal[0]);
zFake = zName ? shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName) : 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);
@ -1132,6 +1133,13 @@ INCLUDE ../ext/misc/memtrace.c
INCLUDE ../ext/misc/shathree.c
INCLUDE ../ext/misc/uint.c
INCLUDE ../ext/misc/decimal.c
#undef sqlite3_base_init
#define sqlite3_base_init sqlite3_base64_init
INCLUDE ../ext/misc/base64.c
#undef sqlite3_base_init
#define sqlite3_base_init sqlite3_base85_init
#define OMIT_BASE85_CHECKER
INCLUDE ../ext/misc/base85.c
INCLUDE ../ext/misc/ieee754.c
INCLUDE ../ext/misc/series.c
INCLUDE ../ext/misc/regexp.c
@ -1588,7 +1596,7 @@ static void editFunc(
}
sz = j;
p[sz] = 0;
}
}
sqlite3_result_text64(context, (const char*)p, sz,
sqlite3_free, SQLITE_UTF8);
}
@ -2763,9 +2771,9 @@ static char *shell_error_context(const char *zSql, sqlite3 *db){
shell_check_oom(zCode);
for(i=0; zCode[i]; i++){ if( IsSpace(zSql[i]) ) zCode[i] = ' '; }
if( iOffset<25 ){
zMsg = sqlite3_mprintf("\n %z\n %*s^--- error here", zCode, iOffset, "");
zMsg = sqlite3_mprintf("\n %z\n %*s^--- error here", zCode,iOffset,"");
}else{
zMsg = sqlite3_mprintf("\n %z\n %*serror here ---^", zCode, iOffset-14, "");
zMsg = sqlite3_mprintf("\n %z\n %*serror here ---^", zCode,iOffset-14,"");
}
return zMsg;
}
@ -2953,7 +2961,7 @@ static int display_stats(
if( pArg->statsOn==3 ){
if( pArg->pStmt ){
iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP,bReset);
raw_printf(pArg->out, "VM-steps: %d\n", iCur);
}
return 0;
@ -3034,8 +3042,10 @@ static int display_stats(
raw_printf(pArg->out, "Sort Operations: %d\n", iCur);
iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX,bReset);
raw_printf(pArg->out, "Autoindex Inserts: %d\n", iCur);
iHit = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FILTER_HIT, bReset);
iMiss = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FILTER_MISS, bReset);
iHit = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FILTER_HIT,
bReset);
iMiss = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FILTER_MISS,
bReset);
if( iHit || iMiss ){
raw_printf(pArg->out, "Bloom filter bypass taken: %d/%d\n",
iHit, iHit+iMiss);
@ -3064,7 +3074,7 @@ static int display_stats(
static int scanStatsHeight(sqlite3_stmt *p, int iEntry){
int iPid = 0;
int ret = 1;
sqlite3_stmt_scanstatus_v2(p, iEntry,
sqlite3_stmt_scanstatus_v2(p, iEntry,
SQLITE_SCANSTAT_SELECTID, SQLITE_SCANSTAT_COMPLEX, (void*)&iPid
);
while( iPid!=0 ){
@ -3072,12 +3082,12 @@ static int scanStatsHeight(sqlite3_stmt *p, int iEntry){
for(ii=0; 1; ii++){
int iId;
int res;
res = sqlite3_stmt_scanstatus_v2(p, ii,
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,
sqlite3_stmt_scanstatus_v2(p, ii,
SQLITE_SCANSTAT_PARENTID, SQLITE_SCANSTAT_COMPLEX, (void*)&iPid
);
}
@ -3409,7 +3419,7 @@ static void bind_prepared_stmt(ShellState *pArg, sqlite3_stmt *pStmt){
** characters
*/
static void print_box_line(FILE *out, int N){
const char zDash[] =
const char zDash[] =
BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24
BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24;
const int nDash = sizeof(zDash) - 1;
@ -3538,7 +3548,7 @@ static char *translateForDisplayAndDup(
break;
}
zOut[j] = 0;
return (char*)zOut;
return (char*)zOut;
}
/* Extract the value of the i-th current column for pStmt as an SQL literal
@ -3899,8 +3909,8 @@ static void exec_prepared_stmt(
** caller to eventually free this buffer using sqlite3_free().
*/
static int expertHandleSQL(
ShellState *pState,
const char *zSql,
ShellState *pState,
const char *zSql,
char **pzErr
){
assert( pState->expert.pExpert );
@ -3910,7 +3920,7 @@ static int expertHandleSQL(
/*
** This function is called either to silently clean up the object
** created by the ".expert" command (if bCancel==1), or to generate a
** created by the ".expert" command (if bCancel==1), or to generate a
** report from it and then clean it up (if bCancel==0).
**
** If successful, SQLITE_OK is returned. Otherwise, an SQLite error
@ -4005,7 +4015,8 @@ static int expertDotCommand(
if( rc==SQLITE_OK ){
pState->expert.pExpert = sqlite3_expert_new(pState->db, &zErr);
if( pState->expert.pExpert==0 ){
raw_printf(stderr, "sqlite3_expert_new: %s\n", zErr ? zErr : "out of memory");
raw_printf(stderr, "sqlite3_expert_new: %s\n",
zErr ? zErr : "out of memory");
rc = SQLITE_ERROR;
}else{
sqlite3_expert_config(
@ -4966,7 +4977,7 @@ int deduceDatabaseType(const char *zName, int dfltZip){
}
}
fclose(f);
return rc;
return rc;
}
#ifndef SQLITE_OMIT_DESERIALIZE
@ -5065,8 +5076,8 @@ readHexDb_error:
** offset (4*<arg2>) of the blob.
*/
static void shellInt32(
sqlite3_context *context,
int argc,
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const unsigned char *pBlob;
@ -5093,8 +5104,8 @@ static void shellInt32(
** using "..." with internal double-quote characters doubled.
*/
static void shellIdQuote(
sqlite3_context *context,
int argc,
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const char *zName = (const char*)sqlite3_value_text(argv[0]);
@ -5109,8 +5120,8 @@ static void shellIdQuote(
** Scalar function "usleep(X)" invokes sqlite3_sleep(X) and returns X.
*/
static void shellUSleepFunc(
sqlite3_context *context,
int argcUnused,
sqlite3_context *context,
int argcUnused,
sqlite3_value **argv
){
int sleep = sqlite3_value_int(argv[0]);
@ -5122,7 +5133,7 @@ static void shellUSleepFunc(
/*
** Scalar function "shell_escape_crnl" used by the .recover command.
** The argument passed to this function is the output of built-in
** function quote(). If the first character of the input is "'",
** function quote(). If the first character of the input is "'",
** indicating that the value passed to quote() was a text value,
** then this function searches the input for "\n" and "\r" characters
** and adds a wrapper similar to the following:
@ -5133,8 +5144,8 @@ static void shellUSleepFunc(
** of the input is returned.
*/
static void shellEscapeCrnl(
sqlite3_context *context,
int argc,
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const char *zText = (const char*)sqlite3_value_text(argv[0]);
@ -5234,13 +5245,13 @@ static void open_db(ShellState *p, int openFlags){
if( zDbFilename==0 || zDbFilename[0]==0 ){
p->openMode = SHELL_OPEN_NORMAL;
}else{
p->openMode = (u8)deduceDatabaseType(zDbFilename,
p->openMode = (u8)deduceDatabaseType(zDbFilename,
(openFlags & OPEN_DB_ZIPFILE)!=0);
}
}
switch( p->openMode ){
case SHELL_OPEN_APPENDVFS: {
sqlite3_open_v2(zDbFilename, &p->db,
sqlite3_open_v2(zDbFilename, &p->db,
SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|p->openFlags, "apndvfs");
break;
}
@ -5282,6 +5293,8 @@ static void open_db(ShellState *p, int openFlags){
sqlite3_shathree_init(p->db, 0, 0);
sqlite3_uint_init(p->db, 0, 0);
sqlite3_decimal_init(p->db, 0, 0);
sqlite3_base64_init(p->db, 0, 0);
sqlite3_base85_init(p->db, 0, 0);
sqlite3_regexp_init(p->db, 0, 0);
sqlite3_ieee_init(p->db, 0, 0);
sqlite3_series_init(p->db, 0, 0);
@ -5393,7 +5406,7 @@ void close_db(sqlite3 *db){
if( rc ){
utf8_printf(stderr, "Error: sqlite3_close() returns %d: %s\n",
rc, sqlite3_errmsg(db));
}
}
}
#if HAVE_READLINE || HAVE_EDITLINE
@ -6636,16 +6649,16 @@ static int lintDotCommand(
#if !defined SQLITE_OMIT_VIRTUALTABLE
static void shellPrepare(
sqlite3 *db,
int *pRc,
const char *zSql,
sqlite3 *db,
int *pRc,
const char *zSql,
sqlite3_stmt **ppStmt
){
*ppStmt = 0;
if( *pRc==SQLITE_OK ){
int rc = sqlite3_prepare_v2(db, zSql, -1, ppStmt, 0);
if( rc!=SQLITE_OK ){
raw_printf(stderr, "sql error: %s (%d)\n",
raw_printf(stderr, "sql error: %s (%d)\n",
sqlite3_errmsg(db), sqlite3_errcode(db)
);
*pRc = rc;
@ -6661,10 +6674,10 @@ static void shellPrepare(
** nuisance compiler warnings about "defined but not used".
*/
void shellPreparePrintf(
sqlite3 *db,
int *pRc,
sqlite3 *db,
int *pRc,
sqlite3_stmt **ppStmt,
const char *zFmt,
const char *zFmt,
...
){
*ppStmt = 0;
@ -6690,7 +6703,7 @@ void shellPreparePrintf(
** nuisance compiler warnings about "defined but not used".
*/
void shellFinalize(
int *pRc,
int *pRc,
sqlite3_stmt *pStmt
){
if( pStmt ){
@ -6712,7 +6725,7 @@ void shellFinalize(
** nuisance compiler warnings about "defined but not used".
*/
void shellReset(
int *pRc,
int *pRc,
sqlite3_stmt *pStmt
){
int rc = sqlite3_reset(pStmt);
@ -6760,7 +6773,7 @@ static int arUsage(FILE *f){
}
/*
** Print an error message for the .ar command to stderr and return
** Print an error message for the .ar command to stderr and return
** SQLITE_ERROR.
*/
static int arErrorMsg(ArCommand *pAr, const char *zFmt, ...){
@ -6841,7 +6854,7 @@ static int arProcessSwitch(ArCommand *pAr, int eSwitch, const char *zArg){
/*
** Parse the command line for an ".ar" command. The results are written into
** structure (*pAr). SQLITE_OK is returned if the command line is parsed
** successfully, otherwise an error message is written to stderr and
** successfully, otherwise an error message is written to stderr and
** SQLITE_ERROR returned.
*/
static int arParseCommand(
@ -7037,7 +7050,7 @@ static int arCheckEntries(ArCommand *pAr){
** when pAr->bGlob is false and GLOB match when pAr->bGlob is true.
*/
static void arWhereClause(
int *pRc,
int *pRc,
ArCommand *pAr,
char **pzWhere /* OUT: New WHERE clause */
){
@ -7052,7 +7065,7 @@ static void arWhereClause(
for(i=0; i<pAr->nArg; i++){
const char *z = pAr->azArg[i];
zWhere = sqlite3_mprintf(
"%z%s name %s '%q' OR substr(name,1,%d) %s '%q/'",
"%z%s name %s '%q' OR substr(name,1,%d) %s '%q/'",
zWhere, zSep, zSameOp, z, strlen30(z)+1, zSameOp, z
);
if( zWhere==0 ){
@ -7067,10 +7080,10 @@ static void arWhereClause(
}
/*
** Implementation of .ar "lisT" command.
** Implementation of .ar "lisT" command.
*/
static int arListCommand(ArCommand *pAr){
const char *zSql = "SELECT %s FROM %s WHERE %s";
const char *zSql = "SELECT %s FROM %s WHERE %s";
const char *azCols[] = {
"name",
"lsmode(mode), sz, datetime(mtime, 'unixepoch'), name"
@ -7092,7 +7105,7 @@ static int arListCommand(ArCommand *pAr){
if( pAr->bVerbose ){
utf8_printf(pAr->p->out, "%s % 10d %s %s\n",
sqlite3_column_text(pSql, 0),
sqlite3_column_int(pSql, 1),
sqlite3_column_int(pSql, 1),
sqlite3_column_text(pSql, 2),
sqlite3_column_text(pSql, 3)
);
@ -7149,17 +7162,17 @@ static int arRemoveCommand(ArCommand *pAr){
}
/*
** Implementation of .ar "eXtract" command.
** Implementation of .ar "eXtract" command.
*/
static int arExtractCommand(ArCommand *pAr){
const char *zSql1 =
const char *zSql1 =
"SELECT "
" ($dir || name),"
" writefile(($dir || name), %s, mode, mtime) "
"FROM %s WHERE (%s) AND (data IS NULL OR $dirOnly = 0)"
" AND name NOT GLOB '*..[/\\]*'";
const char *azExtraArg[] = {
const char *azExtraArg[] = {
"sqlar_uncompress(data, sz)",
"data"
};
@ -7185,7 +7198,7 @@ static int arExtractCommand(ArCommand *pAr){
if( zDir==0 ) rc = SQLITE_NOMEM;
}
shellPreparePrintf(pAr->db, &rc, &pSql, zSql1,
shellPreparePrintf(pAr->db, &rc, &pSql, zSql1,
azExtraArg[pAr->bZip], pAr->zSrcTable, zWhere
);
@ -7263,7 +7276,7 @@ static int arCreateOrUpdateCommand(
int bUpdate, /* true for a --create. */
int bOnlyIfChanged /* Only update if file has changed */
){
const char *zCreate =
const char *zCreate =
"CREATE TABLE IF NOT EXISTS sqlar(\n"
" name TEXT PRIMARY KEY, -- name of the file\n"
" mode INT, -- access permissions\n"
@ -7305,7 +7318,7 @@ static int arCreateOrUpdateCommand(
arExecSql(pAr, "PRAGMA page_size=512");
rc = arExecSql(pAr, "SAVEPOINT ar;");
if( rc!=SQLITE_OK ) return rc;
zTemp[0] = 0;
zTemp[0] = 0;
if( pAr->bZip ){
/* Initialize the zipfile virtual table, if necessary */
if( pAr->zFile ){
@ -7399,7 +7412,7 @@ static int arDotCommand(
}else if( cmd.zFile ){
int flags;
if( cmd.bAppend ) eDbType = SHELL_OPEN_APPENDVFS;
if( cmd.eCmd==AR_CMD_CREATE || cmd.eCmd==AR_CMD_INSERT
if( cmd.eCmd==AR_CMD_CREATE || cmd.eCmd==AR_CMD_INSERT
|| cmd.eCmd==AR_CMD_REMOVE || cmd.eCmd==AR_CMD_UPDATE ){
flags = SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE;
}else{
@ -7410,10 +7423,10 @@ static int arDotCommand(
utf8_printf(pState->out, "-- open database '%s'%s\n", cmd.zFile,
eDbType==SHELL_OPEN_APPENDVFS ? " using 'apndvfs'" : "");
}
rc = sqlite3_open_v2(cmd.zFile, &cmd.db, flags,
rc = sqlite3_open_v2(cmd.zFile, &cmd.db, flags,
eDbType==SHELL_OPEN_APPENDVFS ? "apndvfs" : 0);
if( rc!=SQLITE_OK ){
utf8_printf(stderr, "cannot open file: %s (%s)\n",
utf8_printf(stderr, "cannot open file: %s (%s)\n",
cmd.zFile, sqlite3_errmsg(cmd.db)
);
goto end_ar_command;
@ -7529,7 +7542,7 @@ static int recoverDatabaseCmd(ShellState *pState, int nArg, char **azArg){
bRowids = 0;
}
else{
utf8_printf(stderr, "unexpected option: %s\n", azArg[i]);
utf8_printf(stderr, "unexpected option: %s\n", azArg[i]);
showHelp(pState->out, azArg[0]);
return 1;
}
@ -7892,7 +7905,7 @@ static int do_meta_command(char *zLine, ShellState *p){
return 1;
}
if( zDb==0 ) zDb = "main";
rc = sqlite3_open_v2(zDestFile, &pDest,
rc = sqlite3_open_v2(zDestFile, &pDest,
SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE, zVfs);
if( rc!=SQLITE_OK ){
utf8_printf(stderr, "Error: cannot open \"%s\"\n", zDestFile);
@ -8142,7 +8155,7 @@ static int do_meta_command(char *zLine, ShellState *p){
if( nArg>1 && ii==ArraySize(aDbConfig) ){
utf8_printf(stderr, "Error: unknown dbconfig \"%s\"\n", azArg[1]);
utf8_printf(stderr, "Enter \".dbconfig\" with no arguments for a list\n");
}
}
}else
#if SQLITE_SHELL_HAVE_RECOVER
@ -8209,7 +8222,7 @@ static int do_meta_command(char *zLine, ShellState *p){
" substr(o.name, 1, length(name)+1) == (name||'_')"
")", azArg[i], azArg[i]
);
if( zLike ){
zLike = sqlite3_mprintf("%z OR %z", zLike, zExpr);
}else{
@ -8342,7 +8355,7 @@ static int do_meta_command(char *zLine, ShellState *p){
#ifndef SQLITE_OMIT_VIRTUALTABLE
if( c=='e' && cli_strncmp(azArg[0], "expert", n)==0 ){
if( p->bSafeMode ){
raw_printf(stderr,
raw_printf(stderr,
"Cannot run experimental commands such as \"%s\" in safe mode\n",
azArg[0]);
rc = 1;
@ -8361,7 +8374,7 @@ static int do_meta_command(char *zLine, ShellState *p){
} aCtrl[] = {
{ "chunk_size", SQLITE_FCNTL_CHUNK_SIZE, "SIZE" },
{ "data_version", SQLITE_FCNTL_DATA_VERSION, "" },
{ "has_moved", SQLITE_FCNTL_HAS_MOVED, "" },
{ "has_moved", SQLITE_FCNTL_HAS_MOVED, "" },
{ "lock_timeout", SQLITE_FCNTL_LOCK_TIMEOUT, "MILLISEC" },
{ "persist_wal", SQLITE_FCNTL_PERSIST_WAL, "[BOOLEAN]" },
/* { "pragma", SQLITE_FCNTL_PRAGMA, "NAME ARG" },*/
@ -8382,7 +8395,7 @@ static int do_meta_command(char *zLine, ShellState *p){
open_db(p, 0);
zCmd = nArg>=2 ? azArg[1] : "help";
if( zCmd[0]=='-'
if( zCmd[0]=='-'
&& (cli_strcmp(zCmd,"--schema")==0 || cli_strcmp(zCmd,"-schema")==0)
&& nArg>=4
){
@ -9760,7 +9773,8 @@ static int do_meta_command(char *zLine, ShellState *p){
}else if( zName==0 ){
zName = azArg[ii];
}else{
raw_printf(stderr, "Usage: .schema ?--indent? ?--nosys? ?LIKE-PATTERN?\n");
raw_printf(stderr,
"Usage: .schema ?--indent? ?--nosys? ?LIKE-PATTERN?\n");
rc = 1;
goto meta_command_exit;
}
@ -9876,7 +9890,7 @@ static int do_meta_command(char *zLine, ShellState *p){
if( (c=='s' && n==11 && cli_strncmp(azArg[0], "selecttrace", n)==0)
|| (c=='t' && n==9 && cli_strncmp(azArg[0], "treetrace", n)==0)
){
unsigned int x = nArg>=2 ? (unsigned int)integerValue(azArg[1]) : 0xffffffff;
unsigned int x = nArg>=2? (unsigned int)integerValue(azArg[1]) : 0xffffffff;
sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 1, &x);
}else
@ -10061,7 +10075,8 @@ static int do_meta_command(char *zLine, ShellState *p){
}
}
if( pAuxDb->nSession>=ArraySize(pAuxDb->aSession) ){
raw_printf(stderr, "Maximum of %d sessions\n", ArraySize(pAuxDb->aSession));
raw_printf(stderr,
"Maximum of %d sessions\n", ArraySize(pAuxDb->aSession));
goto meta_command_exit;
}
pSession = &pAuxDb->aSession[pAuxDb->nSession];
@ -10622,28 +10637,28 @@ static int do_meta_command(char *zLine, ShellState *p){
int unSafe; /* Not valid for --safe mode */
const char *zUsage; /* Usage notes */
} aCtrl[] = {
{ "always", SQLITE_TESTCTRL_ALWAYS, 1, "BOOLEAN" },
{ "assert", SQLITE_TESTCTRL_ASSERT, 1, "BOOLEAN" },
/*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS,1, "" },*/
/*{ "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, 1, "" },*/
{ "byteorder", SQLITE_TESTCTRL_BYTEORDER, 0, "" },
{ "extra_schema_checks",SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS,0,"BOOLEAN" },
/*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, 1,"" },*/
{ "imposter", SQLITE_TESTCTRL_IMPOSTER,1,"SCHEMA ON/OFF ROOTPAGE"},
{ "internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS,0,"" },
{ "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,0,"BOOLEAN" },
{ "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT,1, "BOOLEAN" },
{ "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS,0,"DISABLE-MASK" },
{"always", SQLITE_TESTCTRL_ALWAYS, 1, "BOOLEAN" },
{"assert", SQLITE_TESTCTRL_ASSERT, 1, "BOOLEAN" },
/*{"benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS,1, "" },*/
/*{"bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, 1, "" },*/
{"byteorder", SQLITE_TESTCTRL_BYTEORDER, 0, "" },
{"extra_schema_checks",SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS,0,"BOOLEAN" },
/*{"fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, 1,"" },*/
{"imposter", SQLITE_TESTCTRL_IMPOSTER,1,"SCHEMA ON/OFF ROOTPAGE"},
{"internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS,0,"" },
{"localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,0,"BOOLEAN" },
{"never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT,1, "BOOLEAN" },
{"optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS,0,"DISABLE-MASK" },
#ifdef YYCOVERAGE
{ "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE,0,"" },
{"parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE,0,"" },
#endif
{ "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE,0, "OFFSET " },
{ "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE,0, "" },
{ "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, 0, "" },
{ "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, 0, "SEED ?db?" },
{ "seek_count", SQLITE_TESTCTRL_SEEK_COUNT, 0, "" },
{ "sorter_mmap", SQLITE_TESTCTRL_SORTER_MMAP, 0, "NMAX" },
{ "tune", SQLITE_TESTCTRL_TUNE, 1, "ID VALUE" },
{"pending_byte", SQLITE_TESTCTRL_PENDING_BYTE,0, "OFFSET " },
{"prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE,0, "" },
{"prng_save", SQLITE_TESTCTRL_PRNG_SAVE, 0, "" },
{"prng_seed", SQLITE_TESTCTRL_PRNG_SEED, 0, "SEED ?db?" },
{"seek_count", SQLITE_TESTCTRL_SEEK_COUNT, 0, "" },
{"sorter_mmap", SQLITE_TESTCTRL_SORTER_MMAP, 0, "NMAX" },
{"tune", SQLITE_TESTCTRL_TUNE, 1, "ID VALUE" },
};
int testctrl = -1;
int iCtrl = -1;
@ -11068,7 +11083,7 @@ static int do_meta_command(char *zLine, ShellState *p){
}else
if( c=='w' && cli_strncmp(azArg[0], "wheretrace", n)==0 ){
unsigned int x = nArg>=2 ? (unsigned int)integerValue(azArg[1]) : 0xffffffff;
unsigned int x = nArg>=2? (unsigned int)integerValue(azArg[1]) : 0xffffffff;
sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 3, &x);
}else
@ -11296,9 +11311,9 @@ static void echo_group_input(ShellState *p, const char *zDo){
#ifdef SQLITE_SHELL_FIDDLE
/*
** Alternate one_input_line() impl for wasm mode. This is not in the primary 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).
** Alternate one_input_line() impl for wasm mode. This is not in the primary
** 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(FILE *in, char *zPrior, int isContinuation){
/* Parse the next line from shellState.wasm.zInput. */
@ -12117,12 +12132,12 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
data.openFlags |= SQLITE_OPEN_NOFOLLOW;
}else if( cli_strcmp(z,"-ascii")==0 ){
data.mode = MODE_Ascii;
sqlite3_snprintf(sizeof(data.colSeparator), data.colSeparator, SEP_Unit);
sqlite3_snprintf(sizeof(data.rowSeparator), data.rowSeparator, SEP_Record);
sqlite3_snprintf(sizeof(data.colSeparator), data.colSeparator,SEP_Unit);
sqlite3_snprintf(sizeof(data.rowSeparator), data.rowSeparator,SEP_Record);
}else if( cli_strcmp(z,"-tabs")==0 ){
data.mode = MODE_List;
sqlite3_snprintf(sizeof(data.colSeparator), data.colSeparator, SEP_Tab);
sqlite3_snprintf(sizeof(data.rowSeparator), data.rowSeparator, SEP_Row);
sqlite3_snprintf(sizeof(data.colSeparator), data.colSeparator,SEP_Tab);
sqlite3_snprintf(sizeof(data.rowSeparator), data.rowSeparator,SEP_Row);
}else if( cli_strcmp(z,"-separator")==0 ){
sqlite3_snprintf(sizeof(data.colSeparator), data.colSeparator,
"%s",cmdline_option_value(argc,argv,++i));

View File

@ -1257,4 +1257,16 @@ select 2,1; select 3,4;
2,1
3,4}}
#----------------------------------------------------------------------------
# Test cases shell1-10.*: Test that certain static extensions are there.
#
do_test shell1-10.1 {
catchcmd :memory: {
.mode list
.header off
select base64(base64(cast('digity-doo' as blob))),
base85(base85(cast('digity-doo' as blob)));
}
} {0 digity-doo|digity-doo}
finish_test

View File

@ -55,7 +55,7 @@ while {1} {
fconfigure $in2 -translation binary
while {![eof $in2]} {
set lx [omit_redundant_typedefs [gets $in2]]
if {[regexp {^#include "sqlite} $lx]} {
if {[regexp {^# *include "sqlite} $lx]} {
set lx "/* $lx */"
}
if {[regexp {^# *include "test_windirent.h"} $lx]} {