/ Check-in [6df7343b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Change the command-line shell to do the ".dump" inside of a SAVEPOINT rather than a transaction, since this allows it to be run from within a transaction.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:6df7343b4c3de9ad8221180dc959dbbdf54733c7
User & Date: drh 2011-10-13 16:30:13
Context
2011-10-13
16:36
Provide a complete prototype for isatty() in the command-line shell sources. check-in: 8bf13b03 user: drh tags: trunk
16:30
Change the command-line shell to do the ".dump" inside of a SAVEPOINT rather than a transaction, since this allows it to be run from within a transaction. check-in: 6df7343b user: drh tags: trunk
16:02
Enable large-file support for fopen() and friends in the command-line shell. Ticket [92af7da36b6fbd] check-in: eeeba4f0 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/shell.c.

  1587   1587       open_db(p);
  1588   1588       /* When playing back a "dump", the content might appear in an order
  1589   1589       ** which causes immediate foreign key constraints to be violated.
  1590   1590       ** So disable foreign-key constraint enforcement to prevent problems. */
  1591   1591       fprintf(p->out, "PRAGMA foreign_keys=OFF;\n");
  1592   1592       fprintf(p->out, "BEGIN TRANSACTION;\n");
  1593   1593       p->writableSchema = 0;
  1594         -    sqlite3_exec(p->db, "BEGIN; PRAGMA writable_schema=ON", 0, 0, 0);
         1594  +    sqlite3_exec(p->db, "SAVEPOINT dump; PRAGMA writable_schema=ON", 0, 0, 0);
  1595   1595       p->nErr = 0;
  1596   1596       if( nArg==1 ){
  1597   1597         run_schema_dump_query(p, 
  1598   1598           "SELECT name, type, sql FROM sqlite_master "
  1599   1599           "WHERE sql NOT NULL AND type=='table' AND name!='sqlite_sequence'"
  1600   1600         );
  1601   1601         run_schema_dump_query(p, 
................................................................................
  1620   1620             "  AND type IN ('index','trigger','view')"
  1621   1621             "  AND tbl_name LIKE shellstatic()", 0
  1622   1622           );
  1623   1623           zShellStatic = 0;
  1624   1624         }
  1625   1625       }
  1626   1626       if( p->writableSchema ){
  1627         -      fprintf(p->out, "PRAGMA writable_schema=OFF; COMMIT;\n");
         1627  +      fprintf(p->out, "PRAGMA writable_schema=OFF;\n");
  1628   1628         p->writableSchema = 0;
  1629   1629       }
  1630         -    sqlite3_exec(p->db, "PRAGMA writable_schema=OFF", 0, 0, 0);
         1630  +    sqlite3_exec(p->db, "PRAGMA writable_schema=OFF;", 0, 0, 0);
         1631  +    sqlite3_exec(p->db, "RELEASE dump;", 0, 0, 0);
  1631   1632       fprintf(p->out, p->nErr ? "ROLLBACK; -- due to errors\n" : "COMMIT;\n");
  1632   1633     }else
  1633   1634   
  1634   1635     if( c=='e' && strncmp(azArg[0], "echo", n)==0 && nArg>1 && nArg<3 ){
  1635   1636       p->echoOn = booleanValue(azArg[1]);
  1636   1637     }else
  1637   1638