/ Check-in [ebd44f0b]
Login

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

Overview
Comment:Make the command-line shell ".dump" command more resilient in the face of database corruption. (CVS 3496)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ebd44f0b5e229b990910bb44565de9a5c06cb5bc
User & Date: drh 2006-10-31 18:08:28
Context
2006-10-31
18:13
Fix a pair of memory leaks. These were turned up by running valgrind memcheck with various 10k doc insert, update, delete, and query tests. (CVS 3497) check-in: 3cd9b64b user: shess tags: trunk
18:08
Make the command-line shell ".dump" command more resilient in the face of database corruption. (CVS 3496) check-in: ebd44f0b user: drh tags: trunk
2006-10-30
13:37
Changes to support non-ASCII characters in win95 filenames. Ticket #2047. (CVS 3495) check-in: 9fa3ae58 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/shell.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.153 2006/10/27 14:21:54 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "sqlite3.h"
#include <ctype.h>
................................................................................

    rc = run_table_dump_query(p->out, p->db, zSelect);
    if( rc==SQLITE_CORRUPT ){
      zSelect = appendText(zSelect, " ORDER BY rowid DESC", 0);
      rc = run_table_dump_query(p->out, p->db, zSelect);
    }
    if( zSelect ) free(zSelect);
    if( rc!=SQLITE_OK ){
      return 1;
    }
  }
  return 0;
}

/*
** Run zQuery.  Update dump_callback() as the callback routine.
** If we get a SQLITE_CORRUPT error, rerun the query after appending







|







 







<
<
<







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
764
765
766
767
768
769
770



771
772
773
774
775
776
777
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.154 2006/10/31 18:08:28 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "sqlite3.h"
#include <ctype.h>
................................................................................

    rc = run_table_dump_query(p->out, p->db, zSelect);
    if( rc==SQLITE_CORRUPT ){
      zSelect = appendText(zSelect, " ORDER BY rowid DESC", 0);
      rc = run_table_dump_query(p->out, p->db, zSelect);
    }
    if( zSelect ) free(zSelect);



  }
  return 0;
}

/*
** Run zQuery.  Update dump_callback() as the callback routine.
** If we get a SQLITE_CORRUPT error, rerun the query after appending