-C Add\ssupport\sfor\sthe\s"--list"\scommand.\sAnd\sfor\sarguments\sto\sthe\s"--extract"\ncommand.
-D 2017-12-13T20:04:53.034
+C Add\sthe\sshell\stool\s".ar\s--update"\scommand.
+D 2017-12-13T20:17:18.759
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in 6a879cbf01e37f9eac131414955f71774b566502d9a57ded1b8585b507503cb8
F src/resolve.c bbee7e31d369a18a2f4836644769882e9c5d40ef4a3af911db06410b65cb3730
F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
F src/select.c 17e220191860a64a18c084141e1a8b7309e166a6f2d42c02021af27ea080d157
-F src/shell.c.in b53eddcb293a9d35c0673c1d3bf2cf120b55e6660b436f65d689776a56391562
+F src/shell.c.in 12313c0500b9b1958507d3a432c192f73f86da112f0f37467636530696d13152
F src/sqlite.h.in 8fd97993d48b50b9bade38c52f12d175942c9497c960905610c7b03a3e4b5818
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h c02d628cca67f3889c689d82d25c3eb45e2c155db08e4c6089b5840d64687d34
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 1a9867973c9d6675fa5254fdd74f36004707a98a91593a188033cf5a49cc7a0b
-R c505f9c0d154ac54b6761fcc5d07e027
+P 32c4fa2552bb0fa7d7d143108457efae7a756d6cb14b1d59312e56efac3b2656
+R 656e4fd0036ab859f27379daf7289767
U dan
-Z dcb23b384070f4f2014f2150f41e157a
+Z 57a0e73a5198163aa720919c6750aab2
return SQLITE_OK;
}
-/*
-** Implementation of .ar "Update" command.
-*/
-static int arUpdateCmd(ShellState *p, sqlite3 *db, ArCommand *pAr){
- raw_printf(stderr, "todo...\n");
- return SQLITE_OK;
-}
-
/*
** This function assumes that all arguments within the ArCommand.azArg[]
** array refer to archive members, as for the --extract or --list commands.
/*
-** Implementation of .ar "Create" command.
+** Implementation of .ar "create" and "update" commands.
**
** Create the "sqlar" table in the database if it does not already exist.
** Then add each file in the azFile[] array to the archive. Directories
** are added recursively. If argument bVerbose is non-zero, a message is
** printed on stdout for each file archived.
+**
+** The create command is the same as update, except that it drops
+** any existing "sqlar" table before beginning.
*/
-static int arCreateCommand(
+static int arCreateUpdate(
ShellState *p, /* Shell state pointer */
sqlite3 *db,
- ArCommand *pAr /* Command arguments and options */
+ ArCommand *pAr, /* Command arguments and options */
+ int bUpdate
){
const char *zSql = "SELECT name, mode, mtime, data FROM fsdir(?, ?)";
const char *zCreate =
rc = sqlite3_exec(db, "SAVEPOINT ar;", 0, 0, 0);
if( rc!=SQLITE_OK ) return rc;
- rc = sqlite3_exec(db, zDrop, 0, 0, 0);
- if( rc!=SQLITE_OK ) return rc;
+ if( bUpdate==0 ){
+ rc = sqlite3_exec(db, zDrop, 0, 0, 0);
+ if( rc!=SQLITE_OK ) return rc;
+ }
rc = sqlite3_exec(db, zCreate, 0, 0, 0);
shellPrepare(db, &rc, zInsert, &pInsert);
return rc;
}
+/*
+** Implementation of .ar "Create" command.
+**
+** Create the "sqlar" table in the database if it does not already exist.
+** Then add each file in the azFile[] array to the archive. Directories
+** are added recursively. If argument bVerbose is non-zero, a message is
+** printed on stdout for each file archived.
+*/
+static int arCreateCommand(
+ ShellState *p, /* Shell state pointer */
+ sqlite3 *db,
+ ArCommand *pAr /* Command arguments and options */
+){
+ return arCreateUpdate(p, db, pAr, 0);
+}
+
+/*
+** Implementation of .ar "Update" command.
+*/
+static int arUpdateCmd(ShellState *p, sqlite3 *db, ArCommand *pAr){
+ return arCreateUpdate(p, db, pAr, 1);
+}
+
+
/*
** Implementation of ".ar" dot command.
*/