Commit 7323cf30 authored by sasha@mysql.sashanet.com's avatar sasha@mysql.sashanet.com
Browse files

Docs/manual.texi

    updated docs for SET SQL_LOG_BIN
client/mysqltest.c
    added support for expected error
parent 87d4a421
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -24953,10 +24953,12 @@ summary of commands:
 @tab Stops the slave thread. (Slave)
@item @code{SET SQL_LOG_BIN=0}
 @tab Disables update logging (Master)
 @tab Disables update logging if the user has process privilege.
 Ignored otherwise (Master)
@item @code{SET SQL_LOG_BIN=1}
 @tab Re-enable update logging (Master)
 @tab Re-enable update logging if the user has process privilege.
 Ignored otherwise (Master)
@item @code{RESET MASTER}
 @tab Deletes all binary logs listed in the index file, resetting the binlog
+29 −2
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ struct query
  int has_result_set;
  int first_word_len;
  int abort_on_error;
  uint expected_errno;
  char record_file[MAX_RECORD_FILE];
};

@@ -382,19 +383,28 @@ int read_query(struct query* q)
{
  char buf[MAX_QUERY];
  char* p = buf,* p1 ;
  int c;
  int c, expected_errno;
  
  q->record_file[0] = 0;
  q->abort_on_error = 1;
  q->has_result_set = 0;
  q->first_word_len = 0;
  q->expected_errno = 0;
  
  if(read_line(buf, sizeof(buf)))
    return 1;
  if(buf[0] == '!')
  if(*p == '!')
    {
     q->abort_on_error = 0;
     p++;
     if(*p == '$')
       {
	 expected_errno = 0;
	 p++;
	 for(;isdigit(*p);p++)
	   expected_errno = expected_errno * 10 + *p - '0';
	 q->expected_errno = expected_errno;
       }
    }

  while(*p && isspace(*p)) p++ ;
@@ -629,6 +639,15 @@ int run_query(MYSQL* mysql, struct query* q)
	die("query '%s' failed: %s", q->q, mysql_error(mysql));
      else
	{
	  if(q->expected_errno)
	    {
	      error = (q->expected_errno != mysql_errno(mysql));
	      if(error)
       	        verbose_msg("query '%s' failed with wrong errno\
 %d instead of %d", q->q, mysql_errno(mysql), q->expected_errno);
	      goto end;
	    }
	  
 	  verbose_msg("query '%s' failed: %s", q->q, mysql_error(mysql));
	  /* if we do not abort on error, failure to run the query does
	     not fail the whole test case
@@ -637,6 +656,14 @@ int run_query(MYSQL* mysql, struct query* q)
	}
    }

  if(q->expected_errno)
    {
      error = 1;
      verbose_msg("query '%s' succeeded - should have failed with errno %d",
		  q->q, q->expected_errno);
      goto end;
    }
  
  if(!q->has_result_set)
    goto end;