Index: src/sqlcmd.c ================================================================== --- src/sqlcmd.c +++ src/sqlcmd.c @@ -152,17 +152,21 @@ } /* ** COMMAND: sqlite3 ** -** Usage: %fossil sqlite3 ?DATABASE? ?OPTIONS? +** Usage: %fossil sqlite3 ?FOSSIL_OPTS? ?DATABASE? ?SHELL_OPTS? ** -** Run the standalone sqlite3 command-line shell on DATABASE with OPTIONS. +** Run the standalone sqlite3 command-line shell on DATABASE with SHELL_OPTS. ** If DATABASE is omitted, then the repository that serves the working ** directory is opened. See https://www.sqlite.org/cli.html for additional ** information. ** +** Fossil Options: +** +** --no-repository Skip opening the repository database. +** ** WARNING: Careless use of this command can corrupt a Fossil repository ** in ways that are unrecoverable. Be sure you know what you are doing before ** running any SQL commands that modifies the repository database. ** ** The following extensions to the usual SQLite commands are provided: @@ -194,12 +198,14 @@ ** CREATE VIRTUAL TABLE temp.foci USING files_of_checkin; ** SELECT * FROM foci WHERE checkinID=symbolic_name_to_rid('trunk'); */ void cmd_sqlite3(void){ extern int sqlite3_shell(int, char**); - db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); - db_close(1); + if( !find_option("no-repository", 0, 0)!=0 ){ + db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); + db_close(1); + } sqlite3_shutdown(); sqlite3_shell(g.argc-1, g.argv+1); sqlite3_cancel_auto_extension((void(*)(void))sqlcmd_autoinit); g.db = 0; g.zMainDbType = 0; Index: test/merge5.test ================================================================== --- test/merge5.test +++ test/merge5.test @@ -48,11 +48,11 @@ # We need not to clutter the $HOME of the test caller. set env(HOME) [pwd] # Construct a test repository # -exec sqlite3 m5.fossil <$testdir/${testfile}_repo.sql +exec fossil sqlite3 --no-repository m5.fossil <$testdir/${testfile}_repo.sql fossil rebuild m5.fossil fossil open m5.fossil fossil user default drh --user drh fossil update baseline checkout-test 10 {