Commit 1cd13590 authored by joreland@mysql.com's avatar joreland@mysql.com

Merge mysql.com:/home/jonas/src/mysql-5.0

into mysql.com:/home/jonas/src/mysql-5.0-ndb
parents 40d91361 5c4da6aa
......@@ -2,12 +2,6 @@ cflags="$c_warnings $extra_flags"
cxxflags="$cxx_warnings $base_cxxflags $extra_flags"
extra_configs="$extra_configs $local_infile_configs"
configure="./configure $base_configs $extra_configs"
for arg
do
# Escape special characters so they don't confuse eval
configure="$configure "`echo "$arg" | \
sed -e 's,\([^a-zA-Z0-9_.=-]\),\\\\\1,g'`
done
commands="\
$make -k distclean || true
......
......@@ -19,8 +19,23 @@ if test -r /proc/cpuinfo ; then
if test -z "$model_name" ; then
model_name=`uname -m`
fi
else
# Fallback when there is no /proc/cpuinfo
case "`uname -s`" in
FreeBSD)
cpu_family=`uname -m`;
model_name=`sysctl -b hw.model`
;;
*)
cpu_family=`uname -m`;
model_name="unknown";
;;
esac
fi
cpu_flag=""
cpu_flag_old=""
case "$cpu_family--$model_name" in
Alpha*EV6*)
cpu_flag="ev6";
......@@ -28,11 +43,21 @@ case "$cpu_family--$model_name" in
*Xeon*)
cpu_flag="nocona";
;;
*Pentium*4*Mobile*CPU*)
cpu_flag="pentium4m";
;;
*Pentium*4*CPU*)
cpu_flag="pentium4";
;;
*Pentium*III*Mobile*CPU*)
cpu_flag="pentium3m";
;;
*Pentium*III*CPU*)
cpu_flag="pentium3";
;;
*Athlon*64*)
cpu_flag="athlon64";
cpu_flag_old="athlon";
;;
*Athlon*)
cpu_flag="athlon";
......@@ -72,6 +97,10 @@ case "$cc_ver--$cc_verno" in
check_cpu_cflags="-mtune=$cpu_flag -march=$cpu_flag"
;;
*GCC*)
# Fix for older compiler versions
if test -n "$cpu_flag_old"; then
cpu_flag="$cpu_flag_old"
fi
check_cpu_cflags="-mcpu=$cpu_flag -march=$cpu_flag"
;;
*)
......
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
c_warnings=""
cxx_warnings=""
fast_cflags="-O3"
base_cxxflags="-fno-handle-exceptions"
# FIXME do we need to link static, not to depend on CodeWarrior libs?
if [ x$MODE = x ] ; then
echo "You need to give an argument, 'standard', 'max', 'debug' or 'debug-max'"
echo "Like: MODE=standard BUILD/compile-darwin-codewarrior"
exit 1
else
case $MODE in
standard|pro-gpl)
# FIXME pro/pro-gpl different libedit/readline
extra_flags="$ppc_cflags $fast_cflags"
;;
pro)
# FIXME pro/pro-gpl different libedit/readline
extra_flags="$ppc_cflags $fast_cflags"
extra_configs="--with-libedit"
;;
max)
extra_flags="$ppc_cflags $fast_cflags"
extra_configs="$max_configs"
;;
debug)
extra_flags="$ppc_cflags $debug_cflags"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$debug_configs"
;;
debug-max)
extra_flags="$ppc_cflags $debug_cflags $max_cflags"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$debug_configs $max_configs"
;;
*)
echo "You need to give an argument, 'standard', 'max', 'debug' or 'debug-max'"
echo "Like: MODE=standard BUILD/compile-darwin-codewarrior"
exit 1
;;
esac
fi
extra_configs="$extra_configs --with-darwin-mwcc"
. "$path/FINISH.sh"
......@@ -18,12 +18,17 @@ autoconf
# Default to gcc for CC and CXX
if test -z "$CXX" ; then
export CXX=gcc
# Set some required compile options
if test -z "$CXXFLAGS" ; then
export CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti"
fi
fi
if test -z "$CC" ; then
export CC=gcc
fi
# Use ccache, if available
if ccache -V > /dev/null 2>&1
then
......
......@@ -15,6 +15,7 @@ ahlentz@co3064164-a.rochd1.qld.optusnet.com.au
akishkin@work.mysql.com
anjuta@arthur.local
antony@ltantony.dsl-verizon.net
antony@ltantony.mysql.com
antony@ltantony.rdg.cyberkinetica.com
antony@ltantony.rdg.cyberkinetica.homeunix.net
arjen@bitbike.com
......@@ -82,6 +83,7 @@ hf@bisonxp.(none)
hf@deer.(none)
hf@deer.mysql.r18.ru
hf@genie.(none)
holyfoot@mysql.com
igor@hundin.mysql.fi
igor@linux.local
igor@rurik.mysql.com
......@@ -96,6 +98,7 @@ jani@dsl-jkl1657.dial.inet.fi
jani@dsl-kpogw4gb5.dial.inet.fi
jani@hynda.(none)
jani@hynda.mysql.fi
jani@ibmlab.site
jani@janikt.pp.saunalahti.fi
jani@linux.local
jani@rhols221.adsl.netsonic.fi
......@@ -112,6 +115,7 @@ jcole@sarvik.tfr.cafe.ee
jcole@tetra.spaceapes.com
jimw@mysql.com
joerg@mysql.com
joerg@trift-lap.fambruehe
jon@gigan.
jonas@mysql.com
joreland@bk-internal.mysql.com
......@@ -177,6 +181,7 @@ mwagner@cash.mwagner.org
mwagner@evoq.mwagner.org
mwagner@here.mwagner.org
mwagner@mysql.com
mwagner@ultrafly.mysql.com
mwagner@work.mysql.com
mydev@mysql.com
mysql@home.(none)
......@@ -219,9 +224,11 @@ ram@deer.(none)
ram@gw.mysql.r18.ru
ram@gw.udmsearch.izhnet.ru
ram@mysql.r18.ru
ram@ram-book.(none)
ram@ram.(none)
ramil@mysql.com
ranger@regul.home.lan
rburnett@bk-internal.mysql.com
rburnett@build.mysql.com
reggie@bob.(none)
reggie@mdk10.(none)
......@@ -242,6 +249,7 @@ serg@serg.mysql.com
serg@sergbook.mylan
serg@sergbook.mysql.com
sergefp@mysql.com
shuichi@mysql.com
sinisa@rhols221.adsl.netsonic.fi
stewart@mysql.com
svoj@mysql.com
......
......@@ -45,9 +45,9 @@ enum options_client
OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH,
OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS,
OPT_START_POSITION, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME,
OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY
OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY, OPT_COUNT,
#ifdef HAVE_NDBCLUSTER_DB
,OPT_NDBCLUSTER,OPT_NDB_CONNECTSTRING
OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING,
#endif
,OPT_IGNORE_TABLE
OPT_IGNORE_TABLE,OPT_INSERT_IGNORE
};
......@@ -710,9 +710,15 @@ static void usage(int version)
const char* readline= "readline";
#endif
#ifdef HAVE_READLINE
printf("%s Ver %s Distrib %s, for %s (%s) using %s %s\n",
my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE,
readline, rl_library_version);
#else
printf("%s Ver %s Distrib %s, for %s (%s)", my_progname, VER,
MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
#endif
if (version)
return;
printf("\
......@@ -956,7 +962,8 @@ static int read_lines(bool execute_commands)
}
else
{
char *prompt= (char*) (glob_buffer.is_empty() ? construct_prompt() :
char *prompt= (char*) (ml_comment ? " /*> " :
glob_buffer.is_empty() ? construct_prompt() :
!in_string ? " -> " :
in_string == '\'' ?
" '> " : (in_string == '`' ?
......@@ -1093,6 +1100,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
uchar inchar;
char buff[80], *pos, *out;
COMMANDS *com;
bool need_space= 0;
if (!line[0] && buffer.is_empty())
return 0;
......@@ -1201,6 +1209,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
{
pos++;
*ml_comment= 0;
need_space= 1;
}
else
{ // Add found char to buffer
......@@ -1210,7 +1219,14 @@ static bool add_line(String &buffer,char *line,char *in_string,
(inchar == '\'' || inchar == '"' || inchar == '`'))
*in_string= (char) inchar;
if (!*ml_comment)
{
if (need_space && !my_isspace(charset_info, (char)inchar))
{
*out++= ' ';
need_space= 0;
}
*out++= (char) inchar;
}
}
}
if (out != line || !buffer.is_empty())
......
......@@ -83,7 +83,7 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick= 1, extended_insert= 1,
opt_autocommit=0,opt_disable_keys=1,opt_xml=0,
opt_delete_master_logs=0, tty_password=0,
opt_single_transaction=0, opt_comments= 0, opt_compact= 0,
opt_hex_blob=0, opt_order_by_primary=0;
opt_hex_blob=0, opt_order_by_primary=0, opt_ignore=0;
static ulong opt_max_allowed_packet, opt_net_buffer_length;
static MYSQL mysql_connection,*sock=0;
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
......@@ -257,6 +257,9 @@ static struct my_option my_long_options[] =
"use the directive multiple times, once for each table. Each table must "
"be specified with both database and table names, e.g. --ignore-table=database.table",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"insert-ignore", OPT_INSERT_IGNORE, "Insert rows with INSERT IGNORE.",
(gptr*) &opt_ignore, (gptr*) &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...",
(gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
......@@ -1100,13 +1103,15 @@ static uint get_table_structure(char *table, char *db)
my_bool init=0;
uint numFields;
char *strpos, *result_table, *opt_quoted_table;
const char *delayed;
const char *insert_option;
char name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3];
char table_buff2[NAME_LEN*2+3];
FILE *sql_file = md_result_file;
DBUG_ENTER("get_table_structure");
delayed= opt_delayed ? " DELAYED " : "";
insert_option= (opt_delayed && opt_ignore) ? " DELAYED IGNORE " :
opt_delayed ? " DELAYED " :
opt_ignore ? " IGNORE " : "";
if (verbose)
fprintf(stderr, "-- Retrieving table structure for table %s...\n", table);
......@@ -1190,11 +1195,11 @@ static uint get_table_structure(char *table, char *db)
if (cFlag)
my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s (",
delayed, opt_quoted_table);
insert_option, opt_quoted_table);
else
{
my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s VALUES ",
delayed, opt_quoted_table);
insert_option, opt_quoted_table);
if (!extended_insert)
strcat(insert_pat,"(");
}
......@@ -1258,11 +1263,11 @@ static uint get_table_structure(char *table, char *db)
}
if (cFlag)
my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s (",
delayed, result_table);
insert_option, result_table);
else
{
my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s VALUES ",
delayed, result_table);
insert_option, result_table);
if (!extended_insert)
strcat(insert_pat,"(");
}
......
......@@ -28,7 +28,7 @@
#include <sslopt-vars.h>
static my_string host=0,opt_password=0,user=0;
static my_bool opt_show_keys= 0, opt_compress= 0, opt_status= 0,
static my_bool opt_show_keys= 0, opt_compress= 0, opt_count=0, opt_status= 0,
tty_password= 0, opt_table_type= 0;
static uint opt_verbose=0;
static char *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
......@@ -71,8 +71,7 @@ int main(int argc, char **argv)
char *pos= argv[argc-1], *to;
for (to= pos ; *pos ; pos++, to++)
{
switch (*pos)
{
switch (*pos) {
case '*':
*pos= '%';
first_argument_uses_wildcards= 1;
......@@ -163,6 +162,10 @@ static struct my_option my_long_options[] =
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"count", OPT_COUNT,
"Show number of rows per table (may be slow for not MyISAM tables)",
(gptr*) &opt_count, (gptr*) &opt_count, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
......@@ -308,6 +311,14 @@ get_options(int *argc,char ***argv)
if (tty_password)
opt_password=get_tty_password(NullS);
if (opt_count)
{
/*
We need to set verbose to 2 as we need to change the output to include
the number-of-rows column
*/
opt_verbose= 2;
}
return;
}
......@@ -322,7 +333,7 @@ list_dbs(MYSQL *mysql,const char *wild)
char query[255];
MYSQL_FIELD *field;
MYSQL_RES *result;
MYSQL_ROW row, trow, rrow;
MYSQL_ROW row, rrow;
if (!(result=mysql_list_dbs(mysql,wild)))
{
......@@ -352,11 +363,6 @@ list_dbs(MYSQL *mysql,const char *wild)
if (opt_verbose)
{
/*
* Original code by MG16373; Slightly modified by Monty.
* Print now the count of tables and rows for each database.
*/
if (!(mysql_select_db(mysql,row[0])))
{
MYSQL_RES *tresult = mysql_list_tables(mysql,(char*)NULL);
......@@ -366,6 +372,8 @@ list_dbs(MYSQL *mysql,const char *wild)
rowcount = 0;
if (opt_verbose > 1)
{
/* Print the count of tables and rows for each database */
MYSQL_ROW trow;
while ((trow = mysql_fetch_row(tresult)))
{
sprintf(query,"SELECT COUNT(*) FROM `%s`",trow[0]);
......@@ -487,10 +495,6 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
while ((row = mysql_fetch_row(result)))
{
/*
* Modified by MG16373
* Print now the count of rows for each table.
*/
counter++;
if (opt_verbose > 0)
{
......@@ -510,6 +514,7 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
if (opt_verbose > 1)
{
/* Print the count of rows for each table */
sprintf(query,"SELECT COUNT(*) FROM `%s`",row[0]);
if (!(mysql_query(mysql,query)))
{
......@@ -574,7 +579,7 @@ list_table_status(MYSQL *mysql,const char *db,const char *wild)
MYSQL_RES *result;
MYSQL_ROW row;
end=strxmov(query,"show table status from ",db,NullS);
end=strxmov(query,"show table status from `",db,"`",NullS);
if (wild && wild[0])
strxmov(end," like '",wild,"'",NullS);
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
......@@ -600,8 +605,8 @@ list_table_status(MYSQL *mysql,const char *db,const char *wild)
}
/*
** list fields uses field interface as an example of how to parse
** a MYSQL FIELD
list fields uses field interface as an example of how to parse
a MYSQL FIELD
*/
static int
......@@ -612,6 +617,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
MYSQL_RES *result;
MYSQL_ROW row;
ulong rows;
LINT_INIT(rows);
if (mysql_select_db(mysql,db))
{
......@@ -619,16 +625,20 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
mysql_error(mysql));
return 1;
}
sprintf(query,"select count(*) from `%s`", table);
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
if (opt_count)
{
fprintf(stderr,"%s: Cannot get record count for db: %s, table: %s: %s\n",
my_progname,db,table,mysql_error(mysql));
return 1;
sprintf(query,"select count(*) from `%s`", table);
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
{
fprintf(stderr,"%s: Cannot get record count for db: %s, table: %s: %s\n",
my_progname,db,table,mysql_error(mysql));
return 1;
}
row= mysql_fetch_row(result);
rows= (ulong) strtoull(row[0], (char**) 0, 10);
mysql_free_result(result);
}
row = mysql_fetch_row(result);
rows = (ulong) strtoull(row[0], (char**) 0, 10);
mysql_free_result(result);
end=strmov(strmov(strmov(query,"show /*!32332 FULL */ columns from `"),table),"`");
if (wild && wild[0])
......@@ -640,8 +650,9 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
return 1;
}
printf("Database: %s Table: %s Rows: %lu", db, table, rows);
printf("Database: %s Table: %s", db, table);
if (opt_count)
printf(" Rows: %lu", rows);
if (wild && wild[0])
printf(" Wildcard: %s",wild);
putchar('\n');
......@@ -675,7 +686,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
/*****************************************************************************
** General functions to print a nice ascii-table from data
General functions to print a nice ascii-table from data
*****************************************************************************/
static void
......
......@@ -24,7 +24,7 @@ pkginclude_HEADERS = readline/readline.h
noinst_HEADERS = chared.h el.h el_term.h histedit.h key.h parse.h refresh.h sig.h \
sys.h tokenizer.h config.h hist.h map.h prompt.h read.h \
search.h tty.h libedit_term.h
search.h tty.h libedit_term.h vis.h
EXTRA_DIST = makelist.sh np/unvis.c np/strlcpy.c np/vis.c np/vis.h np/strlcat.c np/fgetln.c
......
......@@ -2,8 +2,10 @@
#include "my_config.h"
#include "sys.h"
#if defined(LIBC_SCCS) && !defined(lint)
#define __RCSID(x)
#define __COPYRIGHT(x)
#endif
#define __RENAME(x)
#define _DIAGASSERT(x)
......
......@@ -346,7 +346,7 @@ get_term_capabilities (bp)
register unsigned int i;
for (i = 0; i < NUM_TC_STRINGS; i++)
# ifdef __LCC__
# if defined(__LCC__) || defined(__MWERKS__)
*(tc_strings[i].tc_value) = tgetstr ((char *)tc_strings[i].tc_var, bp);
# else
*(tc_strings[i].tc_value) = tgetstr (tc_strings[i].tc_var, bp);
......
......@@ -693,3 +693,20 @@ dnl ---------------------------------------------------------------------------
dnl END OF MYSQL_CHECK_BIG_TABLES SECTION
dnl ---------------------------------------------------------------------------
dnl MYSQL_NEEDS_MYSYS_NEW
AC_DEFUN([MYSQL_NEEDS_MYSYS_NEW],
[AC_CACHE_CHECK([needs mysys_new helpers], mysql_use_mysys_new,
[
AC_LANG_PUSH(C++)
AC_TRY_LINK([], [
class A { public: int b; }; A *a=new A; a->b=10; delete a;
], mysql_use_mysys_new=no, mysql_use_mysys_new=yes)
AC_LANG_POP(C++)
])
if test "$mysql_use_mysys_new" = "yes"
then
AC_DEFINE([USE_MYSYS_NEW], [1], [Needs to use mysys_new helpers])
fi
])
......@@ -123,8 +123,25 @@ AM_SANITY_CHECK
# This is needed is SUBDIRS is set
AC_PROG_MAKE_SET
# This is need before AC_PROG_CC
#
##############################################################################
# The below section needs to be done before AC_PROG_CC
##############################################################################
# Hack for OS X/Darwin and Metrowerks CodeWarrior
AC_ARG_WITH(darwin-mwcc,
[ --with-darwin-mwcc Use Metrowerks CodeWarrior wrappers on OS X/Darwin],[
builddir=`pwd`
ccwrapper="$builddir/support-files/MacOSX/mwcc-wrapper"
arwrapper="$builddir/support-files/MacOSX/mwar-wrapper"
CC="$ccwrapper"
CXX="$ccwrapper"
LD="$ccwrapper"
AR="$arwrapper"
RANLIB=:
export CC CXX LD AR RANLIB
AC_SUBST(AR)
AC_SUBST(RANLIB)
])
if test "x${CFLAGS-}" = x ; then
cflags_is_set=no
......@@ -144,6 +161,8 @@ else
ldflags_is_set=yes
fi
################ End of section to be done before AC_PROG_CC #################
# The following hack should ensure that configure doesn't add optimizing
# or debugging flags to CFLAGS or CXXFLAGS
# C_EXTRA_FLAGS are flags that are automaticly added to both
......@@ -336,32 +355,6 @@ AC_SUBST(LD)
AC_SUBST(INSTALL_SCRIPT)
export CC CXX CFLAGS LD LDFLAGS AR
if test "$GXX" = "yes"
then
# mysqld requires -fno-implicit-templates.
# Disable exceptions as they seams to create problems with gcc and threads.
# mysqld doesn't use run-time-type-checking, so we disable it.
CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti"
CXX_VERNO=`echo $CXX_VERSION | sed -e 's/[[^0-9. ]]//g; s/^ *//g; s/ .*//g'`
case "$CXX_VERNO" in
3.*)
USE_MYSYS_NEW="-DUSE_MYSYS_NEW" # yassl needs it
if echo $CXX | grep gcc > /dev/null 2>&1
then
# If you are using 'gcc' 3.0 (not g++) to compile C++ programs on Linux,
# we will gets some problems when linking static programs.
# The following code is used to fix this problem.
CXXFLAGS="$CXXFLAGS $USE_MYSYS_NEW"
AC_MSG_WARN([Using MYSYS_NEW for static linking with gcc])
fi
;;
*)
USE_MYSYS_NEW=""
;;
esac
AC_SUBST(USE_MYSYS_NEW)
fi
# Avoid bug in fcntl on some versions of linux
AC_MSG_CHECKING("if we should use 'skip-locking' as default for $target_os")
......@@ -1730,6 +1723,7 @@ AC_TYPE_OFF_T
AC_STRUCT_ST_RDEV
AC_HEADER_TIME
AC_STRUCT_TM
MYSQL_NEEDS_MYSYS_NEW
# AC_CHECK_SIZEOF return 0 when it does not find the size of a
# type. We want a error instead.
AC_CHECK_SIZEOF(char, 1)
......
......@@ -122,6 +122,7 @@ public:
friend sslFactory& GetSSL_Factory(); // singleton creator
private:
static sslFactory instance;
sslFactory(const sslFactory&); // hide copy
sslFactory& operator=(const sslFactory&); // and assign
};
......@@ -208,6 +209,7 @@ public:
private:
Sessions(const Sessions&); // hide copy
Sessions& operator=(const Sessions&); // and assign
static Sessions instance;
};
......
......@@ -5,4 +5,3 @@ libyassl_a_SOURCES = buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp \
handshake.cpp lock.cpp log.cpp socket_wrapper.cpp ssl.cpp \
timer.cpp yassl_imp.cpp yassl_error.cpp yassl_int.cpp
EXTRA_DIST = ../include/*.hpp ../include/openssl/*.h
AM_CXXFLAGS=@USE_MYSYS_NEW@
......@@ -2092,6 +2092,7 @@ void InitClientKeyFactory(ClientKeyFactory& ckf)
} // namespace
#ifdef __GNUC__
namespace mySTL {
template class mySTL::list<unsigned char*>;
template yaSSL::del_ptr_zero mySTL::for_each(mySTL::list<unsigned char*>::iterator, mySTL::list<unsigned char*>::iterator, yaSSL::del_ptr_zero);
template mySTL::pair<int, yaSSL::Message* (*)()>* mySTL::uninit_copy<mySTL::pair<int, yaSSL::Message* (*)()>*, mySTL::pair<int, yaSSL::Message* (*)()>*>(mySTL::pair<int, yaSSL::Message* (*)()>*, mySTL::pair<int, yaSSL::Message* (*)()>*, mySTL::pair<int, yaSSL::Message* (*)()>*);
......@@ -2112,5 +2113,6 @@ template yaSSL::del_ptr_zero mySTL::for_each<mySTL::list<yaSSL::SSL_SESSION*>::i
template yaSSL::del_ptr_zero mySTL::for_each<mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::input_buffer*>::iterator, mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::del_ptr_zero);
template yaSSL::del_ptr_zero mySTL::for_each<mySTL::list<yaSSL::output_buffer*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::output_buffer*>::iterator, mySTL::list<yaSSL::output_buffer*>::iterator, yaSSL::del_ptr_zero);
template yaSSL::del_ptr_zero mySTL::for_each<mySTL::list<yaSSL::x509*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::x509*>::iterator, mySTL::list<yaSSL::x509*>::iterator, yaSSL::del_ptr_zero);
}
#endif
......@@ -1346,17 +1346,18 @@ SSL_SESSION::~SSL_SESSION()
}
Sessions Sessions::instance; // simple singleton
Sessions& GetSessions()
{
static Sessions instance; // simple singleton
return instance;
return Sessions::instance;
}
sslFactory sslFactory::instance;
sslFactory& GetSSL_Factory()
{
static sslFactory instance; // simple singleton
return instance;
return sslFactory::instance;
}
......@@ -1951,7 +1952,7 @@ char* X509_NAME::GetName()
X509::X509(const char* i, size_t iSz, const char* s, size_t sSz)
: issuer_(i, iSz), subject_(s, sSz)
{}
X509_NAME* X509::GetIssuer()
{
......@@ -1967,7 +1968,9 @@ X509_NAME* X509::GetSubject()
} // namespace
#ifdef __GNUC__
namespace mySTL {
template yaSSL::yassl_int_cpp_local1::SumData mySTL::for_each<mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::yassl_int_cpp_local1::SumData>(mySTL::list<yaSSL::input_buffer*>::iterator, mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::yassl_int_cpp_local1::SumData);
template yaSSL::yassl_int_cpp_local1::SumBuffer mySTL::for_each<mySTL::list<yaSSL::output_buffer*>::iterator, yaSSL::yassl_int_cpp_local1::SumBuffer>(mySTL::list<yaSSL::output_buffer*>::iterator, mySTL::list<yaSSL::output_buffer*>::iterator, yaSSL::yassl_int_cpp_local1::SumBuffer);
template mySTL::list<yaSSL::SSL_SESSION*>::iterator mySTL::find_if<mySTL::list<yaSSL::SSL_SESSION*>::iterator, yaSSL::yassl_int_cpp_local2::sess_match>(mySTL::list<yaSSL::SSL_SESSION*>::iterator, mySTL::list<yaSSL::SSL_SESSION*>::iterator, yaSSL::yassl_int_cpp_local2::sess_match);
}
#endif
......@@ -258,6 +258,10 @@ private:
Integer(word value, unsigned int length);
static const Integer zero;
static const Integer one;
static const Integer two;
int PositiveCompare(const Integer& t) const;
friend void PositiveAdd(Integer& sum, const Integer& a, const Integer& b);
friend void PositiveSubtract(Integer& diff, const Integer& a,
......
......@@ -25,10 +25,11 @@
#if !defined(yaSSL_NEW_HPP) && defined(USE_MYSYS_NEW)
#if !defined(yaSSL_NEW_HPP) && defined(__GNUC__)
#define yaSSL_NEW_HPP
#if __GNUC__ > 2
#include <cstdlib>
......@@ -66,4 +67,6 @@ static int __cxa_pure_virtual()
} // extern "C"
#endif // yaSSL_NEW_HPP
#endif // __GNUC__ > 2
#endif // yaSSL_NEW_HPP && __GNUC__
......@@ -5,4 +5,3 @@ libtaocrypt_a_SOURCES = aes.cpp aestables.cpp algebra.cpp arc4.cpp asn.cpp \
coding.cpp dh.cpp des.cpp dsa.cpp file.cpp hash.cpp integer.cpp \
md2.cpp md5.cpp misc.cpp random.cpp ripemd.cpp rsa.cpp sha.cpp
EXTRA_DIST = ../include/*.hpp
AM_CXXFLAGS=@USE_MYSYS_NEW@
......@@ -2844,23 +2844,24 @@ unsigned int Integer::Encode(byte* output, unsigned int outputLen,
}
const Integer Integer::zero(1,2);
const Integer &Integer::Zero()
{
static const Integer zero;
return zero;
}
const Integer Integer::one(1,2);
const Integer &Integer::One()
{
static const Integer one(1,2);
return one;
}
const Integer Integer::two(1,2);
const Integer &Integer::Two()
{
static const Integer two(2,2);
return two;
}
......@@ -4168,16 +4169,13 @@ Integer CRT(const Integer &xp, const Integer &p, const Integer &xq,
return p * (u * (xq-xp) % q) + xp;
}
} // namespace
#ifdef __GNUC__
template TaoCrypt::Integer TaoCrypt::StringToInteger<char>(char const*);
template TaoCrypt::Integer TaoCrypt::StringToInteger<wchar_t>(wchar_t const*);
template class TaoCrypt::EuclideanDomainOf<TaoCrypt::Integer>;
template class TaoCrypt::AbstractEuclideanDomain<TaoCrypt::Integer>;
template unsigned int TaoCrypt::DivideThreeWordsByTwo<unsigned int, TaoCrypt::DWord>(unsigned int*, unsigned int, unsigned int, TaoCrypt::DWord*);
template Integer StringToInteger<char>(char const*);
template Integer StringToInteger<wchar_t>(wchar_t const*);
template class EuclideanDomainOf<Integer>;
template class AbstractEuclideanDomain<Integer>;
template unsigned int DivideThreeWordsByTwo<unsigned int, DWord>(unsigned int*, unsigned int, unsigned int, DWord*);
#endif
} // namespace
......@@ -211,24 +211,28 @@ word32 SSL_Decrypt(const RSA_PublicKey& key, const byte* sig, byte* plain)
lengths.PaddedBlockBitLength(), plain);
}
#ifdef __GNUC__
template AllocatorWithCleanup<unsigned char>::pointer StdReallocate<unsigned char, AllocatorWithCleanup<unsigned char> >(AllocatorWithCleanup<unsigned char>&, unsigned char*, AllocatorWithCleanup<unsigned char>::size_type, AllocatorWithCleanup<unsigned char>::size_type, bool);
template AllocatorWithCleanup<unsigned int>::pointer StdReallocate<unsigned int, AllocatorWithCleanup<unsigned int> >(AllocatorWithCleanup<unsigned int>&, unsigned int*, AllocatorWithCleanup<unsigned int>::size_type, AllocatorWithCleanup<unsigned int>::size_type, bool);
template class AbstractGroup<Integer>;
template class AbstractRing<Integer>;
template class RSA_Decryptor<RSA_BlockType2>;
template class RSA_Encryptor<RSA_BlockType1>;
template class RSA_Encryptor<RSA_BlockType2>;
#endif
} // namespace
#ifdef __GNUC__
template TaoCrypt::AllocatorWithCleanup<unsigned char>::pointer TaoCrypt::StdReallocate<unsigned char, TaoCrypt::AllocatorWithCleanup<unsigned char> >(TaoCrypt::AllocatorWithCleanup<unsigned char>&, unsigned char*, TaoCrypt::AllocatorWithCleanup<unsigned char>::size_type, TaoCrypt::AllocatorWithCleanup<unsigned char>::size_type, bool);
template TaoCrypt::AllocatorWithCleanup<unsigned int>::pointer TaoCrypt::StdReallocate<unsigned int, TaoCrypt::AllocatorWithCleanup<unsigned int> >(TaoCrypt::AllocatorWithCleanup<unsigned int>&, unsigned int*, TaoCrypt::AllocatorWithCleanup<unsigned int>::size_type, TaoCrypt::AllocatorWithCleanup<unsigned int>::size_type, bool);
template TaoCrypt::Integer* mySTL::uninit_copy<TaoCrypt::Integer*, TaoCrypt::Integer*>(TaoCrypt::Integer*, TaoCrypt::Integer*, TaoCrypt::Integer*);
template TaoCrypt::Integer* mySTL::uninit_fill_n<TaoCrypt::Integer*, unsigned int, TaoCrypt::Integer>(TaoCrypt::Integer*, unsigned int, TaoCrypt::Integer const&);
template TaoCrypt::WindowSlider* mySTL::uninit_copy<TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*>(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*);
template class TaoCrypt::AbstractGroup<TaoCrypt::Integer>;
template class TaoCrypt::AbstractRing<TaoCrypt::Integer>;
template class TaoCrypt::RSA_Decryptor<TaoCrypt::RSA_BlockType2>;
template class TaoCrypt::RSA_Encryptor<TaoCrypt::RSA_BlockType1>;
template class TaoCrypt::RSA_Encryptor<TaoCrypt::RSA_BlockType2>;
template mySTL::vector<TaoCrypt::Integer>* mySTL::uninit_fill_n<mySTL::vector<TaoCrypt::Integer>*, unsigned int, mySTL::vector<TaoCrypt::Integer> >(mySTL::vector<TaoCrypt::Integer>*, unsigned int, mySTL::vector<TaoCrypt::Integer> const&);
template void mySTL::destroy<TaoCrypt::Integer*>(TaoCrypt::Integer*, TaoCrypt::Integer*);
template void mySTL::destroy<TaoCrypt::WindowSlider*>(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*);
template void mySTL::destroy<mySTL::vector<TaoCrypt::Integer>*>(mySTL::vector<TaoCrypt::Integer>*, mySTL::vector<TaoCrypt::Integer>*);
namespace mySTL {
template TaoCrypt::Integer* uninit_copy<TaoCrypt::Integer*, TaoCrypt::Integer*>(TaoCrypt::Integer*, TaoCrypt::Integer*, TaoCrypt::Integer*);
template TaoCrypt::Integer* uninit_fill_n<TaoCrypt::Integer*, unsigned int, TaoCrypt::Integer>(TaoCrypt::Integer*, unsigned int, TaoCrypt::Integer const&);
template TaoCrypt::WindowSlider* uninit_copy<TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*>(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*);
template vector<TaoCrypt::Integer>* uninit_fill_n<vector<TaoCrypt::Integer>*, unsigned int, vector<TaoCrypt::Integer> >(vector<TaoCrypt::Integer>*, unsigned int, vector<TaoCrypt::Integer> const&);
template void destroy<TaoCrypt::Integer*>(TaoCrypt::Integer*, TaoCrypt::Integer*);
template void destroy<TaoCrypt::WindowSlider*>(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*);
template void destroy<vector<TaoCrypt::Integer>*>(vector<TaoCrypt::Integer>*, vector<TaoCrypt::Integer>*);
}
#endif
......@@ -635,13 +635,12 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
key+= 2; /* skip key pack length */
if (cs->mbmaxlen > 1)
{
uint char_length= seg->length / cs->mbmaxlen;
char_length_key= my_charpos(cs, key, key + char_length_key,
char_length);
set_if_smaller(char_length_key, seg->length);
char_length_rec= my_charpos(cs, pos, pos + char_length_rec,
char_length);
set_if_smaller(char_length_rec, seg->length);
uint char_length1, char_length2;
char_length1= char_length2= seg->length / cs->mbmaxlen;
char_length1= my_charpos(cs, key, key + char_length_key, char_length1);
set_if_smaller(char_length_key, char_length1);
char_length2= my_charpos(cs, pos, pos + char_length_rec, char_length2);
set_if_smaller(char_length_rec, char_length2);
}
if (cs->coll->strnncollsp(seg->charset,
......
......@@ -39,7 +39,7 @@ int decimal2longlong(decimal_t *from, longlong *to);
int longlong2decimal(longlong from, decimal_t *to);
int decimal2double(decimal_t *from, double *to);
int double2decimal(double from, decimal_t *to);
void decimal_optimize_fraction(decimal_t *from);
int decimal_actual_fraction(decimal_t *from);
int decimal2bin(decimal_t *from, char *to, int precision, int scale);
int bin2decimal(char *from, decimal_t *to, int precision, int scale);
......
......@@ -132,6 +132,7 @@ typedef struct my_collation_handler_st
/* Hash calculation */
void (*hash_sort)(struct charset_info_st *cs, const uchar *key, uint len,
ulong *nr1, ulong *nr2);
my_bool (*propagate)(struct charset_info_st *cs, const uchar *str, uint len);
} MY_COLLATION_HANDLER;
extern MY_COLLATION_HANDLER my_collation_mb_bin_handler;
......@@ -385,6 +386,10 @@ int my_wildcmp_unicode(CHARSET_INFO *cs,
extern my_bool my_parse_charset_xml(const char *bug, uint len,
int (*add)(CHARSET_INFO *cs));
my_bool my_propagate_simple(CHARSET_INFO *cs, const uchar *str, uint len);
my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, uint len);
#define _MY_U 01 /* Upper case */
#define _MY_L 02 /* Lower case */
#define _MY_NMR 04 /* Numeral (digit) */
......
......@@ -43,6 +43,11 @@
#define HAVE_ERRNO_AS_DEFINE
#endif /* __CYGWIN__ */
/* Determine when to use "#pragma interface" */
#if !defined(__CYGWIN__) && !defined(__ICC) && defined(__GNUC__) && (__GNUC__ < 3)
#define USE_PRAGMA_INTERFACE
#endif
#if defined(i386) && !defined(__i386__)
#define __i386__
#endif
......@@ -235,18 +240,6 @@ C_MODE_END
#define BAD_MEMCPY
#endif
/* In Linux-alpha we have atomic.h if we are using gcc */
#if defined(TARGET_OS_LINUX) && defined(__GNUC__) && defined(__alpha__) && (__GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95)) && !defined(HAVE_ATOMIC_ADD)
#define HAVE_ATOMIC_ADD
#define HAVE_ATOMIC_SUB
#endif
/* In Linux-ia64 including atomic.h will give us an error */
#if (defined(TARGET_OS_LINUX) && defined(__GNUC__) && (defined(__ia64__)||defined(__powerpc64__))) || !defined(THREAD)
#undef HAVE_ATOMIC_ADD
#undef HAVE_ATOMIC_SUB
#endif
#if defined(_lint) && !defined(lint)
#define lint
#endif
......
......@@ -72,10 +72,11 @@ typedef struct st_HA_KEYSEG /* Key-portion */
#define set_rec_bits(bits, bit_ptr, bit_ofs, bit_len) \
{ \
(bit_ptr)[0]= ((bit_ptr)[0] & ((1 << (bit_ofs)) - 1)) | \
(bit_ptr)[0]= ((bit_ptr)[0] & ~(((1 << (bit_len)) - 1) << (bit_ofs))) | \
((bits) << (bit_ofs)); \
if ((bit_ofs) + (bit_len) > 8) \
(bit_ptr)[1]= ((bits) & ((1 << (bit_len)) - 1)) >> (8 - (bit_ofs)); \
(bit_ptr)[1]= ((bit_ptr)[1] & ~((1 << ((bit_len) - 8 + (bit_ofs))) - 1)) | \
((bits) >> (8 - (bit_ofs))); \
}
#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
......
......@@ -179,6 +179,10 @@ extern void my_large_free(gptr ptr, myf my_flags);
#if defined(_AIX) && !defined(__GNUC__) && !defined(_AIX43)
#pragma alloca
#endif /* _AIX */
#if defined(__MWERKS__)
#undef alloca
#define alloca __alloca
#endif /* __MWERKS__ */
#if defined(__GNUC__) && !defined(HAVE_ALLOCA_H) && ! defined(alloca)
#define alloca __builtin_alloca
#endif /* GNUC */
......
......@@ -89,7 +89,7 @@ extern "C" {
#ifdef __cplusplus
}
#ifdef __GNUC__
#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
......
......@@ -87,7 +87,7 @@ my_bool vio_peer_addr(Vio* vio, char *buf, uint16 *port);
/* Remotes in_addr */
void vio_in_addr(Vio *vio, struct in_addr *in);
my_bool vio_poll_read(Vio *vio,uint timeout);
void vio_timeout(Vio *vio,uint timeout);
void vio_timeout(Vio *vio,uint which, uint timeout);
#ifdef HAVE_OPENSSL
#include <openssl/opensslv.h>
......@@ -156,7 +156,7 @@ int vio_close_shared_memory(Vio * vio);
#define vio_close(vio) ((vio)->vioclose)(vio)
#define vio_peer_addr(vio, buf, prt) (vio)->peer_addr(vio, buf, prt)
#define vio_in_addr(vio, in) (vio)->in_addr(vio, in)
#define vio_timeout(vio, seconds) (vio)->timeout(vio, seconds)
#define vio_timeout(vio, which, seconds) (vio)->timeout(vio, which, seconds)
#endif /* !defined(DONT_MAP_VIO) */
/* This enumerator is used in parser - should be always visible */
......@@ -199,7 +199,7 @@ struct st_vio
void (*in_addr)(Vio*, struct in_addr*);
my_bool (*should_retry)(Vio*);
int (*vioclose)(Vio*);
void (*timeout)(Vio*, unsigned int timeout);
void (*timeout)(Vio*, unsigned int which, unsigned int timeout);
void *ssl_arg;
#ifdef HAVE_SMEM
HANDLE handle_file_map;
......
......@@ -565,8 +565,15 @@ lock_rec_print(
Prints info of locks for all transactions. */
void
lock_print_info(
/*============*/
lock_print_info_summary(
/*====================*/
FILE* file); /* in: file where to print */
/*************************************************************************
Prints info of locks for each transaction. */
void
lock_print_info_all_transactions(
/*=============================*/
FILE* file); /* in: file where to print */
/*************************************************************************
Validates the lock queue on a table. */
......
......@@ -466,8 +466,13 @@ Outputs to a file the output of the InnoDB Monitor. */
void
srv_printf_innodb_monitor(
/*======================*/
FILE* file); /* in: output stream */
/************************************************************************
FILE* file, /* in: output stream */
ulint* trx_start, /* out: file position of the start of
the list of active transactions */
ulint* trx_end); /* out: file position of the end of
the list of active transactions */
/**********************************************************************
Function to pass InnoDB status variables to MySQL */
void
......
......@@ -4226,21 +4226,10 @@ lock_get_n_rec_locks(void)
Prints info of locks for all transactions. */
void
lock_print_info(
/*============*/
lock_print_info_summary(
/*====================*/
FILE* file) /* in: file where to print */
{
lock_t* lock;
trx_t* trx;
ulint space;
ulint page_no;
page_t* page;
ibool load_page_first = TRUE;
ulint nth_trx = 0;
ulint nth_lock = 0;
ulint i;
mtr_t mtr;
/* We must protect the MySQL thd->query field with a MySQL mutex, and
because the MySQL mutex must be reserved before the kernel_mutex of
InnoDB, we call innobase_mysql_prepare_print_arbitrary_thd() here. */
......@@ -4279,6 +4268,26 @@ lock_print_info(
fprintf(file,
"Total number of lock structs in row lock hash table %lu\n",
(ulong) lock_get_n_rec_locks());
}
/*************************************************************************
Prints info of locks for each transaction. */
void
lock_print_info_all_transactions(
/*=============================*/
FILE* file) /* in: file where to print */
{
lock_t* lock;
ulint space;
ulint page_no;
page_t* page;
ibool load_page_first = TRUE;
ulint nth_trx = 0;
ulint nth_lock = 0;
ulint i;
mtr_t mtr;
trx_t* trx;
fprintf(file, "LIST OF TRANSACTIONS FOR EACH SESSION:\n");
......
......@@ -1602,7 +1602,11 @@ Outputs to a file the output of the InnoDB Monitor. */
void
srv_printf_innodb_monitor(
/*======================*/
FILE* file) /* in: output stream */
FILE* file, /* in: output stream */
ulint* trx_start, /* out: file position of the start of
the list of active transactions */
ulint* trx_end) /* out: file position of the end of
the list of active transactions */
{
double time_elapsed;
time_t current_time;
......@@ -1651,7 +1655,24 @@ srv_printf_innodb_monitor(
mutex_exit(&dict_foreign_err_mutex);
lock_print_info(file);
lock_print_info_summary(file);
if (trx_start) {
long t = ftell(file);
if (t < 0) {
*trx_start = ULINT_UNDEFINED;
} else {
*trx_start = (ulint) t;
}
}
lock_print_info_all_transactions(file);
if (trx_end) {
long t = ftell(file);
if (t < 0) {
*trx_end = ULINT_UNDEFINED;
} else {
*trx_end = (ulint) t;
}
}
fputs("--------\n"
"FILE I/O\n"
"--------\n", file);
......@@ -1865,13 +1886,13 @@ srv_lock_timeout_and_monitor_thread(
last_monitor_time = time(NULL);
if (srv_print_innodb_monitor) {
srv_printf_innodb_monitor(stderr);
srv_printf_innodb_monitor(stderr, NULL, NULL);
}
if (srv_innodb_status) {
mutex_enter(&srv_monitor_file_mutex);
rewind(srv_monitor_file);
srv_printf_innodb_monitor(srv_monitor_file);
srv_printf_innodb_monitor(srv_monitor_file, NULL, NULL);
os_file_set_eof(srv_monitor_file);
mutex_exit(&srv_monitor_file_mutex);
}
......
......@@ -149,3 +149,6 @@ EXPORTS
mysql_server_init
mysql_server_end
get_defaults_files
get_charset_by_csname
get_charsets_dir
charsets_dir
......@@ -199,6 +199,14 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
unix_socket=0;
db_name = db ? my_strdup(db,MYF(MY_WME)) : NULL;
/* Send client information for access check */
client_flag|=CLIENT_CAPABILITIES;
if (client_flag & CLIENT_MULTI_STATEMENTS)
client_flag|= CLIENT_MULTI_RESULTS;
client_flag&= ~CLIENT_COMPRESS;
if (db)
client_flag|=CLIENT_CONNECT_WITH_DB;
mysql->thd= create_embedded_thd(client_flag, db_name);
init_embedded_mysql(mysql, client_flag, db_name);
......@@ -209,11 +217,6 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if (mysql_init_charset(mysql))
goto error;
/* Send client information for access check */
client_flag|=CLIENT_CAPABILITIES;
client_flag&= ~CLIENT_COMPRESS;
if (db)
client_flag|=CLIENT_CONNECT_WITH_DB;
mysql->server_status= SERVER_STATUS_AUTOCOMMIT;
if (mysql->options.init_commands)
......
......@@ -1187,6 +1187,7 @@ start_master()
--language=$LANGUAGE \
--innodb_data_file_path=ibdata1:128M:autoextend \
--open-files-limit=1024 \
--log-bin-trust-routine-creators \
$MASTER_40_ARGS \
$SMALL_SERVER \
$EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT \
......@@ -1207,6 +1208,7 @@ start_master()
--tmpdir=$MYSQL_TMP_DIR \
--language=$LANGUAGE \
--innodb_data_file_path=ibdata1:128M:autoextend \
--log-bin-trust-routine-creators \
$MASTER_40_ARGS \
$SMALL_SERVER \
$EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT \
......@@ -1339,6 +1341,7 @@ start_slave()
--report-port=$slave_port \
--master-retry-count=10 \
-O slave_net_timeout=10 \
--log-bin-trust-routine-creators \
$SMALL_SERVER \
$EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT"
CUR_MYERR=$slave_err
......
......@@ -105,8 +105,8 @@ a
select * from t3;
a
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 # Start 1 # Server ver: VERSION, Binlog ver: 3
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000001 # Query 1 # use `test`; drop table t1,t2
master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole
master-bin.000001 # Query 1 # use `test`; delete from t1 where a=10
......@@ -115,8 +115,8 @@ master-bin.000001 # Query 1 # use `test`; insert into t1 values(1)
master-bin.000001 # Query 1 # use `test`; insert ignore into t1 values(1)
master-bin.000001 # Query 1 # use `test`; replace into t1 values(100)
master-bin.000001 # Query 1 # use `test`; create table t2 (a varchar(200)) engine=blackhole
master-bin.000001 # Create_file 1 # db=test;table=t2;file_id=1;block_len=581
master-bin.000001 # Exec_load 1 # ;file_id=1
master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../../std_data/words.dat' into table t2 ;file_id=1
master-bin.000001 # Query 1 # use `test`; alter table t1 add b int
master-bin.000001 # Query 1 # use `test`; alter table t1 drop b
master-bin.000001 # Query 1 # use `test`; create table t3 like t1
......
......@@ -105,9 +105,9 @@ t1 CREATE TABLE `t1` (
`c4` varbinary(1) NOT NULL default '',
`c5` varbinary(4) NOT NULL default '',
`c6` varbinary(4) NOT NULL default '',
`c7` decimal(5,1) NOT NULL default '0.0',
`c8` decimal(5,1) NOT NULL default '0.0',
`c9` decimal(5,1) default NULL,
`c7` decimal(2,1) NOT NULL default '0.0',
`c8` decimal(2,1) NOT NULL default '0.0',
`c9` decimal(2,1) default NULL,
`c10` double NOT NULL default '0',
`c11` double NOT NULL default '0',
`c12` varbinary(5) NOT NULL default ''
......@@ -152,9 +152,9 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`COALESCE(1)` int(1) NOT NULL default '0',
`COALESCE(1.0)` decimal(5,1) NOT NULL default '0.0',
`COALESCE(1.0)` decimal(2,1) NOT NULL default '0.0',
`COALESCE('a')` varchar(1) NOT NULL default '',
`COALESCE(1,1.0)` decimal(5,1) NOT NULL default '0.0',
`COALESCE(1,1.0)` decimal(2,1) NOT NULL default '0.0',
`COALESCE(1,'1')` varbinary(1) NOT NULL default '',
`COALESCE(1.1,'1')` varbinary(4) NOT NULL default '',
`COALESCE('a' COLLATE latin1_bin,'b')` varchar(1) character set latin1 collate latin1_bin NOT NULL default ''
......
......@@ -5,3 +5,12 @@ insert into t1 values (200000);
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
Create table t1(f1 int);
Create table t2(f1 int);
Create view v1 as Select * from t1;
Check Table v1,t2;
Table Op Msg_type Msg_text
test.v1 check status OK
test.t2 check status OK
drop view v1;
drop table t1, t2;
......@@ -115,9 +115,9 @@ Field Type Null Key Default Extra
a datetime NO 0000-00-00 00:00:00
b time NO 00:00:00
c date NO 0000-00-00
d int(2) NO 0
e decimal(6,1) NO 0.0
f bigint(18) NO 0
d int(3) NO 0
e decimal(3,1) NO 0.0
f bigint(19) NO 0
drop table t2;
create table t2 select CAST("2001-12-29" AS DATE) as d, CAST("20:45:11" AS TIME) as t, CAST("2001-12-29 20:45:11" AS DATETIME) as dt;
describe t2;
......@@ -429,7 +429,7 @@ explain t2;
Field Type Null Key Default Extra
a int(11) YES NULL
b bigint(11) NO 0
c bigint(10) NO 0
c bigint(11) NO 0
d date YES NULL
e varchar(1) NO
f datetime YES NULL
......@@ -448,12 +448,12 @@ Table Create Table
t2 CREATE TABLE `t2` (
`ifnull(a,a)` tinyint(4) default NULL,
`ifnull(b,b)` smallint(6) default NULL,
`ifnull(c,c)` mediumint(9) default NULL,
`ifnull(c,c)` mediumint(8) default NULL,
`ifnull(d,d)` int(11) default NULL,
`ifnull(e,e)` bigint(20) default NULL,
`ifnull(f,f)` float(3,2) default NULL,
`ifnull(g,g)` double(4,3) default NULL,
`ifnull(h,h)` decimal(6,4) default NULL,
`ifnull(f,f)` float(24,2) default NULL,
`ifnull(g,g)` double(53,3) default NULL,
`ifnull(h,h)` decimal(5,4) default NULL,
`ifnull(i,i)` year(4) default NULL,
`ifnull(j,j)` date default NULL,
`ifnull(k,k)` datetime NOT NULL default '0000-00-00 00:00:00',
......@@ -568,3 +568,14 @@ NULL 1
Test 0
NULL 1
drop table t1, t2, t3;
create table t1 (b bool not null default false);
create table t2 (b bool not null default true);
insert into t1 values ();
insert into t2 values ();
select * from t1;
b
0
select * from t2;
b
1
drop table t1,t2;
......@@ -338,3 +338,9 @@ ss
ss
DROP TABLE t1;
create table t1 (s1 char(5) character set latin1 collate latin1_german2_ci);
insert into t1 values (0xf6) /* this is o-umlaut */;
select * from t1 where length(s1)=1 and s1='oe';
s1
drop table t1;
drop table if exists t1;
SET NAMES latin2;
CREATE TABLE t1 (a char(1) character set latin2);
INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27);
INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37);
INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47);
INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57);
INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67);
INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77);
INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87);
INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F);
INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97);
INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F);
INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7);
INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF);
INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7);
INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF);
INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7);
INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF);
INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7);
INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF);
INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7);
INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF);
INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7);
INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF);
SELECT hex(a) ha, hex(lower(a)) hl, hex(upper(a)) hu,
a, lower(a) l, upper(a) u from t1 order by ha;
ha hl hu a l u
21 21 21 ! ! !
22 22 22 " " "
23 23 23 # # #
24 24 24 $ $ $
25 25 25 % % %
26 26 26 & & &
27 27 27 ' ' '
28 28 28 ( ( (
29 29 29 ) ) )
2A 2A 2A * * *
2B 2B 2B + + +
2C 2C 2C , , ,
2D 2D 2D - - -
2E 2E 2E . . .
2F 2F 2F / / /
30 30 30 0 0 0
31 31 31 1 1 1
32 32 32 2 2 2
33 33 33 3 3 3
34 34 34 4 4 4
35 35 35 5 5 5
36 36 36 6 6 6
37 37 37 7 7 7
38 38 38 8 8 8
39 39 39 9 9 9
3A 3A 3A : : :
3B 3B 3B ; ; ;
3C 3C 3C < < <
3D 3D 3D = = =
3E 3E 3E > > >
3F 3F 3F ? ? ?
40 40 40 @ @ @
41 61 41 A a A
42 62 42 B b B
43 63 43 C c C
44 64 44 D d D
45 65 45 E e E
46 66 46 F f F
47 67 47 G g G
48 68 48 H h H
49 69 49 I i I
4A 6A 4A J j J
4B 6B 4B K k K
4C 6C 4C L l L
4D 6D 4D M m M
4E 6E 4E N n N
4F 6F 4F O o O
50 70 50 P p P
51 71 51 Q q Q
52 72 52 R r R
53 73 53 S s S
54 74 54 T t T
55 75 55 U u U
56 76 56 V v V
57 77 57 W w W
58 78 58 X x X
59 79 59 Y y Y
5A 7A 5A Z z Z
5B 5B 5B [ [ [
5C 5C 5C \ \ \
5D 5D 5D ] ] ]
5E 5E 5E ^ ^ ^
5F 5F 5F _ _ _
60 60 60 ` ` `
61 61 41 a a A
62 62 42 b b B
63 63 43 c c C
64 64 44 d d D
65 65 45 e e E
66 66 46 f f F
67 67 47 g g G
68 68 48 h h H
69 69 49 i i I
6A 6A 4A j j J
6B 6B 4B k k K
6C 6C 4C l l L
6D 6D 4D m m M
6E 6E 4E n n N
6F 6F 4F o o O
70 70 50 p p P
71 71 51 q q Q
72 72 52 r r R
73 73 53 s s S
74 74 54 t t T
75 75 55 u u U
76 76 56 v v V
77 77 57 w w W
78 78 58 x x X
79 79 59 y y Y
7A 7A 5A z z Z
7B 7B 7B { { {
7C 7C 7C | | |
7D 7D 7D } } }
7E 7E 7E ~ ~ ~
7F 7F 7F   
80 80 80
81 81 81
82 82 82
83 83 83
84 84 84
85 85 85
86 86 86
87 87 87
88 88 88
89 89 89
8A 8A 8A
8B 8B 8B
8C 8C 8C
8D 8D 8D
8E 8E 8E
8F 8F 8F
90 90 90
91 91 91
92 92 92
93 93 93
94 94 94
95 95 95
96 96 96
97 97 97
98 98 98
99 99 99
9A 9A 9A
9B 9B 9B
9C 9C 9C
9D 9D 9D
9E 9E 9E
9F 9F 9F
A0 A0 A0
A1 B1 A1
A2 A2 A2
A3 B3 A3
A4 A4 A4
A5 B5 A5
A6 B6 A6
A7 A7 A7
A8 A8 A8
A9 B9 A9
AA BA AA
AB BB AB
AC BC AC
AD AD AD
AE BE AE
AF BF AF
B0 B0 B0
B1 B1 A1
B2 B2 B2
B3 B3 A3
B4 B4 B4
B5 B5 A5
B6 B6 A6
B7 B7 B7
B8 B8 B8
B9 B9 A9
BA BA AA
BB BB AB
BC BC AC
BD BD BD
BE BE AE
BF BF AF
C0 E0 C0
C1 E1 C1
C2 E2 C2
C3 E3 C3
C4 E4 C4
C5 E5 C5
C6 E6 C6
C7 E7 C7
C8 E8 C8
C9 E9 C9
CA EA CA
CB EB CB
CC EC CC
CD ED CD
CE EE CE
CF EF CF
D0 F0 D0
D1 F1 D1
D2 F2 D2
D3 F3 D3
D4 F4 D4
D5 F5 D5
D6 F6 D6
D7 D7 D7
D8 F8 D8
D9 F9 D9
DA FA DA
DB FB DB
DC FC DC
DD FD DD
DE FE DE
DF DF DF
E0 E0 C0
E1 E1 C1
E2 E2 C2
E3 E3 C3
E4 E4 C4
E5 E5 C5
E6 E6 C6
E7 E7 C7
E8 E8 C8
E9 E9 C9
EA EA CA
EB EB CB
EC EC CC
ED ED CD
EE EE CE
EF EF CF
F0 F0 D0
F1 F1 D1
F2 F2 D2
F3 F3 D3
F4 F4 D4
F5 F5 D5
F6 F6 D6
F7 F7 F7
F8 F8 D8
F9 F9 D9
FA FA DA
FB FB DB
FC FC DC
FD FD DD
FE FE DE
FF FF FF
SELECT group_concat(a collate latin2_croatian_ci order by binary a) from t1 group by a collate latin2_croatian_ci;
group_concat(a collate latin2_croatian_ci order by binary a)
!
"
#
$
%
&
'
(
)
*
+
,
-
.
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
@
A,a,,,,,,,,,,
B,b
C,c,,
,
,
D,d,,
,
E,e,,,,,,,,
F,f
G,g
H,h
I,i,,,,
J,j
K,k
L,l,,,,,,
M,m
N,n,,,,
O,o,,,,,,,,
P,p
Q,q
R,r,,,,
S,s,,,,,
,
T,t,,,,
U,u,,,,,,,,
V,v
W,w
X,x
Y,y,,
Z,z,,,,
,
[
\
]
^
_
`
{
|
}
~

drop table t1;
......@@ -462,5 +462,5 @@ rout int(11) default '0'
INSERT INTO t1 VALUES ('1',1,0);
SELECT DISTINCT html,SUM(rout)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
html prod
1 0.00000
1 0.0000
drop table t1;
drop table if exists t1,t2;
set @sav_dpi= @@div_precision_increment;
set div_precision_increment= 5;
show variables like 'div_precision_increment';
Variable_name Value
div_precision_increment 5
create table t1 (grp int, a bigint unsigned, c char(10) not null);
insert into t1 values (1,1,"a");
insert into t1 values (2,2,"b");
......@@ -44,13 +49,13 @@ count(distinct a) count(distinct grp)
6 3
select sum(all a),count(all a),avg(all a),std(all a),variance(all a),bit_or(all a),bit_and(all a),min(all a),max(all a),min(all c),max(all c) from t1;
sum(all a) count(all a) avg(all a) std(all a) variance(all a) bit_or(all a) bit_and(all a) min(all a) max(all a) min(all c) max(all c)
21 6 3.5000 1.7078 2.9167 7 0 1 6 E
21 6 3.50000 1.70783 2.91667 7 0 1 6 E
select grp, sum(a),count(a),avg(a),std(a),variance(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1 group by grp;
grp sum(a) count(a) avg(a) std(a) variance(a) bit_or(a) bit_and(a) min(a) max(a) min(c) max(c)
NULL NULL 0 NULL NULL NULL 0 18446744073709551615 NULL NULL
1 1 1 1.0000 0.0000 0.0000 1 1 1 1 a a
2 5 2 2.5000 0.5000 0.2500 3 2 2 3 b c
3 15 3 5.0000 0.8165 0.6667 7 4 4 6 C E
1 1 1 1.00000 0.00000 0.00000 1 1 1 1 a a
2 5 2 2.50000 0.50000 0.25000 3 2 2 3 b c
3 15 3 5.00000 0.81650 0.66667 7 4 4 6 C E
select grp, sum(a)+count(a)+avg(a)+std(a)+variance(a)+bit_or(a)+bit_and(a)+min(a)+max(a)+min(c)+max(c) as sum from t1 group by grp;
grp sum
NULL NULL
......@@ -74,12 +79,12 @@ CREATE TABLE t2 (id int(11),name char(20));
INSERT INTO t2 VALUES (1,'Set One'),(2,'Set Two');
select id, avg(value1), std(value1), variance(value1) from t1 group by id;
id avg(value1) std(value1) variance(value1)
1 1.000000 0.816497 0.666667
2 11.000000 0.816497 0.666667
1 1.0000000 0.816497 0.666667
2 11.0000000 0.816497 0.666667
select name, avg(value1), std(value1), variance(value1) from t1, t2 where t1.id = t2.id group by t1.id;
name avg(value1) std(value1) variance(value1)
Set One 1.000000 0.816497 0.666667
Set Two 11.000000 0.816497 0.666667
Set One 1.0000000 0.816497 0.666667
Set Two 11.0000000 0.816497 0.666667
drop table t1,t2;
create table t1 (id int not null);
create table t2 (id int not null,rating int null);
......@@ -87,19 +92,19 @@ insert into t1 values(1),(2),(3);
insert into t2 values(1, 3),(2, NULL),(2, NULL),(3, 2),(3, NULL);
select t1.id, avg(rating) from t1 left join t2 on ( t1.id = t2.id ) group by t1.id;
id avg(rating)
1 3.0000
1 3.00000
2 NULL
3 2.0000
3 2.00000
select sql_small_result t2.id, avg(rating) from t2 group by t2.id;
id avg(rating)
1 3.0000
1 3.00000
2 NULL
3 2.0000
3 2.00000
select sql_big_result t2.id, avg(rating) from t2 group by t2.id;
id avg(rating)
1 3.0000
1 3.00000
2 NULL
3 2.0000
3 2.00000
select sql_small_result t2.id, avg(rating+0.0e0) from t2 group by t2.id;
id avg(rating+0.0e0)
1 3
......@@ -265,22 +270,22 @@ insert into t1 values (2,1);
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
2 1 1 1.0000 0.0000 1 1 1 1
2 1 1 1.00000 0.00000 1 1 1 1
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
2 1 1 1.0000 0.0000 1 1 1 1
2 1 1 1.00000 0.00000 1 1 1 1
insert into t1 values (3,1);
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
2 1 1 1.0000 0.0000 1 1 1 1
3 1 1 1.0000 0.0000 1 1 1 1
2 1 1 1.00000 0.00000 1 1 1 1
3 1 1 1.00000 0.00000 1 1 1 1
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b) bit_xor(b)
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0 0
2 1 1 1.0000 0.0000 1 1 1 1 1
3 1 1 1.0000 0.0000 1 1 1 1 1
2 1 1 1.00000 0.00000 1 1 1 1 1
3 1 1 1.00000 0.00000 1 1 1 1 1
explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
......@@ -837,10 +842,10 @@ INSERT INTO t1 VALUES (-5.00000000001),(-5.00000000002),(-5.00000000003),(-5.000
insert into t1 select * from t1;
select col1,count(col1),sum(col1),avg(col1) from t1 group by col1;
col1 count(col1) sum(col1) avg(col1)
-5.000000000030 2 -10.000000000060 -5.0000000000300000
-5.000000000020 4 -20.000000000080 -5.0000000000200000
-5.000000000010 4 -20.000000000040 -5.0000000000100000
-5.000000000000 2 -10.000000000000 -5.0000000000000000
-5.000000000030 2 -10.000000000060 -5.00000000003000000
-5.000000000020 4 -20.000000000080 -5.00000000002000000
-5.000000000010 4 -20.000000000040 -5.00000000001000000
-5.000000000000 2 -10.000000000000 -5.00000000000000000
DROP TABLE t1;
create table t1 (col1 decimal(16,12));
insert into t1 values (-5.00000000001);
......@@ -947,3 +952,4 @@ SUM(a)
6
6
DROP TABLE t1;
set div_precision_increment= @sav_dpi;
select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
1+1 1-1 1+1*2 8/5 8%5 mod(8,5) mod(8,5)|0 -(1+1)*-2
2 0 3 1.60000 3 3 3 4
2 0 3 1.6000 3 3 3 4
explain extended select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
......
......@@ -440,12 +440,12 @@ create table t2 (user_id integer not null, date date);
insert into t2 values (1, '2002-06-09'),(2, '2002-06-09'),(1, '2002-06-09'),(3, '2002-06-09'),(4, '2002-06-09'),(4, '2002-06-09');
select u.gender as gender, count(distinct u.id) as dist_count, (count(distinct u.id)/5*100) as percentage from t1 u, t2 l where l.user_id = u.id group by u.gender;
gender dist_count percentage
F 3 60.00000
M 1 20.00000
F 3 60.0000
M 1 20.0000
select u.gender as gender, count(distinct u.id) as dist_count, (count(distinct u.id)/5*100) as percentage from t1 u, t2 l where l.user_id = u.id group by u.gender order by percentage;
gender dist_count percentage
M 1 20.00000
F 3 60.00000
M 1 20.0000
F 3 60.0000
drop table t1,t2;
CREATE TABLE t1 (ID1 int, ID2 int, ID int NOT NULL AUTO_INCREMENT,PRIMARY KEY(ID
));
......
......@@ -1961,3 +1961,10 @@ a varchar(30), b varchar(30), primary key(a), key(b)
select distinct a from t1;
a
drop table t1;
create table t1(a int, key(a)) engine=innodb;
insert into t1 values(1);
select a, count(a) from t1 group by a with rollup;
a count(a)
1 1
NULL 1
drop table t1;
......@@ -3,10 +3,12 @@ Variable_name Value
skip_show_database OFF
grant select, update, execute on test.* to mysqltest_2@localhost;
grant select, update on test.* to mysqltest_1@localhost;
create user mysqltest_3@localhost;
create user mysqltest_3;
select * from information_schema.SCHEMATA where schema_name > 'm';
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME SQL_PATH
NULL mysql latin1 NULL
NULL test latin1 NULL
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
NULL mysql latin1 latin1_swedish_ci NULL
NULL test latin1 latin1_swedish_ci NULL
select schema_name from information_schema.schemata;
schema_name
information_schema
......@@ -154,7 +156,9 @@ NULL mysqltest t1 a 1 NULL YES int NULL NULL 11 0 NULL NULL int(11) select,ins
show columns from mysqltest.t1 where field like "%a%";
Field Type Null Key Default Extra
a int(11) YES NULL
create view mysqltest.v1 (c) as select a from mysqltest.t1;
grant select (a) on mysqltest.t1 to mysqltest_2@localhost;
grant select on mysqltest.v1 to mysqltest_3;
select table_name, column_name, privileges from information_schema.columns
where table_schema = 'mysqltest' and table_name = 't1';
table_name column_name privileges
......@@ -163,7 +167,11 @@ show columns from mysqltest.t1;
Field Type Null Key Default Extra
a int(11) YES NULL
b varchar(30) YES MUL NULL
drop view v1;
select table_name, column_name, privileges from information_schema.columns
where table_schema = 'mysqltest' and table_name = 'v1';
table_name column_name privileges
v1 c select
drop view v1, mysqltest.v1;
drop tables mysqltest.t4, mysqltest.t1, t2, t3;
drop database mysqltest;
select * from information_schema.CHARACTER_SETS
......@@ -376,10 +384,10 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRAN
'mysqltest_1'@'localhost' NULL test t1 a INSERT NO
'mysqltest_1'@'localhost' NULL test t1 a UPDATE NO
'mysqltest_1'@'localhost' NULL test t1 a REFERENCES NO
delete from mysql.user where user='mysqltest_1' or user='mysqltest_2';
delete from mysql.db where user='mysqltest_1' or user='mysqltest_2';
delete from mysql.tables_priv where user='mysqltest_1' or user='mysqltest_2';
delete from mysql.columns_priv where user='mysqltest_1' or user='mysqltest_2';
delete from mysql.user where user like 'mysqltest%';
delete from mysql.db where user like 'mysqltest%';
delete from mysql.tables_priv where user like 'mysqltest%';
delete from mysql.columns_priv where user like 'mysqltest%';
flush privileges;
drop table t1;
create table t1 (a int null, primary key(a));
......@@ -726,3 +734,21 @@ x_real NULL NULL
x_float NULL NULL
x_double_precision NULL NULL
drop table t1;
create user mysqltest_4@localhost;
SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS
where COLUMN_NAME='TABLE_NAME';
TABLE_NAME COLUMN_NAME PRIVILEGES
TABLES TABLE_NAME select
COLUMNS TABLE_NAME select
STATISTICS TABLE_NAME select
VIEWS TABLE_NAME select
TABLE_PRIVILEGES TABLE_NAME select
COLUMN_PRIVILEGES TABLE_NAME select
TABLE_CONSTRAINTS TABLE_NAME select
KEY_COLUMN_USAGE TABLE_NAME select
delete from mysql.user where user='mysqltest_4';
flush privileges;
SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;
table_schema count(*)
information_schema 15
mysql 17
......@@ -2391,3 +2391,9 @@ drop table t1;
set storage_engine=MyISAM;
create table t1 (v varchar(16384)) engine=innodb;
drop table t1;
create table t1(a int(1) , b int(1)) engine=innodb;
insert into t1 values ('1111', '3333');
select distinct concat(a, b) from t1;
concat(a, b)
11113333
drop table t1;
......@@ -167,3 +167,16 @@ a b c VALUES(a)
2 1 11 NULL
DROP TABLE t1;
DROP TABLE t2;
create table t1 (a int not null unique);
insert into t1 values (1),(2);
insert ignore into t1 select 1 on duplicate key update a=2;
select * from t1;
a
1
2
insert ignore into t1 select a from t1 on duplicate key update a=a+1 ;
select * from t1;
a
1
3
drop table t1;
......@@ -2,7 +2,7 @@ drop table if exists t1,t2;
select 1, 1.0, -1, "hello", NULL;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def 1 8 1 1 N 32897 0 63
def 1.0 246 4 3 N 161 1 63
def 1.0 246 4 3 N 129 1 63
def -1 8 2 2 N 32897 0 63
def hello 253 5 5 N 1 31 8
def NULL 6 0 0 Y 32896 0 63
......@@ -18,7 +18,7 @@ def test t1 t1 d d 3 11 0 Y 32768 0 63
def test t1 t1 e e 8 20 0 Y 32768 0 63
def test t1 t1 f f 4 3 0 Y 32768 2 63
def test t1 t1 g g 5 4 0 Y 32768 3 63
def test t1 t1 h h 246 5 0 Y 0 4 63
def test t1 t1 h h 246 7 0 Y 0 4 63
def test t1 t1 i i 13 4 0 Y 32864 0 63
def test t1 t1 j j 10 10 0 Y 128 0 63
def test t1 t1 k k 7 19 0 N 1249 0 63
......
......@@ -631,3 +631,63 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t1 VALUES (4),(5),(6);
/*!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' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
LOCK TABLES `t1` WRITE;
INSERT IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6);
UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!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 */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!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' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!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 */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1;
drop table if exists t1,t2;
set @sav_dpi= @@div_precision_increment;
set div_precision_increment= 5;
show variables like 'div_precision_increment';
Variable_name Value
div_precision_increment 5
create table t1 (product varchar(32), country_id int not null, year int, profit int);
insert into t1 values ( 'Computer', 2,2000, 1200),
( 'TV', 1, 1999, 150),
......@@ -40,11 +45,11 @@ TV 600
NULL 7785
select product, sum(profit),avg(profit) from t1 group by product with rollup;
product sum(profit) avg(profit)
Calculator 275 68.7500
Computer 6900 1380.0000
Phone 10 10.0000
TV 600 120.0000
NULL 7785 519.0000
Calculator 275 68.75000
Computer 6900 1380.00000
Phone 10 10.00000
TV 600 120.00000
NULL 7785 519.00000
select product, country_id , year, sum(profit) from t1 group by product, country_id, year;
product country_id year sum(profit)
Calculator 1 1999 50
......@@ -244,11 +249,11 @@ select product, country_id , year, sum(profit) from t1 group by product, country
product country_id year sum(profit)
select concat(':',product,':'), sum(profit),avg(profit) from t1 group by product with rollup;
concat(':',product,':') sum(profit) avg(profit)
:Calculator: 275 68.7500
:Computer: 6900 1380.0000
:Phone: 10 10.0000
:TV: 600 120.0000
:TV: 7785 519.0000
:Calculator: 275 68.75000
:Computer: 6900 1380.00000
:Phone: 10 10.00000
:TV: 600 120.00000
:TV: 7785 519.00000
select product, country_id , year, sum(profit) from t1 group by product, country_id, year with cube;
ERROR 42000: This version of MySQL doesn't yet support 'CUBE'
explain select product, country_id , year, sum(profit) from t1 group by product, country_id, year with cube;
......@@ -450,3 +455,4 @@ a m
2 2
NULL 3
DROP TABLE t1;
set div_precision_increment= @sav_dpi;
......@@ -595,3 +595,41 @@ c1 c2
200887 860
200887 200887
deallocate prepare stmt;
drop table t1;
create table t1 (
id bigint(20) not null auto_increment,
code varchar(20) character set utf8 collate utf8_bin not null default '',
company_name varchar(250) character set utf8 collate utf8_bin default null,
setup_mode tinyint(4) default null,
start_date datetime default null,
primary key (id), unique key code (code)
);
create table t2 (
id bigint(20) not null auto_increment,
email varchar(250) character set utf8 collate utf8_bin default null,
name varchar(250) character set utf8 collate utf8_bin default null,
t1_id bigint(20) default null,
password varchar(250) character set utf8 collate utf8_bin default null,
primary_contact tinyint(4) not null default '0',
email_opt_in tinyint(4) not null default '1',
primary key (id), unique key email (email), key t1_id (t1_id),
constraint t2_fk1 foreign key (t1_id) references t1 (id)
);
insert into t1 values
(1, 'demo', 'demo s', 0, current_date()),
(2, 'code2', 'name 2', 0, current_date()),
(3, 'code3', 'name 3', 0, current_date());
insert into t2 values
(2, 'email1', 'name1', 3, 'password1', 0, 0),
(3, 'email2', 'name1', 1, 'password2', 1, 0),
(5, 'email3', 'name3', 2, 'password3', 0, 0);
prepare stmt from 'select t2.id from t2, t1 where (t1.id=? and t2.t1_id=t1.id)';
set @a=1;
execute stmt using @a;
id
3
select t2.id from t2, t1 where (t1.id=1 and t2.t1_id=t1.id);
id
3
deallocate prepare stmt;
drop table t1, t2;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create database if not exists mysqltest1;
use mysqltest1;
create table t1 (a varchar(100));
use mysqltest1;
drop procedure if exists foo;
drop procedure if exists foo2;
drop procedure if exists foo3;
drop procedure if exists foo4;
drop procedure if exists bar;
drop function if exists fn1;
create procedure foo()
begin
declare b int;
set b = 8;
insert into t1 values (b);
insert into t1 values (unix_timestamp());
end|
ERROR HY000: This routine is declared to be non-deterministic and to modify data and binary logging is enabled (you *might* want to use the less safe log_bin_trust_routine_creators variable)
show binlog events from 98|
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # create database if not exists mysqltest1
master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a varchar(100))
create procedure foo() deterministic
begin
declare b int;
set b = 8;
insert into t1 values (b);
insert into t1 values (unix_timestamp());
end|
select * from mysql.proc where name='foo' and db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL YES DEFINER begin
declare b int;
set b = 8;
insert into t1 values (b);
insert into t1 values (unix_timestamp());
end root@localhost # #
select * from mysql.proc where name='foo' and db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL YES DEFINER begin
declare b int;
set b = 8;
insert into t1 values (b);
insert into t1 values (unix_timestamp());
end @ # #
set timestamp=1000000000;
call foo();
show binlog events from 308;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `mysqltest1`; create procedure foo() deterministic
begin
declare b int;
set b = 8;
insert into t1 values (b);
insert into t1 values (unix_timestamp());
end
master-bin.000001 # Query 1 # use `mysqltest1`; call foo()
select * from t1;
a
8
1000000000
select * from t1;
a
8
1000000000
delete from t1;
create procedure foo2()
not deterministic
reads sql data
select * from mysqltest1.t1;
call foo2();
a
show binlog events from 605;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1
master-bin.000001 # Query 1 # use `mysqltest1`; create procedure foo2()
not deterministic
reads sql data
select * from mysqltest1.t1
alter procedure foo2 contains sql;
ERROR HY000: This routine is declared to be non-deterministic and to modify data and binary logging is enabled (you *might* want to use the less safe log_bin_trust_routine_creators variable)
drop table t1;
create table t1 (a int);
create table t2 like t1;
create procedure foo3()
deterministic
insert into t1 values (15);
grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1;
grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1;
grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1;
create procedure foo4()
deterministic
insert into t1 values (10);
ERROR HY000: You do not have SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_routine_creators variable)
set global log_bin_trust_routine_creators=1;
create procedure foo4()
deterministic
begin
insert into t2 values(3);
insert into t1 values (5);
end|
call foo4();
Got one of the listed errors
show warnings;
Level Code Message
Warning 1417 A routine failed and is declared to modify data and binary logging is enabled; if non-transactional tables were updated, the binary log will miss their changes
call foo3();
show warnings;
Level Code Message
call foo4();
Got one of the listed errors
show warnings;
Level Code Message
Warning 1417 A routine failed and is declared to modify data and binary logging is enabled; if non-transactional tables were updated, the binary log will miss their changes
alter procedure foo4 sql security invoker;
call foo4();
show warnings;
Level Code Message
show binlog events from 841;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1
master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int)
master-bin.000001 # Query 1 # use `mysqltest1`; create table t2 like t1
master-bin.000001 # Query 1 # use `mysqltest1`; create procedure foo3()
deterministic
insert into t1 values (15)
master-bin.000001 # Query 1 # use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1
master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1
master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1
master-bin.000001 # Query 1 # use `mysqltest1`; create procedure foo4()
deterministic
begin
insert into t2 values(3);
insert into t1 values (5);
end
master-bin.000001 # Query 1 # use `mysqltest1`; call foo3()
master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo4 sql security invoker
master-bin.000001 # Query 1 # use `mysqltest1`; call foo4()
select * from t1;
a
15
5
select * from t2;
a
3
3
3
select * from t1;
a
15
5
select * from t2;
a
3
select if(compte<>3,"this is broken but documented","this unexpectedly works?") from (select count(*) as compte from t2) as aggreg;
if(compte<>3,"this is broken but documented","this unexpectedly works?")
this is broken but documented
select * from mysql.proc where name="foo4" and db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES INVOKER begin
insert into t2 values(3);
insert into t1 values (5);
end @ # #
drop procedure foo4;
select * from mysql.proc where name="foo4" and db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
select * from mysql.proc where name="foo4" and db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
drop procedure foo;
drop procedure foo2;
drop procedure foo3;
create function fn1(x int)
returns int
deterministic
begin
insert into t1 values (x);
return x+2;
end|
delete t1,t2 from t1,t2;
select fn1(20);
fn1(20)
22
insert into t2 values(fn1(21));
select * from t1;
a
21
20
select * from t2;
a
23
select * from t1;
a
21
select if(compte<>1,"this is broken but documented","this unexpectedly works?") from (select count(*) as compte from t1 where a=20) as aggreg;
if(compte<>1,"this is broken but documented","this unexpectedly works?")
this is broken but documented
select * from t2;
a
23
drop function fn1;
create function fn1()
returns int
deterministic
begin
return unix_timestamp();
end|
delete from t1;
set timestamp=1000000000;
insert into t1 values(fn1());
select * from mysql.proc where db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
mysqltest1 fn1 FUNCTION fn1 SQL CONTAINS_SQL YES DEFINER int(11) begin
return unix_timestamp();
end root@localhost # #
select * from t1;
a
1000000000
use mysqltest1;
select * from t1;
a
1000000000
select * from mysql.proc where db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
mysqltest1 fn1 FUNCTION fn1 SQL CONTAINS_SQL YES DEFINER int(11) begin
return unix_timestamp();
end @ # #
drop function fn1;
drop database mysqltest1;
drop user "zedjzlcsjhd"@127.0.0.1;
......@@ -1672,7 +1672,7 @@ fld1 count(*)
158402 4181
select sum(Period)/count(*) from t1;
sum(Period)/count(*)
9410.00000
9410.0000
select companynr,count(price) as "count",sum(price) as "sum" ,abs(sum(price)/count(price)-avg(price)) as "diff",(0+count(price))*companynr as func from t3 group by companynr;
companynr count sum diff func
37 12543 309394878010 0.0000 464091
......@@ -1684,7 +1684,7 @@ companynr count sum diff func
512 4181 3288532102 0.0000 2140672
select companynr,sum(price)/count(price) as avg from t3 group by companynr having avg > 70000000 order by avg;
companynr avg
154 983543950.00
154 983543950.0000
select companynr,count(*) from t2 group by companynr order by 2 desc;
companynr count(*)
37 588
......@@ -2455,3 +2455,24 @@ a
select x.a, y.a, z.a from ( (t1 x inner join t2 y on x.a=y.a) inner join t2 z on y.a=z.a) WHERE x.a=1;
a a a
drop table t1,t2;
create table t1 (s1 varchar(5));
insert into t1 values ('Wall');
select min(s1) from t1 group by s1 with rollup;
min(s1)
Wall
Wall
drop table t1;
create table t1 (s1 int) engine=myisam;
insert into t1 values (0);
select avg(distinct s1) from t1 group by s1 with rollup;
avg(distinct s1)
0.0000
0.0000
drop table t1;
create table t1 (s1 int);
insert into t1 values (null),(1);
select distinct avg(s1) as x from t1 group by s1 with rollup;
x
NULL
1.0000
drop table t1;
......@@ -1404,11 +1404,10 @@ show procedure status like '%p%'|
Db Name Type Definer Modified Created Security_type Comment
drop table if exists fib|
create table fib ( f bigint unsigned not null )|
insert into fib values (1), (1)|
drop procedure if exists fib|
create procedure fib(n int unsigned)
begin
if n > 0 then
if n > 1 then
begin
declare x, y bigint unsigned;
declare c cursor for select f from fib order by f desc limit 2;
......@@ -1421,9 +1420,20 @@ call fib(n-1);
end;
end if;
end|
insert into fib values (0), (1)|
call fib(3)|
select * from fib order by f asc|
f
0
1
1
2
delete from fib|
insert into fib values (0), (1)|
call fib(20)|
select * from fib order by f asc|
f
0
1
1
2
......@@ -1444,8 +1454,6 @@ f
2584
4181
6765
10946
17711
drop table fib|
drop procedure fib|
drop procedure if exists bar|
......@@ -2913,10 +2921,10 @@ select @sptmp|
10
call bug9674_2()|
v/10
10.00000
10.0000
call bug9674_2()|
v/10
10.00000
10.0000
drop procedure bug9674_1|
drop procedure bug9674_2|
drop procedure if exists bug9598_1|
......@@ -3057,4 +3065,12 @@ yes
yes
drop procedure bug7293|
delete from t1|
drop procedure if exists bug9841|
drop view if exists v1|
create view v1 as select * from t1, t2 where id = s|
create procedure bug9841 ()
update v1 set data = 10|
call bug9841()|
drop view v1|
drop procedure bug9841|
drop table t1,t2;
......@@ -123,3 +123,12 @@ select * from t1;
A
This is view again
drop view t1;
create table t1 (a int, b int, index(a), index(b));
create table t2 (c int auto_increment, d varchar(255), primary key (c));
insert into t1 values (3,1),(3,2);
insert into t2 values (NULL, 'foo'), (NULL, 'bar');
select d, c from t1 left join t2 on b = c where a = 3 order by d;
d c
bar 2
foo 1
drop table t1, t2;
......@@ -437,3 +437,24 @@ a+0 b+0
2303 2
12345 4
drop table t1, t2;
create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1),
g bit(1) NOT NULL default 1, h char(1) default 'a');
insert into t1 set a=1;
select hex(g), h from t1;
hex(g) h
1 a
drop table t1;
create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1),
g bit(1) NOT NULL default 1);
insert into t1 set a=1;
select hex(g) from t1;
hex(g)
1
drop table t1;
create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1),
h char(1) default 'a') engine=myisam;
insert into t1 set a=1;
select h from t1;
h
a
drop table t1;
......@@ -731,7 +731,7 @@ t1 CREATE TABLE `t1` (
`d` decimal(10,0) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (d decimal(65,0));
create table t1 (d decimal(66,0));
ERROR 42000: Incorrect column specifier for column 'd'
CREATE TABLE t1 (i INT, d1 DECIMAL(9,2), d2 DECIMAL(9,2));
INSERT INTO t1 VALUES (1, 101.40, 21.40), (1, -80.00, 0.00),
......
......@@ -92,7 +92,7 @@ show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`col1` double default NULL,
`col2` double(22,5) default NULL,
`col2` double(53,5) default NULL,
`col3` double default NULL,
`col4` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
......
This diff is collapsed.
......@@ -270,7 +270,7 @@ drop table t2;
create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, 'a' as t2, repeat('a',256) as t3, binary repeat('b',256) as t4, repeat('a',4096) as t5, binary repeat('b',4096) as t6, '' as t7, binary '' as t8 from t1;
show full columns from t2;
Field Type Collation Null Key Default Extra Privileges Comment
auto int(6) unsigned NULL NO PRI 0 #
auto bigint(12) unsigned NULL NO PRI 0 #
t1 bigint(1) NULL NO 0 #
t2 varchar(1) latin1_swedish_ci NO #
t3 varchar(256) latin1_swedish_ci NO #
......
This diff is collapsed.
......@@ -504,7 +504,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) default NULL,
`c2` decimal(64,30) default NULL,
`c2` decimal(65,30) default NULL,
`c3` longtext,
`c4` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
--log_bin_trust_routine_creators=0
--log_bin_trust_routine_creators=0
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment