mirror of
				https://github.com/sqlite/sqlite.git
				synced 2025-11-03 16:53:36 +03:00 
			
		
		
		
	Cause the command-line shell to issue an error message if you give something
that does not look like a boolean value to a dot-command that wants a boolean argument. FossilOrigin-Name: b4d94947fc11bd63180cbc27554b3bbb60abe7ff
This commit is contained in:
		
							
								
								
									
										19
									
								
								src/shell.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								src/shell.c
									
									
									
									
									
								
							@@ -1537,17 +1537,18 @@ static void resolve_backslashes(char *z){
 | 
			
		||||
** Interpret zArg as a boolean value.  Return either 0 or 1.
 | 
			
		||||
*/
 | 
			
		||||
static int booleanValue(char *zArg){
 | 
			
		||||
  int val = atoi(zArg);
 | 
			
		||||
  int j;
 | 
			
		||||
  for(j=0; zArg[j]; j++){
 | 
			
		||||
    zArg[j] = ToLower(zArg[j]);
 | 
			
		||||
  int i;
 | 
			
		||||
  for(i=0; zArg[i]>='0' && zArg[i]<='9'; i++){}
 | 
			
		||||
  if( i>0 && zArg[i]==0 ) return atoi(zArg);
 | 
			
		||||
  if( sqlite3_stricmp(zArg, "on")==0 || sqlite3_stricmp(zArg,"yes")==0 ){
 | 
			
		||||
    return 1;
 | 
			
		||||
  }
 | 
			
		||||
  if( strcmp(zArg,"on")==0 ){
 | 
			
		||||
    val = 1;
 | 
			
		||||
  }else if( strcmp(zArg,"yes")==0 ){
 | 
			
		||||
    val = 1;
 | 
			
		||||
  if( sqlite3_stricmp(zArg, "off")==0 || sqlite3_stricmp(zArg,"no")==0 ){
 | 
			
		||||
    return 0;
 | 
			
		||||
  }
 | 
			
		||||
  return val;
 | 
			
		||||
  fprintf(stderr, "ERROR: Not a boolean value: \"%s\". Assuming \"no\".\n",
 | 
			
		||||
          zArg);
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user