mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
Merge bk-internal.mysql.com:/home/bk/mysql-4.1/
into serg.mylan:/usr/home/serg/Abk/mysql-4.1
This commit is contained in:
commit
411b111b65
57 changed files with 1623 additions and 743 deletions
|
@ -20,7 +20,7 @@ release_flags="-fast +O3"
|
|||
# note on pointers below.
|
||||
cflags="-g -z +O0"
|
||||
cxxflags="-g0 -z +O0"
|
||||
debug_conigure_options="--with-debug"
|
||||
debug_configure_options="--with-debug"
|
||||
|
||||
while [ "$#" != 0 ]; do
|
||||
case "$1" in
|
||||
|
@ -40,23 +40,23 @@ while [ "$#" != 0 ]; do
|
|||
--release)
|
||||
echo "Building release binary"
|
||||
cflags="$release_flags"
|
||||
cxxflags="$release_flags"
|
||||
debug_configure_options=""
|
||||
cxxflags="$release_flags"
|
||||
debug_configure_options=""
|
||||
;;
|
||||
-32)
|
||||
echo "Building 32-bit binary"
|
||||
;;
|
||||
-64)
|
||||
echo "Building 64-bit binary"
|
||||
-32)
|
||||
echo "Building 32-bit binary"
|
||||
;;
|
||||
-64)
|
||||
echo "Building 64-bit binary"
|
||||
cflags="$cflags +DA2.0W +DD64"
|
||||
cxxflags="$cxxflags +DA2.0W +DD64"
|
||||
;;
|
||||
;;
|
||||
*)
|
||||
echo "$0: invalid option '$1'; use --help to show usage"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ igor@hundin.mysql.fi
|
|||
igor@rurik.mysql.com
|
||||
ingo@mysql.com
|
||||
jan@hundin.mysql.fi
|
||||
jani@a193-229-222-105.elisa-laajakaista.fi
|
||||
jani@a193-229-222-2.elisa-laajakaista.fi
|
||||
jani@a80-186-24-72.elisa-laajakaista.fi
|
||||
jani@a80-186-41-201.elisa-laajakaista.fi
|
||||
|
|
|
@ -21,6 +21,7 @@ then
|
|||
|
||||
CHANGESET=`bk -R prs -r+ -h -d':P:::I:' ChangeSet`
|
||||
BUG=`bk -R prs -r+ -h -d':C:' ChangeSet | sed -ne 's/^.*[Bb][Uu][Gg] *# *\([0-9][0-9]*\).*$/ BUG#\1/p'`
|
||||
WL=`bk -R prs -r+ -h -d':C:' ChangeSet | sed -ne 's/^.*[Ww][Ll] *# *\([0-9][0-9]*\).*$/ WL#\1/p'`
|
||||
|
||||
if [ "$BUG" = "" ]
|
||||
then
|
||||
|
@ -37,7 +38,7 @@ fi
|
|||
List-ID: <bk.mysql-$VERSION>
|
||||
From: $FROM
|
||||
To: $TO
|
||||
Subject: bk commit - $VERSION tree ($CHANGESET)$BUG
|
||||
Subject: bk commit - $VERSION tree ($CHANGESET)${BUG}${WL}
|
||||
|
||||
EOF
|
||||
bk changes -v -r+
|
||||
|
|
|
@ -1811,7 +1811,7 @@ sub fix_image
|
|||
{
|
||||
my($text) = @_;
|
||||
my($arg1, $ext);
|
||||
$text =~ /^([^,]*)$/;
|
||||
$text =~ /^([^,]*)/;
|
||||
die "error in image: '$text'" unless defined($1);
|
||||
$arg1 = $1;
|
||||
$arg1 =~ s/@@/@/g;
|
||||
|
|
|
@ -423,6 +423,10 @@ SOURCE=..\mysys\my_static.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\strings\my_strtoll10.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mysys\my_symlink.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -383,6 +383,10 @@ SOURCE=..\mysys\my_static.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\strings\my_strtoll10.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mysys\my_symlink.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -264,7 +264,6 @@ static int write_to_table(char *filename, MYSQL *sock)
|
|||
{
|
||||
char tablename[FN_REFLEN], hard_path[FN_REFLEN],
|
||||
sql_statement[FN_REFLEN*16+256], *end;
|
||||
my_bool local_file;
|
||||
DBUG_ENTER("write_to_table");
|
||||
DBUG_PRINT("enter",("filename: %s",filename));
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
|
|||
AC_INIT(sql/mysqld.cc)
|
||||
AC_CANONICAL_SYSTEM
|
||||
# The Docs Makefile.am parses this line!
|
||||
AM_INIT_AUTOMAKE(mysql, 4.1.6-gamma)
|
||||
AM_INIT_AUTOMAKE(mysql, 4.1.7-gamma)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
PROTOCOL_VERSION=10
|
||||
|
|
|
@ -713,7 +713,7 @@ typedef void *gptr; /* Generic pointer */
|
|||
typedef char *gptr; /* Generic pointer */
|
||||
#endif
|
||||
#ifndef HAVE_INT_8_16_32
|
||||
typedef char int8; /* Signed integer >= 8 bits */
|
||||
typedef signed char int8; /* Signed integer >= 8 bits */
|
||||
typedef short int16; /* Signed integer >= 16 bits */
|
||||
#endif
|
||||
#ifndef HAVE_UCHAR
|
||||
|
|
|
@ -25,7 +25,6 @@ extern "C" {
|
|||
MYSQL_FIELD *unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
|
||||
my_bool default_value, uint server_capabilities);
|
||||
void free_rows(MYSQL_DATA *cur);
|
||||
my_bool mysql_autenticate(MYSQL *mysql, const char *passwd);
|
||||
void free_old_query(MYSQL *mysql);
|
||||
void end_server(MYSQL *mysql);
|
||||
my_bool mysql_reconnect(MYSQL *mysql);
|
||||
|
|
|
@ -100,7 +100,10 @@ extern ulint srv_max_n_threads;
|
|||
extern lint srv_conc_n_threads;
|
||||
|
||||
extern ibool srv_fast_shutdown;
|
||||
|
||||
extern ibool srv_very_fast_shutdown; /* if this TRUE, do not flush the
|
||||
buffer pool to data files at the
|
||||
shutdown; we effectively 'crash'
|
||||
InnoDB */
|
||||
extern ibool srv_innodb_status;
|
||||
|
||||
extern ibool srv_use_doublewrite_buf;
|
||||
|
|
|
@ -3048,13 +3048,25 @@ loop:
|
|||
#ifdef UNIV_LOG_ARCHIVE
|
||||
log_archive_all();
|
||||
#endif /* UNIV_LOG_ARCHIVE */
|
||||
log_make_checkpoint_at(ut_dulint_max, TRUE);
|
||||
|
||||
if (!srv_very_fast_shutdown) {
|
||||
/* In a 'very fast' shutdown we do not flush the buffer pool:
|
||||
it is essentially a 'crash' of the InnoDB server. */
|
||||
|
||||
log_make_checkpoint_at(ut_dulint_max, TRUE);
|
||||
} else {
|
||||
/* Make sure that the log is all flushed to disk, so that
|
||||
we can recover all committed transactions in a crash
|
||||
recovery */
|
||||
log_buffer_flush_to_disk();
|
||||
}
|
||||
|
||||
mutex_enter(&(log_sys->mutex));
|
||||
|
||||
lsn = log_sys->lsn;
|
||||
|
||||
if (ut_dulint_cmp(lsn, log_sys->last_checkpoint_lsn) != 0
|
||||
if ((ut_dulint_cmp(lsn, log_sys->last_checkpoint_lsn) != 0
|
||||
&& !srv_very_fast_shutdown)
|
||||
#ifdef UNIV_LOG_ARCHIVE
|
||||
|| (srv_log_archive_on
|
||||
&& ut_dulint_cmp(lsn,
|
||||
|
@ -3098,11 +3110,12 @@ loop:
|
|||
fil_flush_file_spaces(FIL_TABLESPACE);
|
||||
fil_flush_file_spaces(FIL_LOG);
|
||||
|
||||
/* The next fil_write_... will pass the buffer pool: therefore
|
||||
it is essential that the buffer pool has been completely flushed
|
||||
to disk! */
|
||||
/* The call fil_write_flushed_lsn_to_data_files() will pass the buffer
|
||||
pool: therefore it is essential that the buffer pool has been
|
||||
completely flushed to disk! (We do not call fil_write... if the
|
||||
'very fast' shutdown is enabled.) */
|
||||
|
||||
if (!buf_all_freed()) {
|
||||
if (!srv_very_fast_shutdown && !buf_all_freed()) {
|
||||
|
||||
goto loop;
|
||||
}
|
||||
|
@ -3125,7 +3138,7 @@ loop:
|
|||
|
||||
/* Make some checks that the server really is quiet */
|
||||
ut_a(srv_n_threads_active[SRV_MASTER] == 0);
|
||||
ut_a(buf_all_freed());
|
||||
ut_a(srv_very_fast_shutdown || buf_all_freed());
|
||||
ut_a(0 == ut_dulint_cmp(lsn, log_sys->lsn));
|
||||
|
||||
if (ut_dulint_cmp(lsn, srv_start_lsn) < 0) {
|
||||
|
@ -3140,7 +3153,15 @@ loop:
|
|||
|
||||
srv_shutdown_lsn = lsn;
|
||||
|
||||
fil_write_flushed_lsn_to_data_files(lsn, arch_log_no);
|
||||
if (!srv_very_fast_shutdown) {
|
||||
/* In a 'very fast' shutdown we do not flush the buffer pool:
|
||||
it is essentially a 'crash' of the InnoDB server. Then we must
|
||||
not write the lsn stamps to the data files, since at a
|
||||
startup InnoDB deduces from the stamps if the previous
|
||||
shutdown was clean. */
|
||||
|
||||
fil_write_flushed_lsn_to_data_files(lsn, arch_log_no);
|
||||
}
|
||||
|
||||
fil_flush_file_spaces(FIL_TABLESPACE);
|
||||
|
||||
|
@ -3148,7 +3169,7 @@ loop:
|
|||
|
||||
/* Make some checks that the server really is quiet */
|
||||
ut_a(srv_n_threads_active[SRV_MASTER] == 0);
|
||||
ut_a(buf_all_freed());
|
||||
ut_a(srv_very_fast_shutdown || buf_all_freed());
|
||||
ut_a(0 == ut_dulint_cmp(lsn, log_sys->lsn));
|
||||
}
|
||||
|
||||
|
|
|
@ -249,6 +249,10 @@ merge to completion before shutdown */
|
|||
|
||||
ibool srv_fast_shutdown = FALSE;
|
||||
|
||||
ibool srv_very_fast_shutdown = FALSE; /* if this TRUE, do not flush the
|
||||
buffer pool to data files at the
|
||||
shutdown; we effectively 'crash'
|
||||
InnoDB */
|
||||
/* Generate a innodb_status.<pid> file */
|
||||
ibool srv_innodb_status = FALSE;
|
||||
|
||||
|
@ -2178,7 +2182,8 @@ loop:
|
|||
/*****************************************************************/
|
||||
background_loop:
|
||||
/* ---- In this loop we run background operations when the server
|
||||
is quiet from user activity */
|
||||
is quiet from user activity. Also in the case of a shutdown, we
|
||||
loop here, flushing the buffer pool to the data files. */
|
||||
|
||||
/* The server has been quiet for a while: start running background
|
||||
operations */
|
||||
|
@ -2251,7 +2256,16 @@ background_loop:
|
|||
|
||||
flush_loop:
|
||||
srv_main_thread_op_info = "flushing buffer pool pages";
|
||||
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 100, ut_dulint_max);
|
||||
|
||||
if (!srv_very_fast_shutdown) {
|
||||
n_pages_flushed =
|
||||
buf_flush_batch(BUF_FLUSH_LIST, 100, ut_dulint_max);
|
||||
} else {
|
||||
/* In a 'very fast' shutdown we do not flush the buffer pool
|
||||
to data files: we set n_pages_flushed to 0 artificially. */
|
||||
|
||||
n_pages_flushed = 0;
|
||||
}
|
||||
|
||||
srv_main_thread_op_info = "reserving kernel mutex";
|
||||
|
||||
|
@ -2304,7 +2318,10 @@ flush_loop:
|
|||
|
||||
/* If we are doing a fast shutdown (= the default)
|
||||
we do not do purge or insert buffer merge. But we
|
||||
flush the buffer pool completely to disk. */
|
||||
flush the buffer pool completely to disk.
|
||||
In a 'very fast' shutdown we do not flush the buffer
|
||||
pool to data files: we have set n_pages_flushed to
|
||||
0 artificially. */
|
||||
|
||||
goto background_loop;
|
||||
}
|
||||
|
|
|
@ -1057,12 +1057,15 @@ trx_purge(void)
|
|||
&& !UT_LIST_GET_LAST(trx_sys->view_list)) {
|
||||
float ratio = (float) trx_sys->rseg_history_len
|
||||
/ srv_max_purge_lag;
|
||||
if (ratio > 1) {
|
||||
if (ratio > ULINT_MAX / 10000) {
|
||||
/* Avoid overflow: maximum delay is 4295 seconds */
|
||||
srv_dml_needed_delay = ULINT_MAX;
|
||||
} else if (ratio > 1) {
|
||||
/* If the history list length exceeds the
|
||||
innodb_max_purge_lag, the
|
||||
data manipulation statements are delayed
|
||||
by at least 5000 microseconds. */
|
||||
srv_dml_needed_delay = (ratio - .5) * 10000;
|
||||
srv_dml_needed_delay = (ulint) ((ratio - .5) * 10000);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3196,24 +3196,20 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number,
|
|||
read_binary_{date,time,datetime}()
|
||||
tm MYSQL_TIME structure to fill
|
||||
pos pointer to current position in network buffer.
|
||||
These functions increase pos to point to the beginning of this
|
||||
field (this is just due to implementation of net_field_length
|
||||
which is used to get length of binary representation of
|
||||
time value).
|
||||
These functions increase pos to point to the beginning of the
|
||||
next column.
|
||||
|
||||
Auxiliary functions to read time (date, datetime) values from network
|
||||
buffer and store in MYSQL_TIME structure. Jointly used by conversion
|
||||
and no-conversion fetching.
|
||||
*/
|
||||
|
||||
static uint read_binary_time(MYSQL_TIME *tm, uchar **pos)
|
||||
static void read_binary_time(MYSQL_TIME *tm, uchar **pos)
|
||||
{
|
||||
uint length;
|
||||
|
||||
/* net_field_length will set pos to the first byte of data */
|
||||
if (!(length= net_field_length(pos)))
|
||||
set_zero_time(tm);
|
||||
else
|
||||
uint length= net_field_length(pos);
|
||||
|
||||
if (length)
|
||||
{
|
||||
uchar *to= *pos;
|
||||
tm->neg= (bool) to[0];
|
||||
|
@ -3226,17 +3222,18 @@ static uint read_binary_time(MYSQL_TIME *tm, uchar **pos)
|
|||
|
||||
tm->year= tm->month= 0;
|
||||
tm->time_type= MYSQL_TIMESTAMP_TIME;
|
||||
|
||||
*pos+= length;
|
||||
}
|
||||
return length;
|
||||
else
|
||||
set_zero_time(tm);
|
||||
}
|
||||
|
||||
static uint read_binary_datetime(MYSQL_TIME *tm, uchar **pos)
|
||||
static void read_binary_datetime(MYSQL_TIME *tm, uchar **pos)
|
||||
{
|
||||
uint length;
|
||||
uint length= net_field_length(pos);
|
||||
|
||||
if (!(length= net_field_length(pos)))
|
||||
set_zero_time(tm);
|
||||
else
|
||||
if (length)
|
||||
{
|
||||
uchar *to= *pos;
|
||||
|
||||
|
@ -3255,17 +3252,18 @@ static uint read_binary_datetime(MYSQL_TIME *tm, uchar **pos)
|
|||
tm->hour= tm->minute= tm->second= 0;
|
||||
tm->second_part= (length > 7) ? (ulong) sint4korr(to+7) : 0;
|
||||
tm->time_type= MYSQL_TIMESTAMP_DATETIME;
|
||||
|
||||
*pos+= length;
|
||||
}
|
||||
return length;
|
||||
else
|
||||
set_zero_time(tm);
|
||||
}
|
||||
|
||||
static uint read_binary_date(MYSQL_TIME *tm, uchar **pos)
|
||||
static void read_binary_date(MYSQL_TIME *tm, uchar **pos)
|
||||
{
|
||||
uint length;
|
||||
uint length= net_field_length(pos);
|
||||
|
||||
if (!(length= net_field_length(pos)))
|
||||
set_zero_time(tm);
|
||||
else
|
||||
if (length)
|
||||
{
|
||||
uchar *to= *pos;
|
||||
tm->year = (uint) sint2korr(to);
|
||||
|
@ -3276,8 +3274,11 @@ static uint read_binary_date(MYSQL_TIME *tm, uchar **pos)
|
|||
tm->second_part= 0;
|
||||
tm->neg= 0;
|
||||
tm->time_type= MYSQL_TIMESTAMP_DATE;
|
||||
|
||||
*pos+= length;
|
||||
}
|
||||
return length;
|
||||
else
|
||||
set_zero_time(tm);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3604,18 +3605,18 @@ static void fetch_datetime_with_conversion(MYSQL_BIND *param,
|
|||
static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
|
||||
uchar **row)
|
||||
{
|
||||
ulong length;
|
||||
enum enum_field_types field_type= field->type;
|
||||
uint field_is_unsigned= field->flags & UNSIGNED_FLAG;
|
||||
|
||||
switch (field_type) {
|
||||
case MYSQL_TYPE_TINY:
|
||||
{
|
||||
char value= (char) **row;
|
||||
longlong data= field_is_unsigned ? (longlong) (unsigned char) value :
|
||||
(longlong) value;
|
||||
uchar value= **row;
|
||||
/* sic: we need to cast to 'signed char' as 'char' may be unsigned */
|
||||
longlong data= field_is_unsigned ? (longlong) value :
|
||||
(longlong) (signed char) value;
|
||||
fetch_long_with_conversion(param, field, data);
|
||||
length= 1;
|
||||
*row+= 1;
|
||||
break;
|
||||
}
|
||||
case MYSQL_TYPE_SHORT:
|
||||
|
@ -3625,7 +3626,7 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
|
|||
longlong data= field_is_unsigned ? (longlong) (unsigned short) value :
|
||||
(longlong) value;
|
||||
fetch_long_with_conversion(param, field, data);
|
||||
length= 2;
|
||||
*row+= 2;
|
||||
break;
|
||||
}
|
||||
case MYSQL_TYPE_INT24: /* mediumint is sent as 4 bytes int */
|
||||
|
@ -3635,14 +3636,14 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
|
|||
longlong data= field_is_unsigned ? (longlong) (unsigned long) value :
|
||||
(longlong) value;
|
||||
fetch_long_with_conversion(param, field, data);
|
||||
length= 4;
|
||||
*row+= 4;
|
||||
break;
|
||||
}
|
||||
case MYSQL_TYPE_LONGLONG:
|
||||
{
|
||||
longlong value= (longlong)sint8korr(*row);
|
||||
fetch_long_with_conversion(param, field, value);
|
||||
length= 8;
|
||||
*row+= 8;
|
||||
break;
|
||||
}
|
||||
case MYSQL_TYPE_FLOAT:
|
||||
|
@ -3650,7 +3651,7 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
|
|||
float value;
|
||||
float4get(value,*row);
|
||||
fetch_float_with_conversion(param, field, value, FLT_DIG);
|
||||
length= 4;
|
||||
*row+= 4;
|
||||
break;
|
||||
}
|
||||
case MYSQL_TYPE_DOUBLE:
|
||||
|
@ -3658,14 +3659,14 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
|
|||
double value;
|
||||
float8get(value,*row);
|
||||
fetch_float_with_conversion(param, field, value, DBL_DIG);
|
||||
length= 8;
|
||||
*row+= 8;
|
||||
break;
|
||||
}
|
||||
case MYSQL_TYPE_DATE:
|
||||
{
|
||||
MYSQL_TIME tm;
|
||||
|
||||
length= read_binary_date(&tm, row);
|
||||
read_binary_date(&tm, row);
|
||||
fetch_datetime_with_conversion(param, &tm);
|
||||
break;
|
||||
}
|
||||
|
@ -3673,7 +3674,7 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
|
|||
{
|
||||
MYSQL_TIME tm;
|
||||
|
||||
length= read_binary_time(&tm, row);
|
||||
read_binary_time(&tm, row);
|
||||
fetch_datetime_with_conversion(param, &tm);
|
||||
break;
|
||||
}
|
||||
|
@ -3682,16 +3683,18 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
|
|||
{
|
||||
MYSQL_TIME tm;
|
||||
|
||||
length= read_binary_datetime(&tm, row);
|
||||
read_binary_datetime(&tm, row);
|
||||
fetch_datetime_with_conversion(param, &tm);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
length= net_field_length(row);
|
||||
{
|
||||
ulong length= net_field_length(row);
|
||||
fetch_string_with_conversion(param, (char*) *row, length);
|
||||
*row+= length;
|
||||
break;
|
||||
}
|
||||
*row+= length;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -3760,19 +3763,19 @@ static void fetch_result_double(MYSQL_BIND *param, uchar **row)
|
|||
static void fetch_result_time(MYSQL_BIND *param, uchar **row)
|
||||
{
|
||||
MYSQL_TIME *tm= (MYSQL_TIME *)param->buffer;
|
||||
*row+= read_binary_time(tm, row);
|
||||
read_binary_time(tm, row);
|
||||
}
|
||||
|
||||
static void fetch_result_date(MYSQL_BIND *param, uchar **row)
|
||||
{
|
||||
MYSQL_TIME *tm= (MYSQL_TIME *)param->buffer;
|
||||
*row+= read_binary_date(tm, row);
|
||||
read_binary_date(tm, row);
|
||||
}
|
||||
|
||||
static void fetch_result_datetime(MYSQL_BIND *param, uchar **row)
|
||||
{
|
||||
MYSQL_TIME *tm= (MYSQL_TIME *)param->buffer;
|
||||
*row+= read_binary_datetime(tm, row);
|
||||
read_binary_datetime(tm, row);
|
||||
}
|
||||
|
||||
static void fetch_result_bin(MYSQL_BIND *param, uchar **row)
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
disable_query_log;
|
||||
show variables like "have_ndbcluster";
|
||||
enable_query_log;
|
||||
connect (server1,127.0.0.1,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connect (server2,127.0.0.1,root,,test,$MASTER_MYPORT1,$MASTER_MYSOCK1);
|
||||
connection server1;
|
||||
#connect (server1,127.0.0.1,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
#connect (server2,127.0.0.1,root,,test,$MASTER_MYPORT1,$MASTER_MYSOCK1);
|
||||
#connection server1;
|
||||
|
|
|
@ -45,7 +45,7 @@ select '------ simple select tests ------' as test_sequence ;
|
|||
|
||||
##### many column types, but no parameter
|
||||
# heavy modified case derived from client_test.c: test_func_fields()
|
||||
prepare stmt1 from ' select * from t9 ' ;
|
||||
prepare stmt1 from ' select * from t9 order by c1 ' ;
|
||||
--enable_metadata
|
||||
execute stmt1;
|
||||
--disable_metadata
|
||||
|
|
|
@ -750,3 +750,43 @@ SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
|
|||
id
|
||||
4
|
||||
DROP TABLE t1;
|
||||
SET NAMES latin1;
|
||||
CREATE TABLE t1 (
|
||||
id int unsigned NOT NULL auto_increment,
|
||||
list_id smallint unsigned NOT NULL,
|
||||
term text NOT NULL,
|
||||
PRIMARY KEY(id),
|
||||
INDEX(list_id, term(19))
|
||||
) TYPE=MyISAM CHARSET=utf8;
|
||||
Warnings:
|
||||
Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
|
||||
INSERT INTO t1 set list_id = 1, term = "testétest";
|
||||
INSERT INTO t1 set list_id = 1, term = "testetest";
|
||||
INSERT INTO t1 set list_id = 1, term = "testètest";
|
||||
SELECT id, term FROM t1 where (list_id = 1) AND (term = "testétest");
|
||||
id term
|
||||
1 testétest
|
||||
2 testetest
|
||||
3 testètest
|
||||
SELECT id, term FROM t1 where (list_id = 1) AND (term = "testetest");
|
||||
id term
|
||||
1 testétest
|
||||
2 testetest
|
||||
3 testètest
|
||||
SELECT id, term FROM t1 where (list_id = 1) AND (term = "testètest");
|
||||
id term
|
||||
1 testétest
|
||||
2 testetest
|
||||
3 testètest
|
||||
DROP TABLE t1;
|
||||
set names utf8;
|
||||
create table t1 (
|
||||
a int primary key,
|
||||
b varchar(6),
|
||||
index b3(b(3))
|
||||
) engine=innodb character set=utf8;
|
||||
insert into t1 values(1,'foo'),(2,'foobar');
|
||||
select * from t1 where b like 'foob%';
|
||||
a b
|
||||
2 foobar
|
||||
drop table t1;
|
||||
|
|
|
@ -318,3 +318,60 @@ execute stmt;
|
|||
a
|
||||
drop table t1;
|
||||
deallocate prepare stmt;
|
||||
create table t1 (a int, b int);
|
||||
insert into t1 (a, b) values (1,1), (1,2), (2,1), (2,2);
|
||||
prepare stmt from
|
||||
"explain select * from t1 where t1.a=2 and t1.a=t1.b and t1.b > 1 + ?";
|
||||
set @v=5;
|
||||
execute stmt using @v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
- - - - - - - - NULL Impossible WHERE
|
||||
set @v=0;
|
||||
execute stmt using @v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
- - - - - - - - 4 Using where
|
||||
set @v=5;
|
||||
execute stmt using @v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
- - - - - - - - NULL Impossible WHERE
|
||||
drop table t1;
|
||||
deallocate prepare stmt;
|
||||
create table t1 (a int);
|
||||
insert into t1 (a) values (1), (2), (3), (4);
|
||||
set @precision=10000000000;
|
||||
select rand(),
|
||||
cast(rand(10)*@precision as unsigned integer),
|
||||
cast(rand(a)*@precision as unsigned integer) from t1;
|
||||
rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer)
|
||||
- 6570515219 -
|
||||
- 1282061302 -
|
||||
- 6698761160 -
|
||||
- 9647622201 -
|
||||
prepare stmt from
|
||||
"select rand(),
|
||||
cast(rand(10)*@precision as unsigned integer),
|
||||
cast(rand(a)*@precision as unsigned integer),
|
||||
cast(rand(?)*@precision as unsigned integer) from t1";
|
||||
set @var=1;
|
||||
execute stmt using @var;
|
||||
rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
|
||||
- 6570515219 - 4054035371
|
||||
- 1282061302 - 8716141803
|
||||
- 6698761160 - 1418603212
|
||||
- 9647622201 - 944590960
|
||||
set @var=2;
|
||||
execute stmt using @var;
|
||||
rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
|
||||
- 6570515219 1559528654 6555866465
|
||||
- 1282061302 6238114970 1223466192
|
||||
- 6698761160 6511989195 6449731873
|
||||
- 9647622201 3845601374 8578261098
|
||||
set @var=3;
|
||||
execute stmt using @var;
|
||||
rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
|
||||
- 6570515219 1559528654 9057697559
|
||||
- 1282061302 6238114970 3730790581
|
||||
- 6698761160 6511989195 1480860534
|
||||
- 9647622201 3845601374 6211931236
|
||||
drop table t1;
|
||||
deallocate prepare stmt;
|
||||
|
|
68
mysql-test/r/ps_10nestset.result
Normal file
68
mysql-test/r/ps_10nestset.result
Normal file
|
@ -0,0 +1,68 @@
|
|||
use test;
|
||||
drop table if exists personnel;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'personnel'
|
||||
create table personnel (
|
||||
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
||||
emp CHAR(10) NOT NULL,
|
||||
salary DECIMAL(6,2) NOT NULL,
|
||||
l INTEGER NOT NULL,
|
||||
r INTEGER NOT NULL);
|
||||
prepare st_ins from 'insert into personnel set emp = ?, salary = ?, l = ?, r = ?';
|
||||
set @arg_nam= 'Jerry';
|
||||
set @arg_sal= 1000;
|
||||
set @arg_l= 1;
|
||||
set @arg_r= 12;
|
||||
execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
|
||||
set @arg_nam= 'Bert';
|
||||
set @arg_sal= 900;
|
||||
set @arg_l= 2;
|
||||
set @arg_r= 3;
|
||||
execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
|
||||
set @arg_nam= 'Chuck';
|
||||
set @arg_sal= 900;
|
||||
set @arg_l= 4;
|
||||
set @arg_r= 11;
|
||||
execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
|
||||
set @arg_nam= 'Donna';
|
||||
set @arg_sal= 800;
|
||||
set @arg_l= 5;
|
||||
set @arg_r= 6;
|
||||
execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
|
||||
set @arg_nam= 'Eddie';
|
||||
set @arg_sal= 700;
|
||||
set @arg_l= 7;
|
||||
set @arg_r= 8;
|
||||
execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
|
||||
set @arg_nam= 'Fred';
|
||||
set @arg_sal= 600;
|
||||
set @arg_l= 9;
|
||||
set @arg_r= 10;
|
||||
execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
|
||||
select * from personnel;
|
||||
id emp salary l r
|
||||
1 Jerry 1000.00 1 12
|
||||
2 Bert 900.00 2 3
|
||||
3 Chuck 900.00 4 11
|
||||
4 Donna 800.00 5 6
|
||||
5 Eddie 700.00 7 8
|
||||
6 Fred 600.00 9 10
|
||||
prepare st_raise_base from 'update personnel set salary = salary * ( 1 + ? ) where r - l = 1';
|
||||
prepare st_raise_mgr from 'update personnel set salary = salary + ? where r - l > 1';
|
||||
set @arg_percent= .10;
|
||||
set @arg_amount= 100;
|
||||
execute st_raise_base using @arg_percent;
|
||||
execute st_raise_mgr using @arg_amount;
|
||||
execute st_raise_base using @arg_percent;
|
||||
execute st_raise_mgr using @arg_amount;
|
||||
execute st_raise_base using @arg_percent;
|
||||
execute st_raise_mgr using @arg_amount;
|
||||
select * from personnel;
|
||||
id emp salary l r
|
||||
1 Jerry 1300.00 1 12
|
||||
2 Bert 1197.90 2 3
|
||||
3 Chuck 1200.00 4 11
|
||||
4 Donna 1064.80 5 6
|
||||
5 Eddie 931.70 7 8
|
||||
6 Fred 798.60 9 10
|
||||
drop table personnel;
|
118
mysql-test/r/ps_11bugs.result
Normal file
118
mysql-test/r/ps_11bugs.result
Normal file
|
@ -0,0 +1,118 @@
|
|||
drop table if exists t1, t2;
|
||||
CREATE TABLE t1(session_id char(9) NOT NULL);
|
||||
INSERT INTO t1 VALUES ("abc");
|
||||
SELECT * FROM t1;
|
||||
session_id
|
||||
abc
|
||||
prepare st_1180 from 'SELECT * FROM t1 WHERE ?="1111" and session_id = "abc"';
|
||||
set @arg1= 'abc';
|
||||
execute st_1180 using @arg1;
|
||||
session_id
|
||||
set @arg1= '1111';
|
||||
execute st_1180 using @arg1;
|
||||
session_id
|
||||
abc
|
||||
set @arg1= 'abc';
|
||||
execute st_1180 using @arg1;
|
||||
session_id
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
c_01 char(6), c_02 integer, c_03 real, c_04 int(3), c_05 varchar(20),
|
||||
c_06 date, c_07 char(1), c_08 real, c_09 int(11), c_10 time,
|
||||
c_11 char(6), c_12 integer, c_13 real, c_14 int(3), c_15 varchar(20),
|
||||
c_16 date, c_17 char(1), c_18 real, c_19 int(11), c_20 text);
|
||||
prepare st_1644 from 'insert into t1 values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
|
||||
set @arg01= 'row_1';
|
||||
set @arg02= 1;
|
||||
set @arg03= 1.1;
|
||||
set @arg04= 111;
|
||||
set @arg05= 'row_one';
|
||||
set @arg06= '2004-10-12';
|
||||
set @arg07= '1';
|
||||
set @arg08= 1.1;
|
||||
set @arg09= '100100100';
|
||||
set @arg10= '12:34:56';
|
||||
set @arg11= 'row_1';
|
||||
set @arg12= 1;
|
||||
set @arg13= 1.1;
|
||||
set @arg14= 111;
|
||||
set @arg15= 'row_one';
|
||||
set @arg16= '2004-10-12';
|
||||
set @arg17= '1';
|
||||
set @arg18= 1.1;
|
||||
set @arg19= '100100100';
|
||||
set @arg20= '12:34:56';
|
||||
execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
|
||||
@arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
|
||||
set @arg01= NULL;
|
||||
set @arg02= NULL;
|
||||
set @arg03= NULL;
|
||||
set @arg04= NULL;
|
||||
set @arg05= NULL;
|
||||
set @arg06= NULL;
|
||||
set @arg07= NULL;
|
||||
set @arg08= NULL;
|
||||
set @arg09= NULL;
|
||||
set @arg10= NULL;
|
||||
set @arg11= NULL;
|
||||
set @arg12= NULL;
|
||||
set @arg13= NULL;
|
||||
set @arg14= NULL;
|
||||
set @arg15= NULL;
|
||||
set @arg16= NULL;
|
||||
set @arg17= NULL;
|
||||
set @arg18= NULL;
|
||||
set @arg19= NULL;
|
||||
set @arg20= NULL;
|
||||
execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
|
||||
@arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
|
||||
set @arg01= 'row_3';
|
||||
set @arg02= 3;
|
||||
set @arg03= 3.3;
|
||||
set @arg04= 333;
|
||||
set @arg05= 'row_three';
|
||||
set @arg06= '2004-10-12';
|
||||
set @arg07= '3';
|
||||
set @arg08= 3.3;
|
||||
set @arg09= '300300300';
|
||||
set @arg10= '12:34:56';
|
||||
set @arg11= 'row_3';
|
||||
set @arg12= 3;
|
||||
set @arg13= 3.3;
|
||||
set @arg14= 333;
|
||||
set @arg15= 'row_three';
|
||||
set @arg16= '2004-10-12';
|
||||
set @arg17= '3';
|
||||
set @arg18= 3.3;
|
||||
set @arg19= '300300300';
|
||||
set @arg20= '12:34:56';
|
||||
execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
|
||||
@arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
|
||||
select * from t1;
|
||||
c_01 c_02 c_03 c_04 c_05 c_06 c_07 c_08 c_09 c_10 c_11 c_12 c_13 c_14 c_15 c_16 c_17 c_18 c_19 c_20
|
||||
row_1 1 1.1 111 row_one 2004-10-12 1 1.1 100100100 12:34:56 row_1 1 1.1 111 row_one 2004-10-12 1 1.1 100100100 12:34:56
|
||||
NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
row_3 3 3.3 333 row_three 2004-10-12 3 3.3 300300300 12:34:56 row_3 3 3.3 333 row_three 2004-10-12 3 3.3 300300300 12:34:56
|
||||
drop table t1;
|
||||
create table t1(
|
||||
cola varchar(50) not null,
|
||||
colb varchar(8) not null,
|
||||
colc varchar(12) not null,
|
||||
cold varchar(2) not null,
|
||||
primary key (cola, colb, cold));
|
||||
create table t2(
|
||||
cola varchar(50) not null,
|
||||
colb varchar(8) not null,
|
||||
colc varchar(2) not null,
|
||||
cold float,
|
||||
primary key (cold));
|
||||
insert into t1 values ('aaaa', 'yyyy', 'yyyy-dd-mm', 'R');
|
||||
insert into t2 values ('aaaa', 'yyyy', 'R', 203), ('bbbb', 'zzzz', 'C', 201);
|
||||
prepare st_1676 from 'select a.cola, a.colb, a.cold from t1 a, t2 b where a.cola = ? and a.colb = ? and a.cold = ? and b.cola = a.cola and b.colb = a.colb and b.colc = a.cold';
|
||||
set @arg0= "aaaa";
|
||||
set @arg1= "yyyy";
|
||||
set @arg2= "R";
|
||||
execute st_1676 using @arg0, @arg1, @arg2;
|
||||
cola colb cold
|
||||
aaaa yyyy R
|
||||
drop table t1, t2;
|
|
@ -46,7 +46,7 @@ c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
|
|||
commit ;
|
||||
test_sequence
|
||||
------ simple select tests ------
|
||||
prepare stmt1 from ' select * from t9 ' ;
|
||||
prepare stmt1 from ' select * from t9 order by c1 ' ;
|
||||
execute stmt1;
|
||||
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t9 t9 c1 c1 1 4 1 N 49155 0 63
|
||||
|
|
|
@ -46,7 +46,7 @@ c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
|
|||
commit ;
|
||||
test_sequence
|
||||
------ simple select tests ------
|
||||
prepare stmt1 from ' select * from t9 ' ;
|
||||
prepare stmt1 from ' select * from t9 order by c1 ' ;
|
||||
execute stmt1;
|
||||
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t9 t9 c1 c1 1 4 1 N 49155 0 63
|
||||
|
|
|
@ -47,7 +47,7 @@ c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
|
|||
commit ;
|
||||
test_sequence
|
||||
------ simple select tests ------
|
||||
prepare stmt1 from ' select * from t9 ' ;
|
||||
prepare stmt1 from ' select * from t9 order by c1 ' ;
|
||||
execute stmt1;
|
||||
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t9 t9 c1 c1 1 4 1 N 49155 0 63
|
||||
|
|
|
@ -89,7 +89,7 @@ c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
|
|||
commit ;
|
||||
test_sequence
|
||||
------ simple select tests ------
|
||||
prepare stmt1 from ' select * from t9 ' ;
|
||||
prepare stmt1 from ' select * from t9 order by c1 ' ;
|
||||
execute stmt1;
|
||||
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t9 t9 c1 c1 1 4 1 N 49155 0 63
|
||||
|
@ -3097,7 +3097,7 @@ c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
|
|||
commit ;
|
||||
test_sequence
|
||||
------ simple select tests ------
|
||||
prepare stmt1 from ' select * from t9 ' ;
|
||||
prepare stmt1 from ' select * from t9 order by c1 ' ;
|
||||
execute stmt1;
|
||||
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t9 t9 c1 c1 1 4 1 N 49155 0 63
|
||||
|
|
|
@ -46,7 +46,7 @@ c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
|
|||
commit ;
|
||||
test_sequence
|
||||
------ simple select tests ------
|
||||
prepare stmt1 from ' select * from t9 ' ;
|
||||
prepare stmt1 from ' select * from t9 order by c1 ' ;
|
||||
execute stmt1;
|
||||
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t9 t9 c1 c1 1 4 1 N 49155 0 63
|
||||
|
|
|
@ -47,7 +47,7 @@ c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
|
|||
commit ;
|
||||
test_sequence
|
||||
------ simple select tests ------
|
||||
prepare stmt1 from ' select * from t9 ' ;
|
||||
prepare stmt1 from ' select * from t9 order by c1 ' ;
|
||||
execute stmt1;
|
||||
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t9 t9 c1 c1 1 4 1 N 49155 0 63
|
||||
|
@ -83,8 +83,8 @@ def test t9 t9 c30 c30 253 100 8 Y 0 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
|
||||
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
|
||||
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
|
||||
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
|
||||
set @arg00='SELECT' ;
|
||||
prepare stmt1 from ' ? a from t1 where a=1 ';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
|
||||
|
|
|
@ -221,7 +221,9 @@ drop table t1;
|
|||
# Bug 4521: unique key prefix interacts poorly with utf8
|
||||
# InnoDB: keys with prefix compression, case insensitive collation.
|
||||
#
|
||||
--disable_warnings
|
||||
create table t1 (c varchar(30) character set utf8, unique(c(10))) engine=innodb;
|
||||
--enable_warnings
|
||||
insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
|
||||
insert into t1 values ('aaaaaaaaaa');
|
||||
--error 1062
|
||||
|
@ -269,7 +271,9 @@ drop table t1;
|
|||
# Bug 4521: unique key prefix interacts poorly with utf8
|
||||
# InnoDB: fixed length keys, case insensitive collation
|
||||
#
|
||||
--disable_warnings
|
||||
create table t1 (c char(3) character set utf8, unique (c(2))) engine=innodb;
|
||||
--enable_warnings
|
||||
insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
|
||||
insert into t1 values ('a');
|
||||
insert into t1 values ('aa');
|
||||
|
@ -504,10 +508,12 @@ drop table t1;
|
|||
# Bug#4594: column index make = failed for gbk, but like works
|
||||
# Check InnoDB
|
||||
#
|
||||
--disable_warnings
|
||||
create table t1 (
|
||||
str varchar(255) character set utf8 not null,
|
||||
key str (str(2))
|
||||
) engine=innodb;
|
||||
--enable_warnings
|
||||
INSERT INTO t1 VALUES ('str');
|
||||
INSERT INTO t1 VALUES ('str2');
|
||||
select * from t1 where str='str';
|
||||
|
@ -563,10 +569,12 @@ DROP TABLE t1;
|
|||
# Bug #5723: length(<varchar utf8 field>) returns varying results
|
||||
#
|
||||
SET NAMES utf8;
|
||||
--disable_warnings
|
||||
CREATE TABLE t1 (
|
||||
subject varchar(255) character set utf8 collate utf8_unicode_ci,
|
||||
p varchar(15) character set utf8
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
--enable_warnings
|
||||
INSERT INTO t1 VALUES ('谷川俊二と申しますが、インターネット予約の会員登録をしましたところ、メールアドレスを間違えてしまい会員IDが受け取ることが出来ませんでした。間違えアドレスはtani-shun@n.vodafone.ne.jpを書き込みました。どうすればよいですか? その他、住所等は間違えありません。連絡ください。よろしくお願いします。m(__)m','040312-000057');
|
||||
INSERT INTO t1 VALUES ('aaa','bbb');
|
||||
SELECT length(subject) FROM t1;
|
||||
|
@ -592,3 +600,38 @@ SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterb");
|
|||
SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera");
|
||||
SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug #6043 erratic searching for diacriticals in indexed MyISAM UTF-8 table
|
||||
#
|
||||
SET NAMES latin1;
|
||||
CREATE TABLE t1 (
|
||||
id int unsigned NOT NULL auto_increment,
|
||||
list_id smallint unsigned NOT NULL,
|
||||
term text NOT NULL,
|
||||
PRIMARY KEY(id),
|
||||
INDEX(list_id, term(19))
|
||||
) TYPE=MyISAM CHARSET=utf8;
|
||||
INSERT INTO t1 set list_id = 1, term = "testétest";
|
||||
INSERT INTO t1 set list_id = 1, term = "testetest";
|
||||
INSERT INTO t1 set list_id = 1, term = "testètest";
|
||||
SELECT id, term FROM t1 where (list_id = 1) AND (term = "testétest");
|
||||
SELECT id, term FROM t1 where (list_id = 1) AND (term = "testetest");
|
||||
SELECT id, term FROM t1 where (list_id = 1) AND (term = "testètest");
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #6019 SELECT tries to use too short prefix index on utf8 data
|
||||
#
|
||||
set names utf8;
|
||||
--disable_warnings
|
||||
create table t1 (
|
||||
a int primary key,
|
||||
b varchar(6),
|
||||
index b3(b(3))
|
||||
) engine=innodb character set=utf8;
|
||||
--enable_warnings
|
||||
insert into t1 values(1,'foo'),(2,'foobar');
|
||||
select * from t1 where b like 'foob%';
|
||||
drop table t1;
|
||||
|
|
|
@ -342,4 +342,51 @@ execute stmt;
|
|||
drop table t1;
|
||||
deallocate prepare stmt;
|
||||
|
||||
#
|
||||
# Test case for Bug#6042 "constants propogation works only once (prepared
|
||||
# statements): check that the query plan changes whenever we change
|
||||
# placeholder value.
|
||||
#
|
||||
create table t1 (a int, b int);
|
||||
insert into t1 (a, b) values (1,1), (1,2), (2,1), (2,2);
|
||||
prepare stmt from
|
||||
"explain select * from t1 where t1.a=2 and t1.a=t1.b and t1.b > 1 + ?";
|
||||
--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
|
||||
set @v=5;
|
||||
execute stmt using @v;
|
||||
--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
|
||||
set @v=0;
|
||||
execute stmt using @v;
|
||||
--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
|
||||
set @v=5;
|
||||
execute stmt using @v;
|
||||
drop table t1;
|
||||
deallocate prepare stmt;
|
||||
|
||||
#
|
||||
# A test case for Bug#5985 prepare stmt from "select rand(?)" crashes
|
||||
# server. Check that Item_func_rand is prepared-statements friendly.
|
||||
#
|
||||
create table t1 (a int);
|
||||
insert into t1 (a) values (1), (2), (3), (4);
|
||||
set @precision=10000000000;
|
||||
--replace_column 1 - 3 -
|
||||
select rand(),
|
||||
cast(rand(10)*@precision as unsigned integer),
|
||||
cast(rand(a)*@precision as unsigned integer) from t1;
|
||||
prepare stmt from
|
||||
"select rand(),
|
||||
cast(rand(10)*@precision as unsigned integer),
|
||||
cast(rand(a)*@precision as unsigned integer),
|
||||
cast(rand(?)*@precision as unsigned integer) from t1";
|
||||
set @var=1;
|
||||
--replace_column 1 - 3 -
|
||||
execute stmt using @var;
|
||||
set @var=2;
|
||||
--replace_column 1 -
|
||||
execute stmt using @var;
|
||||
set @var=3;
|
||||
--replace_column 1 -
|
||||
execute stmt using @var;
|
||||
drop table t1;
|
||||
deallocate prepare stmt;
|
||||
|
|
63
mysql-test/t/ps_10nestset.test
Normal file
63
mysql-test/t/ps_10nestset.test
Normal file
|
@ -0,0 +1,63 @@
|
|||
###############################################
|
||||
# #
|
||||
# Prepared Statements test on #
|
||||
# "nested sets" representing hierarchies #
|
||||
# #
|
||||
###############################################
|
||||
|
||||
# Source: http://kris.koehntopp.de/artikel/sql-self-references (dated 1999)
|
||||
# Source: http://dbmsmag.com/9603d06.html (dated 1996)
|
||||
|
||||
use test;
|
||||
|
||||
drop table if exists personnel;
|
||||
|
||||
# "Nested Set": This table represents an employee list with a hierarchy tree.
|
||||
# The tree is not modeled by "parent" links but rather by showing the "left"
|
||||
# and "right" border of any person's "region". By convention, "l" < "r".
|
||||
# As it is a tree, these "regions" of two persons A and B are either disjoint,
|
||||
# or A's region is completely contained in B's (B is A's boss), or vice versa.
|
||||
# See the references for more info.
|
||||
|
||||
create table personnel (
|
||||
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
||||
emp CHAR(10) NOT NULL,
|
||||
salary DECIMAL(6,2) NOT NULL,
|
||||
l INTEGER NOT NULL,
|
||||
r INTEGER NOT NULL);
|
||||
|
||||
prepare st_ins from 'insert into personnel set emp = ?, salary = ?, l = ?, r = ?';
|
||||
|
||||
# Initial employee list:
|
||||
# Jerry ( Bert ( ) Chuck ( Donna ( ) Eddie ( ) Fred ( ) ) )
|
||||
set @arg_nam= 'Jerry'; set @arg_sal= 1000; set @arg_l= 1; set @arg_r= 12;
|
||||
execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
|
||||
set @arg_nam= 'Bert'; set @arg_sal= 900; set @arg_l= 2; set @arg_r= 3;
|
||||
execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
|
||||
set @arg_nam= 'Chuck'; set @arg_sal= 900; set @arg_l= 4; set @arg_r= 11;
|
||||
execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
|
||||
set @arg_nam= 'Donna'; set @arg_sal= 800; set @arg_l= 5; set @arg_r= 6;
|
||||
execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
|
||||
set @arg_nam= 'Eddie'; set @arg_sal= 700; set @arg_l= 7; set @arg_r= 8;
|
||||
execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
|
||||
set @arg_nam= 'Fred'; set @arg_sal= 600; set @arg_l= 9; set @arg_r= 10;
|
||||
execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
|
||||
|
||||
select * from personnel;
|
||||
|
||||
# Three successive raises, each one is 100 units for managers, 10 percent for others.
|
||||
prepare st_raise_base from 'update personnel set salary = salary * ( 1 + ? ) where r - l = 1';
|
||||
prepare st_raise_mgr from 'update personnel set salary = salary + ? where r - l > 1';
|
||||
let $1= 3;
|
||||
set @arg_percent= .10;
|
||||
set @arg_amount= 100;
|
||||
while ($1)
|
||||
{
|
||||
execute st_raise_base using @arg_percent;
|
||||
execute st_raise_mgr using @arg_amount;
|
||||
dec $1;
|
||||
}
|
||||
|
||||
select * from personnel;
|
||||
|
||||
drop table personnel;
|
131
mysql-test/t/ps_11bugs.test
Normal file
131
mysql-test/t/ps_11bugs.test
Normal file
|
@ -0,0 +1,131 @@
|
|||
###############################################
|
||||
# #
|
||||
# Prepared Statements #
|
||||
# re-testing bug DB entries #
|
||||
# #
|
||||
# The bugs are reported as "closed". #
|
||||
# Command sequences taken from bug report. #
|
||||
# No other test contains the bug# as comment. #
|
||||
# #
|
||||
# Tests drop/create tables 't1', 't2', ... #
|
||||
# #
|
||||
###############################################
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
# bug#1180: optimized away part of WHERE clause cause incorect prepared satatement results
|
||||
|
||||
CREATE TABLE t1(session_id char(9) NOT NULL);
|
||||
INSERT INTO t1 VALUES ("abc");
|
||||
SELECT * FROM t1;
|
||||
|
||||
prepare st_1180 from 'SELECT * FROM t1 WHERE ?="1111" and session_id = "abc"';
|
||||
|
||||
# Must not find a row
|
||||
set @arg1= 'abc';
|
||||
execute st_1180 using @arg1;
|
||||
|
||||
# Now, it should find one row
|
||||
set @arg1= '1111';
|
||||
execute st_1180 using @arg1;
|
||||
|
||||
# Back to non-matching
|
||||
set @arg1= 'abc';
|
||||
execute st_1180 using @arg1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
# end of bug#1180
|
||||
|
||||
|
||||
# bug#1644: Insertion of more than 3 NULL columns with parameter binding fails
|
||||
|
||||
# Using prepared statements, insertion of more than three columns with NULL
|
||||
# values fails to insert additional NULLS. After the third column NULLS will
|
||||
# be inserted into the database as zeros.
|
||||
# First insert four columns of a value (i.e. 22) to verify binding is working
|
||||
# correctly. Then Bind to each columns bind parameter an is_null value of 1.
|
||||
# Then insert four more columns of integers, just for sanity.
|
||||
# A subsequent select on the server will result in this:
|
||||
# mysql> select * from foo_dfr;
|
||||
# +------+------+------+------+
|
||||
# | col1 | col2 | col3 | col4 |
|
||||
# +------+------+------+------+
|
||||
# | 22 | 22 | 22 | 22 |
|
||||
# | NULL | NULL | NULL | 0 |
|
||||
# | 88 | 88 | 88 | 88 |
|
||||
# +------+------+------+------+
|
||||
|
||||
# Test is extended to more columns - code stores bit vector in bytes.
|
||||
|
||||
create table t1 (
|
||||
c_01 char(6), c_02 integer, c_03 real, c_04 int(3), c_05 varchar(20),
|
||||
c_06 date, c_07 char(1), c_08 real, c_09 int(11), c_10 time,
|
||||
c_11 char(6), c_12 integer, c_13 real, c_14 int(3), c_15 varchar(20),
|
||||
c_16 date, c_17 char(1), c_18 real, c_19 int(11), c_20 text);
|
||||
# Do not use "timestamp" type, because it has a non-NULL default as of 4.1.2
|
||||
|
||||
prepare st_1644 from 'insert into t1 values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
|
||||
|
||||
set @arg01= 'row_1'; set @arg02= 1; set @arg03= 1.1; set @arg04= 111; set @arg05= 'row_one';
|
||||
set @arg06= '2004-10-12'; set @arg07= '1'; set @arg08= 1.1; set @arg09= '100100100'; set @arg10= '12:34:56';
|
||||
set @arg11= 'row_1'; set @arg12= 1; set @arg13= 1.1; set @arg14= 111; set @arg15= 'row_one';
|
||||
set @arg16= '2004-10-12'; set @arg17= '1'; set @arg18= 1.1; set @arg19= '100100100'; set @arg20= '12:34:56';
|
||||
execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
|
||||
@arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
|
||||
|
||||
set @arg01= NULL; set @arg02= NULL; set @arg03= NULL; set @arg04= NULL; set @arg05= NULL;
|
||||
set @arg06= NULL; set @arg07= NULL; set @arg08= NULL; set @arg09= NULL; set @arg10= NULL;
|
||||
set @arg11= NULL; set @arg12= NULL; set @arg13= NULL; set @arg14= NULL; set @arg15= NULL;
|
||||
set @arg16= NULL; set @arg17= NULL; set @arg18= NULL; set @arg19= NULL; set @arg20= NULL;
|
||||
execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
|
||||
@arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
|
||||
|
||||
set @arg01= 'row_3'; set @arg02= 3; set @arg03= 3.3; set @arg04= 333; set @arg05= 'row_three';
|
||||
set @arg06= '2004-10-12'; set @arg07= '3'; set @arg08= 3.3; set @arg09= '300300300'; set @arg10= '12:34:56';
|
||||
set @arg11= 'row_3'; set @arg12= 3; set @arg13= 3.3; set @arg14= 333; set @arg15= 'row_three';
|
||||
set @arg16= '2004-10-12'; set @arg17= '3'; set @arg18= 3.3; set @arg19= '300300300'; set @arg20= '12:34:56';
|
||||
execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
|
||||
@arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
|
||||
|
||||
select * from t1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
# end of bug#1644
|
||||
|
||||
|
||||
# bug#1677: Prepared statement two-table join returns no rows when one is expected
|
||||
|
||||
create table t1(
|
||||
cola varchar(50) not null,
|
||||
colb varchar(8) not null,
|
||||
colc varchar(12) not null,
|
||||
cold varchar(2) not null,
|
||||
primary key (cola, colb, cold));
|
||||
|
||||
create table t2(
|
||||
cola varchar(50) not null,
|
||||
colb varchar(8) not null,
|
||||
colc varchar(2) not null,
|
||||
cold float,
|
||||
primary key (cold));
|
||||
|
||||
insert into t1 values ('aaaa', 'yyyy', 'yyyy-dd-mm', 'R');
|
||||
|
||||
insert into t2 values ('aaaa', 'yyyy', 'R', 203), ('bbbb', 'zzzz', 'C', 201);
|
||||
|
||||
prepare st_1676 from 'select a.cola, a.colb, a.cold from t1 a, t2 b where a.cola = ? and a.colb = ? and a.cold = ? and b.cola = a.cola and b.colb = a.colb and b.colc = a.cold';
|
||||
|
||||
set @arg0= "aaaa";
|
||||
set @arg1= "yyyy";
|
||||
set @arg2= "R";
|
||||
|
||||
execute st_1676 using @arg0, @arg1, @arg2;
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
# end of bug#1676
|
||||
|
|
@ -64,7 +64,7 @@ public:
|
|||
/**
|
||||
* No of categories
|
||||
*/
|
||||
#define _LOGLEVEL_CATEGORIES (CFG_MAX_LOGLEVEL - CFG_MIN_LOGLEVEL + 1);
|
||||
#define _LOGLEVEL_CATEGORIES (CFG_MAX_LOGLEVEL - CFG_MIN_LOGLEVEL + 1)
|
||||
static const Uint32 LOGLEVEL_CATEGORIES = _LOGLEVEL_CATEGORIES;
|
||||
|
||||
void clear();
|
||||
|
|
|
@ -30,7 +30,7 @@ extern "C" {
|
|||
|
||||
Uint32 makeVersion(Uint32 major, Uint32 minor, Uint32 build);
|
||||
|
||||
char* getVersionString(Uint32 version, char * status);
|
||||
const char* getVersionString(Uint32 version, const char * status);
|
||||
|
||||
void ndbPrintVersion();
|
||||
Uint32 ndbGetOwnVersion();
|
||||
|
|
|
@ -35,7 +35,7 @@ Uint32 makeVersion(Uint32 major, Uint32 minor, Uint32 build) {
|
|||
|
||||
}
|
||||
|
||||
char * getVersionString(Uint32 version, char * status) {
|
||||
const char * getVersionString(Uint32 version, const char * status) {
|
||||
char buff[100];
|
||||
if (status && status[0] != 0)
|
||||
snprintf(buff, sizeof(buff),
|
||||
|
|
|
@ -2373,7 +2373,7 @@ ConfigInfo::getAlias(const char * section) const {
|
|||
bool
|
||||
ConfigInfo::verify(const Properties * section, const char* fname,
|
||||
Uint64 value) const {
|
||||
Uint64 min, max; min = max + 1;
|
||||
Uint64 min, max;
|
||||
|
||||
min = getInfoInt(section, fname, "Min");
|
||||
max = getInfoInt(section, fname, "Max");
|
||||
|
|
|
@ -1244,6 +1244,7 @@ operator<<(NdbOut& out, const LogLevel & ll)
|
|||
for(size_t i = 0; i<LogLevel::LOGLEVEL_CATEGORIES; i++)
|
||||
out << ll.getLogLevel((LogLevel::EventCategory)i) << " ";
|
||||
out << "]";
|
||||
return out;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -779,7 +779,9 @@ main(void){
|
|||
|
||||
template class Vector<NdbScanFilterImpl::State>;
|
||||
#if __SUNPRO_CC != 0x560
|
||||
#ifndef _FORTEC_
|
||||
template int NdbScanFilterImpl::cond_col_const(Interpreter::BinaryCondition, Uint32 attrId, Uint32);
|
||||
template int NdbScanFilterImpl::cond_col_const(Interpreter::BinaryCondition, Uint32 attrId, Uint64);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ use Getopt::Long;
|
|||
use POSIX qw(strftime);
|
||||
|
||||
$|=1;
|
||||
$VER="2.10";
|
||||
$VER="2.11";
|
||||
|
||||
$opt_config_file = undef();
|
||||
$opt_example = 0;
|
||||
|
@ -577,67 +577,92 @@ sub my_which
|
|||
sub example
|
||||
{
|
||||
print <<EOF;
|
||||
# This is an example of a my.cnf file on behalf of $my_progname.
|
||||
# This file should probably be in your home dir (~/.my.cnf) or /etc/my.cnf
|
||||
# Version $VER by Jani Tolonen
|
||||
# NOTES:
|
||||
# 1.Make sure that the MySQL user, who is stopping the mysqld services (e.g
|
||||
# using the mysqladmin) have the same password and username for all the
|
||||
# data directories accessed (to the 'mysql' database) And make sure that
|
||||
# the user has the 'Shutdown_priv' privilege! If you have many data-
|
||||
# directories and many different 'mysql' databases with different passwords
|
||||
# for the MySQL 'root' user, you may want to create a common 'multi_admin'
|
||||
# user for each using the same password (see below). Example how to do it:
|
||||
# shell> mysql -u root -S /tmp/mysql.sock -proot_password -e
|
||||
# "GRANT SHUTDOWN ON *.* TO multi_admin\@localhost IDENTIFIED BY 'multipass'"
|
||||
# You will have to do the above for each mysqld running in each data
|
||||
# directory, that you have (just change the socket, -S=...)
|
||||
# See more detailed information from chapter:
|
||||
# '6 The MySQL Access Privilege System' from the MySQL manual.
|
||||
# 2.pid-file is very important, if you are using mysqld_safe to start mysqld
|
||||
# (e.g. --mysqld=mysqld_safe) Every mysqld should have it's own pid-file.
|
||||
# The advantage using mysqld_safe instead of mysqld directly here is, that
|
||||
# mysqld_safe 'guards' every mysqld process and will restart it, if mysqld
|
||||
# process fails due to signal kill -9, or similar. (Like segmentation fault,
|
||||
# which MySQL should never do, of course ;) Please note that mysqld_safe
|
||||
# script may require that you start it from a certain place. This means that
|
||||
# you may have to CD to a certain directory, before you start the
|
||||
# mysqld_multi. If you have problems starting, please see the script.
|
||||
# Check especially the lines:
|
||||
# --------------------------------------------------------------------------
|
||||
# MY_PWD=`pwd`
|
||||
# Check if we are starting this relative (for the binary release)
|
||||
# if test -d $MY_PWD/data/mysql -a -f ./share/mysql/english/errmsg.sys -a \
|
||||
# -x ./bin/mysqld
|
||||
# --------------------------------------------------------------------------
|
||||
# The above test should be successful, or you may encounter problems.
|
||||
# 3.Beware of the dangers starting multiple mysqlds in the same data directory.
|
||||
# Use separate data directories, unless you *KNOW* what you are doing!
|
||||
# 4.The socket file and the TCP/IP port must be different for every mysqld.
|
||||
# 5.The first and fifth mysqld was intentionally left out from the example.
|
||||
# You may have 'gaps' in the config file. This gives you more flexibility.
|
||||
# The order in which the mysqlds are started or stopped depends on the order
|
||||
# in which they appear in the config file.
|
||||
# 6.When you want to refer to a certain group with GNR with this program,
|
||||
# just use the number in the end of the group name ( [mysqld# <== )
|
||||
# 7.You may want to use option '--user' for mysqld, but in order to do this
|
||||
# you need to be root when you start this script. Having the option
|
||||
# in the config file doesn't matter; you will just get a warning, if you are
|
||||
# not the superuser and the mysqlds are started under *your* unix account.
|
||||
# IMPORTANT: Make sure that the pid-file and the data directory are
|
||||
# read+write(+execute for the latter one) accessible for *THAT* UNIX user,
|
||||
# who the specific mysqld process is started as. *DON'T* use the UNIX root
|
||||
# account for this, unless you *KNOW* what you are doing!
|
||||
# 8.MOST IMPORTANT: Make sure that you understand the meanings of the options
|
||||
# that are passed to the mysqlds and why *WOULD YOU WANT* to have separate
|
||||
# mysqld processes. Starting multiple mysqlds in one data directory *WON'T*
|
||||
# give you extra performance in a threaded system!
|
||||
# This is an example of a my.cnf file for $my_progname.
|
||||
# Usually this file is located in home dir ~/.my.cnf or /etc/my.cnf
|
||||
#
|
||||
# SOME IMPORTANT NOTES FOLLOW:
|
||||
#
|
||||
# 1.COMMON USER
|
||||
#
|
||||
# Make sure that the MySQL user, who is stopping the mysqld services, has
|
||||
# the same password to all MySQL servers being accessed by $my_progname.
|
||||
# This user needs to have the 'Shutdown_priv' -privilege, but for security
|
||||
# reasons should have no other privileges. It is advised that you create a
|
||||
# common 'multi_admin' user for all MySQL servers being controlled by
|
||||
# $my_progname. Here is an example how to do it:
|
||||
#
|
||||
# GRANT SHUTDOWN ON *.* TO multi_admin\@localhost IDENTIFIED BY 'password'
|
||||
#
|
||||
# You will need to apply the above to all MySQL servers that are being
|
||||
# controlled by $my_progname. 'multi_admin' will shutdown the servers
|
||||
# using 'mysqladmin' -binary, when '$my_progname stop' is being called.
|
||||
#
|
||||
# 2.PID-FILE
|
||||
#
|
||||
# If you are using mysqld_safe to start mysqld, make sure that every
|
||||
# MySQL server has a separate pid-file. In order to use mysqld_safe
|
||||
# via $my_progname, you need to use two options:
|
||||
#
|
||||
# mysqld=/path/to/mysqld_safe
|
||||
# ledir=/path/to/mysqld-binary/
|
||||
#
|
||||
# ledir (library executable directory), is an option that only mysqld_safe
|
||||
# accepts, so you will get an error if you try to pass it to mysqld directly.
|
||||
# For this reason you might want to use the above options within [mysqld#]
|
||||
# group directly.
|
||||
#
|
||||
# 3.DATA DIRECTORY
|
||||
#
|
||||
# It is NOT advised to run many MySQL servers within the same data directory.
|
||||
# You can do so, but please make sure to understand and deal with the
|
||||
# underlying caveats. In short they are:
|
||||
# - Speed penalty
|
||||
# - Risk of table/data corruption
|
||||
# - Data synchronising problems between the running servers
|
||||
# - Heavily media (disk) bound
|
||||
# - Relies on the system (external) file locking
|
||||
# - Is not applicable with all table types. (Such as InnoDB)
|
||||
# Trying so will end up with undesirable results.
|
||||
#
|
||||
# 4.TCP/IP Port
|
||||
#
|
||||
# Every server requires one and it must be unique.
|
||||
#
|
||||
# 5.[mysqld#] Groups
|
||||
#
|
||||
# In the example below the first and the fifth mysqld group was
|
||||
# intentionally left out. You may have 'gaps' in the config file. This
|
||||
# gives you more flexibility.
|
||||
#
|
||||
# 6.MySQL Server User
|
||||
#
|
||||
# You can pass the user=... option inside [mysqld#] groups. This
|
||||
# can be very handy in some cases, but then you need to run $my_progname
|
||||
# as UNIX root.
|
||||
#
|
||||
# 7.A Start-up Manage Script for $my_progname
|
||||
#
|
||||
# In the recent MySQL distributions you can find a file called
|
||||
# mysqld_multi.server.sh. It is a wrapper for $my_progname. This can
|
||||
# be used to start and stop multiple servers during boot and shutdown.
|
||||
#
|
||||
# You can place the file in /etc/init.d/mysqld_multi.server.sh and
|
||||
# make the needed symbolic links to it from various run levels
|
||||
# (as per Linux/Unix standard). You may even replace the
|
||||
# /etc/init.d/mysql.server script with it.
|
||||
#
|
||||
# Before using, you must create a my.cnf file either in /etc/my.cnf
|
||||
# or /root/.my.cnf and add the [mysqld_multi] and [mysqld#] groups.
|
||||
#
|
||||
# The script can be found from support-files/mysqld_multi.server.sh
|
||||
# in MySQL distribution. (Verify the script before using)
|
||||
#
|
||||
|
||||
[mysqld_multi]
|
||||
mysqld = @bindir@/mysqld_safe
|
||||
mysqladmin = @bindir@/mysqladmin
|
||||
user = root
|
||||
password = your_password
|
||||
user = multi_admin
|
||||
password = my_password
|
||||
|
||||
[mysqld2]
|
||||
socket = /tmp/mysql.sock2
|
||||
|
@ -645,15 +670,18 @@ port = 3307
|
|||
pid-file = @localstatedir@2/hostname.pid2
|
||||
datadir = @localstatedir@2
|
||||
language = @datadir@/mysql/english
|
||||
user = john
|
||||
user = unix_user1
|
||||
|
||||
[mysqld3]
|
||||
mysqld = /path/to/safe_mysqld/safe_mysqld
|
||||
ledir = /path/to/mysqld-binary/
|
||||
mysqladmin = /path/to/mysqladmin/mysqladmin
|
||||
socket = /tmp/mysql.sock3
|
||||
port = 3308
|
||||
pid-file = @localstatedir@3/hostname.pid3
|
||||
datadir = @localstatedir@3
|
||||
language = @datadir@/mysql/swedish
|
||||
user = monty
|
||||
user = unix_user2
|
||||
|
||||
[mysqld4]
|
||||
socket = /tmp/mysql.sock4
|
||||
|
@ -661,16 +689,15 @@ port = 3309
|
|||
pid-file = @localstatedir@4/hostname.pid4
|
||||
datadir = @localstatedir@4
|
||||
language = @datadir@/mysql/estonia
|
||||
user = tonu
|
||||
user = unix_user3
|
||||
|
||||
|
||||
[mysqld6]
|
||||
socket = /tmp/mysql.sock6
|
||||
port = 3311
|
||||
pid-file = @localstatedir@6/hostname.pid6
|
||||
datadir = @localstatedir@6
|
||||
language = @datadir@/mysql/japanese
|
||||
user = jani
|
||||
user = unix_user4
|
||||
EOF
|
||||
exit(0);
|
||||
}
|
||||
|
@ -691,39 +718,43 @@ Description:
|
|||
$my_progname can be used to start, or stop any number of separate
|
||||
mysqld processes running in different TCP/IP ports and UNIX sockets.
|
||||
|
||||
This program can read group [mysqld_multi] from my.cnf file.
|
||||
You may want to put options mysqld=... and mysqladmin=... there.
|
||||
$my_progname can read group [mysqld_multi] from my.cnf file. You may
|
||||
want to put options mysqld=... and mysqladmin=... there. Since
|
||||
version 2.10 these options can also be given under groups [mysqld#],
|
||||
which gives more control over different versions. One can have the
|
||||
default mysqld and mysqladmin under group [mysqld_multi], but this is
|
||||
not mandatory. Please note that if mysqld or mysqladmin is missing
|
||||
from both [mysqld_multi] and [mysqld#], a group that is tried to be
|
||||
used, $my_progname will abort with an error.
|
||||
|
||||
The program will search for group(s) named [mysqld#] from my.cnf (or
|
||||
the given --config-file=...), where # can be any positive number
|
||||
starting from 1. These groups should be the same as the usual [mysqld]
|
||||
group (e.g. options to mysqld, see MySQL manual for detailed
|
||||
information about this group), but with those port, socket
|
||||
etc. options that are wanted for each separate mysqld processes. The
|
||||
number in the group name has another function; it can be used for
|
||||
starting, stopping, or reporting some specific mysqld servers with
|
||||
this program. See the usage and options below for more information.
|
||||
$my_progname will search for groups named [mysqld#] from my.cnf (or
|
||||
the given --config-file=...), where '#' can be any positive integer
|
||||
starting from 1. These groups should be the same as the regular
|
||||
[mysqld] group, but with those port, socket and any other options
|
||||
that are to be used with each separate mysqld process. The number
|
||||
in the group name has another function; it can be used for starting,
|
||||
stopping, or reporting any specific mysqld server.
|
||||
|
||||
Usage: $my_progname [OPTIONS] {start|stop|report} [GNR,GNR,GNR...]
|
||||
or $my_progname [OPTIONS] {start|stop|report} [GNR-GNR,GNR,GNR-GNR,...]
|
||||
|
||||
The GNR above means the group number. You can start, stop or report
|
||||
any GNR, or several of them at the same time. (See --example) The GNRs
|
||||
list can be comma separated, or a dash combined, of which the latter
|
||||
means that all the GNRs between GNR1-GNR2 will be affected. Without
|
||||
GNR argument all the found groups will be either started, stopped, or
|
||||
reported. Note that you must not have any white spaces in the GNR
|
||||
list. Anything after a white space are ignored.
|
||||
The GNR means the group number. You can start, stop or report any GNR,
|
||||
or several of them at the same time. (See --example) The GNRs list can
|
||||
be comma separated or a dash combined. The latter means that all the
|
||||
GNRs between GNR1-GNR2 will be affected. Without GNR argument all the
|
||||
groups found will either be started, stopped, or reported. Note that
|
||||
syntax for specifying GNRs must appear without spaces.
|
||||
|
||||
Options:
|
||||
--config-file=... Alternative config file.
|
||||
Using: $opt_config_file
|
||||
--example Give an example of a config file.
|
||||
--example Give an example of a config file with extra information.
|
||||
--help Print this help and exit.
|
||||
--log=... Log file. Full path to and the name for the log file. NOTE:
|
||||
If the file exists, everything will be appended.
|
||||
Using: $opt_log
|
||||
--mysqladmin=... mysqladmin binary to be used for a server shutdown.
|
||||
Since version 2.10 this can be given within groups [mysqld#]
|
||||
Using: $mysqladmin
|
||||
--mysqld=... mysqld binary to be used. Note that you can give mysqld_safe
|
||||
to this option also. The options are passed to mysqld. Just
|
||||
|
@ -732,19 +763,19 @@ Options:
|
|||
Please note: Since mysqld_multi version 2.3 you can also
|
||||
give this option inside groups [mysqld#] in ~/.my.cnf,
|
||||
where '#' stands for an integer (number) of the group in
|
||||
question. This will be recognized as a special option and
|
||||
question. This will be recognised as a special option and
|
||||
will not be passed to the mysqld. This will allow one to
|
||||
start different mysqld versions with mysqld_multi.
|
||||
--no-log Print to stdout instead of the log file. By default the log
|
||||
file is turned on.
|
||||
--password=... Password for user for mysqladmin.
|
||||
--password=... Password for mysqladmin user.
|
||||
--silent Disable warnings.
|
||||
--tcp-ip Connect to the MySQL server(s) via the TCP/IP port instead
|
||||
of the UNIX socket. This affects stopping and reporting.
|
||||
If a socket file is missing, the server may still be
|
||||
running, but can be accessed only via the TCP/IP port.
|
||||
By default connecting is done via the UNIX socket.
|
||||
--user=... MySQL user for mysqladmin. Using: $opt_user
|
||||
--user=... mysqladmin user. Using: $opt_user
|
||||
--verbose Be more verbose.
|
||||
--version Print the version number and exit.
|
||||
EOF
|
||||
|
|
12
sql/field.cc
12
sql/field.cc
|
@ -5000,10 +5000,10 @@ String *Field_blob::val_str(String *val_buffer __attribute__((unused)),
|
|||
int Field_blob::cmp(const char *a,uint32 a_length, const char *b,
|
||||
uint32 b_length)
|
||||
{
|
||||
int diff=my_strnncoll(field_charset,
|
||||
(const uchar*)a,min(a_length,b_length),
|
||||
(const uchar*)b,min(a_length,b_length));
|
||||
return diff ? diff : (int) (a_length - b_length);
|
||||
return field_charset->coll->strnncoll(field_charset,
|
||||
(const uchar*)a, a_length,
|
||||
(const uchar*)b, b_length,
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -5087,8 +5087,8 @@ void Field_blob::get_key_image(char *buff,uint length,
|
|||
|
||||
get_ptr(&blob);
|
||||
uint char_length= length / cs->mbmaxlen;
|
||||
char_length= my_charpos(cs, blob, blob + length, char_length);
|
||||
set_if_smaller(length, char_length);
|
||||
char_length= my_charpos(cs, blob, blob + blob_length, char_length);
|
||||
set_if_smaller(blob_length, char_length);
|
||||
|
||||
if ((uint32) length > blob_length)
|
||||
{
|
||||
|
|
|
@ -20,6 +20,9 @@ NOTE: You can only use noninlined InnoDB functions in this file, because we
|
|||
have disables the InnoDB inlining in this file. */
|
||||
|
||||
/* TODO list for the InnoDB handler in 4.1:
|
||||
- Remove the flag innodb_active_trans from thd and replace it with a
|
||||
function call innodb_active_trans(thd), which looks at the InnoDB
|
||||
trx struct state field
|
||||
- Find out what kind of problems the OS X case-insensitivity causes to
|
||||
table and database names; should we 'normalize' the names like we do
|
||||
in Windows?
|
||||
|
@ -114,6 +117,9 @@ uint innobase_flush_log_at_trx_commit = 1;
|
|||
my_bool innobase_log_archive = FALSE;/* unused */
|
||||
my_bool innobase_use_native_aio = FALSE;
|
||||
my_bool innobase_fast_shutdown = TRUE;
|
||||
my_bool innobase_very_fast_shutdown = FALSE; /* this can be set to
|
||||
1 just prior calling
|
||||
innobase_end() */
|
||||
my_bool innobase_file_per_table = FALSE;
|
||||
my_bool innobase_locks_unsafe_for_binlog = FALSE;
|
||||
my_bool innobase_create_status_file = FALSE;
|
||||
|
@ -799,6 +805,10 @@ ha_innobase::init_table_handle_for_HANDLER(void)
|
|||
|
||||
trx_assign_read_view(prebuilt->trx);
|
||||
|
||||
/* Set the MySQL flag to mark that there is an active transaction */
|
||||
|
||||
current_thd->transaction.all.innodb_active_trans = 1;
|
||||
|
||||
/* We did the necessary inits in this function, no need to repeat them
|
||||
in row_search_for_mysql */
|
||||
|
||||
|
@ -1059,6 +1069,15 @@ innobase_end(void)
|
|||
#endif
|
||||
if (innodb_inited)
|
||||
{
|
||||
if (innobase_very_fast_shutdown) {
|
||||
srv_very_fast_shutdown = TRUE;
|
||||
fprintf(stderr,
|
||||
"InnoDB: MySQL has requested a very fast shutdown without flushing\n"
|
||||
"InnoDB: the InnoDB buffer pool to data files. At the next mysqld startup\n"
|
||||
"InnoDB: InnoDB will do a crash recovery!\n");
|
||||
|
||||
}
|
||||
|
||||
innodb_inited= 0;
|
||||
if (innobase_shutdown_for_mysql() != DB_SUCCESS)
|
||||
err= 1;
|
||||
|
@ -1115,6 +1134,48 @@ innobase_commit_low(
|
|||
trx_commit_for_mysql(trx);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
Creates an InnoDB transaction struct for the thd if it does not yet have one.
|
||||
Starts a new InnoDB transaction if a transaction is not yet started. And
|
||||
assigns a new snapshot for a consistent read if the transaction does not yet
|
||||
have one. */
|
||||
|
||||
int
|
||||
innobase_start_trx_and_assign_read_view(
|
||||
/*====================================*/
|
||||
/* out: 0 */
|
||||
THD* thd) /* in: MySQL thread handle of the user for whom
|
||||
the transaction should be committed */
|
||||
{
|
||||
trx_t* trx;
|
||||
|
||||
DBUG_ENTER("innobase_start_trx_and_assign_read_view");
|
||||
|
||||
/* Create a new trx struct for thd, if it does not yet have one */
|
||||
|
||||
trx = check_trx_exists(thd);
|
||||
|
||||
/* This is just to play safe: release a possible FIFO ticket and
|
||||
search latch. Since we will reserve the kernel mutex, we have to
|
||||
release the search system latch first to obey the latching order. */
|
||||
|
||||
innobase_release_stat_resources(trx);
|
||||
|
||||
/* If the transaction is not started yet, start it */
|
||||
|
||||
trx_start_if_not_started_noninline(trx);
|
||||
|
||||
/* Assign a read view if the transaction does not have it yet */
|
||||
|
||||
trx_assign_read_view(trx);
|
||||
|
||||
/* Set the MySQL flag to mark that there is an active transaction */
|
||||
|
||||
current_thd->transaction.all.innodb_active_trans = 1;
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
Commits a transaction in an InnoDB database or marks an SQL statement
|
||||
ended. */
|
||||
|
@ -1146,8 +1207,10 @@ innobase_commit(
|
|||
|
||||
1. ::external_lock(),
|
||||
2. ::start_stmt(),
|
||||
3. innobase_query_caching_of_table_permitted(), and
|
||||
3. innobase_query_caching_of_table_permitted(),
|
||||
4. innobase_savepoint(),
|
||||
5. ::init_table_handle_for_HANDLER(),
|
||||
6. innobase_start_trx_and_assign_read_view()
|
||||
|
||||
and it is only set to 0 in a commit or a rollback. If it is 0 we know
|
||||
there cannot be resources to be freed and we could return immediately.
|
||||
|
|
|
@ -191,6 +191,11 @@ extern my_bool innobase_log_archive,
|
|||
innobase_use_native_aio, innobase_fast_shutdown,
|
||||
innobase_file_per_table, innobase_locks_unsafe_for_binlog,
|
||||
innobase_create_status_file;
|
||||
extern my_bool innobase_very_fast_shutdown; /* set this to 1 just before
|
||||
calling innobase_end() if you want
|
||||
InnoDB to shut down without
|
||||
flushing the buffer pool: this
|
||||
is equivalent to a 'crash' */
|
||||
extern "C" {
|
||||
extern ulong srv_max_buf_pool_modified_pct;
|
||||
extern ulong srv_auto_extend_increment;
|
||||
|
@ -231,3 +236,4 @@ void innobase_release_temporary_latches(void* innobase_tid);
|
|||
|
||||
void innobase_store_binlog_offset_and_flush_log(char *binlog_name,longlong offset);
|
||||
|
||||
int innobase_start_trx_and_assign_read_view(THD* thd);
|
||||
|
|
|
@ -144,6 +144,7 @@ public:
|
|||
DBUG_ENTER("Item::cleanup");
|
||||
DBUG_PRINT("info", ("Type: %d", (int)type()));
|
||||
fixed=0;
|
||||
marker= 0;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
virtual void make_field(Send_field *field);
|
||||
|
|
|
@ -1010,21 +1010,38 @@ double Item_func_round::val()
|
|||
}
|
||||
|
||||
|
||||
void Item_func_rand::fix_length_and_dec()
|
||||
bool Item_func_rand::fix_fields(THD *thd, struct st_table_list *tables,
|
||||
Item **ref)
|
||||
{
|
||||
decimals=NOT_FIXED_DEC;
|
||||
max_length=float_length(decimals);
|
||||
Item_real_func::fix_fields(thd, tables, ref);
|
||||
used_tables_cache|= RAND_TABLE_BIT;
|
||||
if (arg_count)
|
||||
{ // Only use argument once in query
|
||||
uint32 tmp= (uint32) (args[0]->val_int());
|
||||
if ((rand= (struct rand_struct*) sql_alloc(sizeof(*rand))))
|
||||
randominit(rand,(uint32) (tmp*0x10001L+55555555L),
|
||||
(uint32) (tmp*0x10000001L));
|
||||
/*
|
||||
Allocate rand structure once: we must use thd->current_arena
|
||||
to create rand in proper mem_root if it's a prepared statement or
|
||||
stored procedure.
|
||||
*/
|
||||
if (!rand && !(rand= (struct rand_struct*)
|
||||
thd->current_arena->alloc(sizeof(*rand))))
|
||||
return TRUE;
|
||||
/*
|
||||
PARAM_ITEM is returned if we're in statement prepare and consequently
|
||||
no placeholder value is set yet.
|
||||
*/
|
||||
if (args[0]->type() != PARAM_ITEM)
|
||||
{
|
||||
/*
|
||||
TODO: do not do reinit 'rand' for every execute of PS/SP if
|
||||
args[0] is a constant.
|
||||
*/
|
||||
uint32 tmp= (uint32) args[0]->val_int();
|
||||
randominit(rand, (uint32) (tmp*0x10001L+55555555L),
|
||||
(uint32) (tmp*0x10000001L));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
THD *thd= current_thd;
|
||||
/*
|
||||
No need to send a Rand log event if seed was given eg: RAND(seed),
|
||||
as it will be replicated in the query as such.
|
||||
|
@ -1038,6 +1055,7 @@ void Item_func_rand::fix_length_and_dec()
|
|||
thd->rand_saved_seed2=thd->rand.seed2;
|
||||
rand= &thd->rand;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void Item_func_rand::update_used_tables()
|
||||
|
|
|
@ -512,13 +512,13 @@ class Item_func_rand :public Item_real_func
|
|||
{
|
||||
struct rand_struct *rand;
|
||||
public:
|
||||
Item_func_rand(Item *a) :Item_real_func(a) {}
|
||||
Item_func_rand() :Item_real_func() {}
|
||||
Item_func_rand(Item *a) :Item_real_func(a), rand(0) {}
|
||||
Item_func_rand() :Item_real_func() {}
|
||||
double val();
|
||||
const char *func_name() const { return "rand"; }
|
||||
bool const_item() const { return 0; }
|
||||
void update_used_tables();
|
||||
void fix_length_and_dec();
|
||||
bool fix_fields(THD *thd, struct st_table_list *tables, Item **ref);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1284,7 +1284,8 @@ int subselect_uniquesubquery_engine::exec()
|
|||
error= table->file->index_read(table->record[0],
|
||||
tab->ref.key_buff,
|
||||
tab->ref.key_length,HA_READ_KEY_EXACT);
|
||||
if (error && error != HA_ERR_KEY_NOT_FOUND)
|
||||
if (error &&
|
||||
error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
|
||||
error= report_error(table, error);
|
||||
else
|
||||
{
|
||||
|
@ -1336,7 +1337,8 @@ int subselect_indexsubquery_engine::exec()
|
|||
error= table->file->index_read(table->record[0],
|
||||
tab->ref.key_buff,
|
||||
tab->ref.key_length,HA_READ_KEY_EXACT);
|
||||
if (error && error != HA_ERR_KEY_NOT_FOUND)
|
||||
if (error &&
|
||||
error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
|
||||
error= report_error(table, error);
|
||||
else
|
||||
{
|
||||
|
|
|
@ -447,6 +447,7 @@ bool is_update_query(enum enum_sql_command command);
|
|||
bool alloc_query(THD *thd, char *packet, ulong packet_length);
|
||||
void mysql_init_select(LEX *lex);
|
||||
void mysql_init_query(THD *thd, uchar *buf, uint length);
|
||||
void mysql_reset_thd_for_next_command(THD *thd);
|
||||
bool mysql_new_select(LEX *lex, bool move_down);
|
||||
void create_select_for_variable(const char *var_name);
|
||||
void mysql_init_multi_delete(LEX *lex);
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
update user set password=PASSWORD("hello") where user="test"
|
||||
This saves a hashed number as a string in the password field.
|
||||
|
||||
The new autentication is performed in following manner:
|
||||
The new authentication is performed in following manner:
|
||||
|
||||
SERVER: public_seed=create_random_string()
|
||||
send(public_seed)
|
||||
|
|
|
@ -1498,7 +1498,7 @@ void Statement::restore_backup_statement(Statement *stmt, Statement *backup)
|
|||
}
|
||||
|
||||
|
||||
void Statement::end_statement()
|
||||
void THD::end_statement()
|
||||
{
|
||||
/* Cleanup SQL processing state to resuse this statement in next query. */
|
||||
lex_end(lex);
|
||||
|
|
|
@ -544,6 +544,23 @@ public:
|
|||
Points to the query associated with this statement. It's const, but
|
||||
we need to declare it char * because all table handlers are written
|
||||
in C and need to point to it.
|
||||
|
||||
Note that (A) if we set query = NULL, we must at the same time set
|
||||
query_length = 0, and protect the whole operation with the
|
||||
LOCK_thread_count mutex. And (B) we are ONLY allowed to set query to a
|
||||
non-NULL value if its previous value is NULL. We do not need to protect
|
||||
operation (B) with any mutex. To avoid crashes in races, if we do not
|
||||
know that thd->query cannot change at the moment, one should print
|
||||
thd->query like this:
|
||||
(1) reserve the LOCK_thread_count mutex;
|
||||
(2) check if thd->query is NULL;
|
||||
(3) if not NULL, then print at most thd->query_length characters from
|
||||
it. We will see the query_length field as either 0, or the right value
|
||||
for it.
|
||||
Assuming that the write and read of an n-bit memory field in an n-bit
|
||||
computer is atomic, we can avoid races in the above way.
|
||||
This printing is needed at least in SHOW PROCESSLIST and SHOW INNODB
|
||||
STATUS.
|
||||
*/
|
||||
char *query;
|
||||
uint32 query_length; // current query length
|
||||
|
@ -565,12 +582,6 @@ public:
|
|||
void restore_backup_statement(Statement *stmt, Statement *backup);
|
||||
/* return class type */
|
||||
virtual Type type() const;
|
||||
|
||||
/*
|
||||
Cleanup statement parse state (parse tree, lex) after execution of
|
||||
a non-prepared SQL statement.
|
||||
*/
|
||||
void end_statement();
|
||||
};
|
||||
|
||||
|
||||
|
@ -684,24 +695,6 @@ public:
|
|||
struct rand_struct rand; // used for authentication
|
||||
struct system_variables variables; // Changeable local variables
|
||||
pthread_mutex_t LOCK_delete; // Locked before thd is deleted
|
||||
/*
|
||||
Note that (A) if we set query = NULL, we must at the same time set
|
||||
query_length = 0, and protect the whole operation with the
|
||||
LOCK_thread_count mutex. And (B) we are ONLY allowed to set query to a
|
||||
non-NULL value if its previous value is NULL. We do not need to protect
|
||||
operation (B) with any mutex. To avoid crashes in races, if we do not
|
||||
know that thd->query cannot change at the moment, one should print
|
||||
thd->query like this:
|
||||
(1) reserve the LOCK_thread_count mutex;
|
||||
(2) check if thd->query is NULL;
|
||||
(3) if not NULL, then print at most thd->query_length characters from
|
||||
it. We will see the query_length field as either 0, or the right value
|
||||
for it.
|
||||
Assuming that the write and read of an n-bit memory field in an n-bit
|
||||
computer is atomic, we can avoid races in the above way.
|
||||
This printing is needed at least in SHOW PROCESSLIST and SHOW INNODB
|
||||
STATUS.
|
||||
*/
|
||||
/* all prepared statements and cursors of this connection */
|
||||
Statement_map stmt_map;
|
||||
/*
|
||||
|
@ -1064,6 +1057,12 @@ public:
|
|||
void nocheck_register_item_tree_change(Item **place, Item *old_value,
|
||||
MEM_ROOT *runtime_memroot);
|
||||
void rollback_item_tree_changes();
|
||||
|
||||
/*
|
||||
Cleanup statement parse state (parse tree, lex) and execution
|
||||
state after execution of a non-prepared SQL statement.
|
||||
*/
|
||||
void end_statement();
|
||||
};
|
||||
|
||||
/* Flags for the THD::system_thread (bitmap) variable */
|
||||
|
|
|
@ -261,8 +261,6 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables)
|
|||
{
|
||||
TABLE_LIST *hash_tables;
|
||||
TABLE **table_ptr;
|
||||
bool was_flushed= FALSE;
|
||||
bool not_opened;
|
||||
DBUG_ENTER("mysql_ha_close");
|
||||
DBUG_PRINT("enter",("'%s'.'%s' as '%s'",
|
||||
tables->db, tables->real_name, tables->alias));
|
||||
|
@ -366,7 +364,6 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
|||
uint num_rows;
|
||||
byte *key;
|
||||
uint key_len;
|
||||
bool was_flushed;
|
||||
DBUG_ENTER("mysql_ha_read");
|
||||
DBUG_PRINT("enter",("'%s'.'%s' as '%s'",
|
||||
tables->db, tables->real_name, tables->alias));
|
||||
|
@ -624,10 +621,8 @@ err0:
|
|||
|
||||
int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags)
|
||||
{
|
||||
TABLE_LIST **tmp_tables_p;
|
||||
TABLE_LIST *tmp_tables;
|
||||
TABLE **table_ptr;
|
||||
bool was_flushed;
|
||||
DBUG_ENTER("mysql_ha_flush");
|
||||
DBUG_PRINT("enter", ("tables: %p mode_flags: 0x%02x", tables, mode_flags));
|
||||
|
||||
|
@ -703,14 +698,13 @@ static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags)
|
|||
{
|
||||
TABLE_LIST *hash_tables;
|
||||
TABLE *table= *table_ptr;
|
||||
bool was_flushed;
|
||||
DBUG_ENTER("mysql_ha_flush_table");
|
||||
DBUG_PRINT("enter",("'%s'.'%s' as '%s' flags: 0x%02x",
|
||||
table->table_cache_key, table->real_name,
|
||||
table->table_name, mode_flags));
|
||||
|
||||
if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash,
|
||||
(*table_ptr)->table_name,
|
||||
(byte*) (*table_ptr)->table_name,
|
||||
strlen((*table_ptr)->table_name) + 1)))
|
||||
{
|
||||
if (! (mode_flags & MYSQL_HA_REOPEN_ON_USAGE))
|
||||
|
|
|
@ -117,7 +117,30 @@ void lex_free(void)
|
|||
void lex_start(THD *thd, uchar *buf,uint length)
|
||||
{
|
||||
LEX *lex= thd->lex;
|
||||
lex->unit.init_query();
|
||||
lex->unit.init_select();
|
||||
lex->thd= thd;
|
||||
lex->unit.thd= thd;
|
||||
lex->select_lex.init_query();
|
||||
lex->value_list.empty();
|
||||
lex->param_list.empty();
|
||||
lex->unit.next= lex->unit.master=
|
||||
lex->unit.link_next= lex->unit.return_to= 0;
|
||||
lex->unit.prev= lex->unit.link_prev= 0;
|
||||
lex->unit.slave= lex->unit.global_parameters= lex->current_select=
|
||||
lex->all_selects_list= &lex->select_lex;
|
||||
lex->select_lex.master= &lex->unit;
|
||||
lex->select_lex.prev= &lex->unit.slave;
|
||||
lex->select_lex.link_next= lex->select_lex.slave= lex->select_lex.next= 0;
|
||||
lex->select_lex.link_prev= (st_select_lex_node**)&(lex->all_selects_list);
|
||||
lex->select_lex.options= 0;
|
||||
lex->describe= 0;
|
||||
lex->derived_tables= FALSE;
|
||||
lex->lock_option= TL_READ;
|
||||
lex->found_colon= 0;
|
||||
lex->safe_to_cache_query= 1;
|
||||
lex->time_zone_tables_used= 0;
|
||||
lex->select_lex.select_number= 1;
|
||||
lex->next_state=MY_LEX_START;
|
||||
lex->end_of_query=(lex->ptr=buf)+length;
|
||||
lex->yylineno = 1;
|
||||
|
|
|
@ -369,7 +369,7 @@ public:
|
|||
ulong init_prepare_fake_select_lex(THD *thd);
|
||||
int change_result(select_subselect *result, select_subselect *old_result);
|
||||
|
||||
friend void mysql_init_query(THD *thd, uchar *buf, uint length);
|
||||
friend void lex_start(THD *thd, uchar *buf, uint length);
|
||||
friend int subselect_union_engine::exec();
|
||||
private:
|
||||
bool create_total_list_n_last_return(THD *thd, st_lex *lex,
|
||||
|
@ -508,7 +508,7 @@ public:
|
|||
|
||||
bool test_limit();
|
||||
|
||||
friend void mysql_init_query(THD *thd, uchar *buf, uint length);
|
||||
friend void lex_start(THD *thd, uchar *buf, uint length);
|
||||
st_select_lex() {}
|
||||
void make_empty_select()
|
||||
{
|
||||
|
|
|
@ -1001,16 +1001,15 @@ pthread_handler_decl(handle_one_connection,arg)
|
|||
net->compress=1; // Use compression
|
||||
|
||||
thd->version= refresh_version;
|
||||
thd->proc_info= 0;
|
||||
thd->set_time();
|
||||
thd->init_for_queries();
|
||||
if (sys_init_connect.value_length && !(thd->master_access & SUPER_ACL))
|
||||
{
|
||||
execute_init_command(thd, &sys_init_connect, &LOCK_sys_init_connect);
|
||||
if (thd->query_error)
|
||||
thd->killed= 1;
|
||||
}
|
||||
|
||||
thd->proc_info=0;
|
||||
thd->set_time();
|
||||
thd->init_for_queries();
|
||||
while (!net->error && net->vio != 0 && !thd->killed)
|
||||
{
|
||||
if (do_command(thd))
|
||||
|
@ -3854,7 +3853,6 @@ bool my_yyoverflow(short **yyss, YYSTYPE **yyvs, ulong *yystacksize)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
Initialize global thd variables needed for query
|
||||
****************************************************************************/
|
||||
|
@ -3863,33 +3861,31 @@ void
|
|||
mysql_init_query(THD *thd, uchar *buf, uint length)
|
||||
{
|
||||
DBUG_ENTER("mysql_init_query");
|
||||
LEX *lex= thd->lex;
|
||||
lex->unit.init_query();
|
||||
lex->unit.init_select();
|
||||
lex->unit.thd= thd;
|
||||
lex->select_lex.init_query();
|
||||
lex->value_list.empty();
|
||||
lex->param_list.empty();
|
||||
lex->unit.next= lex->unit.master=
|
||||
lex->unit.link_next= lex->unit.return_to=0;
|
||||
lex->unit.prev= lex->unit.link_prev= 0;
|
||||
lex->unit.slave= lex->unit.global_parameters= lex->current_select=
|
||||
lex->all_selects_list= &lex->select_lex;
|
||||
lex->select_lex.master= &lex->unit;
|
||||
lex->select_lex.prev= &lex->unit.slave;
|
||||
lex->select_lex.link_next= lex->select_lex.slave= lex->select_lex.next= 0;
|
||||
lex->select_lex.link_prev= (st_select_lex_node**)&(lex->all_selects_list);
|
||||
lex->select_lex.options=0;
|
||||
lex->describe= 0;
|
||||
lex->derived_tables= FALSE;
|
||||
lex->lock_option= TL_READ;
|
||||
lex->found_colon= 0;
|
||||
lex->safe_to_cache_query= 1;
|
||||
lex->time_zone_tables_used= 0;
|
||||
lex_start(thd, buf, length);
|
||||
thd->select_number= lex->select_lex.select_number= 1;
|
||||
mysql_reset_thd_for_next_command(thd);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Reset THD part responsible for command processing state.
|
||||
|
||||
DESCRIPTION
|
||||
This needs to be called before execution of every statement
|
||||
(prepared or conventional).
|
||||
|
||||
TODO
|
||||
Make it a method of THD and align its name with the rest of
|
||||
reset/end/start/init methods.
|
||||
Call it after we use THD for queries, not before.
|
||||
*/
|
||||
|
||||
void mysql_reset_thd_for_next_command(THD *thd)
|
||||
{
|
||||
DBUG_ENTER("mysql_reset_thd_for_next_command");
|
||||
thd->free_list= 0;
|
||||
thd->total_warn_count=0; // Warnings for this query
|
||||
thd->select_number= 1;
|
||||
thd->total_warn_count= 0; // Warnings for this query
|
||||
thd->last_insert_id_used= thd->query_start_used= thd->insert_id_used=0;
|
||||
thd->sent_row_count= thd->examined_row_count= 0;
|
||||
thd->is_fatal_error= thd->rand_used= thd->time_zone_used= 0;
|
||||
|
|
|
@ -1760,6 +1760,8 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
DBUG_ASSERT(thd->free_list == NULL);
|
||||
mysql_reset_thd_for_next_command(thd);
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
if (stmt->param_count)
|
||||
{
|
||||
|
@ -1778,7 +1780,6 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
|
|||
if (stmt->param_count && stmt->set_params_data(stmt, &expanded_query))
|
||||
goto set_params_data_err;
|
||||
#endif
|
||||
DBUG_ASSERT(thd->free_list == NULL);
|
||||
thd->protocol= &thd->protocol_prep; // Switch to binary protocol
|
||||
execute_stmt(thd, stmt, &expanded_query, true);
|
||||
thd->protocol= &thd->protocol_simple; // Use normal protocol
|
||||
|
@ -1823,7 +1824,8 @@ void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name)
|
|||
}
|
||||
|
||||
DBUG_ASSERT(thd->free_list == NULL);
|
||||
|
||||
/* Must go before setting variables, as it clears thd->user_var_events */
|
||||
mysql_reset_thd_for_next_command(thd);
|
||||
thd->set_n_backup_statement(stmt, &thd->stmt_backup);
|
||||
if (stmt->set_params_from_vars(stmt,
|
||||
thd->stmt_backup.lex->prepared_stmt_params,
|
||||
|
@ -1932,6 +1934,7 @@ void mysql_stmt_reset(THD *thd, char *packet)
|
|||
*/
|
||||
reset_stmt_params(stmt);
|
||||
|
||||
mysql_reset_thd_for_next_command(thd);
|
||||
send_ok(thd);
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
|
|
|
@ -499,6 +499,10 @@ my_bool my_like_range_mb(CHARSET_INFO *cs,
|
|||
{
|
||||
char buf[10];
|
||||
uint buflen;
|
||||
uint charlen= my_charpos(cs, min_org, min_str, res_length/cs->mbmaxlen);
|
||||
|
||||
if (charlen < (uint) (min_str - min_org))
|
||||
min_str= min_org + charlen;
|
||||
|
||||
/* Write min key */
|
||||
*min_length= (uint) (min_str - min_org);
|
||||
|
|
|
@ -2059,7 +2059,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
|
|||
my_strnncoll_utf8,
|
||||
my_strnncollsp_utf8,
|
||||
my_strnxfrm_utf8,
|
||||
my_like_range_simple,
|
||||
my_like_range_mb,
|
||||
my_wildcmp_mb,
|
||||
my_strcasecmp_utf8,
|
||||
my_instr_mb,
|
||||
|
@ -2119,7 +2119,7 @@ CHARSET_INFO my_charset_utf8_general_ci=
|
|||
1, /* mbminlen */
|
||||
3, /* mbmaxlen */
|
||||
0, /* min_sort_char */
|
||||
255, /* max_sort_char */
|
||||
0xFFFF, /* max_sort_char */
|
||||
&my_charset_utf8_handler,
|
||||
&my_collation_ci_handler
|
||||
};
|
||||
|
|
1076
tests/client_test.c
1076
tests/client_test.c
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue