SQLite

Check-in [bad2065337]
Login

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

Overview
Comment:Changed ".databases" command to use PRAGMA database_list. (CVS 967)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bad2065337d8dcaacd519b8f1730a90f1c933c3e
User & Date: jplyon 2003-05-11 20:07:05.000
Context
2003-05-11
20:09
Changed PRAGMA database_list to show the filename. (CVS 968) (check-in: 3da10d2d02 user: jplyon tags: trunk)
20:07
Changed ".databases" command to use PRAGMA database_list. (CVS 967) (check-in: bad2065337 user: jplyon tags: trunk)
2003-05-10
03:36
Changes to comments. In particular, a lengthy comment was added to encode.c that explains how the encoder algorithm works. (CVS 966) (check-in: 8b388b2f69 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/shell.c.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    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.77 2003/05/04 18:30:59 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "sqlite.h"
#include "sqliteInt.h"
#include <ctype.h>







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    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.78 2003/05/11 20:07:05 jplyon Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "sqlite.h"
#include "sqliteInt.h"
#include <ctype.h>
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
*/
#define MODE_Line     0  /* One column per line.  Blank line between records */
#define MODE_Column   1  /* One record per line in neat columns */
#define MODE_List     2  /* One record per line with a separator */
#define MODE_Semi     3  /* Same as MODE_List but append ";" to each line */
#define MODE_Html     4  /* Generate an XHTML table */
#define MODE_Insert   5  /* Generate SQL "insert" statements */
#define MODE_NUM_OF   6

char *modeDescr[MODE_NUM_OF] = {
  "line",
  "column",
  "list",
  "semi",
  "html",







|







194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
*/
#define MODE_Line     0  /* One column per line.  Blank line between records */
#define MODE_Column   1  /* One record per line in neat columns */
#define MODE_List     2  /* One record per line with a separator */
#define MODE_Semi     3  /* Same as MODE_List but append ";" to each line */
#define MODE_Html     4  /* Generate an XHTML table */
#define MODE_Insert   5  /* Generate SQL "insert" statements */
#define MODE_NUM_OF   6  /* The number of modes (not a mode itself) */

char *modeDescr[MODE_NUM_OF] = {
  "line",
  "column",
  "list",
  "semi",
  "html",
559
560
561
562
563
564
565
566

567
568
569
570
571
572
573
574
575

576
577
578
579
580
581
582

  /* Process the input line.
  */
  if( nArg==0 ) return rc;
  n = strlen(azArg[0]);
  c = azArg[0][0];
  if( c=='d' && n>1 && strncmp(azArg[0], "databases", n)==0 ){
    int i;

    open_db(p);
    fprintf(p->out, "[Name]\t[File]\n");
    for(i=0; i<db->nDb; i++){
      sqlite *db = p->db;
      Db *pDb = &db->aDb[i];
      BtOps* pOps = btOps(pDb->pBt);
      const char *zName = pDb->zName;
      const char *zFilename = pOps->GetFilename(pDb->pBt);
      fprintf(p->out, "%s\t%s\n", zName, zFilename);

    }
  }else

  if( c=='d' && strncmp(azArg[0], "dump", n)==0 ){
    char *zErrMsg = 0;
    open_db(p);
    fprintf(p->out, "BEGIN TRANSACTION;\n");







|
>

<
|
|
|
|
|
<
|
>







559
560
561
562
563
564
565
566
567
568

569
570
571
572
573

574
575
576
577
578
579
580
581
582

  /* Process the input line.
  */
  if( nArg==0 ) return rc;
  n = strlen(azArg[0]);
  c = azArg[0][0];
  if( c=='d' && n>1 && strncmp(azArg[0], "databases", n)==0 ){
    struct callback_data data;
    char *zErrMsg = 0;
    open_db(p);

    memcpy(&data, p, sizeof(data));
    data.showHeader = 0;
    data.mode = MODE_Column;
    sqlite_exec(p->db, "PRAGMA database_list; ", callback, &data, &zErrMsg);
    if( zErrMsg ){

      fprintf(stderr,"Error: %s\n", zErrMsg);
      free(zErrMsg);
    }
  }else

  if( c=='d' && strncmp(azArg[0], "dump", n)==0 ){
    char *zErrMsg = 0;
    open_db(p);
    fprintf(p->out, "BEGIN TRANSACTION;\n");