mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Extended mysqltest with --commands and 'require'
Fixed test results. Added mysqld variable 'have_isam' BitKeeper/deleted/.del-master-slave.inc~556fd038c3a3d54: Delete: mysql-test/t/include/master-slave.inc BitKeeper/deleted/.del-README~f9fd36f3c3711305: Delete: mysql-test/r/3.23/README Docs/manual.texi: Fixed typos client/mysqltest.c: Changed internal commands to accept -- before them. Added command 'require' to make it possible to skip tests if the mysqld server lacks some capabilites. Removed extra \t at end of lines configure.in: Update myisam/myisamlog.c: cleanup mysql-test/mysql-test-run.sh: Added support for 'not supported' tests mysql-test/r/alt000001.result: Removed end tab mysql-test/r/bdb.result: Removed end tab mysql-test/r/crypt.result: Removed end tab mysql-test/r/equal.result: Removed end tab mysql-test/r/ft0000001.a.result: Removed end tab mysql-test/r/ft0000001.b.result: Removed end tab mysql-test/r/ft0000001.c.result: Removed end tab mysql-test/r/ft0000001.d.result: Removed end tab mysql-test/r/ft0000001.e.result: Removed end tab mysql-test/r/ft0000002.a.result: Removed end tab mysql-test/r/ft0000002.b.result: Removed end tab mysql-test/r/ft0000002.c.result: Removed end tab mysql-test/r/ins000001.result: Removed end tab mysql-test/r/mrg000001.dummy.result: Removed end tab mysql-test/r/mrg000001.result: Removed end tab mysql-test/r/mrg000002.result: Removed end tab mysql-test/r/rpl000001.a.result: Removed end tab mysql-test/r/rpl000001.b.result: Removed end tab mysql-test/r/rpl000002.result: Removed end tab mysql-test/r/rpl000003.result: Removed end tab mysql-test/r/rpl000004.a.result: Removed end tab mysql-test/r/rpl000004.b.result: Removed end tab mysql-test/r/rpl000005.result: Removed end tab mysql-test/r/rpl000006.result: Removed end tab mysql-test/r/rpl000007.result: Removed end tab mysql-test/r/rpl000008.result: Removed end tab mysql-test/r/rpl000009.result: Removed end tab mysql-test/r/rpl000010.result: Removed end tab mysql-test/r/rpl000011.result: Removed end tab mysql-test/r/rpl000012.result: Removed end tab mysql-test/r/rpl000012.status.result: Removed end tab mysql-test/r/rpl000013.result: Removed end tab mysql-test/r/rpl000013.status.result: Removed end tab mysql-test/r/rpl000014.result: Removed end tab mysql-test/r/rpl000015.result: Removed end tab mysql-test/r/rpl000016.result: Removed end tab mysql-test/r/sel000001.result: Removed end tab mysql-test/r/sel000002.result: Removed end tab mysql-test/r/sel000003.result: Removed end tab mysql-test/r/sel000004.result: Removed end tab mysql-test/r/sel000005.result: Removed end tab mysql-test/r/sel000006.result: Removed end tab mysql-test/r/sel000007.result: Removed end tab mysql-test/r/sel000008.result: Removed end tab mysql-test/r/sel000009.result: Removed end tab mysql-test/r/sel000010.result: Removed end tab mysql-test/r/sel000011.result: Removed end tab mysql-test/r/sel000012.result: Removed end tab mysql-test/r/sel000013.result: Removed end tab mysql-test/r/sel000014.result: Removed end tab mysql-test/r/sel000015.result: Removed end tab mysql-test/r/sel000016.result: Removed end tab mysql-test/r/sel000017.result: Removed end tab mysql-test/r/sel000018.result: Removed end tab mysql-test/r/sel000019.result: Removed end tab mysql-test/r/sel000020.result: Removed end tab mysql-test/r/sel000021.result: Removed end tab mysql-test/r/sel000022.result: Removed end tab mysql-test/r/sel000023.result: Removed end tab mysql-test/r/sel000024.result: Removed end tab mysql-test/r/sel000025.result: Removed end tab mysql-test/r/sel000026.result: Removed end tab mysql-test/r/sel000027.result: Removed end tab mysql-test/r/sel000028.result: Removed end tab mysql-test/r/sel000029.result: Removed end tab mysql-test/r/sel000030.result: Removed end tab mysql-test/r/sel000031.result: Removed end tab mysql-test/r/sel000032.result: Removed end tab mysql-test/r/sel000033.result: Removed end tab mysql-test/r/sel000100.result: Removed end tab mysql-test/r/shw000001.result: Removed end tab mysql-test/r/slave-running.result: Removed end tab mysql-test/r/slave-stopped.result: Removed end tab mysql-test/t/bdb.test: Check that we have BDB support mysql-test/t/replace.test: Check if we support ISAM tables sql/gen_lex_hash.cc: Fixed bug in last output sql/ha_berkeley.cc: Bug fix sql/ha_berkeley.h: Initialize using_ignore sql/handler.h: Fixed typo sql/mysqld.cc: Fixed typos; Added variable 'have_isam' sql/sql_class.h: Fixed typo BitKeeper/etc/ignore: Added sql-bench/Results-linux/ATIS-mysql_bdb-Linux_2.2.14_my_SMP_i686 to the ignore list
This commit is contained in:
@ -183,3 +183,4 @@ mysqld.S
|
||||
mysqld.sym
|
||||
.snprj/*
|
||||
sql-bench/output/*
|
||||
sql-bench/Results-linux/ATIS-mysql_bdb-Linux_2.2.14_my_SMP_i686
|
||||
|
@ -20271,7 +20271,7 @@ differ somewhat:
|
||||
| flush | OFF |
|
||||
| flush_time | 0 |
|
||||
| have_bdb | YES |
|
||||
| have_gemeni | NO |
|
||||
| have_gemini | NO |
|
||||
| have_innobase | YES |
|
||||
| have_raid | YES |
|
||||
| have_ssl | NO |
|
||||
@ -20449,9 +20449,9 @@ very little resources.
|
||||
@item @code{have_bdb}
|
||||
@code{YES} if @code{mysqld} supports Berkeley DB tables. @code{DISABLED}
|
||||
if @code{--skip-bdb} is used.
|
||||
@item @code{have_gemeni}
|
||||
@code{YES} if @code{mysqld} supports Gemeni tables. @code{DISABLED}
|
||||
if @code{--skip-gemeni} is used.
|
||||
@item @code{have_gemini}
|
||||
@code{YES} if @code{mysqld} supports Gemini tables. @code{DISABLED}
|
||||
if @code{--skip-gemini} is used.
|
||||
@item @code{have_innobase}
|
||||
@code{YES} if @code{mysqld} supports Innobase tables. @code{DISABLED}
|
||||
if @code{--skip-innobase} is used.
|
||||
@ -40052,7 +40052,7 @@ though, so Version 3.23 is not released as a stable version yet.
|
||||
@item
|
||||
Added option @code{--safe-show-databases}.
|
||||
@item
|
||||
Added @code{have_bdb}, @code{have_gemeni}, @code{have_innobase},
|
||||
Added @code{have_bdb}, @code{have_gemini}, @code{have_innobase},
|
||||
@code{have_raid} and @code{have_ssl} to @code{SHOW VARIABLES} to make it
|
||||
easy to test for supported extensions.
|
||||
@item
|
||||
|
@ -23,7 +23,7 @@
|
||||
*
|
||||
**/
|
||||
|
||||
#define MTEST_VERSION "1.0"
|
||||
#define MTEST_VERSION "1.1"
|
||||
|
||||
#include "global.h"
|
||||
#include "my_sys.h"
|
||||
@ -104,17 +104,27 @@ struct connection* cur_con, *next_con, *cons_end;
|
||||
struct query
|
||||
{
|
||||
char q[MAX_QUERY];
|
||||
int has_result_set;
|
||||
int first_word_len;
|
||||
int abort_on_error;
|
||||
my_bool abort_on_error, require_file;
|
||||
uint expected_errno;
|
||||
char record_file[FN_REFLEN];
|
||||
enum {Q_CONNECTION, Q_QUERY, Q_CONNECT,
|
||||
/* Add new commands before Q_UNKNOWN */
|
||||
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_UNKNOWN} type;
|
||||
Q_SYSTEM, Q_RESULT, Q_REQUIRE,
|
||||
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
|
||||
};
|
||||
|
||||
TYPELIB command_typelib= {array_elements(command_names),"",
|
||||
command_names};
|
||||
|
||||
|
||||
#define DS_CHUNK 16384
|
||||
|
||||
typedef struct dyn_string
|
||||
@ -131,11 +141,53 @@ void dyn_string_append(DYN_STRING* ds, const char* str, int len);
|
||||
int dyn_string_cmp(DYN_STRING* ds, const char* fname);
|
||||
void reject_dump(const char* record_file, char* buf, int size);
|
||||
|
||||
|
||||
static void die(const char* fmt, ...);
|
||||
int close_connection(struct query* q);
|
||||
VAR* var_get(char* var_name, char* var_name_end, int raw);
|
||||
void verbose_msg(const char* fmt, ...);
|
||||
|
||||
static void close_cons()
|
||||
{
|
||||
for(--next_con; next_con >= cons; --next_con)
|
||||
{
|
||||
mysql_close(&next_con->mysql);
|
||||
my_free(next_con->name, MYF(MY_ALLOW_ZERO_PTR));
|
||||
}
|
||||
}
|
||||
|
||||
static void die(const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
fprintf(stderr, "%s: ", my_progname);
|
||||
vfprintf(stderr, fmt, args);
|
||||
fprintf(stderr, "\n");
|
||||
va_end(args);
|
||||
close_cons();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void abort_not_supported_test()
|
||||
{
|
||||
fprintf(stderr, "This test is not supported by this installation\n");
|
||||
if (!silent)
|
||||
printf("skipped\n");
|
||||
close_cons();
|
||||
exit(2);
|
||||
}
|
||||
|
||||
static void verbose_msg(const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
if (!verbose) return;
|
||||
|
||||
va_start(args, fmt);
|
||||
|
||||
fprintf(stderr, "%s: ", my_progname);
|
||||
vfprintf(stderr, fmt, args);
|
||||
fprintf(stderr, "\n");
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
void init_parser()
|
||||
{
|
||||
@ -192,6 +244,8 @@ void dyn_string_append(DYN_STRING* ds, const char* str, int len)
|
||||
ds->len += len;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int dyn_string_cmp(DYN_STRING* ds, const char* fname)
|
||||
{
|
||||
MY_STAT stat_info;
|
||||
@ -214,10 +268,15 @@ int dyn_string_cmp(DYN_STRING* ds, const char* fname)
|
||||
return res;
|
||||
}
|
||||
|
||||
int check_result(DYN_STRING* ds, const char* fname)
|
||||
static int check_result(DYN_STRING* ds, const char* fname,
|
||||
my_bool require_option)
|
||||
{
|
||||
int error = 0;
|
||||
switch(dyn_string_cmp(ds, fname))
|
||||
int res=dyn_string_cmp(ds, fname);
|
||||
|
||||
if (res && require_option)
|
||||
abort_not_supported_test();
|
||||
switch (res)
|
||||
{
|
||||
case 0:
|
||||
break; /* ok */
|
||||
@ -304,7 +363,7 @@ int open_file(const char* name)
|
||||
{
|
||||
if (*cur_file && ++cur_file == file_stack_end)
|
||||
die("Source directives are nesting too deep");
|
||||
if(!(*cur_file = fopen(name, "r")))
|
||||
if (!(*cur_file = my_fopen(name, O_RDONLY, MYF(MY_WME))))
|
||||
die("Could not read '%s': errno %d\n", name, errno);
|
||||
|
||||
return 0;
|
||||
@ -438,7 +497,7 @@ int do_sleep(struct query* q)
|
||||
p = (char*)q->q + q->first_word_len;
|
||||
while(*p && isspace(*p)) p++;
|
||||
if (!*p)
|
||||
die("Missing agument in sleep\n");
|
||||
die("Missing argument in sleep\n");
|
||||
arg = p;
|
||||
t.tv_sec = atoi(arg);
|
||||
t.tv_usec = 0;
|
||||
@ -468,6 +527,17 @@ int do_sleep(struct query* q)
|
||||
return select(0,0,0,0, &t);
|
||||
}
|
||||
|
||||
static void get_file_name(char *filename, struct query* q)
|
||||
{
|
||||
char *p = (char*) q->q + q->first_word_len;
|
||||
while(*p && isspace(*p)) p++;
|
||||
strnmov(filename, p, FN_REFLEN);
|
||||
/* Remove end space */
|
||||
while (p > filename && isspace(p[-1]))
|
||||
p--;
|
||||
p[0]=0;
|
||||
}
|
||||
|
||||
|
||||
int select_connection(struct query* q)
|
||||
{
|
||||
@ -619,14 +689,6 @@ int do_while(struct query* q)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void close_cons()
|
||||
{
|
||||
for(--next_con; next_con >= cons; --next_con)
|
||||
{
|
||||
mysql_close(&next_con->mysql);
|
||||
my_free(next_con->name, MYF(MY_ALLOW_ZERO_PTR));
|
||||
}
|
||||
}
|
||||
|
||||
int safe_copy_unescape(char* dest, char* src, int size)
|
||||
{
|
||||
@ -683,7 +745,7 @@ int safe_copy_unescape(char* dest, char* src, int size)
|
||||
int read_line(char* buf, int size)
|
||||
{
|
||||
int c;
|
||||
char* p = buf, *buf_end = buf + size;
|
||||
char* p = buf, *buf_end = buf + size-1;
|
||||
int no_save = 0;
|
||||
enum {R_NORMAL, R_Q1, R_ESC_Q_Q1, R_ESC_Q_Q2,
|
||||
R_ESC_SLASH_Q1, R_ESC_SLASH_Q2,
|
||||
@ -695,7 +757,7 @@ int read_line(char* buf, int size)
|
||||
c = fgetc(*cur_file);
|
||||
if (feof(*cur_file))
|
||||
{
|
||||
fclose(*cur_file);
|
||||
my_fclose(*cur_file,MYF(0));
|
||||
|
||||
if (cur_file == file_stack)
|
||||
return 1;
|
||||
@ -706,8 +768,7 @@ int read_line(char* buf, int size)
|
||||
}
|
||||
}
|
||||
|
||||
switch(state)
|
||||
{
|
||||
switch(state) {
|
||||
case R_NORMAL:
|
||||
if (c == ';' || c == '{') /* '{' allows some interesting syntax
|
||||
* but we don't care, as long as the
|
||||
@ -725,16 +786,16 @@ int read_line(char* buf, int size)
|
||||
|
||||
break;
|
||||
case R_COMMENT:
|
||||
no_save = 1;
|
||||
if (c == '\n')
|
||||
state = R_LINE_START;
|
||||
{
|
||||
*p=0;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case R_LINE_START:
|
||||
if(c == '#')
|
||||
if (c == '#' || c == '-')
|
||||
{
|
||||
state = R_COMMENT;
|
||||
no_save = 1;
|
||||
}
|
||||
else if (isspace(c))
|
||||
no_save = 1;
|
||||
@ -795,6 +856,7 @@ int read_line(char* buf, int size)
|
||||
if (!no_save)
|
||||
*p++ = c;
|
||||
}
|
||||
*p=0; /* Always end with \0 */
|
||||
return feof(*cur_file);
|
||||
}
|
||||
|
||||
@ -815,13 +877,25 @@ int read_query(struct query** q_ptr)
|
||||
die("Out of memory");
|
||||
|
||||
q->record_file[0] = 0;
|
||||
q->require_file=0;
|
||||
q->abort_on_error = 1;
|
||||
q->has_result_set = 0;
|
||||
q->first_word_len = 0;
|
||||
q->expected_errno = 0;
|
||||
q->type = Q_UNKNOWN;
|
||||
if (read_line(buf, sizeof(buf)))
|
||||
return 1;
|
||||
|
||||
if (*p == '#')
|
||||
{
|
||||
q->type = Q_COMMENT;
|
||||
}
|
||||
else if (p[0] == '-' && p[1] == '-')
|
||||
{
|
||||
q->type = Q_COMMENT_WITH_COMMAND;
|
||||
p+=2; /* To calculate first word */
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*p == '!')
|
||||
{
|
||||
q->abort_on_error = 0;
|
||||
@ -839,23 +913,22 @@ int read_query(struct query** q_ptr)
|
||||
while(*p && isspace(*p)) p++ ;
|
||||
if (*p == '@')
|
||||
{
|
||||
q->has_result_set = 1;
|
||||
p++;
|
||||
p1 = q->record_file;
|
||||
while(!isspace(c = *p) &&
|
||||
p1 < q->record_file + sizeof(q->record_file) - 1)
|
||||
*p1++ = *p++;
|
||||
*p1 = 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
while(*p && isspace(*p)) p++;
|
||||
/* Calculate first word */
|
||||
p1 = q->q;
|
||||
while(*p && !isspace(*p))
|
||||
*p1++ = *p++;
|
||||
|
||||
q->first_word_len = p1 - q->q;
|
||||
strcpy(p1, p);
|
||||
strmov(p1, p);
|
||||
parser.read_lines++;
|
||||
return 0;
|
||||
}
|
||||
@ -878,31 +951,6 @@ struct option long_options[] =
|
||||
{0, 0,0,0}
|
||||
};
|
||||
|
||||
void die(const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
fprintf(stderr, "%s: ", my_progname);
|
||||
vfprintf(stderr, fmt, args);
|
||||
fprintf(stderr, "\n");
|
||||
va_end(args);
|
||||
close_cons();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void verbose_msg(const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
if(!verbose) return;
|
||||
|
||||
va_start(args, fmt);
|
||||
|
||||
fprintf(stderr, "%s: ", my_progname);
|
||||
vfprintf(stderr, fmt, args);
|
||||
fprintf(stderr, "\n");
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
static void print_version(void)
|
||||
{
|
||||
@ -990,7 +1038,7 @@ int parse_args(int argc, char **argv)
|
||||
exit(0);
|
||||
default:
|
||||
usage();
|
||||
exit(0);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1002,10 +1050,7 @@ int parse_args(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
if (argc == 1)
|
||||
{
|
||||
my_free(db,MYF(MY_ALLOW_ZERO_PTR));
|
||||
db=my_strdup(*argv,MYF(MY_WME));
|
||||
}
|
||||
db= *argv;
|
||||
if (tty_password)
|
||||
pass=get_tty_password(NullS);
|
||||
|
||||
@ -1042,6 +1087,7 @@ void reject_dump(const char* record_file, char* buf, int size)
|
||||
str_to_file(reject_file, buf, size);
|
||||
}
|
||||
|
||||
|
||||
int run_query(MYSQL* mysql, struct query* q)
|
||||
{
|
||||
MYSQL_RES* res = 0;
|
||||
@ -1060,10 +1106,10 @@ int run_query(MYSQL* mysql, struct query* q)
|
||||
ds = &ds_tmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (mysql_query(mysql, q->q))
|
||||
{
|
||||
if (q->require_file)
|
||||
abort_not_supported_test();
|
||||
if (q->abort_on_error)
|
||||
die("query '%s' failed: %s", q->q, mysql_error(mysql));
|
||||
else
|
||||
@ -1096,6 +1142,8 @@ int run_query(MYSQL* mysql, struct query* q)
|
||||
|
||||
if (!(res = mysql_store_result(mysql)) && mysql_field_count(mysql))
|
||||
{
|
||||
if (q->require_file)
|
||||
abort_not_supported_test();
|
||||
if (q->abort_on_error)
|
||||
die("failed in mysql_store_result for query '%s'", q->q);
|
||||
else
|
||||
@ -1112,8 +1160,9 @@ int run_query(MYSQL* mysql, struct query* q)
|
||||
num_fields = mysql_num_fields(res);
|
||||
for( i = 0; i < num_fields; i++)
|
||||
{
|
||||
dyn_string_append(ds, fields[i].name, 0);
|
||||
if (i)
|
||||
dyn_string_append(ds, "\t", 1);
|
||||
dyn_string_append(ds, fields[i].name, 0);
|
||||
}
|
||||
|
||||
dyn_string_append(ds, "\n", 1);
|
||||
@ -1133,8 +1182,9 @@ int run_query(MYSQL* mysql, struct query* q)
|
||||
len = 4;
|
||||
}
|
||||
|
||||
dyn_string_append(ds, val, len);
|
||||
if (i)
|
||||
dyn_string_append(ds, "\t", 1);
|
||||
dyn_string_append(ds, val, len);
|
||||
}
|
||||
|
||||
dyn_string_append(ds, "\n", 1);
|
||||
@ -1149,7 +1199,7 @@ int run_query(MYSQL* mysql, struct query* q)
|
||||
}
|
||||
else if (q->record_file[0])
|
||||
{
|
||||
error = check_result(ds, q->record_file);
|
||||
error = check_result(ds, q->record_file, q->require_file);
|
||||
}
|
||||
|
||||
end:
|
||||
@ -1157,77 +1207,36 @@ int run_query(MYSQL* mysql, struct query* q)
|
||||
return error;
|
||||
}
|
||||
|
||||
int check_first_word(struct query* q, const char* word, int len)
|
||||
{
|
||||
const char* p, *p1, *end;
|
||||
|
||||
if(len != q->first_word_len)
|
||||
return 0;
|
||||
|
||||
|
||||
p = word;
|
||||
end = p + len;
|
||||
p1 = q->q;
|
||||
|
||||
for(; p < end; p++, p1++)
|
||||
if(tolower(*p) != tolower(*p1))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void get_query_type(struct query* q)
|
||||
{
|
||||
char save;
|
||||
uint type;
|
||||
if (*q->q == '}')
|
||||
{
|
||||
q->type = Q_END_BLOCK;
|
||||
return;
|
||||
}
|
||||
if (q->type != Q_COMMENT_WITH_COMMAND)
|
||||
q->type = Q_QUERY;
|
||||
switch(q->first_word_len)
|
||||
{
|
||||
case 3:
|
||||
if(check_first_word(q, "inc", 3))
|
||||
q->type = Q_INC;
|
||||
else if(check_first_word(q, "dec", 3))
|
||||
q->type = Q_DEC;
|
||||
else if(check_first_word(q, "let", 3))
|
||||
q->type = Q_LET;
|
||||
break;
|
||||
case 4:
|
||||
if(check_first_word(q, "echo", 4))
|
||||
q->type = Q_ECHO;
|
||||
break;
|
||||
case 5:
|
||||
if(check_first_word(q, "sleep", 5))
|
||||
q->type = Q_SLEEP;
|
||||
else if(check_first_word(q, "while", 5))
|
||||
q->type = Q_WHILE;
|
||||
break;
|
||||
case 6:
|
||||
if(check_first_word(q, "source", 6))
|
||||
q->type = Q_SOURCE;
|
||||
else if(check_first_word(q, "system", 6))
|
||||
q->type = Q_SYSTEM;
|
||||
break;
|
||||
case 7:
|
||||
if(check_first_word(q, "connect", 7))
|
||||
q->type = Q_CONNECT;
|
||||
break;
|
||||
case 10:
|
||||
if(check_first_word(q, "connection", 10))
|
||||
q->type = Q_CONNECTION;
|
||||
else if(check_first_word(q, "disconnect", 10))
|
||||
q->type = Q_DISCONNECT;
|
||||
break;
|
||||
|
||||
save=q->q[q->first_word_len];
|
||||
q->q[q->first_word_len]=0;
|
||||
type=find_type(q->q, &command_typelib, 0);
|
||||
q->q[q->first_word_len]=save;
|
||||
if (type > 0)
|
||||
q->type=type; /* Found command */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int error = 0;
|
||||
struct query* q;
|
||||
my_bool require_file=0;
|
||||
char save_file[FN_REFLEN];
|
||||
save_file[0]=0;
|
||||
|
||||
MY_INIT(argv[0]);
|
||||
memset(cons, 0, sizeof(cons));
|
||||
@ -1249,7 +1258,6 @@ int main(int argc, char** argv)
|
||||
*cur_file = stdin;
|
||||
|
||||
|
||||
|
||||
if (!( mysql_init(&cur_con->mysql)))
|
||||
die("Failed in mysql_init()");
|
||||
|
||||
@ -1267,13 +1275,12 @@ int main(int argc, char** argv)
|
||||
for(;!read_query(&q);)
|
||||
{
|
||||
int current_line_inc = 1, processed = 0;
|
||||
if(q->type == Q_UNKNOWN)
|
||||
if (q->type == Q_UNKNOWN || q->type == Q_COMMENT_WITH_COMMAND)
|
||||
get_query_type(q);
|
||||
if (block_ok)
|
||||
{
|
||||
processed = 1;
|
||||
switch(q->type)
|
||||
{
|
||||
switch (q->type) {
|
||||
case Q_CONNECT: do_connect(q); break;
|
||||
case Q_CONNECTION: select_connection(q); break;
|
||||
case Q_DISCONNECT: close_connection(q); break;
|
||||
@ -1284,7 +1291,26 @@ int main(int argc, char** argv)
|
||||
case Q_ECHO: do_echo(q); break;
|
||||
case Q_SYSTEM: do_system(q); break;
|
||||
case Q_LET: do_let(q); break;
|
||||
case Q_QUERY: error |= run_query(&cur_con->mysql, q); break;
|
||||
case Q_QUERY:
|
||||
{
|
||||
if (save_file[0])
|
||||
{
|
||||
strmov(q->record_file,save_file);
|
||||
q->require_file=require_file;
|
||||
save_file[0]=0;
|
||||
}
|
||||
error |= run_query(&cur_con->mysql, q); break;
|
||||
}
|
||||
case Q_RESULT:
|
||||
get_file_name(save_file,q);
|
||||
require_file=0;
|
||||
break;
|
||||
case Q_REQUIRE:
|
||||
get_file_name(save_file,q);
|
||||
require_file=1;
|
||||
break;
|
||||
case Q_COMMENT: /* Ignore row */
|
||||
case Q_COMMENT_WITH_COMMAND:
|
||||
default: processed = 0; break;
|
||||
}
|
||||
}
|
||||
@ -1308,7 +1334,7 @@ int main(int argc, char** argv)
|
||||
if (result_file && ds_res.len)
|
||||
{
|
||||
if(!record)
|
||||
error |= check_result(&ds_res, result_file);
|
||||
error |= check_result(&ds_res, result_file, q->require_file);
|
||||
else
|
||||
str_to_file(result_file, ds_res.str, ds_res.len);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(sql/mysqld.cc)
|
||||
AC_CANONICAL_SYSTEM
|
||||
# The Docs Makefile.am parses this line!
|
||||
AM_INIT_AUTOMAKE(mysql, 3.23.29a-gamma)
|
||||
AM_INIT_AUTOMAKE(mysql, 3.23.30-gamma)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
PROTOCOL_VERSION=10
|
||||
|
@ -393,7 +393,7 @@ static int examine_log(my_string file_name, char **table_names)
|
||||
char *pos,*to;
|
||||
|
||||
/* Fix if old DOS files to new format */
|
||||
for (pos=file_info.name; pos=strchr(pos,'\\') ; pos++)
|
||||
for (pos=file_info.name; (pos=strchr(pos,'\\')) ; pos++)
|
||||
*pos= '/';
|
||||
|
||||
pos=file_info.name;
|
||||
|
2
mysql-test/include/have_bdb.inc
Normal file
2
mysql-test/include/have_bdb.inc
Normal file
@ -0,0 +1,2 @@
|
||||
-- require r/have_bdb.require
|
||||
show variables like "have_bdb";
|
2
mysql-test/include/have_isam.inc
Normal file
2
mysql-test/include/have_isam.inc
Normal file
@ -0,0 +1,2 @@
|
||||
-- require r/have_isam.require
|
||||
show variables like "have_isam";
|
@ -189,6 +189,10 @@ fail_inc () {
|
||||
TOT_FAIL=`$EXPR $TOT_FAIL + 1`
|
||||
}
|
||||
|
||||
skip_inc () {
|
||||
TOT_SKIP=`$EXPR $TOT_SKIP + 1`
|
||||
}
|
||||
|
||||
total_inc () {
|
||||
TOT_TEST=`$EXPR $TOT_TEST + 1`
|
||||
}
|
||||
@ -463,9 +467,14 @@ run_testcase ()
|
||||
$SETCOLOR_NORMAL && $ECHO -n "$pname $timestr"
|
||||
|
||||
|
||||
total_inc
|
||||
|
||||
if [ $res != 0 ]; then
|
||||
if [ $res == 0 ]; then
|
||||
total_inc
|
||||
pass_inc
|
||||
echo "$RES_SPACE [ pass ]"
|
||||
else
|
||||
if [ $res == 1 ]; then
|
||||
total_inc
|
||||
fail_inc
|
||||
echo "$RES_SPACE [ fail ]"
|
||||
$ECHO "failed output"
|
||||
@ -483,10 +492,10 @@ run_testcase ()
|
||||
echo "Resuming Tests"
|
||||
else
|
||||
pass_inc
|
||||
echo "$RES_SPACE [ pass ]"
|
||||
echo "$RES_SPACE [ skipped ]"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -525,7 +534,8 @@ then
|
||||
done
|
||||
fi
|
||||
else
|
||||
tf=$TESTDIR/$1.$TESTSUFFIX
|
||||
tname=`$BASENAME $1 .test`
|
||||
tf=$TESTDIR/$tname.$TESTSUFFIX
|
||||
if [ -f $tf ] ; then
|
||||
run_testcase $tf
|
||||
else
|
||||
|
@ -22,3 +22,6 @@ id code name
|
||||
7 4 Matt
|
||||
8 1 Sinisa
|
||||
12 1 Ralph
|
||||
gesuchnr benutzer_id
|
||||
1 1
|
||||
2 1
|
||||
|
2
mysql-test/r/have_bdb.require
Normal file
2
mysql-test/r/have_bdb.require
Normal file
@ -0,0 +1,2 @@
|
||||
Variable_name Value
|
||||
have_bdb YES
|
2
mysql-test/r/have_isam.require
Normal file
2
mysql-test/r/have_isam.require
Normal file
@ -0,0 +1,2 @@
|
||||
Variable_name Value
|
||||
have_isam YES
|
@ -1,3 +1,5 @@
|
||||
-- source include/have_bdb.inc
|
||||
|
||||
drop table if exists t1;
|
||||
create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=bdb;
|
||||
|
||||
@ -10,3 +12,19 @@ update ignore t1 set id = id + 10, name = 'Ralph' where id < 4;
|
||||
select id, code, name from t1 order by id;
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test replace
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
gesuchnr int(11) DEFAULT '0' NOT NULL,
|
||||
benutzer_id int(11) DEFAULT '0' NOT NULL,
|
||||
PRIMARY KEY (gesuchnr,benutzer_id)
|
||||
) type=BDB;
|
||||
|
||||
replace into t1 (gesuchnr,benutzer_id) values (2,1);
|
||||
replace into t1 (gesuchnr,benutzer_id) values (1,1);
|
||||
replace into t1 (gesuchnr,benutzer_id) values (1,1);
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
@ -1,11 +0,0 @@
|
||||
connect (master,localhost,root,,test,0,var/tmp/mysql.sock);
|
||||
connect (master1,localhost,root,,test,0,var/tmp/mysql.sock);
|
||||
connect (slave,localhost,root,,test,0,var/tmp/mysql-slave.sock);
|
||||
connect (slave1,localhost,root,,test,0,var/tmp/mysql-slave.sock);
|
||||
connection slave;
|
||||
!slave stop;
|
||||
connection master;
|
||||
reset master;
|
||||
connection slave;
|
||||
reset slave;
|
||||
!slave start;
|
@ -1,5 +1,7 @@
|
||||
-- source include/have_isam.inc
|
||||
|
||||
#
|
||||
# Test of REPLACE with ISAM and MyISAM and BDB
|
||||
# Test of REPLACE with ISAM and MyISAM and HEAP
|
||||
#
|
||||
|
||||
drop table if exists t1;
|
||||
@ -15,8 +17,6 @@ replace into t1 (gesuchnr,benutzer_id) values (1,1);
|
||||
replace into t1 (gesuchnr,benutzer_id) values (1,1);
|
||||
alter table t1 type=myisam;
|
||||
replace into t1 (gesuchnr,benutzer_id) values (1,1);
|
||||
alter table t1 type=bdb;
|
||||
replace into t1 (gesuchnr,benutzer_id) values (1,1);
|
||||
alter table t1 type=heap;
|
||||
replace into t1 (gesuchnr,benutzer_id) values (1,1);
|
||||
drop table t1;
|
||||
|
@ -330,7 +330,7 @@ static struct option long_options[] =
|
||||
|
||||
static void usage(int version)
|
||||
{
|
||||
printf("%s Ver 3.1 Distrib %s, for %s (%s)\n",
|
||||
printf("%s Ver 3.2 Distrib %s, for %s (%s)\n",
|
||||
my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
|
||||
if (version)
|
||||
return;
|
||||
@ -350,7 +350,7 @@ static void usage(int version)
|
||||
}
|
||||
|
||||
static uint best_type;
|
||||
static ulong best_t1,best_t2;
|
||||
static ulong best_t1,best_t2, best_start_value;
|
||||
|
||||
static int get_options(int argc, char **argv)
|
||||
{
|
||||
@ -510,8 +510,10 @@ int main(int argc,char **argv)
|
||||
best_mod=function_mod; best_add=function_plus;
|
||||
best_functype=function_type;
|
||||
best_t1=t1; best_t2=t2; best_type=type;
|
||||
printf("\nstart_value=%ldL; best_t1=%ldL; best_t2=%ldL; best_type=%d; /* mode=%d add=%d func_type: %d */\n",
|
||||
start_value,best_t1,best_t2,best_type,best_mod,best_add,best_functype);
|
||||
best_start_value=start_value;
|
||||
printf("\nstart_value=%ldL; best_t1=%ldL; best_t2=%ldL; best_type=%d; /* mode=%d add=%d type: %d */\n",
|
||||
best_start_value,best_t1,best_t2,best_type,best_mod,best_add,
|
||||
best_functype);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -538,7 +540,7 @@ printf("/* This code is generated by gen_lex_hash.cc that seeks for a perfect\nh
|
||||
print_arrays();
|
||||
|
||||
printf("/* start_value=%ldL; best_t1=%ldL; best_t2=%ldL; best_type=%d; */ /* mode=%d add=%d t ype: %d */\n\n",
|
||||
start_value, best_t1, best_t2,best_type,
|
||||
best_start_value, best_t1, best_t2, best_type,
|
||||
best_mod, best_add, best_functype);
|
||||
|
||||
printf("inline SYMBOL *get_hash_symbol(const char *s,unsigned int length,bool function)\n\
|
||||
|
@ -89,7 +89,7 @@ static DB_ENV *db_env;
|
||||
static HASH bdb_open_tables;
|
||||
|
||||
const char *berkeley_lock_names[] =
|
||||
{ "DEFAULT", "OLDEST","RANDOM","YOUNGEST" };
|
||||
{ "DEFAULT", "OLDEST","RANDOM","YOUNGEST",0 };
|
||||
u_int32_t berkeley_lock_types[]=
|
||||
{ DB_LOCK_DEFAULT, DB_LOCK_OLDEST, DB_LOCK_RANDOM };
|
||||
TYPELIB berkeley_lock_typelib= {array_elements(berkeley_lock_names),"",
|
||||
|
@ -91,7 +91,7 @@ class ha_berkeley: public handler
|
||||
HA_BLOB_KEY | HA_NOT_EXACT_COUNT |
|
||||
HA_PRIMARY_KEY_IN_READ_INDEX | HA_DROP_BEFORE_CREATE |
|
||||
HA_AUTO_PART_KEY),
|
||||
last_dup_key((uint) -1),version(0)
|
||||
last_dup_key((uint) -1),version(0),using_ignore(0)
|
||||
{
|
||||
}
|
||||
~ha_berkeley() {}
|
||||
|
@ -25,7 +25,7 @@
|
||||
#define NO_HASH /* Not yet implemented */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_BERKELEY_DB) || defined(HAVE_INNOBASE_DB) || defined(HAVE_GEMENI_DB)
|
||||
#if defined(HAVE_BERKELEY_DB) || defined(HAVE_INNOBASE_DB) || defined(HAVE_GEMINI_DB)
|
||||
#define USING_TRANSACTIONS
|
||||
#endif
|
||||
|
||||
@ -121,7 +121,7 @@ enum row_type { ROW_TYPE_DEFAULT, ROW_TYPE_FIXED, ROW_TYPE_DYNAMIC,
|
||||
typedef struct st_thd_trans {
|
||||
void *bdb_tid;
|
||||
void *innobase_tid;
|
||||
void *gemeni_tid;
|
||||
void *gemini_tid;
|
||||
} THD_TRANS;
|
||||
|
||||
typedef struct st_ha_create_information
|
||||
|
@ -151,16 +151,21 @@ SHOW_COMP_OPTION have_berkeley_db=SHOW_OPTION_YES;
|
||||
#else
|
||||
SHOW_COMP_OPTION have_berkeley_db=SHOW_OPTION_NO;
|
||||
#endif
|
||||
#ifdef HAVE_GEMENI_DB
|
||||
SHOW_COMP_OPTION have_gemeni=SHOW_OPTION_YES;
|
||||
#ifdef HAVE_GEMINI_DB
|
||||
SHOW_COMP_OPTION have_gemini=SHOW_OPTION_YES;
|
||||
#else
|
||||
SHOW_COMP_OPTION have_gemeni=SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_gemini=SHOW_OPTION_NO;
|
||||
#endif
|
||||
#ifdef HAVE_INNOBASE_DB
|
||||
SHOW_COMP_OPTION have_innobase=SHOW_OPTION_YES;
|
||||
#else
|
||||
SHOW_COMP_OPTION have_innobase=SHOW_OPTION_NO;
|
||||
#endif
|
||||
#ifndef NO_ISAM
|
||||
SHOW_COMP_OPTION have_isam=SHOW_OPTION_YES;
|
||||
#else
|
||||
SHOW_COMP_OPTION have_isam=SHOW_OPTION_NO;
|
||||
#endif
|
||||
#ifdef USE_RAID
|
||||
SHOW_COMP_OPTION have_raid=SHOW_OPTION_YES;
|
||||
#else
|
||||
@ -1137,27 +1142,23 @@ static sig_handler handle_segfault(int sig)
|
||||
return;
|
||||
segfaulted = 1;
|
||||
fprintf(stderr,"\
|
||||
mysqld got signal %s in thread %d; \n\
|
||||
mysqld got signal %d;\n\
|
||||
The manual section 'Debugging a MySQL server' tells you how to use a \n\
|
||||
debugger on the core file to produce a backtrace that may help you find out\n\
|
||||
why mysqld died\n",sys_siglist[sig],getpid());
|
||||
#if defined(HAVE_LINUXTHREADS) && defined(__i386__)
|
||||
why mysqld died\n",sig);
|
||||
#if defined(HAVE_LINUXTHREADS)
|
||||
#ifdef __i386__
|
||||
trace_stack();
|
||||
#endif
|
||||
#ifdef HAVE_LINUXTHREADS
|
||||
#endif /* __i386__ */
|
||||
if (test_flags & TEST_CORE_ON_SIGNAL)
|
||||
write_core(sig);
|
||||
else
|
||||
#endif /* HAVE_LINUXTHREADS */
|
||||
exit(1);
|
||||
#else
|
||||
exit(1); /* abort everything */
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_LINUXTHREADS
|
||||
|
||||
/* Produce a core for the thread */
|
||||
|
||||
#ifdef HAVE_LINUXTHREADS
|
||||
static sig_handler write_core(int sig)
|
||||
{
|
||||
signal(sig, SIG_DFL);
|
||||
@ -2623,8 +2624,9 @@ struct show_var_st init_vars[]= {
|
||||
{"flush", (char*) &myisam_flush, SHOW_MY_BOOL},
|
||||
{"flush_time", (char*) &flush_time, SHOW_LONG},
|
||||
{"have_bdb", (char*) &have_berkeley_db, SHOW_HAVE},
|
||||
{"have_gemeni", (char*) &have_gemeni, SHOW_HAVE},
|
||||
{"have_gemini", (char*) &have_gemini, SHOW_HAVE},
|
||||
{"have_innobase", (char*) &have_innobase, SHOW_HAVE},
|
||||
{"have_isam", (char*) &have_isam, SHOW_HAVE},
|
||||
{"have_raid", (char*) &have_raid, SHOW_HAVE},
|
||||
{"have_ssl", (char*) &have_ssl, SHOW_HAVE},
|
||||
{"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR},
|
||||
|
@ -301,7 +301,7 @@ public:
|
||||
{
|
||||
return (transaction.all.bdb_tid != 0 ||
|
||||
transaction.all.innobase_tid != 0 ||
|
||||
transaction.all.gemeni_tid != 0);
|
||||
transaction.all.gemini_tid != 0);
|
||||
}
|
||||
inline gptr alloc(unsigned int size) { return alloc_root(&mem_root,size); }
|
||||
inline gptr calloc(unsigned int size)
|
||||
|
Reference in New Issue
Block a user