1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Merge with MariaDB 5.1.49

Removed references to HA_END_SPACE_KEY (which has been 0 for a long time)
This commit is contained in:
Michael Widenius
2010-08-05 22:56:11 +03:00
820 changed files with 37170 additions and 19216 deletions

View File

@ -18137,6 +18137,181 @@ static void test_bug53371()
}
static void test_bug53907()
{
int rc;
char buf[] = "\x4test\x14../client_test_db/t1";
myheader("test_bug53907");
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
myquery(rc);
rc= mysql_query(mysql, "DROP DATABASE IF EXISTS bug53907");
myquery(rc);
rc= mysql_query(mysql, "DROP USER 'testbug'@localhost");
rc= mysql_query(mysql, "CREATE TABLE t1 (a INT)");
myquery(rc);
rc= mysql_query(mysql, "CREATE DATABASE bug53907");
myquery(rc);
rc= mysql_query(mysql, "GRANT SELECT ON bug53907.* to 'testbug'@localhost");
myquery(rc);
rc= mysql_change_user(mysql, "testbug", NULL, "bug53907");
myquery(rc);
rc= simple_command(mysql, COM_TABLE_DUMP, (uchar*) buf, sizeof(buf), 0);
fprintf(stderr, ">>>>>>>>> %d\n", mysql_errno(mysql));
DIE_UNLESS(mysql_errno(mysql) == 1103); /* ER_WRONG_TABLE_NAME */
rc= mysql_change_user(mysql, opt_user, opt_password, current_db);
myquery(rc);
rc= mysql_query(mysql, "DROP TABLE t1");
myquery(rc);
rc= mysql_query(mysql, "DROP DATABASE bug53907");
myquery(rc);
rc= mysql_query(mysql, "DROP USER 'testbug'@localhost");
myquery(rc);
}
/**
Bug#42373: libmysql can mess a connection at connect
*/
static void test_bug42373()
{
int rc;
MYSQL con;
MYSQL_STMT *stmt;
DBUG_ENTER("test_bug42373");
myheader("test_42373");
rc= mysql_query(mysql, "DROP PROCEDURE IF EXISTS p1");
myquery(rc);
rc= mysql_query(mysql, "CREATE PROCEDURE p1()"
" BEGIN"
" SELECT 1;"
" INSERT INTO t1 VALUES (2);"
"END;");
myquery(rc);
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
myquery(rc);
rc= mysql_query(mysql, "CREATE TABLE t1 (a INT)");
myquery(rc);
/* Try with a stored procedure. */
DIE_UNLESS(mysql_client_init(&con));
mysql_options(&con, MYSQL_INIT_COMMAND, "CALL p1()");
DIE_UNLESS(mysql_real_connect(&con, opt_host, opt_user, opt_password,
current_db, opt_port, opt_unix_socket,
CLIENT_MULTI_STATEMENTS|CLIENT_MULTI_RESULTS));
stmt= mysql_simple_prepare(&con, "SELECT a FROM t1");
check_stmt(stmt);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
rc= my_process_stmt_result(stmt);
DIE_UNLESS(rc == 1);
mysql_stmt_close(stmt);
/* Now try with a multi-statement. */
DIE_UNLESS(mysql_client_init(&con));
mysql_options(&con, MYSQL_INIT_COMMAND,
"SELECT 3; INSERT INTO t1 VALUES (4)");
DIE_UNLESS(mysql_real_connect(&con, opt_host, opt_user, opt_password,
current_db, opt_port, opt_unix_socket,
CLIENT_MULTI_STATEMENTS|CLIENT_MULTI_RESULTS));
stmt= mysql_simple_prepare(&con, "SELECT a FROM t1");
check_stmt(stmt);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
rc= my_process_stmt_result(stmt);
DIE_UNLESS(rc == 2);
mysql_stmt_close(stmt);
mysql_close(&con);
rc= mysql_query(mysql, "DROP TABLE t1");
myquery(rc);
rc= mysql_query(mysql, "DROP PROCEDURE p1");
myquery(rc);
DBUG_VOID_RETURN;
}
/**
Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run
*/
static void test_bug54041()
{
int rc;
MYSQL_STMT *stmt;
MYSQL_BIND bind;
DBUG_ENTER("test_bug54041");
myheader("test_bug54041");
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
myquery(rc);
rc= mysql_query(mysql, "CREATE TABLE t1 (a INT)");
myquery(rc);
stmt= mysql_simple_prepare(mysql, "INSERT INTO t1 (a) VALUES (?)");
check_stmt(stmt);
verify_param_count(stmt, 1);
memset(&bind, 0, sizeof(bind));
/* Any type that does not support long data handling. */
bind.buffer_type= MYSQL_TYPE_LONG;
rc= mysql_stmt_bind_param(stmt, &bind);
check_execute(stmt, rc);
/*
Trick the client API into sending a long data packet for
the parameter. Long data is only supported for string and
binary types.
*/
stmt->params[0].buffer_type= MYSQL_TYPE_STRING;
rc= mysql_stmt_send_long_data(stmt, 0, "data", 5);
check_execute(stmt, rc);
/* Undo API violation. */
stmt->params[0].buffer_type= MYSQL_TYPE_LONG;
rc= mysql_stmt_execute(stmt);
/* Incorrect arguments. */
check_execute_r(stmt, rc);
mysql_stmt_close(stmt);
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
myquery(rc);
DBUG_VOID_RETURN;
}
/*
Read and parse arguments and MySQL options from my.cnf
*/
@ -18146,17 +18321,17 @@ static char **defaults_argv;
static struct my_option client_test_long_options[] =
{
{"basedir", 'b', "Basedir for tests.", (uchar**) &opt_basedir,
(uchar**) &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"count", 't', "Number of times test to be executed", (uchar **) &opt_count,
(uchar **) &opt_count, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
{"database", 'D', "Database to use", (uchar **) &opt_db, (uchar **) &opt_db,
{"basedir", 'b', "Basedir for tests.", &opt_basedir,
&opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"count", 't', "Number of times test to be executed", &opt_count,
&opt_count, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
{"database", 'D', "Database to use", &opt_db, &opt_db,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log", (uchar**) &default_dbug_option,
(uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log", &default_dbug_option,
&default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0},
{"host", 'h', "Connect to host", (uchar **) &opt_host, (uchar **) &opt_host,
{"host", 'h', "Connect to host", &opt_host, &opt_host,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.",
@ -18167,8 +18342,7 @@ static struct my_option client_test_long_options[] =
"/etc/services, "
#endif
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
(uchar **) &opt_port,
(uchar **) &opt_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
&opt_port, &opt_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-arg", 'A', "Send embedded server this as a parameter.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"show-tests", 'T', "Show all tests' names", 0, 0, 0, GET_NO_ARG, NO_ARG,
@ -18177,23 +18351,23 @@ static struct my_option client_test_long_options[] =
0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", 'm', "Base name of shared memory.",
(uchar**) &shared_memory_base_name, (uchar**)&shared_memory_base_name, 0,
&shared_memory_base_name, (uchar**)&shared_memory_base_name, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"socket", 'S', "Socket file to use for connection",
(uchar **) &opt_unix_socket, (uchar **) &opt_unix_socket, 0, GET_STR,
&opt_unix_socket, &opt_unix_socket, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"testcase", 'c',
"May disable some code when runs as mysql-test-run testcase.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user", (uchar **) &opt_user,
(uchar **) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "User for login if not current user", &opt_user,
&opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"vardir", 'v', "Data dir for tests.", (uchar**) &opt_vardir,
(uchar**) &opt_vardir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"vardir", 'v', "Data dir for tests.", &opt_vardir,
&opt_vardir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"getopt-ll-test", 'g', "Option for testing bug in getopt library",
(uchar **) &opt_getopt_ll_test, (uchar **) &opt_getopt_ll_test, 0,
&opt_getopt_ll_test, &opt_getopt_ll_test, 0,
GET_LL, REQUIRED_ARG, 0, 0, LONGLONG_MAX, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@ -18447,6 +18621,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug20023", test_bug20023 },
{ "test_bug45010", test_bug45010 },
{ "test_bug53371", test_bug53371 },
{ "test_bug53907", test_bug53907 },
{ "test_bug31418", test_bug31418 },
{ "test_bug31669", test_bug31669 },
{ "test_bug28386", test_bug28386 },
@ -18458,6 +18633,8 @@ static struct my_tests_st my_tests[]= {
{ "test_bug36326", test_bug36326 },
{ "test_bug41078", test_bug41078 },
{ "test_bug44495", test_bug44495 },
{ "test_bug42373", test_bug42373 },
{ "test_bug54041", test_bug54041 },
{ 0, 0 }
};