summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.com>2001-01-15 22:56:44 +0200
committerunknown <monty@donna.mysql.com>2001-01-15 22:56:44 +0200
commitc753f496a6fa930b8307d1f4463c27532d9c6bb2 (patch)
treeefab60ad01bef9812e6926f3759f8814900a4e4a /client
parent1f23f87f06e10ba616b7ae96757cdd8f0d0cc07b (diff)
downloadmariadb-git-c753f496a6fa930b8307d1f4463c27532d9c6bb2.tar.gz
Fixes for mysqltest
Docs/manual.texi: More information about INSERT DELAYED client/mysqltest.c: Added syntax -- error # mysql-test/mysql-test-run.sh: Don't stop server that isn't started mysql-test/t/bdb.test: Change to use -- error # mysys/my_chsize.c: Fix for last commit sql/field.cc: Fix for purify and opt_range.cc sql/ha_berkeley.cc: Purecoverage hints
Diffstat (limited to 'client')
-rw-r--r--client/mysqltest.c54
1 files changed, 36 insertions, 18 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index d2efead3413..c3f31cdd3c0 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -43,7 +43,7 @@
**********************************************************************/
-#define MTEST_VERSION "1.5"
+#define MTEST_VERSION "1.6"
#include <global.h>
#include <my_sys.h>
@@ -71,23 +71,24 @@
#define MIN_VAR_ALLOC 32
#define BLOCK_STACK_DEPTH 32
-int record = 0, verbose = 0, silent = 0, opt_sleep=0;
+static int record = 0, verbose = 0, silent = 0, opt_sleep=0;
static char *db = 0, *pass=0;
const char* user = 0, *host = 0, *unix_sock = 0;
-int port = 0;
+static int port = 0;
static uint start_lineno, *lineno;
static char **default_argv;
static const char *load_default_groups[]= { "mysqltest","client",0 };
-FILE* file_stack[MAX_INCLUDE_DEPTH];
-FILE** cur_file;
-FILE** file_stack_end;
-uint lineno_stack[MAX_INCLUDE_DEPTH];
-char TMPDIR[FN_REFLEN];
+static FILE* file_stack[MAX_INCLUDE_DEPTH];
+static FILE** cur_file;
+static FILE** file_stack_end;
+static uint lineno_stack[MAX_INCLUDE_DEPTH];
+static char TMPDIR[FN_REFLEN];
-int block_stack[BLOCK_STACK_DEPTH];
-int *cur_block, *block_stack_end;
+static int block_stack[BLOCK_STACK_DEPTH];
+static int *cur_block, *block_stack_end;
+static uint global_expected_errno=0;
DYNAMIC_ARRAY q_lines;
@@ -137,13 +138,13 @@ struct st_query
enum { Q_CONNECTION=1, Q_QUERY, Q_CONNECT,
Q_SLEEP, Q_INC, Q_DEC,Q_SOURCE,
Q_DISCONNECT,Q_LET, Q_ECHO, Q_WHILE, Q_END_BLOCK,
- Q_SYSTEM, Q_RESULT, Q_REQUIRE,
+ Q_SYSTEM, Q_RESULT, Q_REQUIRE, Q_ERROR,
Q_UNKNOWN, Q_COMMENT, Q_COMMENT_WITH_COMMAND} type;
};
const char *command_names[] = {
"connection", "query","connect","sleep","inc","dec","source","disconnect",
-"let","echo","while","end","system","result", "require",0
+"let","echo","while","end","system","result", "require","error",0
};
TYPELIB command_typelib= {array_elements(command_names),"",
@@ -541,6 +542,20 @@ static void get_file_name(char *filename, struct st_query* q)
}
+static int get_int(struct st_query* q)
+{
+ char* p=q->first_argument;
+ int res;
+ DBUG_ENTER("get_int");
+ while (*p && isspace(*p)) p++;
+ if (!*p)
+ die("Missing argument in %s\n", q->query);
+ res=atoi(p);
+ DBUG_PRINT("result",("res: %d",res));
+ DBUG_RETURN(res);
+}
+
+
int select_connection(struct st_query* q)
{
char* p=q->first_argument, *name;
@@ -896,16 +911,16 @@ int read_query(struct st_query** q_ptr)
get_dynamic(&q_lines, (gptr) q_ptr, parser.current_line) ;
return 0;
}
- if (!(*q_ptr=q=(struct st_query*) my_malloc(sizeof(*q), MYF(MY_WME)))
- || insert_dynamic(&q_lines, (gptr) &q)
- )
- die("Out of memory");
+ if (!(*q_ptr=q=(struct st_query*) my_malloc(sizeof(*q), MYF(MY_WME))) ||
+ insert_dynamic(&q_lines, (gptr) &q))
+ die(NullS);
q->record_file[0] = 0;
q->require_file=0;
- q->abort_on_error = 1;
q->first_word_len = 0;
- q->expected_errno = 0;
+ q->expected_errno = global_expected_errno;
+ q->abort_on_error = global_expected_errno == 0;
+ global_expected_errno=0;
q->type = Q_UNKNOWN;
q->query=0;
if (read_line(read_query_buf, sizeof(read_query_buf)))
@@ -1357,6 +1372,9 @@ int main(int argc, char** argv)
get_file_name(save_file,q);
require_file=0;
break;
+ case Q_ERROR:
+ global_expected_errno=get_int(q);
+ break;
case Q_REQUIRE:
get_file_name(save_file,q);
require_file=1;