Renamed SQLITE_SHELL_WASM_MODE to SQLITE_SHELL_WASM_WEB_MODE and no longer automatically enable it if __EMSCRIPTEN__ is defined, in order to facilitate using Emscripten to build the shell for CLI-based WASM runtimes (which cannot make use of the web-specific user input changes). The fiddle build now explicitly passes the new flag on at compile-time.
FossilOrigin-Name: ee059ad5a811a1511e37158f041a7bf9070529d530410d2f1c4395cdd25c6d33
This commit is contained in:
parent
b2d7137154
commit
ea1e3b4251
@ -1540,6 +1540,7 @@ $(fiddle_module_js): Makefile sqlite3.c shell.c \
|
||||
emcc -o $@ $(emcc_flags) \
|
||||
-sEXPORT_NAME=initFiddleModule \
|
||||
-sEXPORTED_FUNCTIONS=@$(fiddle_dir_abs)/EXPORTED_FUNCTIONS.fiddle \
|
||||
-DSQLITE_SHELL_WASM_WEB_MODE \
|
||||
sqlite3.c shell.c
|
||||
gzip < $@ > $@.gz
|
||||
gzip < $(fiddle_dir)/fiddle-module.wasm > $(fiddle_dir)/fiddle-module.wasm.gz
|
||||
|
17
manifest
17
manifest
@ -1,9 +1,9 @@
|
||||
C Back\sout\sthe\spager\sperformance\senhancement\sat\s[a1c090e08139f99d3],\sbecause\sit\nturns\sout\swe\sshould\snever\sallow\sa\szero\skey\sinto\sthe\spcache\sinterface\saccording\nto\sthe\sdesign\sspecs,\seven\sif\sthat\spage\sis\simmediately\sreleased\swithout\sever\nbeing\sused.
|
||||
D 2022-07-12T07:13:38.289
|
||||
C Renamed\sSQLITE_SHELL_WASM_MODE\sto\sSQLITE_SHELL_WASM_WEB_MODE\sand\sno\slonger\sautomatically\senable\sit\sif\s__EMSCRIPTEN__\sis\sdefined,\sin\sorder\sto\sfacilitate\susing\sEmscripten\sto\sbuild\sthe\sshell\sfor\sCLI-based\sWASM\sruntimes\s(which\scannot\smake\suse\sof\sthe\sweb-specific\suser\sinput\schanges).\sThe\sfiddle\sbuild\snow\sexplicitly\spasses\sthe\snew\sflag\son\sat\scompile-time.
|
||||
D 2022-07-12T09:40:27.255
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
F Makefile.in 731cf154c61e7cd63a2707600fecde816cedc113bd9901723522aefc74ddb292
|
||||
F Makefile.in ab82a7cf01fd4d2b1164c8cb20513b59f4223a1a6e713938b1fb5b842418020d
|
||||
F Makefile.linux-gcc f609543700659711fbd230eced1f01353117621dccae7b9fb70daa64236c5241
|
||||
F Makefile.msc de7cb3e095ce2fdc33513ccd76ebdaeda1483d0ddab0410fe65cbdeadd4c0ee1
|
||||
F README.md 8b8df9ca852aeac4864eb1e400002633ee6db84065bd01b78c33817f97d31f5e
|
||||
@ -571,7 +571,7 @@ F src/random.c 097dc8b31b8fba5a9aca1697aeb9fd82078ec91be734c16bffda620ced7ab83c
|
||||
F src/resolve.c 84a8443e3723e908730d754f54df4e1dacc1eb7073c0bd79c9d5efe977a9f5b9
|
||||
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
|
||||
F src/select.c 061b628dd1d3025a4ef3278e7128ce148d5f6bf58b8c1173c3c9e118d16198c6
|
||||
F src/shell.c.in 2b85128ca8ea13fc2dc32f971d628d9f688a324a30f469619b817ce490764fcb
|
||||
F src/shell.c.in b928ddd7c3b5c63a9b625695e8af6a8831efd267d5187b9418f9eca05157bda3
|
||||
F src/sqlite.h.in 01573eae96721f2a8ee2a9e3b7140ceeba2e9c44350911890b89b8ff0dcf6781
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h a988810c9b21c0dc36dc7a62735012339dc76fc7ab448fb0792721d30eacb69d
|
||||
@ -1979,9 +1979,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 51255bad4c1fb6074f602586fabad675ae310b9c37f4b80ecf60e2959fb0db12
|
||||
Q -a1c090e08139f99d30aa89db0756dc59fe8990ce15b3db4d4b726cc6acdab46f
|
||||
R a92351bd0b7826d19b4b1cf7b0fdbaec
|
||||
U drh
|
||||
Z 1a1f72772307e1446eb3c352af79bbe8
|
||||
P ec96293ead83603ebe5d7f250d6fdc11f22172f05a9513f175331437c3eaa4c8
|
||||
R 8020e393ac6ab4de8f603cb939b22712
|
||||
U stephan
|
||||
Z d97d3fda1a826afffbfc7a98df7e436e
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
ec96293ead83603ebe5d7f250d6fdc11f22172f05a9513f175331437c3eaa4c8
|
||||
ee059ad5a811a1511e37158f041a7bf9070529d530410d2f1c4395cdd25c6d33
|
149
src/shell.c.in
149
src/shell.c.in
@ -37,6 +37,16 @@
|
||||
# define SQLITE_OS_WINRT 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Use -DSQLITE_SHELL_WASM_WEB_MODE to build for Emscripten targeting
|
||||
** web browser use. We do not automatically do that using
|
||||
** ifdef(__EMSCRIPTEN__) because it should be possible to build the
|
||||
** shell with Emscripten for use in shell-based WASM/WASI runtime
|
||||
** environments. The browser-mode build has much different user input
|
||||
** requirements and the "wasm web" build rewires the user input
|
||||
** subsystem to account for that.
|
||||
*/
|
||||
|
||||
/*
|
||||
** Warning pragmas copied from msvc.h in the core.
|
||||
*/
|
||||
@ -229,17 +239,6 @@ static void setTextMode(FILE *file, int isOutput){
|
||||
# define setTextMode(X,Y)
|
||||
#endif
|
||||
|
||||
/*
|
||||
** When compiling with emcc (a.k.a. emscripten), we're building a
|
||||
** WebAssembly (WASM) bundle and need to disable and rewire a few
|
||||
** things.
|
||||
*/
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#define SQLITE_SHELL_WASM_MODE
|
||||
#else
|
||||
#undef SQLITE_SHELL_WASM_MODE
|
||||
#endif
|
||||
|
||||
/* True if the timer is enabled */
|
||||
static int enableTimer = 0;
|
||||
|
||||
@ -701,7 +700,7 @@ static char *local_getline(char *zLine, FILE *in){
|
||||
** be freed by the caller or else passed back into this routine via the
|
||||
** zPrior argument for reuse.
|
||||
*/
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
static char *one_input_line(FILE *in, char *zPrior, int isContinuation){
|
||||
char *zPrompt;
|
||||
char *zResult;
|
||||
@ -721,7 +720,7 @@ static char *one_input_line(FILE *in, char *zPrior, int isContinuation){
|
||||
}
|
||||
return zResult;
|
||||
}
|
||||
#endif /* !SQLITE_SHELL_WASM_MODE */
|
||||
#endif /* !SQLITE_SHELL_WASM_WEB_MODE */
|
||||
|
||||
/*
|
||||
** Return the value of a hexadecimal digit. Return -1 if the input
|
||||
@ -1027,7 +1026,7 @@ INCLUDE ../ext/misc/decimal.c
|
||||
INCLUDE ../ext/misc/ieee754.c
|
||||
INCLUDE ../ext/misc/series.c
|
||||
INCLUDE ../ext/misc/regexp.c
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
INCLUDE ../ext/misc/fileio.c
|
||||
INCLUDE ../ext/misc/completion.c
|
||||
INCLUDE ../ext/misc/appendvfs.c
|
||||
@ -1162,7 +1161,7 @@ struct ShellState {
|
||||
char *zNonce; /* Nonce for temporary safe-mode excapes */
|
||||
EQPGraph sGraph; /* Information for the graphical EXPLAIN QUERY PLAN */
|
||||
ExpertInfo expert; /* Valid if previous command was ".expert OPT..." */
|
||||
#ifdef SQLITE_SHELL_WASM_MODE
|
||||
#ifdef SQLITE_SHELL_WASM_WEB_MODE
|
||||
struct {
|
||||
const char * zInput; /* Input string from wasm/JS proxy */
|
||||
const char * zPos; /* Cursor pos into zInput */
|
||||
@ -1170,7 +1169,7 @@ struct ShellState {
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef SQLITE_SHELL_WASM_MODE
|
||||
#ifdef SQLITE_SHELL_WASM_WEB_MODE
|
||||
static ShellState shellState;
|
||||
#endif
|
||||
|
||||
@ -1838,7 +1837,7 @@ static int safeModeAuth(
|
||||
UNUSED_PARAMETER(zA4);
|
||||
switch( op ){
|
||||
case SQLITE_ATTACH: {
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
/* In WASM builds the filesystem is a virtual sandbox, so
|
||||
** there's no harm in using ATTACH. */
|
||||
failIfSafeMode(p, "cannot run ATTACH in safe mode");
|
||||
@ -4252,7 +4251,7 @@ static int run_schema_dump_query(
|
||||
*/
|
||||
static const char *(azHelp[]) = {
|
||||
#if defined(SQLITE_HAVE_ZLIB) && !defined(SQLITE_OMIT_VIRTUALTABLE) \
|
||||
&& !defined(SQLITE_SHELL_WASM_MODE)
|
||||
&& !defined(SQLITE_SHELL_WASM_WEB_MODE)
|
||||
".archive ... Manage SQL archives",
|
||||
" Each command must have exactly one of the following options:",
|
||||
" -c, --create Create a new archive",
|
||||
@ -4278,7 +4277,7 @@ static const char *(azHelp[]) = {
|
||||
#ifndef SQLITE_OMIT_AUTHORIZATION
|
||||
".auth ON|OFF Show authorizer callbacks",
|
||||
#endif
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
".backup ?DB? FILE Backup DB (default \"main\") to FILE",
|
||||
" Options:",
|
||||
" --append Use the appendvfs",
|
||||
@ -4286,11 +4285,11 @@ static const char *(azHelp[]) = {
|
||||
#endif
|
||||
".bail on|off Stop after hitting an error. Default OFF",
|
||||
".binary on|off Turn binary output on or off. Default OFF",
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
".cd DIRECTORY Change the working directory to DIRECTORY",
|
||||
#endif
|
||||
".changes on|off Show number of rows changed by SQL",
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
".check GLOB Fail if output since .testcase does not match",
|
||||
".clone NEWDB Clone data into NEWDB from the existing database",
|
||||
#endif
|
||||
@ -4316,11 +4315,11 @@ static const char *(azHelp[]) = {
|
||||
" trace Like \"full\" but enable \"PRAGMA vdbe_trace\"",
|
||||
#endif
|
||||
" trigger Like \"full\" but also show trigger bytecode",
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
".excel Display the output of next command in spreadsheet",
|
||||
" --bom Put a UTF8 byte-order mark on intermediate file",
|
||||
#endif
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
".exit ?CODE? Exit this program with return-code CODE",
|
||||
#endif
|
||||
".expert EXPERIMENTAL. Suggest indexes for queries",
|
||||
@ -4331,7 +4330,7 @@ static const char *(azHelp[]) = {
|
||||
".fullschema ?--indent? Show schema and the content of sqlite_stat tables",
|
||||
".headers on|off Turn display of headers on or off",
|
||||
".help ?-all? ?PATTERN? Show help text for PATTERN",
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
".import FILE TABLE Import data from FILE into TABLE",
|
||||
" Options:",
|
||||
" --ascii Use \\037 and \\036 as column and row separators",
|
||||
@ -4360,10 +4359,10 @@ static const char *(azHelp[]) = {
|
||||
".lint OPTIONS Report potential schema issues.",
|
||||
" Options:",
|
||||
" fkey-indexes Find missing foreign key indexes",
|
||||
#if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_WASM_MODE)
|
||||
#if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_WASM_WEB_MODE)
|
||||
".load FILE ?ENTRY? Load an extension library",
|
||||
#endif
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
".log FILE|off Turn logging on or off. FILE can be stderr/stdout",
|
||||
#endif
|
||||
".mode MODE ?OPTIONS? Set output mode",
|
||||
@ -4390,11 +4389,11 @@ static const char *(azHelp[]) = {
|
||||
" --quote Quote output text as SQL literals",
|
||||
" --noquote Do not quote output text",
|
||||
" TABLE The name of SQL table used for \"insert\" mode",
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
".nonce STRING Suspend safe mode for one command if nonce matches",
|
||||
#endif
|
||||
".nullvalue STRING Use STRING in place of NULL values",
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
".once ?OPTIONS? ?FILE? Output for the next SQL command only to FILE",
|
||||
" If FILE begins with '|' then open as a pipe",
|
||||
" --bom Put a UTF8 byte-order mark at the beginning",
|
||||
@ -4416,7 +4415,7 @@ static const char *(azHelp[]) = {
|
||||
" --nofollow Do not follow symbolic links",
|
||||
" --readonly Open FILE readonly",
|
||||
" --zip FILE is a ZIP archive",
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
".output ?FILE? Send output to FILE or stdout if FILE is omitted",
|
||||
" If FILE begins with '|' then open it as a pipe.",
|
||||
" Options:",
|
||||
@ -4440,7 +4439,7 @@ static const char *(azHelp[]) = {
|
||||
" --reset Reset the count for each input and interrupt",
|
||||
#endif
|
||||
".prompt MAIN CONTINUE Replace the standard prompts",
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
".quit Exit this program",
|
||||
".read FILE Read input from FILE or command output",
|
||||
" If FILE begins with \"|\", it is a command that generates the input.",
|
||||
@ -4453,7 +4452,7 @@ static const char *(azHelp[]) = {
|
||||
" --no-rowids Do not attempt to recover rowid values",
|
||||
" that are not also INTEGER PRIMARY KEYs",
|
||||
#endif
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
".restore ?DB? FILE Restore content of DB (default \"main\") from FILE",
|
||||
".save ?OPTIONS? FILE Write database to FILE (an alias for .backup ...)",
|
||||
#endif
|
||||
@ -4490,7 +4489,7 @@ static const char *(azHelp[]) = {
|
||||
" --sha3-384 Use the sha3-384 algorithm",
|
||||
" --sha3-512 Use the sha3-512 algorithm",
|
||||
" Any other argument is a LIKE pattern for tables to hash",
|
||||
#if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_WASM_MODE)
|
||||
#if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_WASM_WEB_MODE)
|
||||
".shell CMD ARGS... Run CMD ARGS... in a system shell",
|
||||
#endif
|
||||
".show Show the current values for various settings",
|
||||
@ -4499,11 +4498,11 @@ static const char *(azHelp[]) = {
|
||||
" on Turn on automatic stat display",
|
||||
" stmt Show statement stats",
|
||||
" vmstep Show the virtual machine step count only",
|
||||
#if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_WASM_MODE)
|
||||
#if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_WASM_WEB_MODE)
|
||||
".system CMD ARGS... Run CMD ARGS... in a system shell",
|
||||
#endif
|
||||
".tables ?TABLE? List names of tables matching LIKE pattern TABLE",
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
".testcase NAME Begin redirecting output to 'testcase-out.txt'",
|
||||
#endif
|
||||
".testctrl CMD ... Run various sqlite3_test_control() operations",
|
||||
@ -5056,7 +5055,7 @@ static void open_db(ShellState *p, int openFlags){
|
||||
sqlite3_regexp_init(p->db, 0, 0);
|
||||
sqlite3_ieee_init(p->db, 0, 0);
|
||||
sqlite3_series_init(p->db, 0, 0);
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
sqlite3_fileio_init(p->db, 0, 0);
|
||||
sqlite3_completion_init(p->db, 0, 0);
|
||||
#endif
|
||||
@ -8186,7 +8185,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
#endif
|
||||
|
||||
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) \
|
||||
&& !defined(SQLITE_SHELL_WASM_MODE)
|
||||
&& !defined(SQLITE_SHELL_WASM_WEB_MODE)
|
||||
if( c=='a' && strncmp(azArg[0], "archive", n)==0 ){
|
||||
open_db(p, 0);
|
||||
failIfSafeMode(p, "cannot run .archive in safe mode");
|
||||
@ -8194,7 +8193,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
}else
|
||||
#endif
|
||||
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
if( (c=='b' && n>=3 && strncmp(azArg[0], "backup", n)==0)
|
||||
|| (c=='s' && n>=3 && strncmp(azArg[0], "save", n)==0)
|
||||
){
|
||||
@ -8263,7 +8262,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
}
|
||||
close_db(pDest);
|
||||
}else
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_WEB_MODE) */
|
||||
|
||||
if( c=='b' && n>=3 && strncmp(azArg[0], "bail", n)==0 ){
|
||||
if( nArg==2 ){
|
||||
@ -8294,7 +8293,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
test_breakpoint();
|
||||
}else
|
||||
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
if( c=='c' && strcmp(azArg[0],"cd")==0 ){
|
||||
failIfSafeMode(p, "cannot run .cd in safe mode");
|
||||
if( nArg==2 ){
|
||||
@ -8314,7 +8313,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
rc = 1;
|
||||
}
|
||||
}else
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_WEB_MODE) */
|
||||
|
||||
if( c=='c' && n>=3 && strncmp(azArg[0], "changes", n)==0 ){
|
||||
if( nArg==2 ){
|
||||
@ -8325,7 +8324,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
}
|
||||
}else
|
||||
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
/* Cancel output redirection, if it is currently set (by .testcase)
|
||||
** Then read the content of the testcase-out.txt file and compare against
|
||||
** azArg[1]. If there are differences, report an error and exit.
|
||||
@ -8350,9 +8349,9 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
}
|
||||
sqlite3_free(zRes);
|
||||
}else
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_WEB_MODE) */
|
||||
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
if( c=='c' && strncmp(azArg[0], "clone", n)==0 ){
|
||||
failIfSafeMode(p, "cannot run .clone in safe mode");
|
||||
if( nArg==2 ){
|
||||
@ -8362,7 +8361,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
rc = 1;
|
||||
}
|
||||
}else
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_WEB_MODE) */
|
||||
|
||||
if( c=='c' && strncmp(azArg[0], "connection", n)==0 ){
|
||||
if( nArg==1 ){
|
||||
@ -8651,7 +8650,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
}
|
||||
}else
|
||||
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){
|
||||
if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc);
|
||||
rc = 2;
|
||||
@ -8911,7 +8910,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
}
|
||||
}else
|
||||
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
if( c=='i' && strncmp(azArg[0], "import", n)==0 ){
|
||||
char *zTable = 0; /* Insert data into this table */
|
||||
char *zSchema = 0; /* within this schema (may default to "main") */
|
||||
@ -9202,7 +9201,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
sCtx.nRow, sCtx.nErr, sCtx.nLine-1);
|
||||
}
|
||||
}else
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_WEB_MODE) */
|
||||
|
||||
#ifndef SQLITE_UNTESTABLE
|
||||
if( c=='i' && strncmp(azArg[0], "imposter", n)==0 ){
|
||||
@ -9392,7 +9391,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
lintDotCommand(p, azArg, nArg);
|
||||
}else
|
||||
|
||||
#if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_WASM_MODE)
|
||||
#if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_WASM_WEB_MODE)
|
||||
if( c=='l' && strncmp(azArg[0], "load", n)==0 ){
|
||||
const char *zFile, *zProc;
|
||||
char *zErrMsg = 0;
|
||||
@ -9414,7 +9413,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
}else
|
||||
#endif
|
||||
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
if( c=='l' && strncmp(azArg[0], "log", n)==0 ){
|
||||
failIfSafeMode(p, "cannot run .log in safe mode");
|
||||
if( nArg!=2 ){
|
||||
@ -9551,7 +9550,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
p->cMode = p->mode;
|
||||
}else
|
||||
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
if( c=='n' && strcmp(azArg[0], "nonce")==0 ){
|
||||
if( nArg!=2 ){
|
||||
raw_printf(stderr, "Usage: .nonce NONCE\n");
|
||||
@ -9566,7 +9565,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
** at the end of this procedure */
|
||||
}
|
||||
}else
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_WEB_MODE) */
|
||||
|
||||
if( c=='n' && strncmp(azArg[0], "nullvalue", n)==0 ){
|
||||
if( nArg==2 ){
|
||||
@ -9588,7 +9587,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
/* Check for command-line arguments */
|
||||
for(iName=1; iName<nArg; iName++){
|
||||
const char *z = azArg[iName];
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
if( optionMatch(z,"new") ){
|
||||
newFlag = 1;
|
||||
#ifdef SQLITE_HAVE_ZLIB
|
||||
@ -9610,7 +9609,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
p->szMax = integerValue(azArg[++iName]);
|
||||
#endif /* SQLITE_OMIT_DESERIALIZE */
|
||||
}else
|
||||
#endif /* !SQLITE_SHELL_WASM_MODE */
|
||||
#endif /* !SQLITE_SHELL_WASM_WEB_MODE */
|
||||
if( z[0]=='-' ){
|
||||
utf8_printf(stderr, "unknown option: %s\n", z);
|
||||
rc = 1;
|
||||
@ -9638,7 +9637,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
/* If a filename is specified, try to open it first */
|
||||
if( zFN || p->openMode==SHELL_OPEN_HEXDB ){
|
||||
if( newFlag && zFN && !p->bSafeMode ) shellDeleteFile(zFN);
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
if( p->bSafeMode
|
||||
&& p->openMode!=SHELL_OPEN_HEXDB
|
||||
&& zFN
|
||||
@ -9671,7 +9670,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
}
|
||||
}else
|
||||
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
if( (c=='o'
|
||||
&& (strncmp(azArg[0], "output", n)==0||strncmp(azArg[0], "once", n)==0))
|
||||
|| (c=='e' && n==5 && strcmp(azArg[0],"excel")==0)
|
||||
@ -9787,7 +9786,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
}
|
||||
sqlite3_free(zFile);
|
||||
}else
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_WEB_MODE) */
|
||||
|
||||
if( c=='p' && n>=3 && strncmp(azArg[0], "parameter", n)==0 ){
|
||||
open_db(p,0);
|
||||
@ -9957,13 +9956,13 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
}
|
||||
}else
|
||||
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
if( c=='q' && strncmp(azArg[0], "quit", n)==0 ){
|
||||
rc = 2;
|
||||
}else
|
||||
#endif
|
||||
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
if( c=='r' && n>=3 && strncmp(azArg[0], "read", n)==0 ){
|
||||
FILE *inSaved = p->in;
|
||||
int savedLineno = p->lineno;
|
||||
@ -9998,9 +9997,9 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
p->in = inSaved;
|
||||
p->lineno = savedLineno;
|
||||
}else
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_WEB_MODE) */
|
||||
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
if( c=='r' && n>=3 && strncmp(azArg[0], "restore", n)==0 ){
|
||||
const char *zSrcFile;
|
||||
const char *zDb;
|
||||
@ -10052,7 +10051,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
}
|
||||
close_db(pSrc);
|
||||
}else
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_WEB_MODE) */
|
||||
|
||||
if( c=='s' && strncmp(azArg[0], "scanstats", n)==0 ){
|
||||
if( nArg==2 ){
|
||||
@ -10678,7 +10677,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
sqlite3_free(zSql);
|
||||
}else
|
||||
|
||||
#if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_WASM_MODE)
|
||||
#if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_WASM_WEB_MODE)
|
||||
if( c=='s'
|
||||
&& (strncmp(azArg[0], "shell", n)==0 || strncmp(azArg[0],"system",n)==0)
|
||||
){
|
||||
@ -10699,7 +10698,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
sqlite3_free(zCmd);
|
||||
if( x ) raw_printf(stderr, "System command returns %d\n", x);
|
||||
}else
|
||||
#endif /* !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_WASM_MODE) */
|
||||
#endif /* !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_WASM_WEB_MODE) */
|
||||
|
||||
if( c=='s' && strncmp(azArg[0], "show", n)==0 ){
|
||||
static const char *azBool[] = { "off", "on", "trigger", "full"};
|
||||
@ -10879,7 +10878,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
sqlite3_free(azResult);
|
||||
}else
|
||||
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
/* Begin redirecting output to the file "testcase-out.txt" */
|
||||
if( c=='t' && strcmp(azArg[0],"testcase")==0 ){
|
||||
output_reset(p);
|
||||
@ -10893,7 +10892,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "?");
|
||||
}
|
||||
}else
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
|
||||
#endif /* !defined(SQLITE_SHELL_WASM_WEB_MODE) */
|
||||
|
||||
#ifndef SQLITE_UNTESTABLE
|
||||
if( c=='t' && n>=8 && strncmp(azArg[0], "testctrl", n)==0 ){
|
||||
@ -11565,7 +11564,7 @@ static void echo_group_input(ShellState *p, const char *zDo){
|
||||
if( ShellHasFlag(p, SHFLG_Echo) ) utf8_printf(p->out, "%s\n", zDo);
|
||||
}
|
||||
|
||||
#ifdef SQLITE_SHELL_WASM_MODE
|
||||
#ifdef SQLITE_SHELL_WASM_WEB_MODE
|
||||
/*
|
||||
** 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
|
||||
@ -11596,7 +11595,7 @@ static char *one_input_line(FILE *in, char *zPrior, int isContinuation){
|
||||
zLine[nZ] = 0;
|
||||
return zLine;
|
||||
}
|
||||
#endif /* SQLITE_SHELL_WASM_MODE */
|
||||
#endif /* SQLITE_SHELL_WASM_WEB_MODE */
|
||||
|
||||
/*
|
||||
** Read input from *in and process it. If *in==0 then input
|
||||
@ -11979,7 +11978,7 @@ static char *cmdline_option_value(int argc, char **argv, int i){
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef SQLITE_SHELL_WASM_MODE
|
||||
#ifdef SQLITE_SHELL_WASM_WEB_MODE
|
||||
# define main fiddle_main
|
||||
#endif
|
||||
|
||||
@ -11993,7 +11992,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
|
||||
sqlite3_int64 mem_main_enter = sqlite3_memory_used();
|
||||
#endif
|
||||
char *zErrMsg = 0;
|
||||
#ifdef SQLITE_SHELL_WASM_MODE
|
||||
#ifdef SQLITE_SHELL_WASM_WEB_MODE
|
||||
# define data shellState
|
||||
#else
|
||||
ShellState data;
|
||||
@ -12013,7 +12012,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
|
||||
|
||||
setBinaryMode(stdin, 0);
|
||||
setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
|
||||
#ifdef SQLITE_SHELL_WASM_MODE
|
||||
#ifdef SQLITE_SHELL_WASM_WEB_MODE
|
||||
stdin_is_interactive = 0;
|
||||
stdout_is_console = 1;
|
||||
#else
|
||||
@ -12275,7 +12274,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
|
||||
#endif
|
||||
}
|
||||
data.out = stdout;
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
sqlite3_appendvfs_init(0,0,0);
|
||||
#endif
|
||||
|
||||
@ -12543,7 +12542,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
|
||||
rc = process_input(&data);
|
||||
}
|
||||
}
|
||||
#ifndef SQLITE_SHELL_WASM_MODE
|
||||
#ifndef SQLITE_SHELL_WASM_WEB_MODE
|
||||
/* In WASM mode we have to leave the db state in place so that
|
||||
** client code can "push" SQL into it after this call returns. */
|
||||
free(azCmd);
|
||||
@ -12578,12 +12577,12 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
|
||||
(unsigned int)(sqlite3_memory_used()-mem_main_enter));
|
||||
}
|
||||
#endif
|
||||
#endif /* !SQLITE_SHELL_WASM_MODE */
|
||||
#endif /* !SQLITE_SHELL_WASM_WEB_MODE */
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
#ifdef SQLITE_SHELL_WASM_MODE
|
||||
#ifdef SQLITE_SHELL_WASM_WEB_MODE
|
||||
/* Only for emcc experimentation purposes. */
|
||||
int fiddle_experiment(int a,int b){
|
||||
return a + b;
|
||||
@ -12704,4 +12703,4 @@ void fiddle_exec(const char * zSql){
|
||||
memset(&shellState.wasm, 0, sizeof(shellState.wasm));
|
||||
}
|
||||
}
|
||||
#endif /* SQLITE_SHELL_WASM_MODE */
|
||||
#endif /* SQLITE_SHELL_WASM_WEB_MODE */
|
||||
|
Loading…
x
Reference in New Issue
Block a user