1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

merging from 5.1 to rep+2 starting at gca(5.1, next-mr) == build@mysql.com-20091104182209-iui387z35159aoyw

This commit is contained in:
Andrei Elkin
2009-11-30 14:34:39 +02:00
207 changed files with 4971 additions and 1562 deletions

View File

@ -46,6 +46,9 @@ static char *opt_user= 0;
static char *opt_password= 0;
static char *opt_host= 0;
static char *opt_unix_socket= 0;
#ifdef HAVE_SMEM
static char *shared_memory_base_name= 0;
#endif
static unsigned int opt_port;
static my_bool tty_password= 0, opt_silent= 0;
@ -230,6 +233,26 @@ static void print_st_error(MYSQL_STMT *stmt, const char *msg)
}
}
/*
Enhanced version of mysql_client_init(), which may also set shared memory
base on Windows.
*/
static MYSQL *mysql_client_init(MYSQL* con)
{
MYSQL* res = mysql_init(con);
#ifdef HAVE_SMEM
if (res && shared_memory_base_name)
mysql_options(res, MYSQL_SHARED_MEMORY_BASE_NAME, shared_memory_base_name);
#endif
return res;
}
/*
Disable direct calls of mysql_init, as it disregards shared memory base.
*/
#define mysql_init(A) Please use mysql_client_init instead of mysql_init
/* Check if the connection has InnoDB tables */
static my_bool check_have_innodb(MYSQL *conn)
@ -293,10 +316,10 @@ static MYSQL* client_connect(ulong flag, uint protocol, my_bool auto_reconnect)
fprintf(stdout, "\n Establishing a connection to '%s' ...",
opt_host ? opt_host : "");
if (!(mysql= mysql_init(NULL)))
if (!(mysql= mysql_client_init(NULL)))
{
opt_silent= 0;
myerror("mysql_init() failed");
myerror("mysql_client_init() failed");
exit(1);
}
/* enable local infile, in non-binary builds often disabled by default */
@ -1160,9 +1183,9 @@ static my_bool thread_query(char *query)
error= 0;
if (!opt_silent)
fprintf(stdout, "\n in thread_query(%s)", query);
if (!(l_mysql= mysql_init(NULL)))
if (!(l_mysql= mysql_client_init(NULL)))
{
myerror("mysql_init() failed");
myerror("mysql_client_init() failed");
return 1;
}
if (!(mysql_real_connect(l_mysql, opt_host, opt_user,
@ -2512,9 +2535,9 @@ static void test_ps_query_cache()
case TEST_QCACHE_ON_WITH_OTHER_CONN:
if (!opt_silent)
fprintf(stdout, "\n Establishing a test connection ...");
if (!(lmysql= mysql_init(NULL)))
if (!(lmysql= mysql_client_init(NULL)))
{
printf("mysql_init() failed");
printf("mysql_client_init() failed");
DIE_UNLESS(0);
}
if (!(mysql_real_connect(lmysql, opt_host, opt_user,
@ -4960,9 +4983,9 @@ static void test_stmt_close()
if (!opt_silent)
fprintf(stdout, "\n Establishing a test connection ...");
if (!(lmysql= mysql_init(NULL)))
if (!(lmysql= mysql_client_init(NULL)))
{
myerror("mysql_init() failed");
myerror("mysql_client_init() failed");
exit(1);
}
if (!(mysql_real_connect(lmysql, opt_host, opt_user,
@ -5851,9 +5874,9 @@ DROP TABLE IF EXISTS test_multi_tab";
rc= mysql_more_results(mysql);
DIE_UNLESS(rc == 0);
if (!(mysql_local= mysql_init(NULL)))
if (!(mysql_local= mysql_client_init(NULL)))
{
fprintf(stdout, "\n mysql_init() failed");
fprintf(stdout, "\n mysql_client_init() failed");
exit(1);
}
@ -5976,9 +5999,9 @@ static void test_prepare_multi_statements()
char query[MAX_TEST_QUERY_LENGTH];
myheader("test_prepare_multi_statements");
if (!(mysql_local= mysql_init(NULL)))
if (!(mysql_local= mysql_client_init(NULL)))
{
fprintf(stderr, "\n mysql_init() failed");
fprintf(stderr, "\n mysql_client_init() failed");
exit(1);
}
@ -7459,9 +7482,9 @@ static void test_prepare_grant()
if (!opt_silent)
fprintf(stdout, "\n Establishing a test connection ...");
if (!(lmysql= mysql_init(NULL)))
if (!(lmysql= mysql_client_init(NULL)))
{
myerror("mysql_init() failed");
myerror("mysql_client_init() failed");
exit(1);
}
if (!(mysql_real_connect(lmysql, opt_host, "test_grant",
@ -7915,9 +7938,9 @@ static void test_drop_temp()
if (!opt_silent)
fprintf(stdout, "\n Establishing a test connection ...");
if (!(lmysql= mysql_init(NULL)))
if (!(lmysql= mysql_client_init(NULL)))
{
myerror("mysql_init() failed");
myerror("mysql_client_init() failed");
exit(1);
}
@ -13159,7 +13182,7 @@ static void test_bug15518()
int rc;
myheader("test_bug15518");
mysql1= mysql_init(NULL);
mysql1= mysql_client_init(NULL);
if (!mysql_real_connect(mysql1, opt_host, opt_user, opt_password,
opt_db ? opt_db : "test", opt_port, opt_unix_socket,
@ -13315,9 +13338,9 @@ static void test_bug8378()
if (!opt_silent)
fprintf(stdout, "\n Establishing a test connection ...");
if (!(lmysql= mysql_init(NULL)))
if (!(lmysql= mysql_client_init(NULL)))
{
myerror("mysql_init() failed");
myerror("mysql_client_init() failed");
exit(1);
}
if (mysql_options(lmysql, MYSQL_SET_CHARSET_NAME, "gbk"))
@ -13856,7 +13879,7 @@ static void test_bug9992()
if (!opt_silent)
printf("Establishing a connection with option CLIENT_MULTI_STATEMENTS..\n");
mysql1= mysql_init(NULL);
mysql1= mysql_client_init(NULL);
if (!mysql_real_connect(mysql1, opt_host, opt_user, opt_password,
opt_db ? opt_db : "test", opt_port, opt_unix_socket,
@ -14445,9 +14468,9 @@ static void test_bug12001()
myheader("test_bug12001");
if (!(mysql_local= mysql_init(NULL)))
if (!(mysql_local= mysql_client_init(NULL)))
{
fprintf(stdout, "\n mysql_init() failed");
fprintf(stdout, "\n mysql_client_init() failed");
exit(1);
}
@ -15172,9 +15195,9 @@ static void test_opt_reconnect()
myheader("test_opt_reconnect");
if (!(lmysql= mysql_init(NULL)))
if (!(lmysql= mysql_client_init(NULL)))
{
myerror("mysql_init() failed");
myerror("mysql_client_init() failed");
exit(1);
}
@ -15209,9 +15232,9 @@ static void test_opt_reconnect()
mysql_close(lmysql);
if (!(lmysql= mysql_init(NULL)))
if (!(lmysql= mysql_client_init(NULL)))
{
myerror("mysql_init() failed");
myerror("mysql_client_init() failed");
DIE_UNLESS(0);
}
@ -15246,7 +15269,7 @@ static void test_bug12744()
int rc;
myheader("test_bug12744");
lmysql= mysql_init(NULL);
lmysql= mysql_client_init(NULL);
DIE_UNLESS(lmysql);
if (!mysql_real_connect(lmysql, opt_host, opt_user, opt_password,
@ -15819,7 +15842,7 @@ static void test_bug15752()
rc= mysql_query(mysql, "create procedure p1() select 1");
myquery(rc);
mysql_init(&mysql_local);
mysql_client_init(&mysql_local);
if (! mysql_real_connect(&mysql_local, opt_host, opt_user,
opt_password, current_db, opt_port,
opt_unix_socket,
@ -16705,7 +16728,7 @@ static void test_bug29692()
{
MYSQL* conn;
if (!(conn= mysql_init(NULL)))
if (!(conn= mysql_client_init(NULL)))
{
myerror("test_bug29692 init failed");
exit(1);
@ -16840,7 +16863,7 @@ static void test_bug30472()
/* Create a new connection. */
DIE_UNLESS(mysql_init(&con));
DIE_UNLESS(mysql_client_init(&con));
DIE_UNLESS(mysql_real_connect(&con,
opt_host,
@ -17014,7 +17037,7 @@ static void test_bug20023()
/* Create a new connection. */
DIE_UNLESS(mysql_init(&con));
DIE_UNLESS(mysql_client_init(&con));
DIE_UNLESS(mysql_real_connect(&con,
opt_host,
@ -17151,7 +17174,7 @@ static void bug31418_impl()
/* Create a new connection. */
DIE_UNLESS(mysql_init(&con));
DIE_UNLESS(mysql_client_init(&con));
DIE_UNLESS(mysql_real_connect(&con,
opt_host,
@ -18001,7 +18024,7 @@ static void test_bug44495()
"END;");
myquery(rc);
DIE_UNLESS(mysql_init(&con));
DIE_UNLESS(mysql_client_init(&con));
DIE_UNLESS(mysql_real_connect(&con, opt_host, opt_user, opt_password,
current_db, opt_port, opt_unix_socket,
@ -18064,6 +18087,11 @@ static struct my_option client_test_long_options[] =
0, 0, 0, 0, 0, 0},
{"silent", 's', "Be more silent", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0,
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,
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,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},