/ Check-in [39e34278]
Login

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

Overview
Comment:In the shell, make sure the database is opened before trying to do an ".import". Bug reported on the mailing list. (CVS 3209)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 39e3427813135601a7417c96e55b410fa89ac1f5
User & Date: drh 2006-06-08 16:10:15
Context
2006-06-10
13:29
Basic parsing of CREATE VIRTUAL TABLE statements. (CVS 3210) check-in: 66370cb9 user: drh tags: trunk
2006-06-08
16:10
In the shell, make sure the database is opened before trying to do an ".import". Bug reported on the mailing list. (CVS 3209) check-in: 39e34278 user: drh tags: trunk
15:48
Unload shared libraries when a database connection closes. (CVS 3208) check-in: 327e6909 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/shell.c.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code to implement the "sqlite" command line
    13     13   ** utility for accessing SQLite databases.
    14     14   **
    15         -** $Id: shell.c,v 1.139 2006/06/08 15:28:44 drh Exp $
           15  +** $Id: shell.c,v 1.140 2006/06/08 16:10:15 drh Exp $
    16     16   */
    17     17   #include <stdlib.h>
    18     18   #include <string.h>
    19     19   #include <stdio.h>
    20     20   #include <assert.h>
    21     21   #include "sqlite3.h"
    22     22   #include <ctype.h>
................................................................................
  1029   1029       char *zSql;                 /* An SQL statement */
  1030   1030       char *zLine;                /* A single line of input from the file */
  1031   1031       char **azCol;               /* zLine[] broken up into columns */
  1032   1032       char *zCommit;              /* How to commit changes */   
  1033   1033       FILE *in;                   /* The input file */
  1034   1034       int lineno = 0;             /* Line number of input file */
  1035   1035   
         1036  +    open_db(p);
  1036   1037       nSep = strlen(p->separator);
  1037   1038       if( nSep==0 ){
  1038   1039         fprintf(stderr, "non-null separator required for import\n");
  1039   1040         return 0;
  1040   1041       }
  1041   1042       zSql = sqlite3_mprintf("SELECT * FROM '%q'", zTable);
  1042   1043       if( zSql==0 ) return 0;