Commit f11df2ad authored by unknown's avatar unknown

Docs/manual.texi

    updated docs for SET SQL_LOG_BIN
client/mysqltest.c
    added support for expected error


Docs/manual.texi:
  updated docs for SET SQL_LOG_BIN
client/mysqltest.c:
  added support for expected error
parent 75ea52bb
......@@ -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
......@@ -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
......@@ -636,6 +655,14 @@ int run_query(MYSQL* mysql, struct query* q)
goto end;
}
}
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment