diff options
author | sasha@mysql.sashanet.com <> | 2000-10-18 11:57:02 -0600 |
---|---|---|
committer | sasha@mysql.sashanet.com <> | 2000-10-18 11:57:02 -0600 |
commit | 7323cf3010e710c3dbacff892064bca36faf8271 (patch) | |
tree | 4978f82db364d5e2226d22395878d59141f60fef /client | |
parent | 87d4a421e8f24a4eeb0aee838b2e2adc1d482cfc (diff) | |
download | mariadb-git-7323cf3010e710c3dbacff892064bca36faf8271.tar.gz |
Docs/manual.texi
updated docs for SET SQL_LOG_BIN
client/mysqltest.c
added support for expected error
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqltest.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c index 8f2e83f64e5..47201c35ae9 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -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; |