SQLite

Check-in [fc8d25ea1f]
Login

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

Overview
Comment::-) (CVS 68)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fc8d25ea1fffa115fad15b9eb8bb0b0aaaff0431
User & Date: drh 2000-06-07 02:04:23.000
Context
2000-06-07
14:42
:-) (CVS 1697) (check-in: 5d773b5d4e user: drh tags: trunk)
02:04
:-) (CVS 68) (check-in: fc8d25ea1f user: drh tags: trunk)
01:33
:-) (CVS 67) (check-in: 8bff1bee63 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/shell.c.
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
**   drh@hwaci.com
**   http://www.hwaci.com/drh/
**
*************************************************************************
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.11 2000/06/07 01:33:42 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "sqlite.h"
#include <unistd.h>
#include <ctype.h>







|







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
**   drh@hwaci.com
**   http://www.hwaci.com/drh/
**
*************************************************************************
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.12 2000/06/07 02:04:23 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "sqlite.h"
#include <unistd.h>
#include <ctype.h>
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
          int j;
          for(j=0; z[j] && z[j]!=p->escape && z[j]!='\\'; j++){}
          if( j>0 ){
            fprintf(p->out, "%.*s", j, z);
          }
          if( z[j] ){
            fprintf(p->out, "\\%c", z[j]);
            z = &z[j+1];
          }
          z += j;
        }
        fprintf(p->out, "%s", i==nArg-1 ? "\n" : p->separator);
      }
      break;
    }







|







208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
          int j;
          for(j=0; z[j] && z[j]!=p->escape && z[j]!='\\'; j++){}
          if( j>0 ){
            fprintf(p->out, "%.*s", j, z);
          }
          if( z[j] ){
            fprintf(p->out, "\\%c", z[j]);
            z++;
          }
          z += j;
        }
        fprintf(p->out, "%s", i==nArg-1 ? "\n" : p->separator);
      }
      break;
    }
252
253
254
255
256
257
258

259
260
261
262
263
264
265
  if( nArg!=3 ) return 1;
  fprintf(pData->out, "%s;\n", azArg[2]);
  if( strcmp(azArg[1],"table")==0 ){
    struct callback_data d2;
    char zSql[1000];
    d2 = *pData;
    d2.mode = MODE_List;

    strcpy(d2.separator,"\t");
    fprintf(pData->out, "COPY '%s' FROM STDIN;\n", azArg[0]);
    sprintf(zSql, "SELECT * FROM '%s'", azArg[0]);
    sqlite_exec(pData->db, zSql, callback, &d2, 0);
    fprintf(pData->out, "\\.\n");
  }
  fprintf(pData->out, "VACUUM '%s';\n", azArg[0]);







>







252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
  if( nArg!=3 ) return 1;
  fprintf(pData->out, "%s;\n", azArg[2]);
  if( strcmp(azArg[1],"table")==0 ){
    struct callback_data d2;
    char zSql[1000];
    d2 = *pData;
    d2.mode = MODE_List;
    d2.escape = '\t';
    strcpy(d2.separator,"\t");
    fprintf(pData->out, "COPY '%s' FROM STDIN;\n", azArg[0]);
    sprintf(zSql, "SELECT * FROM '%s'", azArg[0]);
    sqlite_exec(pData->db, zSql, callback, &d2, 0);
    fprintf(pData->out, "\\.\n");
  }
  fprintf(pData->out, "VACUUM '%s';\n", azArg[0]);
Changes to src/tokenize.c.
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
*************************************************************************
** An tokenizer for SQL
**
** This file contains C code that splits an SQL input string up into
** individual tokens and sends those tokens one-by-one over to the
** parser for analysis.
**
** $Id: tokenize.c,v 1.8 2000/06/06 21:56:08 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
#include <stdlib.h>

/*
** All the keywords of the SQL language are stored as in a hash







|







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
*************************************************************************
** An tokenizer for SQL
**
** This file contains C code that splits an SQL input string up into
** individual tokens and sends those tokens one-by-one over to the
** parser for analysis.
**
** $Id: tokenize.c,v 1.9 2000/06/07 02:04:23 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
#include <stdlib.h>

/*
** All the keywords of the SQL language are stored as in a hash
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
          trace = stderr;
          sqliteParserTrace(trace, "parser: ");
        }else if( sqliteStrNICmp(z,"--parser-trace-off--", 20)==0 ){
          trace = 0;
          sqliteParserTrace(trace, "parser: ");
        }else if( sqliteStrNICmp(z,"--vdbe-trace-on--",17)==0 ){
          pParse->db->flags |= SQLITE_VdbeTrace;
        }else if( sqliteStrNICmp(z,"--vdbe-trace-off--", 19)==0 ){
          pParse->db->flags &= ~SQLITE_VdbeTrace;
        }
        break;
      }
      case TK_ILLEGAL:
        sqliteSetNString(pzErrMsg, "illegal token: \"", -1, 
           pParse->sLastToken.z, pParse->sLastToken.n, 0);







|







333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
          trace = stderr;
          sqliteParserTrace(trace, "parser: ");
        }else if( sqliteStrNICmp(z,"--parser-trace-off--", 20)==0 ){
          trace = 0;
          sqliteParserTrace(trace, "parser: ");
        }else if( sqliteStrNICmp(z,"--vdbe-trace-on--",17)==0 ){
          pParse->db->flags |= SQLITE_VdbeTrace;
        }else if( sqliteStrNICmp(z,"--vdbe-trace-off--", 18)==0 ){
          pParse->db->flags &= ~SQLITE_VdbeTrace;
        }
        break;
      }
      case TK_ILLEGAL:
        sqliteSetNString(pzErrMsg, "illegal token: \"", -1, 
           pParse->sLastToken.z, pParse->sLastToken.n, 0);