/ Check-in [f795afd6]
Login

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

Overview
Comment:Modify the shell so that when it is doing a ".dump" it always uses single quotes and not double quotes for quoting literal strings. This is for portability to other databases that only support single quote string literals. (CVS 574)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f795afd63f19ab61c2b3b96621cb6dda31ce0379
User & Date: drh 2002-05-21 13:02:24
Context
2002-05-21
13:18
Clean up some compiler warnings. (CVS 575) check-in: 3399b012 user: drh tags: trunk
13:02
Modify the shell so that when it is doing a ".dump" it always uses single quotes and not double quotes for quoting literal strings. This is for portability to other databases that only support single quote string literals. (CVS 574) check-in: f795afd6 user: drh tags: trunk
12:56
Fix for ticket #45: Allow an UPDATE statement to change the INTEGER PRIMARY KEY to itself without triggering a constraint error. (CVS 573) check-in: 592da134 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.56 2002/04/21 19:06:22 drh Exp $
           15  +** $Id: shell.c,v 1.57 2002/05/21 13:02:24 drh Exp $
    16     16   */
    17     17   #include <stdlib.h>
    18     18   #include <string.h>
    19     19   #include <stdio.h>
    20     20   #include "sqlite.h"
    21     21   #include <ctype.h>
    22     22   
................................................................................
   219    219   
   220    220   /*
   221    221   ** Output the given string as a quoted string using SQL quoting conventions.
   222    222   */
   223    223   static void output_quoted_string(FILE *out, const char *z){
   224    224     int i;
   225    225     int nSingle = 0;
   226         -  int nDouble = 0;
   227    226     for(i=0; z[i]; i++){
   228    227       if( z[i]=='\'' ) nSingle++;
   229         -    else if( z[i]=='"' ) nDouble++;
   230    228     }
   231    229     if( nSingle==0 ){
   232    230       fprintf(out,"'%s'",z);
   233         -  }else if( nDouble==0 ){
   234         -    fprintf(out,"\"%s\"",z);
   235    231     }else{
   236    232       fprintf(out,"'");
   237    233       while( *z ){
   238    234         for(i=0; z[i] && z[i]!='\''; i++){}
   239    235         if( i==0 ){
   240    236           fprintf(out,"''");
   241    237           z++;