/ Check-in [32a8e6e9]
Login

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

Overview
Comment:Do not report an error if the input to the sqlite shell ends in a comment. Ticket #211. (CVS 838)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:32a8e6e9771d636c0ad3042632d35865bc08585b
User & Date: drh 2003-01-18 17:05:01
Context
2003-01-18
20:11
Fix datatype reporting and collating sequence selection so that it works correctly on views and with the UNION, EXCEPT, and INTERCEPT operators. (CVS 839) check-in: 71cc292d user: drh tags: trunk
17:05
Do not report an error if the input to the sqlite shell ends in a comment. Ticket #211. (CVS 838) check-in: 32a8e6e9 user: drh tags: trunk
17:04
Check the validity of the database connection before the trace callback, not afterwards. (CVS 837) check-in: 960a2e4a 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
...
907
908
909
910
911
912
913














914
915
916
917
918
919
920
...
972
973
974
975
976
977
978

979
980
981
982
983
984
985
986
**    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.64 2003/01/08 13:02:53 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "sqlite.h"
#include <ctype.h>

................................................................................
  {
    fprintf(stderr, "unknown command or invalid arguments: "
      " \"%s\". Enter \".help\" for help\n", azArg[0]);
  }

  return rc;
}















/*
** Read input from *in and process it.  If *in==0 then input
** is interactive - the user is typing it it.  Otherwise, input
** is coming from a file or device.  A prompt is issued and history
** is saved only if input is interactive.  An interrupt signal will
** cause this routine to exit immediately, unless input is interactive.
................................................................................
      }
      free(zSql);
      zSql = 0;
      nSql = 0;
    }
  }
  if( zSql ){

    printf("Incomplete SQL: %s\n", zSql);
    free(zSql);
  }
}

/*
** Return a pathname which is the user's home directory.  A
** 0 return indicates an error of some kind.  Space to hold the







|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
...
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
**    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.65 2003/01/18 17:05:01 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "sqlite.h"
#include <ctype.h>

................................................................................
  {
    fprintf(stderr, "unknown command or invalid arguments: "
      " \"%s\". Enter \".help\" for help\n", azArg[0]);
  }

  return rc;
}

/*
** Skip over an SQL comments and whitespace.  Return a pointer to the text that
** follows the comments and whitespace.
*/
static char *skip_whitespace(char *z){
  while( isspace(*z) ){ z++; }
  while( z[0]=='-' && z[1]=='-' ){
    z += 2;
    while( *z && *z!='\n' ){ z++; }
    while( isspace(*z) ){ z++; }
  }
  return z;
}

/*
** Read input from *in and process it.  If *in==0 then input
** is interactive - the user is typing it it.  Otherwise, input
** is coming from a file or device.  A prompt is issued and history
** is saved only if input is interactive.  An interrupt signal will
** cause this routine to exit immediately, unless input is interactive.
................................................................................
      }
      free(zSql);
      zSql = 0;
      nSql = 0;
    }
  }
  if( zSql ){
    char *zTail = skip_whitespace(zSql);
    if( zTail && zTail[0] ) printf("Incomplete SQL: %s\n", zSql);
    free(zSql);
  }
}

/*
** Return a pathname which is the user's home directory.  A
** 0 return indicates an error of some kind.  Space to hold the