SQLite

Check-in [9b95ff1abf]
Login

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

Overview
Comment:Fix a potential SQLITE_MISUSE in the .excel command when no database is open.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | excel-shell-cmd
Files: files | file ages | folders
SHA3-256: 9b95ff1abfb8d49bbe5a727f5c917a455e4289b4d69196377dc9294409341d70
User & Date: drh 2018-01-10 21:50:08.964
Context
2018-01-10
22:15
An attempt to get ".once -e" working reliably on Windows. (check-in: 9b97f9d2c8 user: drh tags: excel-shell-cmd)
21:50
Fix a potential SQLITE_MISUSE in the .excel command when no database is open. (check-in: 9b95ff1abf user: drh tags: excel-shell-cmd)
21:41
Add support for the ".excel" command (and ".once -e" and ".once -x") in the CLI. (check-in: 23fa7c57c2 user: drh tags: excel-shell-cmd)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/shell.c.in.
4230
4231
4232
4233
4234
4235
4236

4237

4238
4239
4240
4241
4242
4243
4244
/*
** Create a new temp file name with the given suffix.
*/
static void newTempFile(ShellState *p, const char *zSuffix){
  clearTempFile(p);
  sqlite3_free(p->zTempFile);
  p->zTempFile = 0;

  sqlite3_file_control(p->db, 0, SQLITE_FCNTL_TEMPFILENAME, &p->zTempFile);

  if( p->zTempFile==0 ){
    sqlite3_uint64 r;
    sqlite3_randomness(sizeof(r), &r);
    p->zTempFile = sqlite3_mprintf("temp%llx.%s", r, zSuffix);
  }else{
    p->zTempFile = sqlite3_mprintf("%z.%s", p->zTempFile, zSuffix);
  }







>
|
>







4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
/*
** Create a new temp file name with the given suffix.
*/
static void newTempFile(ShellState *p, const char *zSuffix){
  clearTempFile(p);
  sqlite3_free(p->zTempFile);
  p->zTempFile = 0;
  if( p->db ){
    sqlite3_file_control(p->db, 0, SQLITE_FCNTL_TEMPFILENAME, &p->zTempFile);
  }
  if( p->zTempFile==0 ){
    sqlite3_uint64 r;
    sqlite3_randomness(sizeof(r), &r);
    p->zTempFile = sqlite3_mprintf("temp%llx.%s", r, zSuffix);
  }else{
    p->zTempFile = sqlite3_mprintf("%z.%s", p->zTempFile, zSuffix);
  }