mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
Merge mleich@bk-internal.mysql.com:/home/bk/mysql-4.1
into three.local.lan:/home/matthias/Arbeit/mysql-4.1/src
This commit is contained in:
commit
257d1f6db3
105 changed files with 1576 additions and 905 deletions
|
@ -140,6 +140,7 @@ msvensson@build.mysql.com
|
|||
mwagner@cash.mwagner.org
|
||||
mwagner@evoq.mwagner.org
|
||||
mwagner@here.mwagner.org
|
||||
mwagner@mysql.com
|
||||
mwagner@work.mysql.com
|
||||
mydev@mysql.com
|
||||
mysql@home.(none)
|
||||
|
|
|
@ -125,6 +125,10 @@ static TYPELIB command_typelib=
|
|||
|
||||
static struct my_option my_long_options[] =
|
||||
{
|
||||
#ifdef __NETWARE__
|
||||
{"autoclose", 'a', " Auto close the screen on exit for NetWare",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
{"count", 'c',
|
||||
"Number of iterations to make. This works with -i (--sleep) only.",
|
||||
(gptr*) &nr_iterations, (gptr*) &nr_iterations, 0, GET_UINT,
|
||||
|
@ -218,6 +222,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
int error = 0;
|
||||
|
||||
switch(optid) {
|
||||
#ifdef __NETWARE__
|
||||
case 'a':
|
||||
setscreenmode(SCR_AUTOCLOSE_ON_EXIT); // auto close the screen /
|
||||
break;
|
||||
#endif
|
||||
case 'c':
|
||||
opt_count_iterations= 1;
|
||||
break;
|
||||
|
@ -816,10 +825,17 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
|||
}
|
||||
if (argv[1][0])
|
||||
{
|
||||
char *pw= argv[1];
|
||||
#ifdef __WIN__
|
||||
uint pw_len= strlen(pw);
|
||||
if (pw_len > 1 && pw[0] == '\'' && pw[pw_len-1] == '\'')
|
||||
printf("Warning: single quotes were not trimmed from the password by"
|
||||
" your command\nline client, as you might have expected.\n");
|
||||
#endif
|
||||
if (find_type(argv[0], &command_typelib, 2) == ADMIN_OLD_PASSWORD)
|
||||
make_scrambled_password_323(crypted_pw, argv[1]);
|
||||
make_scrambled_password_323(crypted_pw, pw);
|
||||
else
|
||||
make_scrambled_password(crypted_pw, argv[1]);
|
||||
make_scrambled_password(crypted_pw, pw);
|
||||
}
|
||||
else
|
||||
crypted_pw[0]=0; /* No password */
|
||||
|
|
|
@ -1890,7 +1890,7 @@ static int init_dumping(char *database)
|
|||
MYSQL_ROW row;
|
||||
MYSQL_RES *dbinfo;
|
||||
|
||||
sprintf(qbuf,"SHOW CREATE DATABASE WITH IF NOT EXISTS %s",
|
||||
sprintf(qbuf,"SHOW CREATE DATABASE IF NOT EXISTS %s",
|
||||
qdatabase);
|
||||
|
||||
if (mysql_query_with_error_report(sock, &dbinfo, qbuf))
|
||||
|
|
|
@ -41,6 +41,13 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
|
|||
{
|
||||
HP_KEYDEF *keyinfo;
|
||||
DBUG_PRINT("info",("Initializing new table"));
|
||||
|
||||
/*
|
||||
We have to store sometimes byte* del_link in records,
|
||||
so the record length should be at least sizeof(byte*)
|
||||
*/
|
||||
set_if_bigger(reclength, sizeof (byte*));
|
||||
|
||||
for (i= key_segs= max_length= 0, keyinfo= keydef; i < keys; i++, keyinfo++)
|
||||
{
|
||||
bzero((char*) &keyinfo->block,sizeof(keyinfo->block));
|
||||
|
|
|
@ -41,7 +41,9 @@ AC_CHECK_SIZEOF(long, 4)
|
|||
AC_CHECK_SIZEOF(void*, 4)
|
||||
AC_CHECK_FUNCS(sched_yield)
|
||||
AC_CHECK_FUNCS(fdatasync)
|
||||
#AC_CHECK_FUNCS(localtime_r) # Already checked by MySQL
|
||||
AC_CHECK_FUNCS(localtime_r)
|
||||
#AC_CHECK_FUNCS(readdir_r) MySQL checks that it has also the right args.
|
||||
# Some versions of Unix only take 2 arguments.
|
||||
#AC_C_INLINE Already checked in MySQL
|
||||
AC_C_BIGENDIAN
|
||||
|
||||
|
|
|
@ -463,13 +463,32 @@ lock_rec_hash(
|
|||
ulint space, /* in: space */
|
||||
ulint page_no);/* in: page number */
|
||||
/*************************************************************************
|
||||
Gets the table covered by an IX table lock. */
|
||||
Gets the source table of an ALTER TABLE transaction. The table must be
|
||||
covered by an IX or IS table lock. */
|
||||
|
||||
dict_table_t*
|
||||
lock_get_ix_table(
|
||||
/*==============*/
|
||||
/* out: the table covered by the lock */
|
||||
lock_t* lock); /* in: table lock */
|
||||
lock_get_src_table(
|
||||
/*===============*/
|
||||
/* out: the source table of transaction,
|
||||
if it is covered by an IX or IS table lock;
|
||||
dest if there is no source table, and
|
||||
NULL if the transaction is locking more than
|
||||
two tables or an inconsistency is found */
|
||||
trx_t* trx, /* in: transaction */
|
||||
dict_table_t* dest, /* in: destination of ALTER TABLE */
|
||||
ulint* mode); /* out: lock mode of the source table */
|
||||
/*************************************************************************
|
||||
Determine if the given table is exclusively "owned" by the given
|
||||
transaction, i.e., transaction holds LOCK_IX and possibly LOCK_AUTO_INC
|
||||
on the table. */
|
||||
|
||||
ibool
|
||||
lock_is_table_exclusive(
|
||||
/*====================*/
|
||||
/* out: TRUE if table is only locked by trx,
|
||||
with LOCK_IX, and possibly LOCK_AUTO_INC */
|
||||
dict_table_t* table, /* in: table */
|
||||
trx_t* trx); /* in: transaction */
|
||||
/*************************************************************************
|
||||
Checks that a transaction id is sensible, i.e., not in the future. */
|
||||
|
||||
|
|
|
@ -177,10 +177,12 @@ row_lock_table_for_mysql(
|
|||
/* out: error code or DB_SUCCESS */
|
||||
row_prebuilt_t* prebuilt, /* in: prebuilt struct in the MySQL
|
||||
table handle */
|
||||
dict_table_t* table); /* in: table to LOCK_IX, or NULL
|
||||
dict_table_t* table, /* in: table to lock, or NULL
|
||||
if prebuilt->table should be
|
||||
locked as LOCK_TABLE_EXP |
|
||||
prebuilt->select_lock_type */
|
||||
ulint mode); /* in: lock mode of table */
|
||||
|
||||
/*************************************************************************
|
||||
Does an insert for MySQL. */
|
||||
|
||||
|
|
|
@ -365,6 +365,21 @@ lock_deadlock_recursive(
|
|||
ulint* cost); /* in/out: number of calculation steps thus
|
||||
far: if this exceeds LOCK_MAX_N_STEPS_...
|
||||
we return TRUE */
|
||||
|
||||
/*************************************************************************
|
||||
Gets the type of a lock. */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
lock_get_type(
|
||||
/*==========*/
|
||||
/* out: LOCK_TABLE or LOCK_REC */
|
||||
lock_t* lock) /* in: lock */
|
||||
{
|
||||
ut_ad(lock);
|
||||
|
||||
return(lock->type_mode & LOCK_TYPE_MASK);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Gets the nth bit of a record lock. */
|
||||
UNIV_INLINE
|
||||
|
@ -395,19 +410,6 @@ lock_rec_get_nth_bit(
|
|||
return(ut_bit_get_nth(b, bit_index));
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Gets the table covered by an IX table lock. */
|
||||
|
||||
dict_table_t*
|
||||
lock_get_ix_table(
|
||||
/*==============*/
|
||||
/* out: the table covered by the lock */
|
||||
lock_t* lock) /* in: table lock */
|
||||
{
|
||||
ut_a(lock->type_mode == (LOCK_TABLE | LOCK_IX));
|
||||
return(lock->un_member.tab_lock.table);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
#define lock_mutex_enter_kernel() mutex_enter(&kernel_mutex)
|
||||
|
@ -581,20 +583,6 @@ lock_get_mode(
|
|||
return(lock->type_mode & LOCK_MODE_MASK);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Gets the type of a lock. */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
lock_get_type(
|
||||
/*==========*/
|
||||
/* out: LOCK_TABLE or LOCK_REC */
|
||||
lock_t* lock) /* in: lock */
|
||||
{
|
||||
ut_ad(lock);
|
||||
|
||||
return(lock->type_mode & LOCK_TYPE_MASK);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Gets the wait flag of a lock. */
|
||||
UNIV_INLINE
|
||||
|
@ -614,6 +602,128 @@ lock_get_wait(
|
|||
return(FALSE);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Gets the source table of an ALTER TABLE transaction. The table must be
|
||||
covered by an IX or IS table lock. */
|
||||
|
||||
dict_table_t*
|
||||
lock_get_src_table(
|
||||
/*===============*/
|
||||
/* out: the source table of transaction,
|
||||
if it is covered by an IX or IS table lock;
|
||||
dest if there is no source table, and
|
||||
NULL if the transaction is locking more than
|
||||
two tables or an inconsistency is found */
|
||||
trx_t* trx, /* in: transaction */
|
||||
dict_table_t* dest, /* in: destination of ALTER TABLE */
|
||||
ulint* mode) /* out: lock mode of the source table */
|
||||
{
|
||||
dict_table_t* src;
|
||||
lock_t* lock;
|
||||
|
||||
src = NULL;
|
||||
*mode = LOCK_NONE;
|
||||
|
||||
for (lock = UT_LIST_GET_FIRST(trx->trx_locks);
|
||||
lock;
|
||||
lock = UT_LIST_GET_NEXT(trx_locks, lock)) {
|
||||
lock_table_t* tab_lock;
|
||||
ulint lock_mode;
|
||||
if (!(lock_get_type(lock) & LOCK_TABLE)) {
|
||||
/* We are only interested in table locks. */
|
||||
continue;
|
||||
}
|
||||
tab_lock = &lock->un_member.tab_lock;
|
||||
if (dest == tab_lock->table) {
|
||||
/* We are not interested in the destination table. */
|
||||
continue;
|
||||
} else if (!src) {
|
||||
/* This presumably is the source table. */
|
||||
src = tab_lock->table;
|
||||
if (UT_LIST_GET_LEN(src->locks) != 1 ||
|
||||
UT_LIST_GET_FIRST(src->locks) != lock) {
|
||||
/* We only support the case when
|
||||
there is only one lock on this table. */
|
||||
return(NULL);
|
||||
}
|
||||
} else if (src != tab_lock->table) {
|
||||
/* The transaction is locking more than
|
||||
two tables (src and dest): abort */
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* Check that the source table is locked by
|
||||
LOCK_IX or LOCK_IS. */
|
||||
lock_mode = lock_get_mode(lock);
|
||||
switch (lock_mode) {
|
||||
case LOCK_IX:
|
||||
case LOCK_IS:
|
||||
if (*mode != LOCK_NONE && *mode != lock_mode) {
|
||||
/* There are multiple locks on src. */
|
||||
return(NULL);
|
||||
}
|
||||
*mode = lock_mode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!src) {
|
||||
/* No source table lock found: flag the situation to caller */
|
||||
src = dest;
|
||||
}
|
||||
|
||||
return(src);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Determine if the given table is exclusively "owned" by the given
|
||||
transaction, i.e., transaction holds LOCK_IX and possibly LOCK_AUTO_INC
|
||||
on the table. */
|
||||
|
||||
ibool
|
||||
lock_is_table_exclusive(
|
||||
/*====================*/
|
||||
/* out: TRUE if table is only locked by trx,
|
||||
with LOCK_IX, and possibly LOCK_AUTO_INC */
|
||||
dict_table_t* table, /* in: table */
|
||||
trx_t* trx) /* in: transaction */
|
||||
{
|
||||
lock_t* lock;
|
||||
bool ok = FALSE;
|
||||
|
||||
ut_ad(table && trx);
|
||||
|
||||
for (lock = UT_LIST_GET_FIRST(table->locks);
|
||||
lock;
|
||||
lock = UT_LIST_GET_NEXT(locks, &lock->un_member.tab_lock)) {
|
||||
if (lock->trx != trx) {
|
||||
/* A lock on the table is held
|
||||
by some other transaction. */
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
if (!(lock_get_type(lock) & LOCK_TABLE)) {
|
||||
/* We are interested in table locks only. */
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (lock_get_mode(lock)) {
|
||||
case LOCK_IX:
|
||||
ok = TRUE;
|
||||
break;
|
||||
case LOCK_AUTO_INC:
|
||||
/* It is allowed for trx to hold an
|
||||
auto_increment lock. */
|
||||
break;
|
||||
default:
|
||||
/* Other table locks than LOCK_IX are not allowed. */
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
return(ok);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Sets the wait flag of a lock and the back pointer in trx to lock. */
|
||||
UNIV_INLINE
|
||||
|
|
|
@ -711,13 +711,41 @@ http://www.mysql.com/doc/en/Windows_symbolic_links.html */
|
|||
char* full_path;
|
||||
int ret;
|
||||
struct stat statinfo;
|
||||
#ifdef HAVE_READDIR_R
|
||||
char dirent_buf[sizeof(struct dirent) + _POSIX_PATH_MAX +
|
||||
100];
|
||||
/* In /mysys/my_lib.c, _POSIX_PATH_MAX + 1 is used as
|
||||
the max file name len; but in most standards, the
|
||||
length is NAME_MAX; we add 100 to be even safer */
|
||||
#endif
|
||||
|
||||
next_file:
|
||||
ent = readdir(dir);
|
||||
|
||||
#ifdef HAVE_READDIR_R
|
||||
ret = readdir_r(dir, (struct dirent*)dirent_buf, &ent);
|
||||
|
||||
if (ret != 0) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: cannot read directory %s, error %lu\n", dirname, (ulong)ret);
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (ent == NULL) {
|
||||
/* End of directory */
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
ut_a(strlen(ent->d_name) < _POSIX_PATH_MAX + 100 - 1);
|
||||
#else
|
||||
ent = readdir(dir);
|
||||
|
||||
if (ent == NULL) {
|
||||
|
||||
return(1);
|
||||
}
|
||||
#endif
|
||||
ut_a(strlen(ent->d_name) < OS_FILE_MAX_PATH);
|
||||
|
||||
if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) {
|
||||
|
|
|
@ -782,10 +782,11 @@ row_lock_table_for_mysql(
|
|||
/* out: error code or DB_SUCCESS */
|
||||
row_prebuilt_t* prebuilt, /* in: prebuilt struct in the MySQL
|
||||
table handle */
|
||||
dict_table_t* table) /* in: table to LOCK_IX, or NULL
|
||||
dict_table_t* table, /* in: table to lock, or NULL
|
||||
if prebuilt->table should be
|
||||
locked as LOCK_TABLE_EXP |
|
||||
prebuilt->select_lock_type */
|
||||
ulint mode) /* in: lock mode of table */
|
||||
{
|
||||
trx_t* trx = prebuilt->trx;
|
||||
que_thr_t* thr;
|
||||
|
@ -819,7 +820,7 @@ run_again:
|
|||
trx_start_if_not_started(trx);
|
||||
|
||||
if (table) {
|
||||
err = lock_table(0, table, LOCK_IX, thr);
|
||||
err = lock_table(0, table, mode, thr);
|
||||
} else {
|
||||
err = lock_table(LOCK_TABLE_EXP, prebuilt->table,
|
||||
prebuilt->select_lock_type, thr);
|
||||
|
|
|
@ -31,6 +31,7 @@ Created 12/19/1997 Heikki Tuuri
|
|||
#include "pars0pars.h"
|
||||
#include "row0mysql.h"
|
||||
#include "read0read.h"
|
||||
#include "buf0lru.h"
|
||||
|
||||
/* Maximum number of rows to prefetch; MySQL interface has another parameter */
|
||||
#define SEL_MAX_N_PREFETCH 16
|
||||
|
|
|
@ -235,13 +235,18 @@ ut_get_year_month_day(
|
|||
*month = (ulint)cal_tm.wMonth;
|
||||
*day = (ulint)cal_tm.wDay;
|
||||
#else
|
||||
struct tm cal_tm;
|
||||
struct tm* cal_tm_ptr;
|
||||
time_t tm;
|
||||
|
||||
time(&tm);
|
||||
|
||||
#ifdef HAVE_LOCALTIME_R
|
||||
localtime_r(&tm, &cal_tm);
|
||||
cal_tm_ptr = &cal_tm;
|
||||
#else
|
||||
cal_tm_ptr = localtime(&tm);
|
||||
|
||||
#endif
|
||||
*year = (ulint)cal_tm_ptr->tm_year + 1900;
|
||||
*month = (ulint)cal_tm_ptr->tm_mon + 1;
|
||||
*day = (ulint)cal_tm_ptr->tm_mday;
|
||||
|
|
7
mysql-test/include/endspace.inc
Normal file
7
mysql-test/include/endspace.inc
Normal file
|
@ -0,0 +1,7 @@
|
|||
select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
|
||||
select 'a\0' = 'a', 'a\0' < 'a', 'a\0' > 'a';
|
||||
select 'a' = 'a\0', 'a' < 'a\0', 'a' > 'a\0';
|
||||
select 'a\0' = 'a ', 'a\0' < 'a ', 'a\0' > 'a ';
|
||||
select 'a ' = 'a\0', 'a ' < 'a\0', 'a ' > 'a\0';
|
||||
select 'a a' > 'a', 'a \0' < 'a';
|
||||
select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a';
|
|
@ -1,4 +1,27 @@
|
|||
DROP TABLE IF EXISTS t1;
|
||||
SET NAMES latin1;
|
||||
SET character_set_connection=ucs2;
|
||||
select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
|
||||
'a' = 'a' 'a' = 'a ' 'a ' = 'a'
|
||||
1 1 1
|
||||
select 'a\0' = 'a', 'a\0' < 'a', 'a\0' > 'a';
|
||||
'a\0' = 'a' 'a\0' < 'a' 'a\0' > 'a'
|
||||
0 1 0
|
||||
select 'a' = 'a\0', 'a' < 'a\0', 'a' > 'a\0';
|
||||
'a' = 'a\0' 'a' < 'a\0' 'a' > 'a\0'
|
||||
0 0 1
|
||||
select 'a\0' = 'a ', 'a\0' < 'a ', 'a\0' > 'a ';
|
||||
'a\0' = 'a ' 'a\0' < 'a ' 'a\0' > 'a '
|
||||
0 1 0
|
||||
select 'a ' = 'a\0', 'a ' < 'a\0', 'a ' > 'a\0';
|
||||
'a ' = 'a\0' 'a ' < 'a\0' 'a ' > 'a\0'
|
||||
0 0 1
|
||||
select 'a a' > 'a', 'a \0' < 'a';
|
||||
'a a' > 'a' 'a \0' < 'a'
|
||||
1 1
|
||||
select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a';
|
||||
binary 'a a' > 'a' binary 'a \0' > 'a' binary 'a\0' > 'a'
|
||||
1 1 1
|
||||
SET CHARACTER SET koi8r;
|
||||
CREATE TABLE t1 (word VARCHAR(64) CHARACTER SET ucs2);
|
||||
INSERT INTO t1 VALUES (_koi8r'ò'), (X'2004');
|
||||
|
|
|
@ -20,4 +20,12 @@ commit;
|
|||
a
|
||||
1
|
||||
unlock tables;
|
||||
commit;
|
||||
begin;
|
||||
insert into t1 values(10);
|
||||
flush tables with read lock;
|
||||
commit;
|
||||
unlock tables;
|
||||
flush tables with read lock;
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
|
|
|
@ -321,3 +321,23 @@ DROP DATABASE testdb7;
|
|||
DROP DATABASE testdb8;
|
||||
DROP DATABASE testdb9;
|
||||
DROP DATABASE testdb10;
|
||||
create table t1(a int, b int, c int, d int);
|
||||
grant insert(b), insert(c), insert(d), insert(a) on t1 to grant_user@localhost;
|
||||
show grants for grant_user@localhost;
|
||||
Grants for grant_user@localhost
|
||||
GRANT USAGE ON *.* TO 'grant_user'@'localhost'
|
||||
GRANT INSERT (a, d, c, b) ON `test`.`t1` TO 'grant_user'@'localhost'
|
||||
select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
|
||||
Host Db User Table_name Column_name Column_priv
|
||||
localhost test grant_user t1 c Insert
|
||||
localhost test grant_user t1 b Insert
|
||||
localhost test grant_user t1 a Insert
|
||||
localhost test grant_user t1 d Insert
|
||||
revoke ALL PRIVILEGES on t1 from grant_user@localhost;
|
||||
show grants for grant_user@localhost;
|
||||
Grants for grant_user@localhost
|
||||
GRANT USAGE ON *.* TO 'grant_user'@'localhost'
|
||||
select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
|
||||
Host Db User Table_name Column_name Column_priv
|
||||
drop user grant_user@localhost;
|
||||
drop table t1;
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
Variable_name Value
|
||||
Ssl_cipher EDH-RSA-DES-CBC3-SHA
|
||||
Ssl_cipher DHE-RSA-AES256-SHA
|
||||
|
|
|
@ -240,3 +240,12 @@ SELECT * FROM t1;
|
|||
pseudo date
|
||||
ZoomZip 1101106546
|
||||
DROP TABLE t1;
|
||||
create table t1(a char(2)) engine=memory;
|
||||
insert into t1 values (NULL), (NULL);
|
||||
delete from t1 where a is null;
|
||||
insert into t1 values ('2'), ('3');
|
||||
select * from t1;
|
||||
a
|
||||
3
|
||||
2
|
||||
drop table t1;
|
||||
|
|
|
@ -332,3 +332,45 @@ CREATE TABLE `t1` (
|
|||
2
|
||||
3
|
||||
drop table t1;
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
|
||||
|
||||
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;
|
||||
|
||||
USE `test`;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
|
||||
create database mysqldump_test_db character set latin2 collate latin2_bin;
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
|
||||
|
||||
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_test_db` /*!40100 DEFAULT CHARACTER SET latin2 COLLATE latin2_bin */;
|
||||
|
||||
USE `mysqldump_test_db`;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
|
||||
drop database mysqldump_test_db;
|
||||
|
|
|
@ -189,3 +189,13 @@ p a
|
|||
5 aaa
|
||||
6 AAA
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a varchar(10) primary key
|
||||
) engine=ndb;
|
||||
insert into t1 values ('jonas % ');
|
||||
replace into t1 values ('jonas % ');
|
||||
replace into t1 values ('jonas % ');
|
||||
select * from t1;
|
||||
a
|
||||
jonas %
|
||||
drop table t1;
|
||||
|
|
|
@ -77,8 +77,10 @@ a b c
|
|||
3 NULL NULL
|
||||
select * from t1 use index (bc) where b IS NULL and c IS NULL order by a;
|
||||
a b c
|
||||
3 NULL NULL
|
||||
select * from t1 use index (bc) where b IS NULL and c = 2 order by a;
|
||||
a b c
|
||||
2 NULL 2
|
||||
select * from t1 use index (bc) where b < 4 order by a;
|
||||
a b c
|
||||
1 1 1
|
||||
|
@ -574,3 +576,39 @@ uid gid rid cid
|
|||
1 1 2 3
|
||||
1 1 2 4
|
||||
drop table t1,t2,t3,t4,t5,t6,t7;
|
||||
CREATE TABLE t1 (
|
||||
a int unsigned NOT NULL PRIMARY KEY,
|
||||
b int unsigned,
|
||||
c int unsigned,
|
||||
UNIQUE bc(b,c) ) engine = ndb;
|
||||
insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
|
||||
select * from t1 where b=1 and c=1;
|
||||
a b c
|
||||
1 1 1
|
||||
select * from t1 where b is null and c is null;
|
||||
a b c
|
||||
3 NULL NULL
|
||||
select * from t1 where b is null and c = 2;
|
||||
a b c
|
||||
2 NULL 2
|
||||
select * from t1 where b = 4 and c is null;
|
||||
a b c
|
||||
4 4 NULL
|
||||
create table t8 as
|
||||
select * from t1 where (b = 1 and c = 1)
|
||||
or (b is null and c is null)
|
||||
or (b is null and c = 2)
|
||||
or (b = 4 and c is null);
|
||||
select * from t8 order by a;
|
||||
a b c
|
||||
1 1 1
|
||||
2 NULL 2
|
||||
3 NULL NULL
|
||||
4 4 NULL
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
1 1 1
|
||||
2 NULL 2
|
||||
3 NULL NULL
|
||||
4 4 NULL
|
||||
drop table t1, t8;
|
||||
|
|
|
@ -2,9 +2,9 @@ drop table if exists t1;
|
|||
create table t1(f1 int);
|
||||
insert into t1 values (5);
|
||||
grant select on test.* to ssl_user1@localhost require SSL;
|
||||
grant select on test.* to ssl_user2@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
|
||||
grant select on test.* to ssl_user3@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com";
|
||||
grant select on test.* to ssl_user4@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com";
|
||||
grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA";
|
||||
grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com";
|
||||
grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com";
|
||||
flush privileges;
|
||||
select * from t1;
|
||||
f1
|
||||
|
|
|
@ -2,20 +2,19 @@ use test;
|
|||
drop table if exists t1, t9 ;
|
||||
create table t1
|
||||
(
|
||||
a int not null, b varchar(30),
|
||||
a int, b varchar(30),
|
||||
primary key(a)
|
||||
) engine = 'NDB' ;
|
||||
drop table if exists t9;
|
||||
create table t9
|
||||
(
|
||||
c1 tinyint not null, c2 smallint, c3 mediumint, c4 int,
|
||||
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
|
||||
c5 integer, c6 bigint, c7 float, c8 double,
|
||||
c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
|
||||
c13 date, c14 datetime, c15 timestamp(14), c16 time,
|
||||
c17 year, c18 bit, c19 bool, c20 char,
|
||||
c21 char(10), c22 varchar(30), c23 char(100), c24 char(100),
|
||||
c25 char(100), c26 char(100), c27 char(100), c28 char(100),
|
||||
c29 char(100), c30 char(100), c31 enum('one', 'two', 'three'),
|
||||
c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
|
||||
c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
|
||||
c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
|
||||
c32 set('monday', 'tuesday', 'wednesday'),
|
||||
primary key(c1)
|
||||
) engine = 'NDB' ;
|
||||
|
@ -72,14 +71,14 @@ def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
|
|||
def test t9 t9 c20 c20 254 1 1 Y 0 0 8
|
||||
def test t9 t9 c21 c21 253 10 10 Y 0 0 8
|
||||
def test t9 t9 c22 c22 253 30 30 Y 0 0 8
|
||||
def test t9 t9 c23 c23 253 100 8 Y 0 0 8
|
||||
def test t9 t9 c24 c24 253 100 8 Y 0 0 8
|
||||
def test t9 t9 c25 c25 253 100 4 Y 0 0 8
|
||||
def test t9 t9 c26 c26 253 100 4 Y 0 0 8
|
||||
def test t9 t9 c27 c27 253 100 10 Y 0 0 8
|
||||
def test t9 t9 c28 c28 253 100 10 Y 0 0 8
|
||||
def test t9 t9 c29 c29 253 100 8 Y 0 0 8
|
||||
def test t9 t9 c30 c30 253 100 8 Y 0 0 8
|
||||
def test t9 t9 c23 c23 252 255 8 Y 144 0 63
|
||||
def test t9 t9 c24 c24 252 255 8 Y 16 0 8
|
||||
def test t9 t9 c25 c25 252 65535 4 Y 144 0 63
|
||||
def test t9 t9 c26 c26 252 65535 4 Y 16 0 8
|
||||
def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63
|
||||
def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8
|
||||
def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63
|
||||
def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8
|
||||
def test t9 t9 c31 c31 254 5 3 Y 256 0 8
|
||||
def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
|
||||
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
|
||||
|
@ -1188,7 +1187,7 @@ c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
|
|||
commit ;
|
||||
prepare stmt1 from 'delete from t1 where a=2' ;
|
||||
execute stmt1;
|
||||
select a,b from t1 where a=2 order by b;
|
||||
select a,b from t1 where a=2;
|
||||
a b
|
||||
execute stmt1;
|
||||
insert into t1 values(0,NULL);
|
||||
|
@ -1270,18 +1269,23 @@ execute stmt1 using @arg00, @arg00;
|
|||
select a,b from t1 where a=@arg00;
|
||||
a b
|
||||
2 two
|
||||
execute stmt1 using @arg01, @arg00;
|
||||
select a,b from t1 where a=@arg01;
|
||||
a b
|
||||
22 two
|
||||
execute stmt1 using @arg00, @arg01;
|
||||
select a,b from t1 where a=@arg00;
|
||||
a b
|
||||
2 two
|
||||
set @arg00=NULL;
|
||||
set @arg01=2;
|
||||
execute stmt1 using @arg00, @arg01;
|
||||
Warnings:
|
||||
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
|
||||
select a,b from t1 order by a;
|
||||
a b
|
||||
0 two
|
||||
1 one
|
||||
2 two
|
||||
3 three
|
||||
4 four
|
||||
set @arg00=0;
|
||||
|
@ -1302,15 +1306,19 @@ create table t2 as select a,b from t1 ;
|
|||
prepare stmt1 from 'update t1 set a=? where b=?
|
||||
and a in (select ? from t2
|
||||
where b = ? or a = ?)';
|
||||
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
|
||||
affected rows: 1
|
||||
info: Rows matched: 1 Changed: 1 Warnings: 0
|
||||
select a,b from t1 where a = @arg00 ;
|
||||
a b
|
||||
23 two
|
||||
prepare stmt1 from 'update t1 set a=? where b=?
|
||||
and a not in (select ? from t2
|
||||
where b = ? or a = ?)';
|
||||
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
|
||||
affected rows: 0
|
||||
info: Rows matched: 0 Changed: 0 Warnings: 0
|
||||
select a,b from t1 order by a;
|
||||
affected rows: 1
|
||||
info: Rows matched: 1 Changed: 1 Warnings: 0
|
||||
select a,b from t1 order by a ;
|
||||
a b
|
||||
1 one
|
||||
2 two
|
||||
|
@ -1319,21 +1327,25 @@ a b
|
|||
drop table t2 ;
|
||||
create table t2
|
||||
(
|
||||
a int not null, b varchar(30),
|
||||
a int, b varchar(30),
|
||||
primary key(a)
|
||||
) engine = 'NDB' ;
|
||||
insert into t2(a,b) select a, b from t1 ;
|
||||
prepare stmt1 from 'update t1 set a=? where b=?
|
||||
and a in (select ? from t2
|
||||
where b = ? or a = ?)';
|
||||
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
|
||||
affected rows: 1
|
||||
info: Rows matched: 1 Changed: 1 Warnings: 0
|
||||
select a,b from t1 where a = @arg00 ;
|
||||
a b
|
||||
23 two
|
||||
prepare stmt1 from 'update t1 set a=? where b=?
|
||||
and a not in (select ? from t2
|
||||
where b = ? or a = ?)';
|
||||
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
|
||||
affected rows: 0
|
||||
info: Rows matched: 0 Changed: 0 Warnings: 0
|
||||
affected rows: 1
|
||||
info: Rows matched: 1 Changed: 1 Warnings: 0
|
||||
select a,b from t1 order by a ;
|
||||
a b
|
||||
1 one
|
||||
|
@ -1474,7 +1486,7 @@ set @arg02=82 ;
|
|||
set @arg03='8-2' ;
|
||||
prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
|
||||
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
|
||||
select a,b from t1 where a in (@arg00,@arg02) order by a ;
|
||||
select a,b from t1 where a in (@arg00,@arg02) ;
|
||||
a b
|
||||
81 8-1
|
||||
82 8-2
|
||||
|
@ -1489,6 +1501,7 @@ set @arg00=6 ;
|
|||
set @arg01=1 ;
|
||||
prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
|
||||
on duplicate key update a=a + ?, b=concat(b,''modified'') ';
|
||||
execute stmt1 using @arg00, @arg01;
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
0 NULL
|
||||
|
@ -1497,13 +1510,15 @@ a b
|
|||
3 three
|
||||
4 four
|
||||
5 five
|
||||
6 six
|
||||
7 sixmodified
|
||||
8 eight
|
||||
9 nine
|
||||
81 8-1
|
||||
82 8-2
|
||||
set @arg00=81 ;
|
||||
set @arg01=1 ;
|
||||
execute stmt1 using @arg00, @arg01;
|
||||
ERROR 23000: Duplicate entry '82' for key 1
|
||||
drop table if exists t2 ;
|
||||
create table t2 (id int auto_increment primary key)
|
||||
ENGINE= 'NDB' ;
|
||||
|
@ -1526,23 +1541,32 @@ set @x1100="x1100" ;
|
|||
set @100=100 ;
|
||||
set @updated="updated" ;
|
||||
insert into t1 values(1000,'x1000_1') ;
|
||||
insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
|
||||
on duplicate key update a = a + @100, b = concat(b,@updated) ;
|
||||
select a,b from t1 where a >= 1000 order by a ;
|
||||
a b
|
||||
1000 x1000_1
|
||||
1000 x1000_3
|
||||
1100 x1000_1updated
|
||||
delete from t1 where a >= 1000 ;
|
||||
insert into t1 values(1000,'x1000_1') ;
|
||||
prepare stmt1 from ' insert into t1 values(?,?),(?,?)
|
||||
on duplicate key update a = a + ?, b = concat(b,?) ';
|
||||
execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
|
||||
select a,b from t1 where a >= 1000 order by a ;
|
||||
a b
|
||||
1000 x1000_1
|
||||
1000 x1000_3
|
||||
1100 x1000_1updated
|
||||
delete from t1 where a >= 1000 ;
|
||||
insert into t1 values(1000,'x1000_1') ;
|
||||
execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
|
||||
select a,b from t1 where a >= 1000 order by a ;
|
||||
a b
|
||||
1000 x1000_1
|
||||
1200 x1000_1updatedupdated
|
||||
delete from t1 where a >= 1000 ;
|
||||
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
|
||||
execute stmt1;
|
||||
execute stmt1;
|
||||
execute stmt1;
|
||||
test_sequence
|
||||
------ multi table tests ------
|
||||
delete from t1 ;
|
||||
|
@ -1891,13 +1915,13 @@ def @arg19 254 20 1 Y 128 31 63
|
|||
def @arg20 254 8192 1 Y 0 31 8
|
||||
def @arg21 254 8192 10 Y 0 31 8
|
||||
def @arg22 254 8192 30 Y 0 31 8
|
||||
def @arg23 254 8192 8 Y 0 31 8
|
||||
def @arg23 254 8192 8 Y 128 31 63
|
||||
def @arg24 254 8192 8 Y 0 31 8
|
||||
def @arg25 254 8192 4 Y 0 31 8
|
||||
def @arg25 254 8192 4 Y 128 31 63
|
||||
def @arg26 254 8192 4 Y 0 31 8
|
||||
def @arg27 254 8192 10 Y 0 31 8
|
||||
def @arg27 254 8192 10 Y 128 31 63
|
||||
def @arg28 254 8192 10 Y 0 31 8
|
||||
def @arg29 254 8192 8 Y 0 31 8
|
||||
def @arg29 254 8192 8 Y 128 31 63
|
||||
def @arg30 254 8192 8 Y 0 31 8
|
||||
def @arg31 254 8192 3 Y 0 31 8
|
||||
def @arg32 254 8192 6 Y 128 31 63
|
||||
|
@ -1938,13 +1962,13 @@ def @arg19 254 20 0 Y 128 31 63
|
|||
def @arg20 254 8192 0 Y 0 31 8
|
||||
def @arg21 254 8192 0 Y 0 31 8
|
||||
def @arg22 254 8192 0 Y 0 31 8
|
||||
def @arg23 254 8192 0 Y 0 31 8
|
||||
def @arg23 254 8192 0 Y 128 31 63
|
||||
def @arg24 254 8192 0 Y 0 31 8
|
||||
def @arg25 254 8192 0 Y 0 31 8
|
||||
def @arg25 254 8192 0 Y 128 31 63
|
||||
def @arg26 254 8192 0 Y 0 31 8
|
||||
def @arg27 254 8192 0 Y 0 31 8
|
||||
def @arg27 254 8192 0 Y 128 31 63
|
||||
def @arg28 254 8192 0 Y 0 31 8
|
||||
def @arg29 254 8192 0 Y 0 31 8
|
||||
def @arg29 254 8192 0 Y 128 31 63
|
||||
def @arg30 254 8192 0 Y 0 31 8
|
||||
def @arg31 254 8192 0 Y 0 31 8
|
||||
def @arg32 254 8192 0 Y 0 31 8
|
||||
|
@ -1988,13 +2012,13 @@ def @arg19 254 20 1 Y 128 31 63
|
|||
def @arg20 254 8192 1 Y 0 31 8
|
||||
def @arg21 254 8192 10 Y 0 31 8
|
||||
def @arg22 254 8192 30 Y 0 31 8
|
||||
def @arg23 254 8192 8 Y 0 31 8
|
||||
def @arg23 254 8192 8 Y 128 31 63
|
||||
def @arg24 254 8192 8 Y 0 31 8
|
||||
def @arg25 254 8192 4 Y 0 31 8
|
||||
def @arg25 254 8192 4 Y 128 31 63
|
||||
def @arg26 254 8192 4 Y 0 31 8
|
||||
def @arg27 254 8192 10 Y 0 31 8
|
||||
def @arg27 254 8192 10 Y 128 31 63
|
||||
def @arg28 254 8192 10 Y 0 31 8
|
||||
def @arg29 254 8192 8 Y 0 31 8
|
||||
def @arg29 254 8192 8 Y 128 31 63
|
||||
def @arg30 254 8192 8 Y 0 31 8
|
||||
def @arg31 254 8192 3 Y 0 31 8
|
||||
def @arg32 254 8192 6 Y 128 31 63
|
||||
|
@ -2028,13 +2052,13 @@ def @arg19 254 20 0 Y 128 31 63
|
|||
def @arg20 254 8192 0 Y 0 31 8
|
||||
def @arg21 254 8192 0 Y 0 31 8
|
||||
def @arg22 254 8192 0 Y 0 31 8
|
||||
def @arg23 254 8192 0 Y 0 31 8
|
||||
def @arg23 254 8192 0 Y 128 31 63
|
||||
def @arg24 254 8192 0 Y 0 31 8
|
||||
def @arg25 254 8192 0 Y 0 31 8
|
||||
def @arg25 254 8192 0 Y 128 31 63
|
||||
def @arg26 254 8192 0 Y 0 31 8
|
||||
def @arg27 254 8192 0 Y 0 31 8
|
||||
def @arg27 254 8192 0 Y 128 31 63
|
||||
def @arg28 254 8192 0 Y 0 31 8
|
||||
def @arg29 254 8192 0 Y 0 31 8
|
||||
def @arg29 254 8192 0 Y 128 31 63
|
||||
def @arg30 254 8192 0 Y 0 31 8
|
||||
def @arg31 254 8192 0 Y 0 31 8
|
||||
def @arg32 254 8192 0 Y 0 31 8
|
||||
|
@ -2076,13 +2100,13 @@ def @arg19 254 20 1 Y 128 31 63
|
|||
def @arg20 254 8192 1 Y 0 31 8
|
||||
def @arg21 254 8192 10 Y 0 31 8
|
||||
def @arg22 254 8192 30 Y 0 31 8
|
||||
def @arg23 254 8192 8 Y 0 31 8
|
||||
def @arg23 254 8192 8 Y 128 31 63
|
||||
def @arg24 254 8192 8 Y 0 31 8
|
||||
def @arg25 254 8192 4 Y 0 31 8
|
||||
def @arg25 254 8192 4 Y 128 31 63
|
||||
def @arg26 254 8192 4 Y 0 31 8
|
||||
def @arg27 254 8192 10 Y 0 31 8
|
||||
def @arg27 254 8192 10 Y 128 31 63
|
||||
def @arg28 254 8192 10 Y 0 31 8
|
||||
def @arg29 254 8192 8 Y 0 31 8
|
||||
def @arg29 254 8192 8 Y 128 31 63
|
||||
def @arg30 254 8192 8 Y 0 31 8
|
||||
def @arg31 254 8192 3 Y 0 31 8
|
||||
def @arg32 254 8192 6 Y 128 31 63
|
||||
|
@ -2120,13 +2144,13 @@ def @arg19 254 20 0 Y 128 31 63
|
|||
def @arg20 254 8192 0 Y 0 31 8
|
||||
def @arg21 254 8192 0 Y 0 31 8
|
||||
def @arg22 254 8192 0 Y 0 31 8
|
||||
def @arg23 254 8192 0 Y 0 31 8
|
||||
def @arg23 254 8192 0 Y 128 31 63
|
||||
def @arg24 254 8192 0 Y 0 31 8
|
||||
def @arg25 254 8192 0 Y 0 31 8
|
||||
def @arg25 254 8192 0 Y 128 31 63
|
||||
def @arg26 254 8192 0 Y 0 31 8
|
||||
def @arg27 254 8192 0 Y 0 31 8
|
||||
def @arg27 254 8192 0 Y 128 31 63
|
||||
def @arg28 254 8192 0 Y 0 31 8
|
||||
def @arg29 254 8192 0 Y 0 31 8
|
||||
def @arg29 254 8192 0 Y 128 31 63
|
||||
def @arg30 254 8192 0 Y 0 31 8
|
||||
def @arg31 254 8192 0 Y 0 31 8
|
||||
def @arg32 254 8192 0 Y 0 31 8
|
||||
|
@ -2166,13 +2190,13 @@ def @arg19 254 20 1 Y 128 31 63
|
|||
def @arg20 254 8192 1 Y 0 31 8
|
||||
def @arg21 254 8192 10 Y 0 31 8
|
||||
def @arg22 254 8192 30 Y 0 31 8
|
||||
def @arg23 254 8192 8 Y 0 31 8
|
||||
def @arg23 254 8192 8 Y 128 31 63
|
||||
def @arg24 254 8192 8 Y 0 31 8
|
||||
def @arg25 254 8192 4 Y 0 31 8
|
||||
def @arg25 254 8192 4 Y 128 31 63
|
||||
def @arg26 254 8192 4 Y 0 31 8
|
||||
def @arg27 254 8192 10 Y 0 31 8
|
||||
def @arg27 254 8192 10 Y 128 31 63
|
||||
def @arg28 254 8192 10 Y 0 31 8
|
||||
def @arg29 254 8192 8 Y 0 31 8
|
||||
def @arg29 254 8192 8 Y 128 31 63
|
||||
def @arg30 254 8192 8 Y 0 31 8
|
||||
def @arg31 254 8192 3 Y 0 31 8
|
||||
def @arg32 254 8192 6 Y 128 31 63
|
||||
|
@ -2204,13 +2228,13 @@ def @arg19 254 20 0 Y 128 31 63
|
|||
def @arg20 254 8192 0 Y 0 31 8
|
||||
def @arg21 254 8192 0 Y 0 31 8
|
||||
def @arg22 254 8192 0 Y 0 31 8
|
||||
def @arg23 254 8192 0 Y 0 31 8
|
||||
def @arg23 254 8192 0 Y 128 31 63
|
||||
def @arg24 254 8192 0 Y 0 31 8
|
||||
def @arg25 254 8192 0 Y 0 31 8
|
||||
def @arg25 254 8192 0 Y 128 31 63
|
||||
def @arg26 254 8192 0 Y 0 31 8
|
||||
def @arg27 254 8192 0 Y 0 31 8
|
||||
def @arg27 254 8192 0 Y 128 31 63
|
||||
def @arg28 254 8192 0 Y 0 31 8
|
||||
def @arg29 254 8192 0 Y 0 31 8
|
||||
def @arg29 254 8192 0 Y 128 31 63
|
||||
def @arg30 254 8192 0 Y 0 31 8
|
||||
def @arg31 254 8192 0 Y 0 31 8
|
||||
def @arg32 254 8192 0 Y 0 31 8
|
||||
|
@ -2770,14 +2794,14 @@ c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
|
|||
41 4 41 41 41 41 41 41 41 41 41 41
|
||||
42 4 42 42 42 42 42 42 42 42 42 42
|
||||
43 4 43 43 43 43 43 43 43 43 43 43
|
||||
50 5 50 50 50 50 50 50 50 50 50 50
|
||||
50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00
|
||||
51 5 51 51 51 51 51 51 51 51 51 51
|
||||
52 5 52 52 52 52 52 52 52 52 52 52
|
||||
53 5 53 53 53 53 53 53 53 53 53 53
|
||||
54 5 54 54 54 54 54 54 54 54 54 54
|
||||
52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00
|
||||
53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00
|
||||
54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
|
||||
55 5 55 55 55 55 55 55 55 55 55 55
|
||||
56 6 56 56 56 56 56 56 56 56 56 56
|
||||
57 6 57 57 57 57 57 57 57 57 57 57
|
||||
56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
|
||||
57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
|
||||
60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
|
|
|
@ -1693,3 +1693,35 @@ oe
|
|||
ue
|
||||
ss
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
a ENUM('ä','ö','ü') character set utf8 default 'ü'
|
||||
);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` enum('ä','ö','ü') character set utf8 default 'ü'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
insert into t1 values ('ä'), ('ö'), ('ü');
|
||||
select a from t1 order by a;
|
||||
a
|
||||
ä
|
||||
ö
|
||||
ü
|
||||
drop table t1;
|
||||
set names utf8;
|
||||
CREATE TABLE t1 (
|
||||
a ENUM('ä','Ü','ß') character set latin1 default 'ß'
|
||||
);
|
||||
insert into t1 values ('ä'),('Ü'),('ß');
|
||||
set names latin1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` enum('ä','ö','ü') default 'ü'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
select a from t1 order by a;
|
||||
a
|
||||
ä
|
||||
ö
|
||||
ü
|
||||
drop table t1;
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
SET NAMES latin1;
|
||||
SET character_set_connection=ucs2;
|
||||
-- source include/endspace.inc
|
||||
|
||||
SET CHARACTER SET koi8r;
|
||||
|
||||
#
|
||||
|
|
|
@ -7,13 +7,7 @@
|
|||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
|
||||
select 'a\0' = 'a', 'a\0' < 'a', 'a\0' > 'a';
|
||||
select 'a' = 'a\0', 'a' < 'a\0', 'a' > 'a\0';
|
||||
select 'a\0' = 'a ', 'a\0' < 'a ', 'a\0' > 'a ';
|
||||
select 'a ' = 'a\0', 'a ' < 'a\0', 'a ' > 'a\0';
|
||||
select 'a a' > 'a', 'a \0' < 'a';
|
||||
select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a';
|
||||
-- source include/endspace.inc
|
||||
|
||||
#
|
||||
# Test MyISAM tables.
|
||||
|
|
|
@ -48,5 +48,19 @@ reap;
|
|||
connection con3;
|
||||
reap;
|
||||
unlock tables;
|
||||
|
||||
# BUG#6732 FLUSH TABLES WITH READ LOCK + COMMIT hangs later FLUSH TABLES
|
||||
# WITH READ LOCK
|
||||
|
||||
connection con2;
|
||||
commit; # unlock InnoDB row locks to allow insertions
|
||||
connection con1;
|
||||
begin;
|
||||
insert into t1 values(10);
|
||||
flush tables with read lock;
|
||||
commit;
|
||||
unlock tables;
|
||||
connection con2;
|
||||
flush tables with read lock; # bug caused hang here
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
|
|
|
@ -267,3 +267,16 @@ DROP DATABASE testdb8;
|
|||
DROP DATABASE testdb9;
|
||||
DROP DATABASE testdb10;
|
||||
|
||||
#
|
||||
# Bug #6932: a problem with 'revoke ALL PRIVILEGES'
|
||||
#
|
||||
|
||||
create table t1(a int, b int, c int, d int);
|
||||
grant insert(b), insert(c), insert(d), insert(a) on t1 to grant_user@localhost;
|
||||
show grants for grant_user@localhost;
|
||||
select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
|
||||
revoke ALL PRIVILEGES on t1 from grant_user@localhost;
|
||||
show grants for grant_user@localhost;
|
||||
select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
|
||||
drop user grant_user@localhost;
|
||||
drop table t1;
|
||||
|
|
|
@ -185,3 +185,13 @@ DELETE FROM t1 WHERE date<1101106546;
|
|||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #6878: a problem with small length records
|
||||
#
|
||||
|
||||
create table t1(a char(2)) engine=memory;
|
||||
insert into t1 values (NULL), (NULL);
|
||||
delete from t1 where a is null;
|
||||
insert into t1 values ('2'), ('3');
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
|
|
@ -127,3 +127,13 @@ insert into t1 values (1),(2),(3);
|
|||
--exec rm $MYSQL_TEST_DIR/var/tmp/t1.sql
|
||||
--exec rm $MYSQL_TEST_DIR/var/tmp/t1.txt
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #6101: create database problem
|
||||
#
|
||||
|
||||
--exec $MYSQL_DUMP --skip-comments --databases test
|
||||
|
||||
create database mysqldump_test_db character set latin2 collate latin2_bin;
|
||||
--exec $MYSQL_DUMP --skip-comments --databases mysqldump_test_db;
|
||||
drop database mysqldump_test_db;
|
||||
|
|
|
@ -157,3 +157,13 @@ select * from t1 where a = 'AaA' order by p;
|
|||
# 6
|
||||
select * from t1 where a = 'AAA' order by p;
|
||||
drop table t1;
|
||||
|
||||
# bug
|
||||
create table t1 (
|
||||
a varchar(10) primary key
|
||||
) engine=ndb;
|
||||
insert into t1 values ('jonas % ');
|
||||
replace into t1 values ('jonas % ');
|
||||
replace into t1 values ('jonas % ');
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
|
|
@ -265,4 +265,24 @@ select * from t4 where rid = 2 order by cid;
|
|||
|
||||
drop table t1,t2,t3,t4,t5,t6,t7;
|
||||
|
||||
# test null in indexes
|
||||
CREATE TABLE t1 (
|
||||
a int unsigned NOT NULL PRIMARY KEY,
|
||||
b int unsigned,
|
||||
c int unsigned,
|
||||
UNIQUE bc(b,c) ) engine = ndb;
|
||||
|
||||
insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
|
||||
select * from t1 where b=1 and c=1;
|
||||
select * from t1 where b is null and c is null;
|
||||
select * from t1 where b is null and c = 2;
|
||||
select * from t1 where b = 4 and c is null;
|
||||
create table t8 as
|
||||
select * from t1 where (b = 1 and c = 1)
|
||||
or (b is null and c is null)
|
||||
or (b is null and c = 2)
|
||||
or (b = 4 and c is null);
|
||||
select * from t8 order by a;
|
||||
select * from t1 order by a;
|
||||
drop table t1, t8;
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ create table t1(f1 int);
|
|||
insert into t1 values (5);
|
||||
|
||||
grant select on test.* to ssl_user1@localhost require SSL;
|
||||
grant select on test.* to ssl_user2@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
|
||||
grant select on test.* to ssl_user3@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com";
|
||||
grant select on test.* to ssl_user4@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com";
|
||||
grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA";
|
||||
grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com";
|
||||
grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com";
|
||||
flush privileges;
|
||||
connect (con1,localhost,ssl_user1,,);
|
||||
connect (con2,localhost,ssl_user2,,);
|
||||
|
|
|
@ -12,365 +12,11 @@ use test;
|
|||
|
||||
-- source include/have_ndb.inc
|
||||
let $type= 'NDB' ;
|
||||
--disable_warnings
|
||||
drop table if exists t1, t9 ;
|
||||
--enable_warnings
|
||||
eval create table t1
|
||||
(
|
||||
a int not null, b varchar(30),
|
||||
primary key(a)
|
||||
) engine = $type ;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t9;
|
||||
--enable_warnings
|
||||
# The used table type doesn't support BLOB/TEXT columns.
|
||||
# (The server would send error 1163 .)
|
||||
# So we use char(100) instead.
|
||||
eval create table t9
|
||||
(
|
||||
c1 tinyint not null, c2 smallint, c3 mediumint, c4 int,
|
||||
c5 integer, c6 bigint, c7 float, c8 double,
|
||||
c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
|
||||
c13 date, c14 datetime, c15 timestamp(14), c16 time,
|
||||
c17 year, c18 bit, c19 bool, c20 char,
|
||||
c21 char(10), c22 varchar(30), c23 char(100), c24 char(100),
|
||||
c25 char(100), c26 char(100), c27 char(100), c28 char(100),
|
||||
c29 char(100), c30 char(100), c31 enum('one', 'two', 'three'),
|
||||
c32 set('monday', 'tuesday', 'wednesday'),
|
||||
primary key(c1)
|
||||
) engine = $type ;
|
||||
-- source include/ps_create.inc
|
||||
-- source include/ps_renew.inc
|
||||
|
||||
-- source include/ps_query.inc
|
||||
# The following line is deactivated, because the ndb storage engine is not able
|
||||
# to do primary key column updates .
|
||||
#-- source include/ps_modify.inc
|
||||
# let's include all statements which will work
|
||||
--disable_query_log
|
||||
select '------ delete tests ------' as test_sequence ;
|
||||
--enable_query_log
|
||||
--source include/ps_renew.inc
|
||||
|
||||
## delete without parameter
|
||||
prepare stmt1 from 'delete from t1 where a=2' ;
|
||||
execute stmt1;
|
||||
select a,b from t1 where a=2 order by b;
|
||||
# delete with row not found
|
||||
execute stmt1;
|
||||
|
||||
## delete with one parameter in the where clause
|
||||
insert into t1 values(0,NULL);
|
||||
set @arg00=NULL;
|
||||
prepare stmt1 from 'delete from t1 where b=?' ;
|
||||
execute stmt1 using @arg00;
|
||||
select a,b from t1 where b is NULL ;
|
||||
set @arg00='one';
|
||||
execute stmt1 using @arg00;
|
||||
select a,b from t1 where b=@arg00;
|
||||
|
||||
## truncate a table
|
||||
--error 1295
|
||||
prepare stmt1 from 'truncate table t1' ;
|
||||
|
||||
|
||||
--disable_query_log
|
||||
select '------ update tests ------' as test_sequence ;
|
||||
--enable_query_log
|
||||
--source include/ps_renew.inc
|
||||
|
||||
## update without parameter
|
||||
prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
|
||||
execute stmt1;
|
||||
select a,b from t1 where a=2;
|
||||
# dummy update
|
||||
execute stmt1;
|
||||
select a,b from t1 where a=2;
|
||||
|
||||
## update with one parameter in the set clause
|
||||
set @arg00=NULL;
|
||||
prepare stmt1 from 'update t1 set b=? where a=2' ;
|
||||
execute stmt1 using @arg00;
|
||||
select a,b from t1 where a=2;
|
||||
set @arg00='two';
|
||||
execute stmt1 using @arg00;
|
||||
select a,b from t1 where a=2;
|
||||
|
||||
## update with one parameter in the where cause
|
||||
set @arg00=2;
|
||||
prepare stmt1 from 'update t1 set b=NULL where a=?' ;
|
||||
execute stmt1 using @arg00;
|
||||
select a,b from t1 where a=@arg00;
|
||||
update t1 set b='two' where a=@arg00;
|
||||
# row not found in update
|
||||
set @arg00=2000;
|
||||
execute stmt1 using @arg00;
|
||||
select a,b from t1 where a=@arg00;
|
||||
|
||||
## update on primary key column (two parameters)
|
||||
set @arg00=2;
|
||||
set @arg01=22;
|
||||
prepare stmt1 from 'update t1 set a=? where a=?' ;
|
||||
# dummy update
|
||||
execute stmt1 using @arg00, @arg00;
|
||||
select a,b from t1 where a=@arg00;
|
||||
# deactivated primary key column update
|
||||
# execute stmt1 using @arg01, @arg00;
|
||||
select a,b from t1 where a=@arg01;
|
||||
execute stmt1 using @arg00, @arg01;
|
||||
select a,b from t1 where a=@arg00;
|
||||
set @arg00=NULL;
|
||||
set @arg01=2;
|
||||
# deactivated primary key column update
|
||||
# execute stmt1 using @arg00, @arg01;
|
||||
select a,b from t1 order by a;
|
||||
set @arg00=0;
|
||||
execute stmt1 using @arg01, @arg00;
|
||||
select a,b from t1 order by a;
|
||||
|
||||
## update with subquery and several parameters
|
||||
set @arg00=23;
|
||||
set @arg01='two';
|
||||
set @arg02=2;
|
||||
set @arg03='two';
|
||||
set @arg04=2;
|
||||
--disable_warnings
|
||||
drop table if exists t2;
|
||||
--enable_warnings
|
||||
# t2 will be of table type 'MYISAM'
|
||||
create table t2 as select a,b from t1 ;
|
||||
prepare stmt1 from 'update t1 set a=? where b=?
|
||||
and a in (select ? from t2
|
||||
where b = ? or a = ?)';
|
||||
--enable_info
|
||||
# deactivated primary key column update
|
||||
# execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
|
||||
--disable_info
|
||||
select a,b from t1 where a = @arg00 ;
|
||||
prepare stmt1 from 'update t1 set a=? where b=?
|
||||
and a not in (select ? from t2
|
||||
where b = ? or a = ?)';
|
||||
--enable_info
|
||||
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
|
||||
--disable_info
|
||||
select a,b from t1 order by a;
|
||||
drop table t2 ;
|
||||
# t2 is now of table type '$type'
|
||||
# The test battery for table type 'MERGE' gets here only a 'MYISAM' table
|
||||
eval create table t2
|
||||
(
|
||||
a int not null, b varchar(30),
|
||||
primary key(a)
|
||||
) engine = $type ;
|
||||
insert into t2(a,b) select a, b from t1 ;
|
||||
prepare stmt1 from 'update t1 set a=? where b=?
|
||||
and a in (select ? from t2
|
||||
where b = ? or a = ?)';
|
||||
--enable_info
|
||||
# deactivated primary key column update
|
||||
# execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
|
||||
--disable_info
|
||||
select a,b from t1 where a = @arg00 ;
|
||||
prepare stmt1 from 'update t1 set a=? where b=?
|
||||
and a not in (select ? from t2
|
||||
where b = ? or a = ?)';
|
||||
--enable_info
|
||||
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
|
||||
--disable_info
|
||||
select a,b from t1 order by a ;
|
||||
drop table t2 ;
|
||||
|
||||
## update with parameters in limit
|
||||
set @arg00=1;
|
||||
prepare stmt1 from 'update t1 set b=''bla''
|
||||
where a=2
|
||||
limit 1';
|
||||
execute stmt1 ;
|
||||
select a,b from t1 where b = 'bla' ;
|
||||
# currently (May 2004, Version 4.1) it is impossible
|
||||
-- error 1064
|
||||
prepare stmt1 from 'update t1 set b=''bla''
|
||||
where a=2
|
||||
limit ?';
|
||||
|
||||
--disable_query_log
|
||||
select '------ insert tests ------' as test_sequence ;
|
||||
--enable_query_log
|
||||
--source include/ps_renew.inc
|
||||
|
||||
## insert without parameter
|
||||
prepare stmt1 from 'insert into t1 values(5, ''five'' )';
|
||||
execute stmt1;
|
||||
select a,b from t1 where a = 5;
|
||||
|
||||
## insert with one parameter in values part
|
||||
set @arg00='six' ;
|
||||
prepare stmt1 from 'insert into t1 values(6, ? )';
|
||||
execute stmt1 using @arg00;
|
||||
select a,b from t1 where b = @arg00;
|
||||
# the second insert fails, because the first column is primary key
|
||||
--error 1062
|
||||
execute stmt1 using @arg00;
|
||||
set @arg00=NULL ;
|
||||
prepare stmt1 from 'insert into t1 values(0, ? )';
|
||||
execute stmt1 using @arg00;
|
||||
select a,b from t1 where b is NULL;
|
||||
|
||||
## insert with two parameter in values part
|
||||
set @arg00=8 ;
|
||||
set @arg01='eight' ;
|
||||
prepare stmt1 from 'insert into t1 values(?, ? )';
|
||||
execute stmt1 using @arg00, @arg01 ;
|
||||
select a,b from t1 where b = @arg01;
|
||||
# cases derived from client_test.c: test_null()
|
||||
set @NULL= null ;
|
||||
set @arg00= 'abc' ;
|
||||
# execute must fail, because first column is primary key (-> not null)
|
||||
--error 1048
|
||||
execute stmt1 using @NULL, @NULL ;
|
||||
--error 1048
|
||||
execute stmt1 using @NULL, @NULL ;
|
||||
--error 1048
|
||||
execute stmt1 using @NULL, @arg00 ;
|
||||
--error 1048
|
||||
execute stmt1 using @NULL, @arg00 ;
|
||||
let $1 = 2;
|
||||
while ($1)
|
||||
{
|
||||
eval set @arg01= 10000 + $1 ;
|
||||
execute stmt1 using @arg01, @arg00 ;
|
||||
dec $1;
|
||||
}
|
||||
select * from t1 where a > 10000 order by a ;
|
||||
delete from t1 where a > 10000 ;
|
||||
let $1 = 2;
|
||||
while ($1)
|
||||
{
|
||||
eval set @arg01= 10000 + $1 ;
|
||||
execute stmt1 using @arg01, @NULL ;
|
||||
dec $1;
|
||||
}
|
||||
select * from t1 where a > 10000 order by a ;
|
||||
delete from t1 where a > 10000 ;
|
||||
let $1 = 10;
|
||||
while ($1)
|
||||
{
|
||||
eval set @arg01= 10000 + $1 ;
|
||||
execute stmt1 using @arg01, @arg01 ;
|
||||
dec $1;
|
||||
}
|
||||
select * from t1 where a > 10000 order by a ;
|
||||
delete from t1 where a > 10000 ;
|
||||
|
||||
|
||||
## insert with two rows in values part
|
||||
set @arg00=81 ;
|
||||
set @arg01='8-1' ;
|
||||
set @arg02=82 ;
|
||||
set @arg03='8-2' ;
|
||||
prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
|
||||
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
|
||||
select a,b from t1 where a in (@arg00,@arg02) order by a ;
|
||||
|
||||
## insert with two parameter in the set part
|
||||
set @arg00=9 ;
|
||||
set @arg01='nine' ;
|
||||
prepare stmt1 from 'insert into t1 set a=?, b=? ';
|
||||
execute stmt1 using @arg00, @arg01 ;
|
||||
select a,b from t1 where a = @arg00 ;
|
||||
|
||||
## insert with parameters in the ON DUPLICATE KEY part
|
||||
set @arg00=6 ;
|
||||
set @arg01=1 ;
|
||||
prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
|
||||
on duplicate key update a=a + ?, b=concat(b,''modified'') ';
|
||||
# There is no primary key collision, so there will be no key column update
|
||||
# If a key column update would be necessary occurs BUG#4312
|
||||
# deactivated, activate when BUG#4312: is solved
|
||||
# execute stmt1 using @arg00, @arg01;
|
||||
select * from t1 order by a;
|
||||
set @arg00=81 ;
|
||||
set @arg01=1 ;
|
||||
# deactivated, activate when BUG#4312: is solved
|
||||
# execute stmt1 using @arg00, @arg01;
|
||||
|
||||
## insert, autoincrement column and ' SELECT LAST_INSERT_ID() '
|
||||
# cases derived from client_test.c: test_bug3117()
|
||||
--disable_warnings
|
||||
drop table if exists t2 ;
|
||||
--enable_warnings
|
||||
# The test battery for table type 'MERGE' gets here only a 'MYISAM' table
|
||||
eval create table t2 (id int auto_increment primary key)
|
||||
ENGINE= $type ;
|
||||
prepare stmt1 from ' select last_insert_id() ' ;
|
||||
insert into t2 values (NULL) ;
|
||||
execute stmt1 ;
|
||||
insert into t2 values (NULL) ;
|
||||
execute stmt1 ;
|
||||
drop table t2 ;
|
||||
|
||||
## many parameters
|
||||
set @1000=1000 ;
|
||||
set @x1000_2="x1000_2" ;
|
||||
set @x1000_3="x1000_3" ;
|
||||
|
||||
set @x1000="x1000" ;
|
||||
set @1100=1100 ;
|
||||
set @x1100="x1100" ;
|
||||
set @100=100 ;
|
||||
set @updated="updated" ;
|
||||
insert into t1 values(1000,'x1000_1') ;
|
||||
# deactivated, activate when BUG#4312: is solved
|
||||
# insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
|
||||
# on duplicate key update a = a + @100, b = concat(b,@updated) ;
|
||||
select a,b from t1 where a >= 1000 order by a ;
|
||||
delete from t1 where a >= 1000 ;
|
||||
insert into t1 values(1000,'x1000_1') ;
|
||||
prepare stmt1 from ' insert into t1 values(?,?),(?,?)
|
||||
on duplicate key update a = a + ?, b = concat(b,?) ';
|
||||
# deactivated, activate when BUG#4312: is solved
|
||||
# execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
|
||||
select a,b from t1 where a >= 1000 order by a ;
|
||||
delete from t1 where a >= 1000 ;
|
||||
insert into t1 values(1000,'x1000_1') ;
|
||||
# deactivated, activate when BUG#4312: is solved
|
||||
# execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
|
||||
select a,b from t1 where a >= 1000 order by a ;
|
||||
delete from t1 where a >= 1000 ;
|
||||
|
||||
## replace
|
||||
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
|
||||
--error 1031
|
||||
|
||||
## multi table statements
|
||||
--disable_query_log
|
||||
select '------ multi table tests ------' as test_sequence ;
|
||||
--enable_query_log
|
||||
# cases derived from client_test.c: test_multi
|
||||
delete from t1 ;
|
||||
delete from t9 ;
|
||||
insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
|
||||
insert into t9 (c1,c21)
|
||||
values (1, 'one'), (2, 'two'), (3, 'three') ;
|
||||
prepare stmt_delete from " delete t1, t9
|
||||
from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
|
||||
prepare stmt_update from " update t1, t9
|
||||
set t1.b='updated', t9.c21='updated'
|
||||
where t1.a=t9.c1 and t1.a=? ";
|
||||
prepare stmt_select1 from " select a, b from t1 order by a" ;
|
||||
prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
|
||||
set @arg00= 1 ;
|
||||
let $1= 3 ;
|
||||
while ($1)
|
||||
{
|
||||
execute stmt_update using @arg00 ;
|
||||
execute stmt_delete ;
|
||||
execute stmt_select1 ;
|
||||
execute stmt_select2 ;
|
||||
set @arg00= @arg00 + 1 ;
|
||||
dec $1 ;
|
||||
}
|
||||
|
||||
-- source include/ps_modify.inc
|
||||
-- source include/ps_modify1.inc
|
||||
-- source include/ps_conv.inc
|
||||
|
||||
|
|
|
@ -72,3 +72,31 @@ CREATE TABLE t1 (c enum('ae','oe','ue','ss') collate latin1_german2_ci);
|
|||
INSERT INTO t1 VALUES ('ä'),('ö'),('ü'),('ß');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #6379: ENUM values are incorrectly converted
|
||||
#
|
||||
# Check latin1 -> utf8 conversion
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
a ENUM('ä','ö','ü') character set utf8 default 'ü'
|
||||
);
|
||||
show create table t1;
|
||||
insert into t1 values ('ä'), ('ö'), ('ü');
|
||||
select a from t1 order by a;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Now check utf8 -> latin1 conversion
|
||||
# This test emulates loading a script generated with mysqldump
|
||||
#
|
||||
set names utf8;
|
||||
CREATE TABLE t1 (
|
||||
a ENUM('ä','ö','ü') character set latin1 default 'ü'
|
||||
);
|
||||
insert into t1 values ('ä'),('ö'),('ü');
|
||||
# Now check what has been loaded
|
||||
set names latin1;
|
||||
show create table t1;
|
||||
select a from t1 order by a;
|
||||
drop table t1;
|
||||
|
|
|
@ -78,15 +78,15 @@ public:
|
|||
STATIC_CONST( SignalLength = 3 );
|
||||
|
||||
enum ErrorCode {
|
||||
Undefined = 200,
|
||||
FailedToAllocateBuffers = 202,
|
||||
FailedToSetupFsBuffers = 203,
|
||||
FailedToAllocateTables = 204,
|
||||
FailedInsertFileHeader = 205,
|
||||
FailedInsertTableList = 206,
|
||||
FailedAllocateTableMem = 207,
|
||||
FailedToAllocateFileRecord = 208,
|
||||
FailedToAllocateAttributeRecord = 209
|
||||
Undefined = 1340,
|
||||
FailedToAllocateBuffers = 1342,
|
||||
FailedToSetupFsBuffers = 1343,
|
||||
FailedToAllocateTables = 1344,
|
||||
FailedInsertFileHeader = 1345,
|
||||
FailedInsertTableList = 1346,
|
||||
FailedAllocateTableMem = 1347,
|
||||
FailedToAllocateFileRecord = 1348,
|
||||
FailedToAllocateAttributeRecord = 1349
|
||||
};
|
||||
private:
|
||||
Uint32 backupId;
|
||||
|
|
|
@ -119,12 +119,13 @@ public:
|
|||
|
||||
private:
|
||||
enum ErrorCodes {
|
||||
Undefined = 100,
|
||||
IAmNotMaster = 101,
|
||||
OutOfBackupRecord = 102,
|
||||
OutOfResources = 103,
|
||||
SequenceFailure = 104,
|
||||
BackupDefinitionNotImplemented = 105
|
||||
Undefined = 1300,
|
||||
IAmNotMaster = 1301,
|
||||
OutOfBackupRecord = 1302,
|
||||
OutOfResources = 1303,
|
||||
SequenceFailure = 1304,
|
||||
BackupDefinitionNotImplemented = 1305,
|
||||
CannotBackupDiskless = 1306
|
||||
};
|
||||
Uint32 senderData;
|
||||
Uint32 errorCode;
|
||||
|
@ -232,13 +233,13 @@ public:
|
|||
STATIC_CONST( SignalLength = 3 );
|
||||
|
||||
enum RequestType {
|
||||
ClientAbort = 1,
|
||||
BackupComplete = 2,
|
||||
BackupFailure = 3, // General backup failure coordinator -> slave
|
||||
LogBufferFull = 4, // slave -> coordinator
|
||||
FileOrScanError = 5, // slave -> coordinator
|
||||
BackupFailureDueToNodeFail = 6, // slave -> slave
|
||||
OkToClean = 7 // master -> slave
|
||||
ClientAbort = 1321,
|
||||
BackupComplete = 1322,
|
||||
BackupFailure = 1323, // General backup failure coordinator -> slave
|
||||
LogBufferFull = 1324, // slave -> coordinator
|
||||
FileOrScanError = 1325, // slave -> coordinator
|
||||
BackupFailureDueToNodeFail = 1326, // slave -> slave
|
||||
OkToClean = 1327 // master -> slave
|
||||
};
|
||||
private:
|
||||
Uint32 requestType;
|
||||
|
|
|
@ -375,6 +375,7 @@ extern "C" {
|
|||
int ndb_mgm_get_configuration_nodeid(NdbMgmHandle handle);
|
||||
int ndb_mgm_get_connected_port(NdbMgmHandle handle);
|
||||
const char *ndb_mgm_get_connected_host(NdbMgmHandle handle);
|
||||
const char *ndb_mgm_get_connectstring(NdbMgmHandle handle, char *buf, int buf_sz);
|
||||
|
||||
/**
|
||||
* Destroy a management server handle
|
||||
|
@ -746,6 +747,7 @@ extern "C" {
|
|||
int ndb_mgm_get_string_parameter(const ndb_mgm_configuration_iterator*,
|
||||
int param, const char ** value);
|
||||
int ndb_mgm_purge_stale_sessions(NdbMgmHandle handle, char **);
|
||||
int ndb_mgm_check_connection(NdbMgmHandle handle);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -72,6 +72,7 @@ public:
|
|||
|
||||
Uint32 get_mgmd_port() const;
|
||||
const char *get_mgmd_host() const;
|
||||
const char *get_connectstring(char *buf, int buf_sz) const;
|
||||
|
||||
Uint32 get_configuration_nodeid() const;
|
||||
private:
|
||||
|
|
|
@ -30,12 +30,14 @@ class Ndb_cluster_connection {
|
|||
public:
|
||||
Ndb_cluster_connection(const char * connect_string = 0);
|
||||
~Ndb_cluster_connection();
|
||||
int connect(int reconnect= 0);
|
||||
int connect(int no_retries, int retry_delay_in_seconds, int verbose);
|
||||
int start_connect_thread(int (*connect_callback)(void)= 0);
|
||||
const char *get_connectstring(char *buf, int buf_sz) const;
|
||||
int get_connected_port() const;
|
||||
const char *get_connected_host() const;
|
||||
private:
|
||||
friend void* run_ndb_cluster_connection_connect_thread(void*);
|
||||
void connect_thread();
|
||||
char *m_connect_string;
|
||||
TransporterFacade *m_facade;
|
||||
ConfigRetriever *m_config_retriever;
|
||||
NdbThread *m_connect_thread;
|
||||
|
|
|
@ -46,7 +46,8 @@ typedef enum
|
|||
ndberror_cl_internal_error = 12,
|
||||
ndberror_cl_function_not_implemented = 13,
|
||||
ndberror_cl_unknown_error_code = 14,
|
||||
ndberror_cl_node_shutdown = 15
|
||||
ndberror_cl_node_shutdown = 15,
|
||||
ndberror_cl_configuration = 16
|
||||
} ndberror_classification_enum;
|
||||
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ Logger::addHandler(const BaseString &logstring) {
|
|||
logstring.split(logdest, ";");
|
||||
|
||||
for(i = 0; i < logdest.size(); i++) {
|
||||
DBUG_PRINT("info",("adding: %s",logdest[i]));
|
||||
DBUG_PRINT("info",("adding: %s",logdest[i].c_str()));
|
||||
|
||||
Vector<BaseString> v_type_args;
|
||||
logdest[i].split(v_type_args, ":", 2);
|
||||
|
|
|
@ -90,6 +90,11 @@ const char *ConfigRetriever::get_mgmd_host() const
|
|||
return ndb_mgm_get_connected_host(m_handle);
|
||||
}
|
||||
|
||||
const char *ConfigRetriever::get_connectstring(char *buf, int buf_sz) const
|
||||
{
|
||||
return ndb_mgm_get_connectstring(m_handle, buf, buf_sz);
|
||||
}
|
||||
|
||||
//****************************************************************************
|
||||
//****************************************************************************
|
||||
|
||||
|
|
|
@ -863,6 +863,13 @@ Backup::execBACKUP_REQ(Signal* signal)
|
|||
sendBackupRef(senderRef, signal, senderData, BackupRef::IAmNotMaster);
|
||||
return;
|
||||
}//if
|
||||
|
||||
if (m_diskless)
|
||||
{
|
||||
sendBackupRef(senderRef, signal, senderData,
|
||||
BackupRef::CannotBackupDiskless);
|
||||
return;
|
||||
}
|
||||
|
||||
if(dataLen32 != 0) {
|
||||
jam();
|
||||
|
|
|
@ -526,6 +526,7 @@ public:
|
|||
NdbNodeBitmask c_aliveNodes;
|
||||
DLList<BackupRecord> c_backups;
|
||||
Config c_defaults;
|
||||
Uint32 m_diskless;
|
||||
|
||||
STATIC_CONST(NO_OF_PAGES_META_FILE = 2);
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ Backup::Backup(const Configuration & conf) :
|
|||
ndbrequire(p != 0);
|
||||
|
||||
Uint32 noBackups = 0, noTables = 0, noAttribs = 0;
|
||||
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_DISCLESS, &m_diskless));
|
||||
ndb_mgm_get_int_parameter(p, CFG_DB_PARALLEL_BACKUPS, &noBackups);
|
||||
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_TABLES, &noTables));
|
||||
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_ATTRIBUTES, &noAttribs));
|
||||
|
|
|
@ -706,7 +706,10 @@ Dbtup::checkUpdateOfPrimaryKey(Uint32* updateBuffer, Tablerec* const regTabPtr)
|
|||
tOutBufIndex = 0;
|
||||
tMaxRead = MAX_KEY_SIZE_IN_WORDS;
|
||||
|
||||
bool tmp = tXfrmFlag;
|
||||
tXfrmFlag = false;
|
||||
ndbrequire((this->*f)(&keyReadBuffer[0], ahOut, attrDescriptor, attributeOffset));
|
||||
tXfrmFlag = tmp;
|
||||
ndbrequire(tOutBufIndex == ahOut->getDataSize());
|
||||
if (ahIn.getDataSize() != ahOut->getDataSize()) {
|
||||
ljam();
|
||||
|
|
|
@ -298,13 +298,21 @@ char *
|
|||
LocalConfig::makeConnectString(char *buf, int sz)
|
||||
{
|
||||
int p= BaseString::snprintf(buf,sz,"nodeid=%d", _ownNodeId);
|
||||
for (int i = 0; (i < ids.size()) && (sz-p > 0); i++)
|
||||
{
|
||||
if (ids[i].type != MgmId_TCP)
|
||||
continue;
|
||||
p+=BaseString::snprintf(buf+p,sz-p,",%s:%d",
|
||||
ids[i].name.c_str(), ids[i].port);
|
||||
}
|
||||
if (p < sz)
|
||||
for (unsigned i = 0; i < ids.size(); i++)
|
||||
{
|
||||
if (ids[i].type != MgmId_TCP)
|
||||
continue;
|
||||
int new_p= p+BaseString::snprintf(buf+p,sz-p,",%s:%d",
|
||||
ids[i].name.c_str(), ids[i].port);
|
||||
if (new_p < sz)
|
||||
p= new_p;
|
||||
else
|
||||
{
|
||||
buf[p]= 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
buf[sz-1]=0;
|
||||
return buf;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,6 @@ typedef Parser<ParserDummy> Parser_t;
|
|||
#define NDB_MGM_MAX_ERR_DESC_SIZE 256
|
||||
|
||||
struct ndb_mgm_handle {
|
||||
char * connectstring;
|
||||
int cfg_i;
|
||||
|
||||
int connected;
|
||||
|
@ -575,7 +574,9 @@ cmp_state(const void *_a, const void *_b)
|
|||
a = (struct ndb_mgm_node_state *)_a;
|
||||
b = (struct ndb_mgm_node_state *)_b;
|
||||
|
||||
return a->node_id > b->node_id;
|
||||
if (a->node_id > b->node_id)
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
|
@ -1677,6 +1678,12 @@ const char *ndb_mgm_get_connected_host(NdbMgmHandle handle)
|
|||
return handle->cfg.ids[handle->cfg_i].name.c_str();
|
||||
}
|
||||
|
||||
extern "C"
|
||||
const char *ndb_mgm_get_connectstring(NdbMgmHandle handle, char *buf, int buf_sz)
|
||||
{
|
||||
return handle->cfg.makeConnectString(buf,buf_sz);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
int
|
||||
ndb_mgm_alloc_nodeid(NdbMgmHandle handle, unsigned int version, int nodetype)
|
||||
|
@ -1934,4 +1941,38 @@ ndb_mgm_purge_stale_sessions(NdbMgmHandle handle, char **purged){
|
|||
return res;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
int
|
||||
ndb_mgm_check_connection(NdbMgmHandle handle){
|
||||
CHECK_HANDLE(handle, 0);
|
||||
CHECK_CONNECTED(handle, 0);
|
||||
SocketOutputStream out(handle->socket);
|
||||
SocketInputStream in(handle->socket, handle->read_timeout);
|
||||
char buf[32];
|
||||
|
||||
if (out.println("check connection"))
|
||||
goto ndb_mgm_check_connection_error;
|
||||
|
||||
if (out.println(""))
|
||||
goto ndb_mgm_check_connection_error;
|
||||
|
||||
in.gets(buf, sizeof(buf));
|
||||
if(strcmp("check connection reply\n", buf))
|
||||
goto ndb_mgm_check_connection_error;
|
||||
|
||||
in.gets(buf, sizeof(buf));
|
||||
if(strcmp("result: Ok\n", buf))
|
||||
goto ndb_mgm_check_connection_error;
|
||||
|
||||
in.gets(buf, sizeof(buf));
|
||||
if(strcmp("\n", buf))
|
||||
goto ndb_mgm_check_connection_error;
|
||||
|
||||
return 0;
|
||||
|
||||
ndb_mgm_check_connection_error:
|
||||
ndb_mgm_disconnect(handle);
|
||||
return -1;
|
||||
}
|
||||
|
||||
template class Vector<const ParserRow<ParserDummy>*>;
|
||||
|
|
|
@ -54,10 +54,11 @@ public:
|
|||
*
|
||||
* @return true until quit/bye/exit has been typed
|
||||
*/
|
||||
int execute(const char *_line, int _try_reconnect=-1);
|
||||
int execute(const char *_line, int _try_reconnect=-1, int *error= 0);
|
||||
|
||||
private:
|
||||
void printError();
|
||||
int execute_impl(const char *_line);
|
||||
|
||||
/**
|
||||
* Analyse the command line, after the first token.
|
||||
|
@ -96,7 +97,7 @@ private:
|
|||
void executeShow(char* parameters);
|
||||
void executeConnect(char* parameters);
|
||||
void executePurge(char* parameters);
|
||||
void executeShutdown(char* parameters);
|
||||
int executeShutdown(char* parameters);
|
||||
void executeRun(char* parameters);
|
||||
void executeInfo(char* parameters);
|
||||
void executeClusterLog(char* parameters);
|
||||
|
@ -121,7 +122,7 @@ public:
|
|||
void executeStatus(int processId, const char* parameters, bool all);
|
||||
void executeEventReporting(int processId, const char* parameters, bool all);
|
||||
void executeDumpState(int processId, const char* parameters, bool all);
|
||||
void executeStartBackup(char * parameters);
|
||||
int executeStartBackup(char * parameters);
|
||||
void executeAbortBackup(char * parameters);
|
||||
|
||||
void executeRep(char* parameters);
|
||||
|
@ -156,6 +157,7 @@ private:
|
|||
bool connected;
|
||||
int m_verbose;
|
||||
int try_reconnect;
|
||||
int m_error;
|
||||
#ifdef HAVE_GLOBAL_REPLICATION
|
||||
NdbRepHandle m_repserver;
|
||||
const char *rep_host;
|
||||
|
@ -179,9 +181,9 @@ Ndb_mgmclient::~Ndb_mgmclient()
|
|||
{
|
||||
delete m_cmd;
|
||||
}
|
||||
int Ndb_mgmclient::execute(const char *_line, int _try_reconnect)
|
||||
int Ndb_mgmclient::execute(const char *_line, int _try_reconnect, int *error)
|
||||
{
|
||||
return m_cmd->execute(_line,_try_reconnect);
|
||||
return m_cmd->execute(_line,_try_reconnect,error);
|
||||
}
|
||||
int
|
||||
Ndb_mgmclient::disconnect()
|
||||
|
@ -227,7 +229,7 @@ extern "C" {
|
|||
#include <util/InputStream.hpp>
|
||||
#include <util/OutputStream.hpp>
|
||||
|
||||
int Ndb_mgmclient::execute(int argc, char** argv, int _try_reconnect)
|
||||
int Ndb_mgmclient::execute(int argc, char** argv, int _try_reconnect, int *error)
|
||||
{
|
||||
if (argc <= 0)
|
||||
return 0;
|
||||
|
@ -236,7 +238,7 @@ int Ndb_mgmclient::execute(int argc, char** argv, int _try_reconnect)
|
|||
{
|
||||
_line.appfmt(" %s", argv[i]);
|
||||
}
|
||||
return m_cmd->execute(_line.c_str(),_try_reconnect);
|
||||
return m_cmd->execute(_line.c_str(),_try_reconnect, error);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -277,7 +279,7 @@ static const char* helpText =
|
|||
"REP CONNECT <host:port> Connect to REP server on host:port\n"
|
||||
#endif
|
||||
"PURGE STALE SESSIONS Reset reserved nodeid's in the mgmt server\n"
|
||||
"CONNECT Connect to management server (reconnect if already connected)\n"
|
||||
"CONNECT [<connectstring>] Connect to management server (reconnect if already connected)\n"
|
||||
"QUIT Quit management client\n"
|
||||
;
|
||||
|
||||
|
@ -427,6 +429,8 @@ emptyString(const char* s)
|
|||
void
|
||||
CommandInterpreter::printError()
|
||||
{
|
||||
if (ndb_mgm_check_connection(m_mgmsrv))
|
||||
connected= false;
|
||||
ndbout_c("* %5d: %s",
|
||||
ndb_mgm_get_latest_error(m_mgmsrv),
|
||||
ndb_mgm_get_latest_error_msg(m_mgmsrv));
|
||||
|
@ -469,13 +473,24 @@ CommandInterpreter::disconnect()
|
|||
//*****************************************************************************
|
||||
|
||||
int
|
||||
CommandInterpreter::execute(const char *_line, int _try_reconnect)
|
||||
CommandInterpreter::execute(const char *_line, int _try_reconnect,
|
||||
int *error)
|
||||
{
|
||||
DBUG_ENTER("CommandInterpreter::execute");
|
||||
DBUG_PRINT("info",("line=\"%s\"",_line));
|
||||
|
||||
if (_try_reconnect >= 0)
|
||||
try_reconnect=_try_reconnect;
|
||||
int result= execute_impl(_line);
|
||||
if (error)
|
||||
*error= m_error;
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
CommandInterpreter::execute_impl(const char *_line)
|
||||
{
|
||||
DBUG_ENTER("CommandInterpreter::execute_impl");
|
||||
DBUG_PRINT("enter",("line=\"%s\"",_line));
|
||||
m_error= 0;
|
||||
|
||||
char * line;
|
||||
if(_line == NULL) {
|
||||
// ndbout << endl;
|
||||
|
@ -488,84 +503,80 @@ CommandInterpreter::execute(const char *_line, int _try_reconnect)
|
|||
DBUG_RETURN(true);
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < strlen(line); ++i) {
|
||||
line[i] = toupper(line[i]);
|
||||
}
|
||||
|
||||
// if there is anything in the line proceed
|
||||
char* firstToken = strtok(line, " ");
|
||||
char* allAfterFirstToken = strtok(NULL, "");
|
||||
|
||||
if (strcmp(firstToken, "HELP") == 0 ||
|
||||
strcmp(firstToken, "?") == 0) {
|
||||
if (strcasecmp(firstToken, "HELP") == 0 ||
|
||||
strcasecmp(firstToken, "?") == 0) {
|
||||
executeHelp(allAfterFirstToken);
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
else if (strcmp(firstToken, "CONNECT") == 0) {
|
||||
else if (strcasecmp(firstToken, "CONNECT") == 0) {
|
||||
executeConnect(allAfterFirstToken);
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
else if((strcasecmp(firstToken, "QUIT") == 0 ||
|
||||
strcasecmp(firstToken, "EXIT") == 0 ||
|
||||
strcasecmp(firstToken, "BYE") == 0) &&
|
||||
allAfterFirstToken == NULL){
|
||||
DBUG_RETURN(false);
|
||||
}
|
||||
|
||||
if (!connect())
|
||||
DBUG_RETURN(true);
|
||||
|
||||
if (strcmp(firstToken, "SHOW") == 0) {
|
||||
if (strcasecmp(firstToken, "SHOW") == 0) {
|
||||
executeShow(allAfterFirstToken);
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
else if (strcmp(firstToken, "SHUTDOWN") == 0) {
|
||||
executeShutdown(allAfterFirstToken);
|
||||
else if (strcasecmp(firstToken, "SHUTDOWN") == 0) {
|
||||
m_error= executeShutdown(allAfterFirstToken);
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
else if (strcmp(firstToken, "CLUSTERLOG") == 0){
|
||||
else if (strcasecmp(firstToken, "CLUSTERLOG") == 0){
|
||||
executeClusterLog(allAfterFirstToken);
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
else if(strcmp(firstToken, "START") == 0 &&
|
||||
else if(strcasecmp(firstToken, "START") == 0 &&
|
||||
allAfterFirstToken != NULL &&
|
||||
strncmp(allAfterFirstToken, "BACKUP", sizeof("BACKUP") - 1) == 0){
|
||||
executeStartBackup(allAfterFirstToken);
|
||||
strncasecmp(allAfterFirstToken, "BACKUP", sizeof("BACKUP") - 1) == 0){
|
||||
m_error= executeStartBackup(allAfterFirstToken);
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
else if(strcmp(firstToken, "ABORT") == 0 &&
|
||||
else if(strcasecmp(firstToken, "ABORT") == 0 &&
|
||||
allAfterFirstToken != NULL &&
|
||||
strncmp(allAfterFirstToken, "BACKUP", sizeof("BACKUP") - 1) == 0){
|
||||
strncasecmp(allAfterFirstToken, "BACKUP", sizeof("BACKUP") - 1) == 0){
|
||||
executeAbortBackup(allAfterFirstToken);
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
else if (strcmp(firstToken, "PURGE") == 0) {
|
||||
else if (strcasecmp(firstToken, "PURGE") == 0) {
|
||||
executePurge(allAfterFirstToken);
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
#ifdef HAVE_GLOBAL_REPLICATION
|
||||
else if(strcmp(firstToken, "REPLICATION") == 0 ||
|
||||
strcmp(firstToken, "REP") == 0) {
|
||||
else if(strcasecmp(firstToken, "REPLICATION") == 0 ||
|
||||
strcasecmp(firstToken, "REP") == 0) {
|
||||
executeRep(allAfterFirstToken);
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
#endif // HAVE_GLOBAL_REPLICATION
|
||||
else if(strcmp(firstToken, "ENTER") == 0 &&
|
||||
else if(strcasecmp(firstToken, "ENTER") == 0 &&
|
||||
allAfterFirstToken != NULL &&
|
||||
strncmp(allAfterFirstToken, "SINGLE USER MODE ",
|
||||
strncasecmp(allAfterFirstToken, "SINGLE USER MODE ",
|
||||
sizeof("SINGLE USER MODE") - 1) == 0){
|
||||
executeEnterSingleUser(allAfterFirstToken);
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
else if(strcmp(firstToken, "EXIT") == 0 &&
|
||||
else if(strcasecmp(firstToken, "EXIT") == 0 &&
|
||||
allAfterFirstToken != NULL &&
|
||||
strncmp(allAfterFirstToken, "SINGLE USER MODE ",
|
||||
strncasecmp(allAfterFirstToken, "SINGLE USER MODE ",
|
||||
sizeof("SINGLE USER MODE") - 1) == 0){
|
||||
executeExitSingleUser(allAfterFirstToken);
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
else if (strcmp(firstToken, "ALL") == 0) {
|
||||
else if (strcasecmp(firstToken, "ALL") == 0) {
|
||||
analyseAfterFirstToken(-1, allAfterFirstToken);
|
||||
}
|
||||
else if((strcmp(firstToken, "QUIT") == 0 ||
|
||||
strcmp(firstToken, "EXIT") == 0 ||
|
||||
strcmp(firstToken, "BYE") == 0) &&
|
||||
allAfterFirstToken == NULL){
|
||||
DBUG_RETURN(false);
|
||||
} else {
|
||||
/**
|
||||
* First token should be a digit, node ID
|
||||
|
@ -573,12 +584,12 @@ CommandInterpreter::execute(const char *_line, int _try_reconnect)
|
|||
int nodeId;
|
||||
|
||||
if (! convert(firstToken, nodeId)) {
|
||||
ndbout << "Invalid command: " << line << endl;
|
||||
ndbout << "Invalid command: " << _line << endl;
|
||||
ndbout << "Type HELP for help." << endl << endl;
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
|
||||
if (nodeId < 0) {
|
||||
if (nodeId <= 0) {
|
||||
ndbout << "Invalid node ID: " << firstToken << "." << endl;
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
|
@ -639,7 +650,7 @@ CommandInterpreter::analyseAfterFirstToken(int processId,
|
|||
ExecuteFunction fun = 0;
|
||||
const char * command = 0;
|
||||
for(int i = 0; i<tmpSize; i++){
|
||||
if(strcmp(secondToken, commands[i].command) == 0){
|
||||
if(strcasecmp(secondToken, commands[i].command) == 0){
|
||||
fun = commands[i].executeFunction;
|
||||
command = commands[i].command;
|
||||
break;
|
||||
|
@ -655,7 +666,7 @@ CommandInterpreter::analyseAfterFirstToken(int processId,
|
|||
if(processId == -1){
|
||||
executeForAll(command, fun, allAfterSecondToken);
|
||||
} else {
|
||||
if(strcmp(command, "STATUS") != 0)
|
||||
if(strcasecmp(command, "STATUS") != 0)
|
||||
ndbout_c("Executing %s on node %d.", command, processId);
|
||||
(this->*fun)(processId, allAfterSecondToken, false);
|
||||
ndbout << endl;
|
||||
|
@ -705,10 +716,10 @@ CommandInterpreter::executeForAll(const char * cmd, ExecuteFunction fun,
|
|||
const char * allAfterSecondToken)
|
||||
{
|
||||
int nodeId = 0;
|
||||
if(strcmp(cmd, "STOP") == 0) {
|
||||
if(strcasecmp(cmd, "STOP") == 0) {
|
||||
ndbout_c("Executing STOP on all nodes.");
|
||||
(this->*fun)(nodeId, allAfterSecondToken, true);
|
||||
} else if(strcmp(cmd, "RESTART") == 0) {
|
||||
} else if(strcasecmp(cmd, "RESTART") == 0) {
|
||||
ndbout_c("Executing RESTART on all nodes.");
|
||||
ndbout_c("Starting shutdown. This may take a while. Please wait...");
|
||||
(this->*fun)(nodeId, allAfterSecondToken, true);
|
||||
|
@ -723,7 +734,7 @@ CommandInterpreter::executeForAll(const char * cmd, ExecuteFunction fun,
|
|||
}
|
||||
NdbAutoPtr<char> ap1((char*)cl);
|
||||
while(get_next_nodeid(cl, &nodeId, NDB_MGM_NODE_TYPE_NDB)) {
|
||||
if(strcmp(cmd, "STATUS") != 0)
|
||||
if(strcasecmp(cmd, "STATUS") != 0)
|
||||
ndbout_c("Executing %s on node %d.", cmd, nodeId);
|
||||
(this->*fun)(nodeId, allAfterSecondToken, true);
|
||||
ndbout << endl;
|
||||
|
@ -751,7 +762,7 @@ CommandInterpreter::parseBlockSpecification(const char* allAfterLog,
|
|||
firstTokenAfterLog[i] = toupper(firstTokenAfterLog[i]);
|
||||
}
|
||||
|
||||
if (strcmp(firstTokenAfterLog, "BLOCK") != 0) {
|
||||
if (strcasecmp(firstTokenAfterLog, "BLOCK") != 0) {
|
||||
ndbout << "Unexpected value: " << firstTokenAfterLog
|
||||
<< ". Expected BLOCK." << endl;
|
||||
return false;
|
||||
|
@ -764,7 +775,7 @@ CommandInterpreter::parseBlockSpecification(const char* allAfterLog,
|
|||
}
|
||||
|
||||
char* secondTokenAfterLog = strtok(allAfterFirstToken, " ");
|
||||
if (strcmp(secondTokenAfterLog, "=") != 0) {
|
||||
if (strcasecmp(secondTokenAfterLog, "=") != 0) {
|
||||
ndbout << "Unexpected value: " << secondTokenAfterLog
|
||||
<< ". Expected =." << endl;
|
||||
return false;
|
||||
|
@ -772,7 +783,7 @@ CommandInterpreter::parseBlockSpecification(const char* allAfterLog,
|
|||
|
||||
char* blockName = strtok(NULL, " ");
|
||||
bool all = false;
|
||||
if (blockName != NULL && (strcmp(blockName, "ALL") == 0)) {
|
||||
if (blockName != NULL && (strcasecmp(blockName, "ALL") == 0)) {
|
||||
all = true;
|
||||
}
|
||||
while (blockName != NULL) {
|
||||
|
@ -823,15 +834,15 @@ CommandInterpreter::executeHelp(char* parameters)
|
|||
ndbout << "<level> = " << "0 - 15" << endl;
|
||||
ndbout << "<id> = " << "ALL | Any database node id" << endl;
|
||||
ndbout << endl;
|
||||
} else if (strcmp(parameters, "SHOW") == 0) {
|
||||
} else if (strcasecmp(parameters, "SHOW") == 0) {
|
||||
ndbout << helpTextShow;
|
||||
#ifdef HAVE_GLOBAL_REPLICATION
|
||||
} else if (strcmp(parameters, "REPLICATION") == 0 ||
|
||||
strcmp(parameters, "REP") == 0) {
|
||||
} else if (strcasecmp(parameters, "REPLICATION") == 0 ||
|
||||
strcasecmp(parameters, "REP") == 0) {
|
||||
ndbout << helpTextRep;
|
||||
#endif // HAVE_GLOBAL_REPLICATION
|
||||
#ifdef VM_TRACE // DEBUG ONLY
|
||||
} else if (strcmp(parameters, "DEBUG") == 0) {
|
||||
} else if (strcasecmp(parameters, "DEBUG") == 0) {
|
||||
ndbout << helpTextDebug;
|
||||
#endif
|
||||
} else {
|
||||
|
@ -845,23 +856,23 @@ CommandInterpreter::executeHelp(char* parameters)
|
|||
* SHUTDOWN
|
||||
*****************************************************************************/
|
||||
|
||||
void
|
||||
int
|
||||
CommandInterpreter::executeShutdown(char* parameters)
|
||||
{
|
||||
ndb_mgm_cluster_state *state = ndb_mgm_get_status(m_mgmsrv);
|
||||
if(state == NULL) {
|
||||
ndbout_c("Could not get status");
|
||||
printError();
|
||||
return;
|
||||
return 1;
|
||||
}
|
||||
NdbAutoPtr<char> ap1((char*)state);
|
||||
|
||||
int result = 0;
|
||||
result = ndb_mgm_stop(m_mgmsrv, 0, 0);
|
||||
if (result < 0) {
|
||||
ndbout << "Shutdown failed." << endl;
|
||||
ndbout << "Shutdown off NDB Cluster storage node(s) failed." << endl;
|
||||
printError();
|
||||
return;
|
||||
return result;
|
||||
}
|
||||
|
||||
ndbout << result << " NDB Cluster storage node(s) have shutdown." << endl;
|
||||
|
@ -876,21 +887,23 @@ CommandInterpreter::executeShutdown(char* parameters)
|
|||
ndbout << "Unable to locate management server, "
|
||||
<< "shutdown manually with <id> STOP"
|
||||
<< endl;
|
||||
return;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result = 0;
|
||||
result = ndb_mgm_stop(m_mgmsrv, 1, &mgm_id);
|
||||
if (result <= 0) {
|
||||
ndbout << "Shutdown failed." << endl;
|
||||
ndbout << "Shutdown of NDB Cluster management server failed." << endl;
|
||||
printError();
|
||||
return;
|
||||
if (result == 0)
|
||||
return 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
connected = false;
|
||||
ndbout << "NDB Cluster management server shutdown." << endl;
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -939,7 +952,7 @@ print_nodes(ndb_mgm_cluster_state *state, ndb_mgm_configuration_iterator *it,
|
|||
const char *hostname= node_state->connect_address;
|
||||
if (hostname == 0
|
||||
|| strlen(hostname) == 0
|
||||
|| strcmp(hostname,"0.0.0.0") == 0)
|
||||
|| strcasecmp(hostname,"0.0.0.0") == 0)
|
||||
ndbout << " ";
|
||||
else
|
||||
ndbout << "\t@" << hostname;
|
||||
|
@ -984,9 +997,9 @@ CommandInterpreter::executePurge(char* parameters)
|
|||
break;
|
||||
char* firstToken = strtok(parameters, " ");
|
||||
char* nextToken = strtok(NULL, " \0");
|
||||
if (strcmp(firstToken,"STALE") == 0 &&
|
||||
if (strcasecmp(firstToken,"STALE") == 0 &&
|
||||
nextToken &&
|
||||
strcmp(nextToken, "SESSIONS") == 0) {
|
||||
strcasecmp(nextToken, "SESSIONS") == 0) {
|
||||
command_ok= 1;
|
||||
break;
|
||||
}
|
||||
|
@ -1019,9 +1032,6 @@ CommandInterpreter::executeShow(char* parameters)
|
|||
{
|
||||
int i;
|
||||
if (emptyString(parameters)) {
|
||||
ndbout << "Cluster Configuration" << endl
|
||||
<< "---------------------" << endl;
|
||||
|
||||
ndb_mgm_cluster_state *state = ndb_mgm_get_status(m_mgmsrv);
|
||||
if(state == NULL) {
|
||||
ndbout_c("Could not get status");
|
||||
|
@ -1081,22 +1091,24 @@ CommandInterpreter::executeShow(char* parameters)
|
|||
}
|
||||
}
|
||||
|
||||
ndbout << "Cluster Configuration" << endl
|
||||
<< "---------------------" << endl;
|
||||
print_nodes(state, it, "ndbd", ndb_nodes, NDB_MGM_NODE_TYPE_NDB, master_id);
|
||||
print_nodes(state, it, "ndb_mgmd", mgm_nodes, NDB_MGM_NODE_TYPE_MGM, 0);
|
||||
print_nodes(state, it, "mysqld", api_nodes, NDB_MGM_NODE_TYPE_API, 0);
|
||||
// ndbout << helpTextShow;
|
||||
return;
|
||||
} else if (strcmp(parameters, "PROPERTIES") == 0 ||
|
||||
strcmp(parameters, "PROP") == 0) {
|
||||
} else if (strcasecmp(parameters, "PROPERTIES") == 0 ||
|
||||
strcasecmp(parameters, "PROP") == 0) {
|
||||
ndbout << "SHOW PROPERTIES is not yet implemented." << endl;
|
||||
// ndbout << "_mgmtSrvr.getConfig()->print();" << endl; /* XXX */
|
||||
} else if (strcmp(parameters, "CONFIGURATION") == 0 ||
|
||||
strcmp(parameters, "CONFIG") == 0){
|
||||
} else if (strcasecmp(parameters, "CONFIGURATION") == 0 ||
|
||||
strcasecmp(parameters, "CONFIG") == 0){
|
||||
ndbout << "SHOW CONFIGURATION is not yet implemented." << endl;
|
||||
//nbout << "_mgmtSrvr.getConfig()->printConfigFile();" << endl; /* XXX */
|
||||
} else if (strcmp(parameters, "PARAMETERS") == 0 ||
|
||||
strcmp(parameters, "PARAMS") == 0 ||
|
||||
strcmp(parameters, "PARAM") == 0) {
|
||||
} else if (strcasecmp(parameters, "PARAMETERS") == 0 ||
|
||||
strcasecmp(parameters, "PARAMS") == 0 ||
|
||||
strcasecmp(parameters, "PARAM") == 0) {
|
||||
ndbout << "SHOW PARAMETERS is not yet implemented." << endl;
|
||||
// ndbout << "_mgmtSrvr.getConfig()->getConfigInfo()->print();"
|
||||
// << endl; /* XXX */
|
||||
|
@ -1109,6 +1121,14 @@ void
|
|||
CommandInterpreter::executeConnect(char* parameters)
|
||||
{
|
||||
disconnect();
|
||||
if (!emptyString(parameters)) {
|
||||
if (ndb_mgm_set_connectstring(m_mgmsrv,
|
||||
BaseString(parameters).trim().c_str()))
|
||||
{
|
||||
printError();
|
||||
return;
|
||||
}
|
||||
}
|
||||
connect();
|
||||
}
|
||||
|
||||
|
@ -1132,7 +1152,7 @@ CommandInterpreter::executeClusterLog(char* parameters)
|
|||
/********************
|
||||
* CLUSTERLOG FILTER
|
||||
********************/
|
||||
if (strcmp(item, "FILTER") == 0) {
|
||||
if (strcasecmp(item, "FILTER") == 0) {
|
||||
|
||||
item = strtok_r(NULL, " ", &tmpPtr);
|
||||
if (item == NULL) {
|
||||
|
@ -1141,21 +1161,21 @@ CommandInterpreter::executeClusterLog(char* parameters)
|
|||
while (item != NULL) {
|
||||
snprintf(name, sizeof(name), item);
|
||||
|
||||
if (strcmp(item, "ALL") == 0) {
|
||||
if (strcasecmp(item, "ALL") == 0) {
|
||||
severity = NDB_MGM_CLUSTERLOG_ALL;
|
||||
} else if (strcmp(item, "ALERT") == 0) {
|
||||
} else if (strcasecmp(item, "ALERT") == 0) {
|
||||
severity = NDB_MGM_CLUSTERLOG_ALERT;
|
||||
} else if (strcmp(item, "CRITICAL") == 0) {
|
||||
} else if (strcasecmp(item, "CRITICAL") == 0) {
|
||||
severity = NDB_MGM_CLUSTERLOG_CRITICAL;
|
||||
} else if (strcmp(item, "ERROR") == 0) {
|
||||
} else if (strcasecmp(item, "ERROR") == 0) {
|
||||
severity = NDB_MGM_CLUSTERLOG_ERROR;
|
||||
} else if (strcmp(item, "WARNING") == 0) {
|
||||
} else if (strcasecmp(item, "WARNING") == 0) {
|
||||
severity = NDB_MGM_CLUSTERLOG_WARNING;
|
||||
} else if (strcmp(item, "INFO") == 0) {
|
||||
} else if (strcasecmp(item, "INFO") == 0) {
|
||||
severity = NDB_MGM_CLUSTERLOG_INFO;
|
||||
} else if (strcmp(item, "DEBUG") == 0) {
|
||||
} else if (strcasecmp(item, "DEBUG") == 0) {
|
||||
severity = NDB_MGM_CLUSTERLOG_DEBUG;
|
||||
} else if (strcmp(item, "OFF") == 0) {
|
||||
} else if (strcasecmp(item, "OFF") == 0) {
|
||||
severity = NDB_MGM_CLUSTERLOG_OFF;
|
||||
} else {
|
||||
isOk = false;
|
||||
|
@ -1168,17 +1188,17 @@ CommandInterpreter::executeClusterLog(char* parameters)
|
|||
ndbout << "Missing argument(s)." << endl;
|
||||
} else if (isOk) {
|
||||
if(ndb_mgm_filter_clusterlog(m_mgmsrv, severity, NULL)) {
|
||||
if(strcmp(name, "ALL") == 0 || strcmp(name, "all") == 0) {
|
||||
if(strcasecmp(name, "ALL") == 0) {
|
||||
ndbout << "All severities levels enabled." << endl;
|
||||
} else if(strcmp(name, "OFF") == 0 || strcmp(name, "off") == 0) {
|
||||
} else if(strcasecmp(name, "OFF") == 0) {
|
||||
ndbout << "Cluster logging enabled." << endl;
|
||||
} else {
|
||||
ndbout << name << " events disabled." << endl;
|
||||
}
|
||||
} else {
|
||||
if(strcmp(name, "ALL") == 0) {
|
||||
if(strcasecmp(name, "ALL") == 0) {
|
||||
ndbout << "All severities levels disabled." << endl;
|
||||
} else if(strcmp(name, "OFF") == 0) {
|
||||
} else if(strcasecmp(name, "OFF") == 0) {
|
||||
ndbout << "Cluster logging disabled." << endl;
|
||||
} else {
|
||||
ndbout << name << " events enabled." << endl;
|
||||
|
@ -1191,7 +1211,7 @@ CommandInterpreter::executeClusterLog(char* parameters)
|
|||
/********************
|
||||
* CLUSTERLOG INFO
|
||||
********************/
|
||||
} else if (strcmp(item, "INFO") == 0) {
|
||||
} else if (strcasecmp(item, "INFO") == 0) {
|
||||
Uint32 *enabled = ndb_mgm_get_logfilter(m_mgmsrv);
|
||||
if(enabled == NULL) {
|
||||
ndbout << "Couldn't get status" << endl;
|
||||
|
@ -1216,7 +1236,7 @@ CommandInterpreter::executeClusterLog(char* parameters)
|
|||
/********************
|
||||
* CLUSTERLOG OFF
|
||||
********************/
|
||||
} else if (strcmp(item, "OFF") == 0) {
|
||||
} else if (strcasecmp(item, "OFF") == 0) {
|
||||
Uint32 *enabled = ndb_mgm_get_logfilter(m_mgmsrv);
|
||||
if(enabled == NULL) {
|
||||
ndbout << "Couldn't get status" << endl;
|
||||
|
@ -1234,7 +1254,7 @@ CommandInterpreter::executeClusterLog(char* parameters)
|
|||
/********************
|
||||
* CLUSTERLOG ON
|
||||
********************/
|
||||
} else if (strcmp(item, "ON") == 0) {
|
||||
} else if (strcasecmp(item, "ON") == 0) {
|
||||
Uint32 *enabled = ndb_mgm_get_logfilter(m_mgmsrv);
|
||||
if(enabled == NULL) {
|
||||
ndbout << "Could not get status" << endl;
|
||||
|
@ -1358,11 +1378,11 @@ CommandInterpreter::executeRestart(int processId, const char* parameters,
|
|||
char * tmpPtr = 0;
|
||||
char * item = strtok_r(tmpString, " ", &tmpPtr);
|
||||
while(item != NULL){
|
||||
if(strcmp(item, "-N") == 0)
|
||||
if(strcasecmp(item, "-N") == 0)
|
||||
nostart = 1;
|
||||
if(strcmp(item, "-I") == 0)
|
||||
if(strcasecmp(item, "-I") == 0)
|
||||
initialstart = 1;
|
||||
if(strcmp(item, "-A") == 0)
|
||||
if(strcasecmp(item, "-A") == 0)
|
||||
abort = 1;
|
||||
item = strtok_r(NULL, " ", &tmpPtr);
|
||||
}
|
||||
|
@ -1591,7 +1611,7 @@ CommandInterpreter::executeTrace(int /*processId*/,
|
|||
|
||||
int result = _mgmtSrvr.setTraceNo(processId, traceNo);
|
||||
if (result != 0) {
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1751,7 +1771,7 @@ CommandInterpreter::executeSet(int /*processId*/,
|
|||
}
|
||||
}
|
||||
else {
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
if (configBackupFileUpdated && configPrimaryFileUpdated) {
|
||||
ndbout << "The configuration files are however updated and "
|
||||
<< "the value will be used next time the process is restarted."
|
||||
|
@ -1786,7 +1806,7 @@ void CommandInterpreter::executeGetStat(int /*processId*/,
|
|||
MgmtSrvr::Statistics statistics;
|
||||
int result = _mgmtSrvr.getStatistics(processId, statistics);
|
||||
if (result != 0) {
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -1856,7 +1876,7 @@ CommandInterpreter::executeEventReporting(int processId,
|
|||
/*****************************************************************************
|
||||
* Backup
|
||||
*****************************************************************************/
|
||||
void
|
||||
int
|
||||
CommandInterpreter::executeStartBackup(char* /*parameters*/)
|
||||
{
|
||||
struct ndb_mgm_reply reply;
|
||||
|
@ -1869,7 +1889,7 @@ CommandInterpreter::executeStartBackup(char* /*parameters*/)
|
|||
ndbout << "Start of backup failed" << endl;
|
||||
printError();
|
||||
close(fd);
|
||||
return;
|
||||
return result;
|
||||
}
|
||||
|
||||
char *tmp;
|
||||
|
@ -1900,6 +1920,7 @@ CommandInterpreter::executeStartBackup(char* /*parameters*/)
|
|||
} while(tmp && tmp[0] != 0);
|
||||
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1966,7 +1987,7 @@ CommandInterpreter::executeRep(char* parameters)
|
|||
unsigned int repId;
|
||||
|
||||
|
||||
if (!strcmp(firstToken, "CONNECT")) {
|
||||
if (!strcasecmp(firstToken, "CONNECT")) {
|
||||
char * host = strtok(NULL, "\0");
|
||||
for (unsigned int i = 0; i < strlen(host); ++i) {
|
||||
host[i] = tolower(host[i]);
|
||||
|
@ -2001,30 +2022,30 @@ CommandInterpreter::executeRep(char* parameters)
|
|||
/********
|
||||
* START
|
||||
********/
|
||||
if (!strcmp(firstToken, "START")) {
|
||||
if (!strcasecmp(firstToken, "START")) {
|
||||
|
||||
unsigned int req;
|
||||
char *startType = strtok(NULL, "\0");
|
||||
|
||||
if (startType == NULL) {
|
||||
req = GrepReq::START;
|
||||
} else if (!strcmp(startType, "SUBSCRIPTION")) {
|
||||
} else if (!strcasecmp(startType, "SUBSCRIPTION")) {
|
||||
req = GrepReq::START_SUBSCR;
|
||||
} else if (!strcmp(startType, "METALOG")) {
|
||||
} else if (!strcasecmp(startType, "METALOG")) {
|
||||
req = GrepReq::START_METALOG;
|
||||
} else if (!strcmp(startType, "METASCAN")) {
|
||||
} else if (!strcasecmp(startType, "METASCAN")) {
|
||||
req = GrepReq::START_METASCAN;
|
||||
} else if (!strcmp(startType, "DATALOG")) {
|
||||
} else if (!strcasecmp(startType, "DATALOG")) {
|
||||
req = GrepReq::START_DATALOG;
|
||||
} else if (!strcmp(startType, "DATASCAN")) {
|
||||
} else if (!strcasecmp(startType, "DATASCAN")) {
|
||||
req = GrepReq::START_DATASCAN;
|
||||
} else if (!strcmp(startType, "REQUESTOR")) {
|
||||
} else if (!strcasecmp(startType, "REQUESTOR")) {
|
||||
req = GrepReq::START_REQUESTOR;
|
||||
} else if (!strcmp(startType, "TRANSFER")) {
|
||||
} else if (!strcasecmp(startType, "TRANSFER")) {
|
||||
req = GrepReq::START_TRANSFER;
|
||||
} else if (!strcmp(startType, "APPLY")) {
|
||||
} else if (!strcasecmp(startType, "APPLY")) {
|
||||
req = GrepReq::START_APPLY;
|
||||
} else if (!strcmp(startType, "DELETE")) {
|
||||
} else if (!strcasecmp(startType, "DELETE")) {
|
||||
req = GrepReq::START_DELETE;
|
||||
} else {
|
||||
ndbout_c("Illegal argument to command 'REPLICATION START'");
|
||||
|
@ -2044,7 +2065,7 @@ CommandInterpreter::executeRep(char* parameters)
|
|||
/********
|
||||
* STOP
|
||||
********/
|
||||
if (!strcmp(firstToken, "STOP")) {
|
||||
if (!strcasecmp(firstToken, "STOP")) {
|
||||
unsigned int req;
|
||||
char *startType = strtok(NULL, " ");
|
||||
unsigned int epoch = 0;
|
||||
|
@ -2054,7 +2075,7 @@ CommandInterpreter::executeRep(char* parameters)
|
|||
* Stop immediately
|
||||
*/
|
||||
req = GrepReq::STOP;
|
||||
} else if (!strcmp(startType, "EPOCH")) {
|
||||
} else if (!strcasecmp(startType, "EPOCH")) {
|
||||
char *strEpoch = strtok(NULL, "\0");
|
||||
if(strEpoch == NULL) {
|
||||
ndbout_c("Epoch expected!");
|
||||
|
@ -2062,23 +2083,23 @@ CommandInterpreter::executeRep(char* parameters)
|
|||
}
|
||||
req = GrepReq::STOP;
|
||||
epoch=atoi(strEpoch);
|
||||
} else if (!strcmp(startType, "SUBSCRIPTION")) {
|
||||
} else if (!strcasecmp(startType, "SUBSCRIPTION")) {
|
||||
req = GrepReq::STOP_SUBSCR;
|
||||
} else if (!strcmp(startType, "METALOG")) {
|
||||
} else if (!strcasecmp(startType, "METALOG")) {
|
||||
req = GrepReq::STOP_METALOG;
|
||||
} else if (!strcmp(startType, "METASCAN")) {
|
||||
} else if (!strcasecmp(startType, "METASCAN")) {
|
||||
req = GrepReq::STOP_METASCAN;
|
||||
} else if (!strcmp(startType, "DATALOG")) {
|
||||
} else if (!strcasecmp(startType, "DATALOG")) {
|
||||
req = GrepReq::STOP_DATALOG;
|
||||
} else if (!strcmp(startType, "DATASCAN")) {
|
||||
} else if (!strcasecmp(startType, "DATASCAN")) {
|
||||
req = GrepReq::STOP_DATASCAN;
|
||||
} else if (!strcmp(startType, "REQUESTOR")) {
|
||||
} else if (!strcasecmp(startType, "REQUESTOR")) {
|
||||
req = GrepReq::STOP_REQUESTOR;
|
||||
} else if (!strcmp(startType, "TRANSFER")) {
|
||||
} else if (!strcasecmp(startType, "TRANSFER")) {
|
||||
req = GrepReq::STOP_TRANSFER;
|
||||
} else if (!strcmp(startType, "APPLY")) {
|
||||
} else if (!strcasecmp(startType, "APPLY")) {
|
||||
req = GrepReq::STOP_APPLY;
|
||||
} else if (!strcmp(startType, "DELETE")) {
|
||||
} else if (!strcasecmp(startType, "DELETE")) {
|
||||
req = GrepReq::STOP_DELETE;
|
||||
} else {
|
||||
ndbout_c("Illegal argument to command 'REPLICATION STOP'");
|
||||
|
@ -2097,7 +2118,7 @@ CommandInterpreter::executeRep(char* parameters)
|
|||
/*********
|
||||
* STATUS
|
||||
*********/
|
||||
if (!strcmp(firstToken, "STATUS")) {
|
||||
if (!strcasecmp(firstToken, "STATUS")) {
|
||||
struct rep_state repstate;
|
||||
int result =
|
||||
ndb_rep_get_status(m_repserver, &repId, &reply, &repstate);
|
||||
|
@ -2117,7 +2138,7 @@ CommandInterpreter::executeRep(char* parameters)
|
|||
/*********
|
||||
* QUERY (see repapi.h for querable counters)
|
||||
*********/
|
||||
if (!strcmp(firstToken, "QUERY")) {
|
||||
if (!strcasecmp(firstToken, "QUERY")) {
|
||||
char *query = strtok(NULL, "\0");
|
||||
int queryCounter=-1;
|
||||
if(query != NULL) {
|
||||
|
|
|
@ -60,10 +60,15 @@ static const char default_prompt[]= "ndb_mgm> ";
|
|||
static unsigned _try_reconnect;
|
||||
static char *opt_connect_str= 0;
|
||||
static const char *prompt= default_prompt;
|
||||
static char *opt_execute_str= 0;
|
||||
|
||||
static struct my_option my_long_options[] =
|
||||
{
|
||||
NDB_STD_OPTS("ndb_mgm"),
|
||||
{ "execute", 'e',
|
||||
"execute command and exit",
|
||||
(gptr*) &opt_execute_str, (gptr*) &opt_execute_str, 0,
|
||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
|
||||
{ "try-reconnect", 't',
|
||||
"Specify number of tries for connecting to ndb_mgmd (0 = infinite)",
|
||||
(gptr*) &_try_reconnect, (gptr*) &_try_reconnect, 0,
|
||||
|
@ -156,19 +161,25 @@ int main(int argc, char** argv){
|
|||
opt_connect_str= buf;
|
||||
}
|
||||
|
||||
if (!isatty(0))
|
||||
if (!isatty(0) || opt_execute_str)
|
||||
{
|
||||
prompt= 0;
|
||||
}
|
||||
|
||||
ndbout << "-- NDB Cluster -- Management Client --" << endl;
|
||||
|
||||
signal(SIGPIPE, handler);
|
||||
|
||||
com = new Ndb_mgmclient(opt_connect_str,1);
|
||||
while(read_and_execute(_try_reconnect));
|
||||
int ret= 0;
|
||||
if (!opt_execute_str)
|
||||
{
|
||||
ndbout << "-- NDB Cluster -- Management Client --" << endl;
|
||||
while(read_and_execute(_try_reconnect));
|
||||
}
|
||||
else
|
||||
{
|
||||
com->execute(opt_execute_str,_try_reconnect, &ret);
|
||||
}
|
||||
delete com;
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@ class Ndb_mgmclient
|
|||
public:
|
||||
Ndb_mgmclient(const char*,int verbose=0);
|
||||
~Ndb_mgmclient();
|
||||
int execute(const char *_line, int _try_reconnect=-1);
|
||||
int execute(int argc, char** argv, int _try_reconnect=-1);
|
||||
int execute(const char *_line, int _try_reconnect=-1, int *error= 0);
|
||||
int execute(int argc, char** argv, int _try_reconnect=-1, int *error= 0);
|
||||
int disconnect();
|
||||
private:
|
||||
CommandInterpreter *m_cmd;
|
||||
|
|
|
@ -113,6 +113,11 @@ private:
|
|||
void * m_ptr;
|
||||
};
|
||||
|
||||
const char *CommandInterpreter::get_error_text(int err_no)
|
||||
{
|
||||
return _mgmtSrvr.getErrorText(err_no, m_err_str, sizeof(m_err_str));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//*****************************************************************************
|
||||
int CommandInterpreter::readAndExecute() {
|
||||
|
@ -600,8 +605,9 @@ stopCallback(int nodeId, void * anyData, int errCode){
|
|||
ndbout << "\nNode " << nodeId << " has shutdown" << endl;
|
||||
} else {
|
||||
MgmtSrvr * mgm = (MgmtSrvr *)anyData;
|
||||
char err_str[1024];
|
||||
ndbout << "Node " << nodeId << " has not shutdown: "
|
||||
<< mgm->getErrorText(errCode) << endl;
|
||||
<< mgm->getErrorText(errCode,err_str,sizeof(err_str)) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -653,7 +659,8 @@ versionCallback(int nodeId, int version, void * anyData, int errCode){
|
|||
|
||||
} else {
|
||||
MgmtSrvr * mgm = (MgmtSrvr *)anyData;
|
||||
ndbout << mgm->getErrorText(errCode) << endl;
|
||||
char err_str[1024];
|
||||
ndbout << mgm->getErrorText(errCode,err_str,sizeof(err_str)) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -671,7 +678,7 @@ void CommandInterpreter::executeStop(int processId,
|
|||
result = _mgmtSrvr.stopNode(processId, false, stopCallback, this);
|
||||
|
||||
if(result != 0)
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
}
|
||||
|
||||
|
||||
|
@ -686,7 +693,7 @@ void CommandInterpreter::executeStart(int processId, const char* parameters,
|
|||
|
||||
int result = _mgmtSrvr.start(processId);
|
||||
if (result != 0) {
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -719,7 +726,7 @@ CommandInterpreter::executeRestart(int processId, const char* parameters,
|
|||
stopCallback,
|
||||
this);
|
||||
if (result != 0) {
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -760,7 +767,7 @@ CommandInterpreter::executeDumpState(int processId, const char* parameters,
|
|||
free(tmpString);
|
||||
int result = _mgmtSrvr.dumpState(processId, pars, no);
|
||||
if (result != 0) {
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -781,7 +788,7 @@ void CommandInterpreter::executeStatus(int processId,
|
|||
&status, &version, &startPhase, &system,
|
||||
&dynamicId, &nodeGroup, &connectCount);
|
||||
if(result != 0){
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -875,7 +882,7 @@ void CommandInterpreter::executeLogLevel(int processId,
|
|||
|
||||
int result = _mgmtSrvr.setNodeLogLevel(processId, logLevel);
|
||||
if (result != 0) {
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -913,7 +920,7 @@ void CommandInterpreter::executeError(int processId,
|
|||
|
||||
int result = _mgmtSrvr.insertError(processId, errorNo);
|
||||
if (result != 0) {
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
}
|
||||
free(newpar);
|
||||
}
|
||||
|
@ -953,7 +960,7 @@ void CommandInterpreter::executeTrace(int processId,
|
|||
|
||||
int result = _mgmtSrvr.setTraceNo(processId, traceNo);
|
||||
if (result != 0) {
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
}
|
||||
free(newpar);
|
||||
}
|
||||
|
@ -974,7 +981,7 @@ void CommandInterpreter::executeLog(int processId,
|
|||
|
||||
int result = _mgmtSrvr.setSignalLoggingMode(processId, MgmtSrvr::InOut, blocks);
|
||||
if (result != 0) {
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -995,7 +1002,7 @@ void CommandInterpreter::executeLogIn(int processId,
|
|||
|
||||
int result = _mgmtSrvr.setSignalLoggingMode(processId, MgmtSrvr::In, blocks);
|
||||
if (result != 0) {
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1014,7 +1021,7 @@ void CommandInterpreter::executeLogOut(int processId,
|
|||
|
||||
int result = _mgmtSrvr.setSignalLoggingMode(processId, MgmtSrvr::Out, blocks);
|
||||
if (result != 0) {
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1035,7 +1042,7 @@ void CommandInterpreter::executeLogOff(int processId,
|
|||
|
||||
int result = _mgmtSrvr.setSignalLoggingMode(processId, MgmtSrvr::Off, blocks);
|
||||
if (result != 0) {
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1054,7 +1061,7 @@ void CommandInterpreter::executeTestOn(int processId,
|
|||
|
||||
int result = _mgmtSrvr.startSignalTracing(processId);
|
||||
if (result != 0) {
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1073,7 +1080,7 @@ void CommandInterpreter::executeTestOff(int processId,
|
|||
|
||||
int result = _mgmtSrvr.stopSignalTracing(processId);
|
||||
if (result != 0) {
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1126,7 +1133,7 @@ void CommandInterpreter::executeEventReporting(int processId,
|
|||
ndbout_c("processId %d", processId);
|
||||
int result = _mgmtSrvr.setEventReportingLevel(processId, logLevel);
|
||||
if (result != 0) {
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1136,7 +1143,7 @@ CommandInterpreter::executeStartBackup(char* parameters) {
|
|||
Uint32 backupId;
|
||||
int result = _mgmtSrvr.startBackup(backupId);
|
||||
if (result != 0) {
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
} else {
|
||||
// ndbout << "Start of backup ordered" << endl;
|
||||
}
|
||||
|
@ -1153,7 +1160,7 @@ CommandInterpreter::executeAbortBackup(char* parameters) {
|
|||
}
|
||||
int result = _mgmtSrvr.abortBackup(bid);
|
||||
if (result != 0) {
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
} else {
|
||||
ndbout << "Abort of backup " << bid << " ordered" << endl;
|
||||
}
|
||||
|
@ -1174,7 +1181,7 @@ CommandInterpreter::executeEnterSingleUser(char* parameters) {
|
|||
}
|
||||
int result = _mgmtSrvr.enterSingleUser(0, nodeId,0,0);
|
||||
if (result != 0) {
|
||||
ndbout << _mgmtSrvr.getErrorText(result) << endl;
|
||||
ndbout << get_error_text(result) << endl;
|
||||
} else {
|
||||
ndbout << "Entering single user mode, granting access for node "
|
||||
<< nodeId << " OK." << endl;
|
||||
|
|
|
@ -55,6 +55,9 @@ public:
|
|||
int readAndExecute();
|
||||
|
||||
private:
|
||||
char m_err_str[1024];
|
||||
const char *get_error_text(int err_no);
|
||||
|
||||
/**
|
||||
* Read a string, and return a pointer to it.
|
||||
*
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
|
||||
#include <NdbAutoPtr.hpp>
|
||||
|
||||
#include <ndberror.h>
|
||||
|
||||
#include <mgmapi.h>
|
||||
#include <mgmapi_configuration.hpp>
|
||||
#include <mgmapi_config_parameters.h>
|
||||
|
@ -264,16 +266,6 @@ MgmtSrvr::isEventLogFilterEnabled(int severity)
|
|||
|
||||
static ErrorItem errorTable[] =
|
||||
{
|
||||
{200, "Backup undefined error"},
|
||||
{202, "Backup failed to allocate buffers (check configuration)"},
|
||||
{203, "Backup failed to setup fs buffers (check configuration)"},
|
||||
{204, "Backup failed to allocate tables (check configuration)"},
|
||||
{205, "Backup failed to insert file header (check configuration)"},
|
||||
{206, "Backup failed to insert table list (check configuration)"},
|
||||
{207, "Backup failed to allocate table memory (check configuration)"},
|
||||
{208, "Backup failed to allocate file record (check configuration)"},
|
||||
{209, "Backup failed to allocate attribute record (check configuration)"},
|
||||
|
||||
{MgmtSrvr::NO_CONTACT_WITH_PROCESS, "No contact with the process (dead ?)."},
|
||||
{MgmtSrvr::PROCESS_NOT_CONFIGURED, "The process is not configured."},
|
||||
{MgmtSrvr::WRONG_PROCESS_TYPE,
|
||||
|
@ -1856,18 +1848,21 @@ MgmtSrvr::dumpState(int processId, const Uint32 args[], Uint32 no)
|
|||
//****************************************************************************
|
||||
//****************************************************************************
|
||||
|
||||
const char* MgmtSrvr::getErrorText(int errorCode)
|
||||
const char* MgmtSrvr::getErrorText(int errorCode, char *buf, int buf_sz)
|
||||
{
|
||||
static char text[255];
|
||||
|
||||
for (int i = 0; i < noOfErrorCodes; ++i) {
|
||||
if (errorCode == errorTable[i]._errorCode) {
|
||||
return errorTable[i]._errorText;
|
||||
BaseString::snprintf(buf, buf_sz, errorTable[i]._errorText);
|
||||
buf[buf_sz-1]= 0;
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
||||
BaseString::snprintf(text, 255, "Unknown management server error code %d", errorCode);
|
||||
return text;
|
||||
|
||||
ndb_error_string(errorCode, buf, buf_sz);
|
||||
buf[buf_sz-1]= 0;
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -466,7 +466,7 @@ public:
|
|||
* @param errorCode: Error code to get a match error text for.
|
||||
* @return The error text.
|
||||
*/
|
||||
const char* getErrorText(int errorCode);
|
||||
const char* getErrorText(int errorCode, char *buf, int buf_sz);
|
||||
|
||||
/**
|
||||
* Get configuration
|
||||
|
|
|
@ -244,6 +244,8 @@ ParserRow<MgmApiSession> commands[] = {
|
|||
|
||||
MGM_CMD("purge stale sessions", &MgmApiSession::purge_stale_sessions, ""),
|
||||
|
||||
MGM_CMD("check connection", &MgmApiSession::check_connection, ""),
|
||||
|
||||
MGM_END()
|
||||
};
|
||||
|
||||
|
@ -579,7 +581,7 @@ MgmApiSession::insertError(Parser<MgmApiSession>::Context &,
|
|||
|
||||
m_output->println("insert error reply");
|
||||
if(result != 0)
|
||||
m_output->println("result: %s", m_mgmsrv.getErrorText(result));
|
||||
m_output->println("result: %s", get_error_text(result));
|
||||
else
|
||||
m_output->println("result: Ok");
|
||||
m_output->println("");
|
||||
|
@ -597,7 +599,7 @@ MgmApiSession::setTrace(Parser<MgmApiSession>::Context &,
|
|||
|
||||
m_output->println("set trace reply");
|
||||
if(result != 0)
|
||||
m_output->println("result: %s", m_mgmsrv.getErrorText(result));
|
||||
m_output->println("result: %s", get_error_text(result));
|
||||
else
|
||||
m_output->println("result: Ok");
|
||||
m_output->println("");
|
||||
|
@ -665,7 +667,7 @@ MgmApiSession::startBackup(Parser<MgmApiSession>::Context &,
|
|||
|
||||
m_output->println("start backup reply");
|
||||
if(result != 0)
|
||||
m_output->println("result: %s(%d)", m_mgmsrv.getErrorText(result), result);
|
||||
m_output->println("result: %s(%d)", get_error_text(result), result);
|
||||
else{
|
||||
m_output->println("result: Ok");
|
||||
m_output->println("id: %d", backupId);
|
||||
|
@ -685,7 +687,7 @@ MgmApiSession::startBackup(Parser<MgmApiSession>::Context &,
|
|||
|
||||
m_output->println("start backup reply");
|
||||
if(result != 0)
|
||||
m_output->println("result: %s", m_mgmsrv.getErrorText(result));
|
||||
m_output->println("result: %s", get_error_text(result));
|
||||
else{
|
||||
m_output->println("result: Ok");
|
||||
m_output->println("id: %d", backupId);
|
||||
|
@ -705,7 +707,7 @@ MgmApiSession::abortBackup(Parser<MgmApiSession>::Context &,
|
|||
|
||||
m_output->println("abort backup reply");
|
||||
if(result != 0)
|
||||
m_output->println("result: %s", m_mgmsrv.getErrorText(result));
|
||||
m_output->println("result: %s", get_error_text(result));
|
||||
else
|
||||
m_output->println("result: Ok");
|
||||
m_output->println("");
|
||||
|
@ -727,7 +729,7 @@ MgmApiSession::repCommand(Parser<MgmApiSession>::Context &,
|
|||
|
||||
m_output->println("global replication reply");
|
||||
if(result != 0)
|
||||
m_output->println("result: %s", m_mgmsrv.getErrorText(result));
|
||||
m_output->println("result: %s", get_error_text(result));
|
||||
else{
|
||||
m_output->println("result: Ok");
|
||||
m_output->println("id: %d", repReqId);
|
||||
|
@ -749,7 +751,7 @@ MgmApiSession::dumpState(Parser<MgmApiSession>::Context &,
|
|||
int result = m_mgmsrv.dumpState(node, args_str.c_str());
|
||||
m_output->println("dump state reply");
|
||||
if(result != 0)
|
||||
m_output->println("result: %s", m_mgmsrv.getErrorText(result));
|
||||
m_output->println("result: %s", get_error_text(result));
|
||||
else
|
||||
m_output->println("result: Ok");
|
||||
m_output->println("");
|
||||
|
@ -834,7 +836,7 @@ MgmApiSession::stopSignalLog(Parser<MgmApiSession>::Context &,
|
|||
|
||||
m_output->println("stop signallog");
|
||||
if(result != 0)
|
||||
m_output->println("result: %s", m_mgmsrv.getErrorText(result));
|
||||
m_output->println("result: %s", get_error_text(result));
|
||||
else
|
||||
m_output->println("result: Ok");
|
||||
m_output->println("");
|
||||
|
@ -874,7 +876,7 @@ MgmApiSession::restart(Parser<MgmApiSession>::Context &,
|
|||
|
||||
m_output->println("restart reply");
|
||||
if(result != 0){
|
||||
m_output->println("result: %d-%s", result, m_mgmsrv.getErrorText(result));
|
||||
m_output->println("result: %d-%s", result, get_error_text(result));
|
||||
} else
|
||||
m_output->println("result: Ok");
|
||||
m_output->println("restarted: %d", restarted);
|
||||
|
@ -898,7 +900,7 @@ MgmApiSession::restartAll(Parser<MgmApiSession>::Context &,
|
|||
|
||||
m_output->println("restart reply");
|
||||
if(result != 0)
|
||||
m_output->println("result: %s", m_mgmsrv.getErrorText(result));
|
||||
m_output->println("result: %s", get_error_text(result));
|
||||
else
|
||||
m_output->println("result: Ok");
|
||||
m_output->println("restarted: %d", count);
|
||||
|
@ -1029,7 +1031,7 @@ MgmApiSession::stop(Parser<MgmApiSession>::Context &,
|
|||
|
||||
m_output->println("stop reply");
|
||||
if(result != 0)
|
||||
m_output->println("result: %s", m_mgmsrv.getErrorText(result));
|
||||
m_output->println("result: %s", get_error_text(result));
|
||||
else
|
||||
m_output->println("result: Ok");
|
||||
m_output->println("stopped: %d", stopped);
|
||||
|
@ -1051,7 +1053,7 @@ MgmApiSession::stopAll(Parser<MgmApiSession>::Context &,
|
|||
|
||||
m_output->println("stop reply");
|
||||
if(result != 0)
|
||||
m_output->println("result: %s", m_mgmsrv.getErrorText(result));
|
||||
m_output->println("result: %s", get_error_text(result));
|
||||
else
|
||||
m_output->println("result: Ok");
|
||||
m_output->println("stopped: %d", stopped);
|
||||
|
@ -1067,7 +1069,7 @@ MgmApiSession::enterSingleUser(Parser<MgmApiSession>::Context &,
|
|||
int result = m_mgmsrv.enterSingleUser(&stopped, nodeId);
|
||||
m_output->println("enter single user reply");
|
||||
if(result != 0) {
|
||||
m_output->println("result: %s", m_mgmsrv.getErrorText(result));
|
||||
m_output->println("result: %s", get_error_text(result));
|
||||
}
|
||||
else {
|
||||
m_output->println("result: Ok");
|
||||
|
@ -1082,7 +1084,7 @@ MgmApiSession::exitSingleUser(Parser<MgmApiSession>::Context &,
|
|||
int result = m_mgmsrv.exitSingleUser(&stopped, false);
|
||||
m_output->println("exit single user reply");
|
||||
if(result != 0)
|
||||
m_output->println("result: %s", m_mgmsrv.getErrorText(result));
|
||||
m_output->println("result: %s", get_error_text(result));
|
||||
else
|
||||
m_output->println("result: Ok");
|
||||
m_output->println("");
|
||||
|
@ -1100,7 +1102,7 @@ MgmApiSession::startSignalLog(Parser<MgmApiSession>::Context &,
|
|||
|
||||
m_output->println("start signallog reply");
|
||||
if(result != 0)
|
||||
m_output->println("result: %s", m_mgmsrv.getErrorText(result));
|
||||
m_output->println("result: %s", get_error_text(result));
|
||||
else
|
||||
m_output->println("result: Ok");
|
||||
m_output->println("");
|
||||
|
@ -1145,7 +1147,7 @@ MgmApiSession::logSignals(Parser<MgmApiSession>::Context &,
|
|||
|
||||
m_output->println("log signals reply");
|
||||
if(result != 0)
|
||||
m_output->println("result: %s", m_mgmsrv.getErrorText(result));
|
||||
m_output->println("result: %s", get_error_text(result));
|
||||
else
|
||||
m_output->println("result: Ok");
|
||||
m_output->println("");
|
||||
|
@ -1162,7 +1164,7 @@ MgmApiSession::start(Parser<MgmApiSession>::Context &,
|
|||
|
||||
m_output->println("start reply");
|
||||
if(result != 0)
|
||||
m_output->println("result: %s", m_mgmsrv.getErrorText(result));
|
||||
m_output->println("result: %s", get_error_text(result));
|
||||
else
|
||||
m_output->println("result: Ok");
|
||||
m_output->println("");
|
||||
|
@ -1454,6 +1456,15 @@ MgmApiSession::purge_stale_sessions(Parser_t::Context &ctx,
|
|||
m_output->println("");
|
||||
}
|
||||
|
||||
void
|
||||
MgmApiSession::check_connection(Parser_t::Context &ctx,
|
||||
const class Properties &args)
|
||||
{
|
||||
m_output->println("check connection reply");
|
||||
m_output->println("result: Ok");
|
||||
m_output->println("");
|
||||
}
|
||||
|
||||
template class MutexVector<int>;
|
||||
template class Vector<ParserRow<MgmApiSession> const*>;
|
||||
template class Vector<unsigned short>;
|
||||
|
|
|
@ -39,10 +39,13 @@ private:
|
|||
OutputStream *m_output;
|
||||
Parser_t *m_parser;
|
||||
MgmtSrvr::Allocated_resources *m_allocated_resources;
|
||||
char m_err_str[1024];
|
||||
|
||||
void getConfig_common(Parser_t::Context &ctx,
|
||||
const class Properties &args,
|
||||
bool compat = false);
|
||||
const char *get_error_text(int err_no)
|
||||
{ return m_mgmsrv.getErrorText(err_no, m_err_str, sizeof(m_err_str)); }
|
||||
|
||||
public:
|
||||
MgmApiSession(class MgmtSrvr & mgm, NDB_SOCKET_TYPE sock);
|
||||
|
@ -88,6 +91,7 @@ public:
|
|||
void listen_event(Parser_t::Context &ctx, const class Properties &args);
|
||||
|
||||
void purge_stale_sessions(Parser_t::Context &ctx, const class Properties &args);
|
||||
void check_connection(Parser_t::Context &ctx, const class Properties &args);
|
||||
|
||||
void repCommand(Parser_t::Context &ctx, const class Properties &args);
|
||||
};
|
||||
|
|
|
@ -58,7 +58,7 @@ Ndb::Ndb( const char* aDataBase , const char* aSchema) {
|
|||
theNoOfNdbObjects++;
|
||||
if (global_ndb_cluster_connection == 0) {
|
||||
global_ndb_cluster_connection= new Ndb_cluster_connection(ndbConnectString);
|
||||
global_ndb_cluster_connection->connect();
|
||||
global_ndb_cluster_connection->connect(12,5,1);
|
||||
}
|
||||
setup(global_ndb_cluster_connection, aDataBase, aSchema);
|
||||
DBUG_VOID_RETURN;
|
||||
|
|
|
@ -40,10 +40,7 @@ Ndb_cluster_connection::Ndb_cluster_connection(const char *connect_string)
|
|||
DBUG_ENTER("Ndb_cluster_connection");
|
||||
DBUG_PRINT("enter",("Ndb_cluster_connection this=0x%x", this));
|
||||
m_facade= TransporterFacade::theFacadeInstance= new TransporterFacade();
|
||||
if (connect_string)
|
||||
m_connect_string= my_strdup(connect_string,MYF(MY_WME));
|
||||
else
|
||||
m_connect_string= 0;
|
||||
|
||||
m_config_retriever= 0;
|
||||
m_connect_thread= 0;
|
||||
m_connect_callback= 0;
|
||||
|
@ -58,9 +55,39 @@ Ndb_cluster_connection::Ndb_cluster_connection(const char *connect_string)
|
|||
ndb_print_state_mutex= NdbMutex_Create();
|
||||
}
|
||||
#endif
|
||||
m_config_retriever=
|
||||
new ConfigRetriever(connect_string, NDB_VERSION, NODE_TYPE_API);
|
||||
if (m_config_retriever->hasError())
|
||||
{
|
||||
printf("Could not connect initialize handle to management server: %s",
|
||||
m_config_retriever->getErrorString());
|
||||
delete m_config_retriever;
|
||||
m_config_retriever= 0;
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
int Ndb_cluster_connection::get_connected_port() const
|
||||
{
|
||||
if (m_config_retriever)
|
||||
return m_config_retriever->get_mgmd_port();
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char *Ndb_cluster_connection::get_connected_host() const
|
||||
{
|
||||
if (m_config_retriever)
|
||||
return m_config_retriever->get_mgmd_host();
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *Ndb_cluster_connection::get_connectstring(char *buf, int buf_sz) const
|
||||
{
|
||||
if (m_config_retriever)
|
||||
return m_config_retriever->get_connectstring(buf,buf_sz);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" pthread_handler_decl(run_ndb_cluster_connection_connect_thread, me)
|
||||
{
|
||||
my_thread_init();
|
||||
|
@ -77,7 +104,7 @@ void Ndb_cluster_connection::connect_thread()
|
|||
int r;
|
||||
do {
|
||||
NdbSleep_SecSleep(1);
|
||||
if ((r = connect(1)) == 0)
|
||||
if ((r = connect(0,0,0)) == 0)
|
||||
break;
|
||||
if (r == -1) {
|
||||
printf("Ndb_cluster_connection::connect_thread error\n");
|
||||
|
@ -98,7 +125,7 @@ int Ndb_cluster_connection::start_connect_thread(int (*connect_callback)(void))
|
|||
int r;
|
||||
DBUG_ENTER("Ndb_cluster_connection::start_connect_thread");
|
||||
m_connect_callback= connect_callback;
|
||||
if ((r = connect(1)) == 1)
|
||||
if ((r = connect(0,0,0)) == 1)
|
||||
{
|
||||
DBUG_PRINT("info",("starting thread"));
|
||||
m_connect_thread=
|
||||
|
@ -117,36 +144,15 @@ int Ndb_cluster_connection::start_connect_thread(int (*connect_callback)(void))
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
int Ndb_cluster_connection::connect(int reconnect)
|
||||
int Ndb_cluster_connection::connect(int no_retries, int retry_delay_in_seconds, int verbose)
|
||||
{
|
||||
DBUG_ENTER("Ndb_cluster_connection::connect");
|
||||
const char* error = 0;
|
||||
do {
|
||||
if (m_config_retriever == 0)
|
||||
{
|
||||
m_config_retriever=
|
||||
new ConfigRetriever(m_connect_string, NDB_VERSION, NODE_TYPE_API);
|
||||
if (m_config_retriever->hasError())
|
||||
{
|
||||
printf("Could not connect initialize handle to management server",
|
||||
m_config_retriever->getErrorString());
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (reconnect == 0)
|
||||
DBUG_RETURN(0);
|
||||
if (reconnect)
|
||||
{
|
||||
int r= m_config_retriever->do_connect(0,0,0);
|
||||
if (r == 1)
|
||||
DBUG_RETURN(1); // mgmt server not up yet
|
||||
if (r == -1)
|
||||
break;
|
||||
}
|
||||
else
|
||||
if(m_config_retriever->do_connect(12,5,1) == -1)
|
||||
break;
|
||||
DBUG_RETURN(-1);
|
||||
if (m_config_retriever->do_connect(no_retries,retry_delay_in_seconds,verbose))
|
||||
DBUG_RETURN(1); // mgmt server not up yet
|
||||
|
||||
Uint32 nodeId = m_config_retriever->allocNodeId(4/*retries*/,3/*delay*/);
|
||||
if(nodeId == 0)
|
||||
|
@ -189,7 +195,6 @@ Ndb_cluster_connection::~Ndb_cluster_connection()
|
|||
abort();
|
||||
TransporterFacade::theFacadeInstance= 0;
|
||||
}
|
||||
my_free(m_connect_string,MYF(MY_ALLOW_ZERO_PTR));
|
||||
if (m_config_retriever)
|
||||
delete m_config_retriever;
|
||||
DBUG_VOID_RETURN;
|
||||
|
|
|
@ -35,6 +35,7 @@ typedef struct ErrorBundle {
|
|||
|
||||
#define NE ndberror_cl_none
|
||||
#define AE ndberror_cl_application
|
||||
#define CE ndberror_cl_configuration
|
||||
#define ND ndberror_cl_no_data_found
|
||||
#define CV ndberror_cl_constraint_violation
|
||||
#define SE ndberror_cl_schema_error
|
||||
|
@ -58,6 +59,27 @@ static const char REDO_BUFFER_MSG[]=
|
|||
|
||||
static const char* empty_string = "";
|
||||
|
||||
/*
|
||||
* Error code ranges are reserved for respective block
|
||||
*
|
||||
* 200 - TC
|
||||
* 300 - DIH
|
||||
* 400 - LQH
|
||||
* 600 - ACC
|
||||
* 700 - DICT
|
||||
* 800 - TUP
|
||||
* 1200 - LQH
|
||||
* 1300 - BACKUP
|
||||
* 4000 - API
|
||||
* 4100 - ""
|
||||
* 4200 - ""
|
||||
* 4300 - ""
|
||||
* 4400 - ""
|
||||
* 4500 - ""
|
||||
* 4600 - ""
|
||||
* 5000 - Management server
|
||||
*/
|
||||
|
||||
static
|
||||
const
|
||||
ErrorBundle ErrorCodes[] = {
|
||||
|
@ -303,6 +325,36 @@ ErrorBundle ErrorCodes[] = {
|
|||
*/
|
||||
{ 4003, NI, "Function not implemented yet" },
|
||||
|
||||
/**
|
||||
* Backup error codes
|
||||
*/
|
||||
|
||||
{ 1300, IE, "Undefined error" },
|
||||
{ 1301, IE, "Backup issued to not master (reissue command to master)" },
|
||||
{ 1302, IE, "Out of backup record" },
|
||||
{ 1303, IS, "Out of resources" },
|
||||
{ 1304, IE, "Sequence failure" },
|
||||
{ 1305, IE, "Backup definition not implemented" },
|
||||
{ 1306, AE, "Backup not supported in diskless mode (change Diskless)" },
|
||||
|
||||
{ 1321, IE, "Backup aborted by application" },
|
||||
{ 1322, IE, "Backup already completed" },
|
||||
{ 1323, IE, "1323" },
|
||||
{ 1324, IE, "Backup log buffer full" },
|
||||
{ 1325, IE, "File or scan error" },
|
||||
{ 1326, IE, "Backup abortet due to node failure" },
|
||||
{ 1327, IE, "1327" },
|
||||
|
||||
{ 1340, IE, "Backup undefined error" },
|
||||
{ 1342, AE, "Backup failed to allocate buffers (check configuration)" },
|
||||
{ 1343, AE, "Backup failed to setup fs buffers (check configuration)" },
|
||||
{ 1344, AE, "Backup failed to allocate tables (check configuration)" },
|
||||
{ 1345, AE, "Backup failed to insert file header (check configuration)" },
|
||||
{ 1346, AE, "Backup failed to insert table list (check configuration)" },
|
||||
{ 1347, AE, "Backup failed to allocate table memory (check configuration)" },
|
||||
{ 1348, AE, "Backup failed to allocate file record (check configuration)" },
|
||||
{ 1349, AE, "Backup failed to allocate attribute record (check configuration)" },
|
||||
|
||||
/**
|
||||
* Still uncategorized
|
||||
*/
|
||||
|
@ -467,6 +519,7 @@ const
|
|||
ErrorStatusClassification StatusClassificationMapping[] = {
|
||||
{ ST_S, NE, "No error"},
|
||||
{ ST_P, AE, "Application error"},
|
||||
{ ST_P, CE, "Configuration or application error"},
|
||||
{ ST_P, ND, "No data found"},
|
||||
{ ST_P, CV, "Constraint violation"},
|
||||
{ ST_P, SE, "Schema error"},
|
||||
|
|
|
@ -228,10 +228,11 @@ int main(int argc, char** argv){
|
|||
_tabname = argv[0];
|
||||
|
||||
ndb_cluster_connection = new Ndb_cluster_connection(opt_connect_str);
|
||||
if (ndb_cluster_connection->connect(12,5,1))
|
||||
fatal("unable to connect");
|
||||
ndb = new Ndb(ndb_cluster_connection, _dbname);
|
||||
if (ndb->init() != 0)
|
||||
fatal("init");
|
||||
ndb_cluster_connection->connect();
|
||||
if (ndb->waitUntilReady(30) < 0)
|
||||
fatal("waitUntilReady");
|
||||
dic = ndb->getDictionary();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# MySQL Error File Compiler
|
||||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Error File Compiler"
|
||||
VERSION 4, 0
|
||||
XDCDATA ../netware/mysql.xdc
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
SCREENNAME "MySQL ISAM Table Check Tool"
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL ISAM Table Check Tool"
|
||||
VERSION 4, 0
|
||||
STACKSIZE 65536
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# ISAM Log
|
||||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL ISAM Table Log Tool"
|
||||
VERSION 4, 0
|
||||
XDCDATA ../netware/mysql.xdc
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
EXPORT @libmysql.imp
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Client Library"
|
||||
VERSION 4, 0
|
||||
AUTOUNLOAD
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# My Print Defaults
|
||||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Print Defaults Tool"
|
||||
VERSION 4, 0
|
||||
XDCDATA ../netware/mysql.xdc
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
SCREENNAME "MySQL MyISAM Table Dump Tool"
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL MyISAM Table Dump Tool"
|
||||
VERSION 4, 0
|
||||
STACKSIZE 65536
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
SCREENNAME "MySQL MyISAM Table Check Tool"
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL MyISAM Table Check Tool"
|
||||
VERSION 4, 0
|
||||
STACKSIZE 65536
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
SCREENNAME "MySQL MyISAM Table Log Tool"
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL MyISAM Table Log Tool"
|
||||
VERSION 4, 0
|
||||
XDCDATA ../netware/mysql.xdc
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
SCREENNAME "MySQL MyISAM Table Pack Tool"
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL MyISAM Table Pack Tool"
|
||||
VERSION 4, 0
|
||||
XDCDATA ../netware/mysql.xdc
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
SCREENNAME "MySQL Monitor"
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Monitor"
|
||||
VERSION 4, 0
|
||||
MULTIPLE
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# My Print Defaults
|
||||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Install Tool"
|
||||
VERSION 4, 0
|
||||
XDCDATA ../netware/mysql.xdc
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
SCREENNAME "MySQL Install"
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Initial Database Installer"
|
||||
VERSION 4, 0
|
||||
XDCDATA ../netware/mysql.xdc
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
MODULE libc.nlm
|
||||
STACKSIZE 65536
|
||||
SCREENNAME "MySQL Test Run"
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Test Run"
|
||||
VERSION 4, 0
|
||||
XDCDATA ../netware/mysql.xdc
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
#SCREENNAME "MySQL Tool - Wait for a Program to Terminate"
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Tool - Wait for a Program to Terminate"
|
||||
VERSION 4, 0
|
||||
STACKSIZE 65536
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
SCREENNAME "MySQL Admin"
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Admin Tool"
|
||||
VERSION 4, 0
|
||||
XDCDATA ../netware/mysql.xdc
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
SCREENNAME "MySQL Binary Log Dump Tool"
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Binary Log Dump Tool"
|
||||
VERSION 4, 0
|
||||
XDCDATA ../netware/mysql.xdc
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
SCREENNAME "MySQL Check Tool"
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Check Tool"
|
||||
VERSION 4, 0
|
||||
XDCDATA ../netware/mysql.xdc
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# MySQL Server
|
||||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Database Server"
|
||||
VERSION 4, 0
|
||||
MULTIPLE
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
SCREENNAME "MySQL Database Server"
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Database Server Monitor"
|
||||
VERSION 4, 0
|
||||
MULTIPLE
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
SCREENNAME "MySQL Dump Tool"
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Dump Tool"
|
||||
VERSION 4, 0
|
||||
XDCDATA ../netware/mysql.xdc
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
SCREENNAME "MySQL Import"
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Import Tool"
|
||||
VERSION 4, 0
|
||||
XDCDATA ../netware/mysql.xdc
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
SCREENNAME "MySQL Show"
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Show Tool"
|
||||
VERSION 4, 0
|
||||
XDCDATA ../netware/mysql.xdc
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# MySQL Admin
|
||||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Test Case Tool"
|
||||
VERSION 4, 0
|
||||
XDCDATA ../netware/mysql.xdc
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Pack ISAM
|
||||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL ISAM Table Pack Tool"
|
||||
VERSION 4, 0
|
||||
XDCDATA ../netware/mysql.xdc
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# PERROR
|
||||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Error Code Description Tool"
|
||||
VERSION 4, 0
|
||||
XDCDATA ../netware/mysql.xdc
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Replace
|
||||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Text Replacement Tool"
|
||||
VERSION 4, 0
|
||||
XDCDATA ../netware/mysql.xdc
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
#SCREENNAME "MySQL Stack Dump Resolve Tool"
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL Stack Dump Resolve Tool"
|
||||
VERSION 4, 0
|
||||
STACKSIZE 65536
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Resolve IP
|
||||
#------------------------------------------------------------------------------
|
||||
MODULE libc.nlm
|
||||
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
|
||||
DESCRIPTION "MySQL IP/Hostname Resolve Tool"
|
||||
VERSION 4, 0
|
||||
XDCDATA ../netware/mysql.xdc
|
||||
|
|
|
@ -1860,9 +1860,9 @@ int Field_long::store(double nr)
|
|||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
|
||||
error= 1;
|
||||
}
|
||||
else if (nr > (double) (ulong) ~0L)
|
||||
else if (nr > (double) UINT_MAX32)
|
||||
{
|
||||
res=(int32) (uint32) ~0L;
|
||||
res= UINT_MAX32;
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
|
||||
error= 1;
|
||||
}
|
||||
|
|
|
@ -1198,6 +1198,7 @@ public:
|
|||
uint decimals,flags,pack_length;
|
||||
Field::utype unireg_check;
|
||||
TYPELIB *interval; // Which interval to use
|
||||
List<String> interval_list;
|
||||
CHARSET_INFO *charset;
|
||||
Field::geometry_type geom_type;
|
||||
Field *field; // For alter table
|
||||
|
|
|
@ -2324,20 +2324,58 @@ ha_innobase::write_row(
|
|||
position in the source table need not be adjusted after the
|
||||
intermediate COMMIT, since writes by other transactions are
|
||||
being blocked by a MySQL table lock TL_WRITE_ALLOW_READ. */
|
||||
ut_a(prebuilt->trx->mysql_n_tables_locked == 2);
|
||||
ut_a(UT_LIST_GET_LEN(prebuilt->trx->trx_locks) >= 2);
|
||||
dict_table_t* table = lock_get_ix_table(
|
||||
UT_LIST_GET_FIRST(prebuilt->trx->trx_locks));
|
||||
|
||||
dict_table_t* src_table;
|
||||
ibool mode;
|
||||
|
||||
num_write_row = 0;
|
||||
|
||||
/* Commit the transaction. This will release the table
|
||||
locks, so they have to be acquired again. */
|
||||
innobase_commit(user_thd, prebuilt->trx);
|
||||
/* Note that this transaction is still active. */
|
||||
user_thd->transaction.all.innodb_active_trans = 1;
|
||||
/* Re-acquire the IX table lock on the source table. */
|
||||
row_lock_table_for_mysql(prebuilt, table);
|
||||
/* We will need an IX lock on the destination table. */
|
||||
prebuilt->sql_stat_start = TRUE;
|
||||
|
||||
/* Altering an InnoDB table */
|
||||
/* Get the source table. */
|
||||
src_table = lock_get_src_table(
|
||||
prebuilt->trx, prebuilt->table, &mode);
|
||||
if (!src_table) {
|
||||
no_commit:
|
||||
/* Unknown situation: do not commit */
|
||||
/*
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB error: ALTER TABLE is holding lock"
|
||||
" on %lu tables!\n",
|
||||
prebuilt->trx->mysql_n_tables_locked);
|
||||
*/
|
||||
;
|
||||
} else if (src_table == prebuilt->table) {
|
||||
/* Source table is not in InnoDB format:
|
||||
no need to re-acquire locks on it. */
|
||||
|
||||
/* Altering to InnoDB format */
|
||||
innobase_commit(user_thd, prebuilt->trx);
|
||||
/* Note that this transaction is still active. */
|
||||
user_thd->transaction.all.innodb_active_trans = 1;
|
||||
/* We will need an IX lock on the destination table. */
|
||||
prebuilt->sql_stat_start = TRUE;
|
||||
} else {
|
||||
/* Ensure that there are no other table locks than
|
||||
LOCK_IX and LOCK_AUTO_INC on the destination table. */
|
||||
if (!lock_is_table_exclusive(prebuilt->table,
|
||||
prebuilt->trx)) {
|
||||
goto no_commit;
|
||||
}
|
||||
|
||||
/* Commit the transaction. This will release the table
|
||||
locks, so they have to be acquired again. */
|
||||
innobase_commit(user_thd, prebuilt->trx);
|
||||
/* Note that this transaction is still active. */
|
||||
user_thd->transaction.all.innodb_active_trans = 1;
|
||||
/* Re-acquire the table lock on the source table. */
|
||||
row_lock_table_for_mysql(prebuilt, src_table, mode);
|
||||
/* We will need an IX lock on the destination table. */
|
||||
prebuilt->sql_stat_start = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
num_write_row++;
|
||||
|
@ -5015,7 +5053,8 @@ ha_innobase::external_lock(
|
|||
if (thd->in_lock_tables &&
|
||||
thd->variables.innodb_table_locks) {
|
||||
ulint error;
|
||||
error = row_lock_table_for_mysql(prebuilt, 0);
|
||||
error = row_lock_table_for_mysql(prebuilt,
|
||||
NULL, LOCK_TABLE_EXP);
|
||||
|
||||
if (error != DB_SUCCESS) {
|
||||
error = convert_error_code_to_mysql(
|
||||
|
|
|
@ -1197,9 +1197,10 @@ int ha_ndbcluster::unique_index_read(const byte *key,
|
|||
|
||||
for (i= 0; key_part != end; key_part++, i++)
|
||||
{
|
||||
if (set_ndb_key(op, key_part->field, i, key_ptr))
|
||||
if (set_ndb_key(op, key_part->field, i,
|
||||
key_part->null_bit ? key_ptr + 1 : key_ptr))
|
||||
ERR_RETURN(trans->getNdbError());
|
||||
key_ptr+= key_part->length;
|
||||
key_ptr+= key_part->store_length;
|
||||
}
|
||||
|
||||
// Get non-index attribute(s)
|
||||
|
@ -2287,6 +2288,28 @@ int ha_ndbcluster::index_end()
|
|||
DBUG_RETURN(close_scan());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if key contains null
|
||||
*/
|
||||
static
|
||||
int
|
||||
check_null_in_key(const KEY* key_info, const byte *key, uint key_len)
|
||||
{
|
||||
KEY_PART_INFO *curr_part, *end_part;
|
||||
const byte* end_ptr = key + key_len;
|
||||
curr_part= key_info->key_part;
|
||||
end_part= curr_part + key_info->key_parts;
|
||||
|
||||
|
||||
for (; curr_part != end_part && key < end_ptr; curr_part++)
|
||||
{
|
||||
if(curr_part->null_bit && *key)
|
||||
return 1;
|
||||
|
||||
key += curr_part->store_length;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ha_ndbcluster::index_read(byte *buf,
|
||||
const byte *key, uint key_len,
|
||||
|
@ -2304,6 +2327,8 @@ int ha_ndbcluster::index_read(byte *buf,
|
|||
case PRIMARY_KEY_INDEX:
|
||||
if (find_flag == HA_READ_KEY_EXACT && key_info->key_length == key_len)
|
||||
{
|
||||
if(m_active_cursor && (error= close_scan()))
|
||||
DBUG_RETURN(error);
|
||||
DBUG_RETURN(pk_read(key, key_len, buf));
|
||||
}
|
||||
else if (type == PRIMARY_KEY_INDEX)
|
||||
|
@ -2313,8 +2338,11 @@ int ha_ndbcluster::index_read(byte *buf,
|
|||
break;
|
||||
case UNIQUE_ORDERED_INDEX:
|
||||
case UNIQUE_INDEX:
|
||||
if (find_flag == HA_READ_KEY_EXACT && key_info->key_length == key_len)
|
||||
if (find_flag == HA_READ_KEY_EXACT && key_info->key_length == key_len &&
|
||||
!check_null_in_key(key_info, key, key_len))
|
||||
{
|
||||
if(m_active_cursor && (error= close_scan()))
|
||||
DBUG_RETURN(error);
|
||||
DBUG_RETURN(unique_index_read(key, key_len, buf));
|
||||
}
|
||||
else if (type == UNIQUE_INDEX)
|
||||
|
@ -2418,6 +2446,8 @@ int ha_ndbcluster::read_range_first_to_buf(const key_range *start_key,
|
|||
start_key->length == key_info->key_length &&
|
||||
start_key->flag == HA_READ_KEY_EXACT)
|
||||
{
|
||||
if(m_active_cursor && (error= close_scan()))
|
||||
DBUG_RETURN(error);
|
||||
error= pk_read(start_key->key, start_key->length, buf);
|
||||
DBUG_RETURN(error == HA_ERR_KEY_NOT_FOUND ? HA_ERR_END_OF_FILE : error);
|
||||
}
|
||||
|
@ -2425,10 +2455,12 @@ int ha_ndbcluster::read_range_first_to_buf(const key_range *start_key,
|
|||
case UNIQUE_ORDERED_INDEX:
|
||||
case UNIQUE_INDEX:
|
||||
key_info= table->key_info + active_index;
|
||||
if (start_key &&
|
||||
start_key->length == key_info->key_length &&
|
||||
start_key->flag == HA_READ_KEY_EXACT)
|
||||
if (start_key && start_key->length == key_info->key_length &&
|
||||
start_key->flag == HA_READ_KEY_EXACT &&
|
||||
!check_null_in_key(key_info, start_key->key, start_key->length))
|
||||
{
|
||||
if(m_active_cursor && (error= close_scan()))
|
||||
DBUG_RETURN(error);
|
||||
error= unique_index_read(start_key->key, start_key->length, buf);
|
||||
DBUG_RETURN(error == HA_ERR_KEY_NOT_FOUND ? HA_ERR_END_OF_FILE : error);
|
||||
}
|
||||
|
@ -4199,7 +4231,7 @@ bool ndbcluster_init()
|
|||
new Ndb_cluster_connection(ndbcluster_connectstring)) == 0)
|
||||
{
|
||||
DBUG_PRINT("error",("Ndb_cluster_connection(%s)",ndbcluster_connectstring));
|
||||
DBUG_RETURN(TRUE);
|
||||
goto ndbcluster_init_error;
|
||||
}
|
||||
|
||||
// Create a Ndb object to open the connection to NDB
|
||||
|
@ -4208,25 +4240,33 @@ bool ndbcluster_init()
|
|||
if (g_ndb->init() != 0)
|
||||
{
|
||||
ERR_PRINT (g_ndb->getNdbError());
|
||||
DBUG_RETURN(TRUE);
|
||||
goto ndbcluster_init_error;
|
||||
}
|
||||
|
||||
if ((res= g_ndb_cluster_connection->connect(1)) == 0)
|
||||
if ((res= g_ndb_cluster_connection->connect(0,0,0)) == 0)
|
||||
{
|
||||
DBUG_PRINT("info",("NDBCLUSTER storage engine at %s on port %d",
|
||||
g_ndb_cluster_connection->get_connected_host(),
|
||||
g_ndb_cluster_connection->get_connected_port()));
|
||||
g_ndb->waitUntilReady(10);
|
||||
}
|
||||
else if(res == 1)
|
||||
{
|
||||
if (g_ndb_cluster_connection->start_connect_thread()) {
|
||||
DBUG_PRINT("error", ("g_ndb_cluster_connection->start_connect_thread()"));
|
||||
DBUG_RETURN(TRUE);
|
||||
goto ndbcluster_init_error;
|
||||
}
|
||||
{
|
||||
char buf[1024];
|
||||
DBUG_PRINT("info",("NDBCLUSTER storage engine not started, will connect using %s",
|
||||
g_ndb_cluster_connection->get_connectstring(buf,sizeof(buf))));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DBUG_ASSERT(res == -1);
|
||||
DBUG_PRINT("error", ("permanent error"));
|
||||
DBUG_RETURN(TRUE);
|
||||
goto ndbcluster_init_error;
|
||||
}
|
||||
|
||||
(void) hash_init(&ndbcluster_open_tables,system_charset_info,32,0,0,
|
||||
|
@ -4236,9 +4276,12 @@ bool ndbcluster_init()
|
|||
ndbcluster_inited= 1;
|
||||
#ifdef USE_DISCOVER_ON_STARTUP
|
||||
if (ndb_discover_tables() != 0)
|
||||
DBUG_RETURN(TRUE);
|
||||
goto ndbcluster_init_error;
|
||||
#endif
|
||||
DBUG_RETURN(FALSE);
|
||||
ndbcluster_init_error:
|
||||
ndbcluster_end();
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
|
69
sql/lock.cc
69
sql/lock.cc
|
@ -705,15 +705,70 @@ static void print_lock_error(int error)
|
|||
/****************************************************************************
|
||||
Handling of global read locks
|
||||
|
||||
The global locks are handled through the global variables:
|
||||
global_read_lock
|
||||
global_read_lock_blocks_commit
|
||||
waiting_for_read_lock
|
||||
protect_against_global_read_lock
|
||||
|
||||
Taking the global read lock is TWO steps (2nd step is optional; without
|
||||
it, COMMIT of existing transactions will be allowed):
|
||||
lock_global_read_lock() THEN make_global_read_lock_block_commit().
|
||||
|
||||
The global locks are handled through the global variables:
|
||||
global_read_lock
|
||||
count of threads which have the global read lock (i.e. have completed at
|
||||
least the first step above)
|
||||
global_read_lock_blocks_commit
|
||||
count of threads which have the global read lock and block
|
||||
commits (i.e. have completed the second step above)
|
||||
waiting_for_read_lock
|
||||
count of threads which want to take a global read lock but cannot
|
||||
protect_against_global_read_lock
|
||||
count of threads which have set protection against global read lock.
|
||||
|
||||
How blocking of threads by global read lock is achieved: that's
|
||||
advisory. Any piece of code which should be blocked by global read lock must
|
||||
be designed like this:
|
||||
- call to wait_if_global_read_lock(). When this returns 0, no global read
|
||||
lock is owned; if argument abort_on_refresh was 0, none can be obtained.
|
||||
- job
|
||||
- if abort_on_refresh was 0, call to start_waiting_global_read_lock() to
|
||||
allow other threads to get the global read lock. I.e. removal of the
|
||||
protection.
|
||||
(Note: it's a bit like an implementation of rwlock).
|
||||
|
||||
[ I am sorry to mention some SQL syntaxes below I know I shouldn't but found
|
||||
no better descriptive way ]
|
||||
|
||||
Why does FLUSH TABLES WITH READ LOCK need to block COMMIT: because it's used
|
||||
to read a non-moving SHOW MASTER STATUS, and a COMMIT writes to the binary
|
||||
log.
|
||||
|
||||
Why getting the global read lock is two steps and not one. Because FLUSH
|
||||
TABLES WITH READ LOCK needs to insert one other step between the two:
|
||||
flushing tables. So the order is
|
||||
1) lock_global_read_lock() (prevents any new table write locks, i.e. stalls
|
||||
all new updates)
|
||||
2) close_cached_tables() (the FLUSH TABLES), which will wait for tables
|
||||
currently opened and being updated to close (so it's possible that there is
|
||||
a moment where all new updates of server are stalled *and* FLUSH TABLES WITH
|
||||
READ LOCK is, too).
|
||||
3) make_global_read_lock_block_commit().
|
||||
If we have merged 1) and 3) into 1), we would have had this deadlock:
|
||||
imagine thread 1 and 2, in non-autocommit mode, thread 3, and an InnoDB
|
||||
table t.
|
||||
thd1: SELECT * FROM t FOR UPDATE;
|
||||
thd2: UPDATE t SET a=1; # blocked by row-level locks of thd1
|
||||
thd3: FLUSH TABLES WITH READ LOCK; # blocked in close_cached_tables() by the
|
||||
table instance of thd2
|
||||
thd1: COMMIT; # blocked by thd3.
|
||||
thd1 blocks thd2 which blocks thd3 which blocks thd1: deadlock.
|
||||
|
||||
Note that we need to support that one thread does
|
||||
FLUSH TABLES WITH READ LOCK; and then COMMIT;
|
||||
(that's what innobackup does, for some good reason).
|
||||
So in this exceptional case the COMMIT should not be blocked by the FLUSH
|
||||
TABLES WITH READ LOCK.
|
||||
|
||||
TODO in MySQL 5.x: make_global_read_lock_block_commit() should be
|
||||
killable. Normally CPU does not spend a long time in this function (COMMITs
|
||||
are quite fast), but it would still be nice.
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
volatile uint global_read_lock=0;
|
||||
|
@ -828,6 +883,8 @@ void start_waiting_global_read_lock(THD *thd)
|
|||
{
|
||||
bool tmp;
|
||||
DBUG_ENTER("start_waiting_global_read_lock");
|
||||
if (unlikely(thd->global_read_lock))
|
||||
DBUG_VOID_RETURN;
|
||||
(void) pthread_mutex_lock(&LOCK_open);
|
||||
tmp= (!--protect_against_global_read_lock && waiting_for_read_lock);
|
||||
(void) pthread_mutex_unlock(&LOCK_open);
|
||||
|
|
|
@ -688,7 +688,8 @@ bool add_field_to_list(THD *thd, char *field_name, enum enum_field_types type,
|
|||
uint type_modifier,
|
||||
Item *default_value, Item *on_update_value,
|
||||
LEX_STRING *comment,
|
||||
char *change, TYPELIB *interval,CHARSET_INFO *cs,
|
||||
char *change, List<String> *interval_list,
|
||||
CHARSET_INFO *cs,
|
||||
uint uint_geom_type);
|
||||
void store_position_for_column(const char *name);
|
||||
bool add_to_list(THD *thd, SQL_LIST &list,Item *group,bool asc=0);
|
||||
|
|
|
@ -36,6 +36,28 @@
|
|||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
#include "ha_ndbcluster.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_INNOBASE_DB
|
||||
#define OPT_INNODB_DEFAULT 1
|
||||
#else
|
||||
#define OPT_INNODB_DEFAULT 0
|
||||
#endif
|
||||
#ifdef HAVE_BERKLEY_DB
|
||||
#define OPT_BDB_DEFAULT 1
|
||||
#else
|
||||
#define OPT_BDB_DEFAULT 0
|
||||
#endif
|
||||
#ifdef HAVE_ISAM_DB
|
||||
#define OPT_ISAM_DEFAULT 1
|
||||
#else
|
||||
#define OPT_ISAM_DEFAULT 0
|
||||
#endif
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
#define OPT_NDBCLUSTER_DEFAULT 0
|
||||
#else
|
||||
#define OPT_NDBCLUSTER_DEFAULT 0
|
||||
#endif
|
||||
|
||||
#include <nisam.h>
|
||||
#include <thr_alarm.h>
|
||||
#include <ft_global.h>
|
||||
|
@ -146,6 +168,7 @@ static VolumeID_t datavolid;
|
|||
static event_handle_t eh;
|
||||
static Report_t ref;
|
||||
static void *refneb= NULL;
|
||||
my_bool event_flag= FALSE;
|
||||
static int volumeid= -1;
|
||||
|
||||
/* NEB event callback */
|
||||
|
@ -815,7 +838,8 @@ static void __cdecl kill_server(int sig_ptr)
|
|||
else
|
||||
unireg_end();
|
||||
#ifdef __NETWARE__
|
||||
pthread_join(select_thread, NULL); // wait for main thread
|
||||
if (!event_flag)
|
||||
pthread_join(select_thread, NULL); // wait for main thread
|
||||
#endif /* __NETWARE__ */
|
||||
|
||||
pthread_exit(0); /* purecov: deadcode */
|
||||
|
@ -1525,20 +1549,20 @@ static void check_data_home(const char *path)
|
|||
// down server event callback
|
||||
void mysql_down_server_cb(void *, void *)
|
||||
{
|
||||
event_flag = TRUE;
|
||||
kill_server(0);
|
||||
}
|
||||
|
||||
|
||||
// destroy callback resources
|
||||
void mysql_cb_destroy(void *)
|
||||
{
|
||||
UnRegisterEventNotification(eh); // cleanup down event notification
|
||||
{
|
||||
UnRegisterEventNotification(eh); // cleanup down event notification
|
||||
NX_UNWRAP_INTERFACE(ref);
|
||||
|
||||
/* Deregister NSS volume deactivation event */
|
||||
NX_UNWRAP_INTERFACE(refneb);
|
||||
/* Deregister NSS volume deactivation event */
|
||||
NX_UNWRAP_INTERFACE(refneb);
|
||||
if (neb_consumer_id)
|
||||
UnRegisterConsumer(neb_consumer_id, NULL);
|
||||
UnRegisterConsumer(neb_consumer_id, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1558,7 +1582,7 @@ void mysql_cb_init()
|
|||
Register for volume deactivation event
|
||||
Wrap the callback function, as it is called by non-LibC thread
|
||||
*/
|
||||
(void)NX_WRAP_INTERFACE(neb_event_callback, 1, &refneb);
|
||||
(void *) NX_WRAP_INTERFACE(neb_event_callback, 1, &refneb);
|
||||
registerwithneb();
|
||||
|
||||
NXVmRegisterExitHandler(mysql_cb_destroy, NULL); // clean-up
|
||||
|
@ -1655,7 +1679,9 @@ ulong neb_event_callback(struct EventBlock *eblock)
|
|||
{
|
||||
consoleprintf("MySQL data volume is deactivated, shutting down MySQL Server \n");
|
||||
nw_panic = TRUE;
|
||||
event_flag= TRUE;
|
||||
kill_server(0);
|
||||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -1729,8 +1755,8 @@ static void init_signals(void)
|
|||
for (uint i=0 ; i < sizeof(signals)/sizeof(int) ; i++)
|
||||
signal(signals[i], kill_server);
|
||||
mysql_cb_init(); // initialize callbacks
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void start_signal_handler(void)
|
||||
{
|
||||
|
@ -2237,7 +2263,13 @@ extern "C" pthread_handler_decl(handle_shutdown,arg)
|
|||
#endif
|
||||
|
||||
|
||||
const char *load_default_groups[]= { "mysqld","server",MYSQL_BASE_VERSION,0,0};
|
||||
const char *load_default_groups[]= {
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
"mysql_cluster",
|
||||
#endif
|
||||
"mysqld","server",MYSQL_BASE_VERSION,0,0};
|
||||
static const int load_default_groups_sz=
|
||||
sizeof(load_default_groups)/sizeof(load_default_groups[0]);
|
||||
|
||||
bool open_log(MYSQL_LOG *log, const char *hostname,
|
||||
const char *opt_name, const char *extension,
|
||||
|
@ -2813,6 +2845,7 @@ int win_main(int argc, char **argv)
|
|||
int main(int argc, char **argv)
|
||||
#endif
|
||||
{
|
||||
|
||||
DEBUGGER_OFF;
|
||||
|
||||
MY_INIT(argv[0]); // init my_sys library & pthreads
|
||||
|
@ -3008,7 +3041,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
|
|||
#endif /* __NT__ */
|
||||
|
||||
/* (void) pthread_attr_destroy(&connection_attrib); */
|
||||
|
||||
|
||||
DBUG_PRINT("quit",("Exiting main thread"));
|
||||
|
||||
#ifndef __WIN__
|
||||
|
@ -3058,6 +3091,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
|
|||
#endif
|
||||
clean_up_mutexes();
|
||||
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
|
||||
|
||||
exit(0);
|
||||
return(0); /* purecov: deadcode */
|
||||
}
|
||||
|
@ -3184,7 +3218,7 @@ int main(int argc, char **argv)
|
|||
and we are now stuck with it.
|
||||
*/
|
||||
if (my_strcasecmp(system_charset_info, argv[1],"mysql"))
|
||||
load_default_groups[3]= argv[1];
|
||||
load_default_groups[load_default_groups_sz-2]= argv[1];
|
||||
start_mode= 1;
|
||||
Service.Init(argv[1], mysql_service);
|
||||
return 0;
|
||||
|
@ -3205,7 +3239,7 @@ int main(int argc, char **argv)
|
|||
opt_argv=argv;
|
||||
start_mode= 1;
|
||||
if (my_strcasecmp(system_charset_info, argv[2],"mysql"))
|
||||
load_default_groups[3]= argv[2];
|
||||
load_default_groups[load_default_groups_sz-2]= argv[2];
|
||||
Service.Init(argv[2], mysql_service);
|
||||
return 0;
|
||||
}
|
||||
|
@ -4077,7 +4111,7 @@ struct my_option my_long_options[] =
|
|||
0, 0, 0, 0, 0, 0},
|
||||
{"bdb", OPT_BDB, "Enable Berkeley DB (if this version of MySQL supports it). \
|
||||
Disable with --skip-bdb (will save memory).",
|
||||
(gptr*) &opt_bdb, (gptr*) &opt_bdb, 0, GET_BOOL, NO_ARG, 1, 0, 0,
|
||||
(gptr*) &opt_bdb, (gptr*) &opt_bdb, 0, GET_BOOL, NO_ARG, OPT_BDB_DEFAULT, 0, 0,
|
||||
0, 0, 0},
|
||||
#ifdef HAVE_BERKELEY_DB
|
||||
{"bdb-home", OPT_BDB_HOME, "Berkeley home directory.", (gptr*) &berkeley_home,
|
||||
|
@ -4214,7 +4248,7 @@ Disable with --skip-bdb (will save memory).",
|
|||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"innodb", OPT_INNODB, "Enable InnoDB (if this version of MySQL supports it). \
|
||||
Disable with --skip-innodb (will save memory).",
|
||||
(gptr*) &opt_innodb, (gptr*) &opt_innodb, 0, GET_BOOL, NO_ARG, 1, 0, 0,
|
||||
(gptr*) &opt_innodb, (gptr*) &opt_innodb, 0, GET_BOOL, NO_ARG, OPT_INNODB_DEFAULT, 0, 0,
|
||||
0, 0, 0},
|
||||
{"innodb_data_file_path", OPT_INNODB_DATA_FILE_PATH,
|
||||
"Path to individual files and their sizes.",
|
||||
|
@ -4274,7 +4308,7 @@ Disable with --skip-innodb (will save memory).",
|
|||
#endif /* End HAVE_INNOBASE_DB */
|
||||
{"isam", OPT_ISAM, "Enable ISAM (if this version of MySQL supports it). \
|
||||
Disable with --skip-isam.",
|
||||
(gptr*) &opt_isam, (gptr*) &opt_isam, 0, GET_BOOL, NO_ARG, 1, 0, 0,
|
||||
(gptr*) &opt_isam, (gptr*) &opt_isam, 0, GET_BOOL, NO_ARG, OPT_ISAM_DEFAULT, 0, 0,
|
||||
0, 0, 0},
|
||||
{"language", 'L',
|
||||
"Client error messages in given language. May be given as a full path.",
|
||||
|
@ -4401,8 +4435,8 @@ master-ssl",
|
|||
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"ndbcluster", OPT_NDBCLUSTER, "Enable NDB Cluster (if this version of MySQL supports it). \
|
||||
Disable with --skip-ndbcluster (will save memory).",
|
||||
(gptr*) &opt_ndbcluster, (gptr*) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, 1, 0, 0,
|
||||
0, 0, 0},
|
||||
(gptr*) &opt_ndbcluster, (gptr*) &opt_ndbcluster, 0, GET_BOOL, NO_ARG,
|
||||
OPT_NDBCLUSTER_DEFAULT, 0, 0, 0, 0, 0},
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
{"ndb-connectstring", OPT_NDB_CONNECTSTRING,
|
||||
"Connect string for ndbcluster.",
|
||||
|
@ -6236,6 +6270,24 @@ static void get_options(int argc,char **argv)
|
|||
if ((ho_error= handle_options(&argc, &argv, my_long_options,
|
||||
get_one_option)))
|
||||
exit(ho_error);
|
||||
|
||||
#ifndef HAVE_NDBCLUSTER_DB
|
||||
if (opt_ndbcluster)
|
||||
sql_print_warning("this binary does not contain NDBCLUSTER storage engine");
|
||||
#endif
|
||||
#ifndef HAVE_INNOBASE_DB
|
||||
if (opt_innodb)
|
||||
sql_print_warning("this binary does not contain INNODB storage engine");
|
||||
#endif
|
||||
#ifndef HAVE_ISAM
|
||||
if (opt_isam)
|
||||
sql_print_warning("this binary does not contain ISAM storage engine");
|
||||
#endif
|
||||
#ifndef HAVE_BERKELEY_DB
|
||||
if (opt_bdb)
|
||||
sql_print_warning("this binary does not contain BDB storage engine");
|
||||
#endif
|
||||
|
||||
if (argc > 0)
|
||||
{
|
||||
fprintf(stderr, "%s: Too many arguments (first extra is '%s').\nUse --help to get a list of available options\n", my_progname, *argv);
|
||||
|
|
|
@ -2035,7 +2035,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
|
|||
{
|
||||
table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
|
||||
if (table->file->index_read(table->record[0], (byte*) table->field[0]->ptr,
|
||||
table->key_info[0].key_length,
|
||||
key_length,
|
||||
HA_READ_KEY_EXACT))
|
||||
goto end;
|
||||
|
||||
|
|
|
@ -592,7 +592,6 @@ typedef struct st_lex
|
|||
List<set_var_base> var_list;
|
||||
List<Item_param> param_list;
|
||||
SQL_LIST proc_list, auxilliary_table_list, save_list;
|
||||
TYPELIB *interval;
|
||||
create_field *last_field;
|
||||
char *savepoint_name; // Transaction savepoint id
|
||||
udf_func udf;
|
||||
|
|
|
@ -4115,31 +4115,6 @@ bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length)
|
|||
#endif
|
||||
|
||||
|
||||
/*
|
||||
Calculate interval lengths.
|
||||
Strip trailing spaces from all strings.
|
||||
After this function call:
|
||||
- ENUM uses max_length
|
||||
- SET uses tot_length.
|
||||
*/
|
||||
void calculate_interval_lengths(THD *thd, TYPELIB *interval,
|
||||
uint32 *max_length, uint32 *tot_length)
|
||||
{
|
||||
const char **pos;
|
||||
uint *len;
|
||||
CHARSET_INFO *cs= thd->variables.character_set_client;
|
||||
*max_length= *tot_length= 0;
|
||||
for (pos= interval->type_names, len= interval->type_lengths;
|
||||
*pos ; pos++, len++)
|
||||
{
|
||||
*len= (uint) strip_sp((char*) *pos);
|
||||
uint length= cs->cset->numchars(cs, *pos, *pos + *len);
|
||||
*tot_length+= length;
|
||||
set_if_bigger(*max_length, (uint32)length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** Store field definition for create
|
||||
** Return 0 if ok
|
||||
|
@ -4150,7 +4125,8 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
|
|||
uint type_modifier,
|
||||
Item *default_value, Item *on_update_value,
|
||||
LEX_STRING *comment,
|
||||
char *change, TYPELIB *interval, CHARSET_INFO *cs,
|
||||
char *change,
|
||||
List<String> *interval_list, CHARSET_INFO *cs,
|
||||
uint uint_geom_type)
|
||||
{
|
||||
register create_field *new_field;
|
||||
|
@ -4445,62 +4421,39 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
|
|||
break;
|
||||
case FIELD_TYPE_SET:
|
||||
{
|
||||
if (interval->count > sizeof(longlong)*8)
|
||||
if (interval_list->elements > sizeof(longlong)*8)
|
||||
{
|
||||
net_printf(thd,ER_TOO_BIG_SET,field_name); /* purecov: inspected */
|
||||
DBUG_RETURN(1); /* purecov: inspected */
|
||||
net_printf(thd,ER_TOO_BIG_SET,field_name); /* purecov: inspected */
|
||||
DBUG_RETURN(1); /* purecov: inspected */
|
||||
}
|
||||
new_field->pack_length=(interval->count+7)/8;
|
||||
new_field->pack_length= (interval_list->elements + 7) / 8;
|
||||
if (new_field->pack_length > 4)
|
||||
new_field->pack_length=8;
|
||||
new_field->interval=interval;
|
||||
uint32 dummy_max_length;
|
||||
calculate_interval_lengths(thd, interval,
|
||||
&dummy_max_length, &new_field->length);
|
||||
new_field->length+= (interval->count - 1);
|
||||
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
|
||||
if (default_value)
|
||||
{
|
||||
char *not_used;
|
||||
uint not_used2;
|
||||
bool not_used3;
|
||||
new_field->pack_length=8;
|
||||
|
||||
thd->cuted_fields=0;
|
||||
String str,*res;
|
||||
res=default_value->val_str(&str);
|
||||
(void) find_set(interval, res->ptr(), res->length(),
|
||||
&my_charset_bin,
|
||||
¬_used, ¬_used2, ¬_used3);
|
||||
if (thd->cuted_fields)
|
||||
{
|
||||
net_printf(thd,ER_INVALID_DEFAULT,field_name);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
}
|
||||
List_iterator<String> it(*interval_list);
|
||||
String *tmp;
|
||||
while ((tmp= it++))
|
||||
new_field->interval_list.push_back(tmp);
|
||||
/*
|
||||
Set fake length to 1 to pass the below conditions.
|
||||
Real length will be set in mysql_prepare_table()
|
||||
when we know the character set of the column
|
||||
*/
|
||||
new_field->length= 1;
|
||||
}
|
||||
break;
|
||||
case FIELD_TYPE_ENUM:
|
||||
{
|
||||
new_field->interval=interval;
|
||||
new_field->pack_length=interval->count < 256 ? 1 : 2; // Should be safe
|
||||
// Should be safe
|
||||
new_field->pack_length= interval_list->elements < 256 ? 1 : 2;
|
||||
|
||||
uint32 dummy_tot_length;
|
||||
calculate_interval_lengths(thd, interval,
|
||||
&new_field->length, &dummy_tot_length);
|
||||
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
|
||||
if (default_value)
|
||||
{
|
||||
String str,*res;
|
||||
res=default_value->val_str(&str);
|
||||
res->strip_sp();
|
||||
if (!find_type(interval, res->ptr(), res->length(), 0))
|
||||
{
|
||||
net_printf(thd,ER_INVALID_DEFAULT,field_name);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
List_iterator<String> it(*interval_list);
|
||||
String *tmp;
|
||||
while ((tmp= it++))
|
||||
new_field->interval_list.push_back(tmp);
|
||||
new_field->length= 1; // See comment for FIELD_TYPE_SET above.
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ((new_field->length > MAX_FIELD_CHARLENGTH && type != FIELD_TYPE_SET &&
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue