summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD/FINISH.sh6
-rwxr-xr-xBUILD/compile-dist5
-rw-r--r--BitKeeper/etc/logging_ok3
-rw-r--r--client/client_priv.h6
-rw-r--r--client/mysql.cc18
-rw-r--r--client/mysqlshow.c65
-rw-r--r--extra/yassl/include/yassl_int.hpp2
-rw-r--r--extra/yassl/src/yassl_int.cpp9
-rw-r--r--extra/yassl/taocrypt/include/integer.hpp4
-rw-r--r--extra/yassl/taocrypt/src/integer.cpp7
-rw-r--r--include/my_global.h12
-rw-r--r--include/violite.h6
-rw-r--r--libmysql/libmysql.def3
-rw-r--r--mysql-test/r/check.result9
-rw-r--r--mysql-test/r/create.result19
-rw-r--r--mysql-test/r/ctype_latin2.resultbin6569 -> 6411 bytes
-rw-r--r--mysql-test/r/information_schema.result38
-rw-r--r--mysql-test/r/innodb.result6
-rw-r--r--mysql-test/r/insert_update.result13
-rw-r--r--mysql-test/r/select.result21
-rw-r--r--mysql-test/r/sp.result16
-rw-r--r--mysql-test/r/temp_table.result9
-rw-r--r--mysql-test/r/type_float.result2
-rw-r--r--mysql-test/r/type_newdecimal.result17
-rw-r--r--mysql-test/r/type_ranges.result2
-rw-r--r--mysql-test/t/archive.test2
-rw-r--r--mysql-test/t/check.test12
-rw-r--r--mysql-test/t/create.test11
-rw-r--r--mysql-test/t/ctype_latin2.test11
-rw-r--r--mysql-test/t/information_schema.test32
-rw-r--r--mysql-test/t/innodb.test9
-rw-r--r--mysql-test/t/insert_update.test12
-rw-r--r--mysql-test/t/select.test27
-rw-r--r--mysql-test/t/sp.test18
-rw-r--r--mysql-test/t/temp_table-master.opt1
-rw-r--r--mysql-test/t/temp_table.test8
-rw-r--r--mysql-test/t/type_newdecimal.test16
-rw-r--r--mysys/default.c13
-rw-r--r--mysys/my_thr_init.c11
-rw-r--r--scripts/make_binary_distribution.sh16
-rw-r--r--sql/ha_berkeley.cc4
-rw-r--r--sql/ha_berkeley.h1
-rw-r--r--sql/ha_blackhole.cc2
-rw-r--r--sql/ha_heap.cc6
-rw-r--r--sql/ha_innodb.cc12
-rw-r--r--sql/ha_ndbcluster.cc43
-rw-r--r--sql/handler.cc28
-rw-r--r--sql/item.cc6
-rw-r--r--sql/item_cmpfunc.cc3
-rw-r--r--sql/item_cmpfunc.h1
-rw-r--r--sql/item_func.cc92
-rw-r--r--sql/item_sum.cc7
-rw-r--r--sql/log.cc8
-rw-r--r--sql/my_decimal.cc6
-rw-r--r--sql/mysql_priv.h5
-rw-r--r--sql/mysqld.cc52
-rw-r--r--sql/net_serv.cc4
-rw-r--r--sql/opt_range.cc19
-rw-r--r--sql/opt_sum.cc10
-rw-r--r--sql/share/charsets/Index.xml3
-rw-r--r--sql/share/charsets/cp1250.xml25
-rw-r--r--sql/share/charsets/latin2.xml32
-rw-r--r--sql/sp_head.cc33
-rw-r--r--sql/sql_acl.cc49
-rw-r--r--sql/sql_base.cc1
-rw-r--r--sql/sql_insert.cc4
-rw-r--r--sql/sql_parse.cc2
-rw-r--r--sql/sql_select.cc30
-rw-r--r--sql/sql_show.cc32
-rw-r--r--sql/sql_table.cc133
-rw-r--r--sql/sql_test.cc2
-rw-r--r--sql/sql_trigger.cc2
-rw-r--r--sql/sql_yacc.yy9
-rw-r--r--sql/unireg.cc1
-rw-r--r--storage/ndb/src/cw/cpcd/Process.cpp5
-rw-r--r--storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp2
-rw-r--r--storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp4
-rw-r--r--storage/ndb/src/kernel/error/ErrorReporter.cpp5
-rw-r--r--storage/ndb/src/ndbapi/Ndb.cpp11
-rw-r--r--strings/decimal.c39
-rw-r--r--vio/vio_priv.h4
-rw-r--r--vio/viosocket.c8
-rw-r--r--vio/viossl.c3
83 files changed, 813 insertions, 432 deletions
diff --git a/BUILD/FINISH.sh b/BUILD/FINISH.sh
index ae0518c150d..9745233e5d1 100644
--- a/BUILD/FINISH.sh
+++ b/BUILD/FINISH.sh
@@ -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
diff --git a/BUILD/compile-dist b/BUILD/compile-dist
index 248f4bb04ce..a8d180eace1 100755
--- a/BUILD/compile-dist
+++ b/BUILD/compile-dist
@@ -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
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index a3b7c5ed7e8..3e07576ce12 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -115,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
@@ -180,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)
@@ -227,6 +229,7 @@ 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)
diff --git a/client/client_priv.h b/client/client_priv.h
index 95f4d105156..8d25bddc286 100644
--- a/client/client_priv.h
+++ b/client/client_priv.h
@@ -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
};
diff --git a/client/mysql.cc b/client/mysql.cc
index 5282f74453d..e0ed85f2651 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -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())
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index 5631d296a54..85c8f123082 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -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
diff --git a/extra/yassl/include/yassl_int.hpp b/extra/yassl/include/yassl_int.hpp
index fa13baf1ac2..02895d3897b 100644
--- a/extra/yassl/include/yassl_int.hpp
+++ b/extra/yassl/include/yassl_int.hpp
@@ -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;
};
diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp
index 4cc2b85fccc..c552cfa7189 100644
--- a/extra/yassl/src/yassl_int.cpp
+++ b/extra/yassl/src/yassl_int.cpp
@@ -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;
}
diff --git a/extra/yassl/taocrypt/include/integer.hpp b/extra/yassl/taocrypt/include/integer.hpp
index 1706b4c0eea..94383f8061d 100644
--- a/extra/yassl/taocrypt/include/integer.hpp
+++ b/extra/yassl/taocrypt/include/integer.hpp
@@ -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,
diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp
index c95170722ae..9be0a25b363 100644
--- a/extra/yassl/taocrypt/src/integer.cpp
+++ b/extra/yassl/taocrypt/src/integer.cpp
@@ -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;
}
diff --git a/include/my_global.h b/include/my_global.h
index 55ec427e3e1..f051ed2918e 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -235,18 +235,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
diff --git a/include/violite.h b/include/violite.h
index 5ee051cb6e7..48046346f8c 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -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;
diff --git a/libmysql/libmysql.def b/libmysql/libmysql.def
index 5d88497e561..414ac4afd85 100644
--- a/libmysql/libmysql.def
+++ b/libmysql/libmysql.def
@@ -149,3 +149,6 @@ EXPORTS
mysql_server_init
mysql_server_end
get_defaults_files
+ get_charset_by_csname
+ get_charsets_dir
+ charsets_dir
diff --git a/mysql-test/r/check.result b/mysql-test/r/check.result
index ecaa13642bd..4c565f4f1b1 100644
--- a/mysql-test/r/check.result
+++ b/mysql-test/r/check.result
@@ -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;
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 82c0f4c1ce5..34ccab9bcc5 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -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,11 +448,11 @@ 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(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,
@@ -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;
diff --git a/mysql-test/r/ctype_latin2.result b/mysql-test/r/ctype_latin2.result
index 2876accaf72..c2c021b0760 100644
--- a/mysql-test/r/ctype_latin2.result
+++ b/mysql-test/r/ctype_latin2.result
Binary files differ
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index c53779582f1..6c8e7a9cf8b 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -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,17 @@ 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;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index d6cfefff9e6..b22330c7f90 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -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;
diff --git a/mysql-test/r/insert_update.result b/mysql-test/r/insert_update.result
index 1817500973e..12b83640d91 100644
--- a/mysql-test/r/insert_update.result
+++ b/mysql-test/r/insert_update.result
@@ -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;
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index ff45eff68da..fd67903a576 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -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;
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 815683172f6..0cc16448625 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -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|
diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result
index f43fd09982a..081bd35622e 100644
--- a/mysql-test/r/temp_table.result
+++ b/mysql-test/r/temp_table.result
@@ -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;
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index 3cdf35f5032..b0b3ab147b0 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -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
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result
index 6702676fa35..86c905b83a2 100644
--- a/mysql-test/r/type_newdecimal.result
+++ b/mysql-test/r/type_newdecimal.result
@@ -846,3 +846,20 @@ set sql_mode='';
select 0/0;
0/0
NULL
+select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 as x;
+x
+999999999999999999999999999999999999999999999999999999999999999999999999999999999
+Warnings:
+Error 1292 Truncated incorrect DECIMAL value: ''
+select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 1 as x;
+x
+NULL
+Warnings:
+Error 1292 Truncated incorrect DECIMAL value: ''
+Error 1292 Truncated incorrect DECIMAL value: ''
+select 0.190287977636363637 + 0.040372670 * 0 - 0;
+0.190287977636363637 + 0.040372670 * 0 - 0
+0.190287977636363637
+select -0.123 * 0;
+-0.123 * 0
+0.000
diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result
index 3b07464c8f4..b30e41f00d3 100644
--- a/mysql-test/r/type_ranges.result
+++ b/mysql-test/r/type_ranges.result
@@ -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 #
diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test
index 9d25524da5f..51334fa62bc 100644
--- a/mysql-test/t/archive.test
+++ b/mysql-test/t/archive.test
@@ -1296,6 +1296,8 @@ select fld1,fld3 from t2 where fld1 like "25050_";
create table t3 engine=archive select * from t2;
select * from t3 where fld3='bonfire';
select count(*) from t3;
+# Clean up path in error message
+--replace_result $MYSQL_TEST_DIR . /var/master-data/ /
rename table t3 to t4;
select * from t4 where fld3='bonfire';
select count(*) from t4;
diff --git a/mysql-test/t/check.test b/mysql-test/t/check.test
index bc61aea2d66..c502655818d 100644
--- a/mysql-test/t/check.test
+++ b/mysql-test/t/check.test
@@ -22,3 +22,15 @@ connection con1;
reap;
drop table t1;
+#
+# Bug #9897 Views: 'Check Table' crashes MySQL, with a view and a table
+# in the statement
+#
+
+connection default;
+Create table t1(f1 int);
+Create table t2(f1 int);
+Create view v1 as Select * from t1;
+Check Table v1,t2;
+drop view v1;
+drop table t1, t2;
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 1e2cf391221..d4733e6dc7e 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -460,3 +460,14 @@ INSERT INTO t2 VALUES ('5000000001', 'proc01', '20031029090650', '2003-10-29 13:
CREATE TABLE t3 SELECT t1.dsc,COUNT(DISTINCT t2.id) AS countOfRuns FROM t1 LEFT JOIN t2 ON (t1.id=t2.id) GROUP BY t1.id;
SELECT * FROM t3;
drop table t1, t2, t3;
+
+#
+# Bug#9666: Can't use 'DEFAULT FALSE' for column of type bool
+#
+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;
+select * from t2;
+drop table t1,t2;
diff --git a/mysql-test/t/ctype_latin2.test b/mysql-test/t/ctype_latin2.test
index 445223f534c..cc232adeaec 100644
--- a/mysql-test/t/ctype_latin2.test
+++ b/mysql-test/t/ctype_latin2.test
@@ -7,10 +7,6 @@ drop table if exists t1;
SET NAMES latin2;
CREATE TABLE t1 (a char(1) character set latin2);
-INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07);
-INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
-INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17);
-INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
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);
@@ -45,3 +41,10 @@ 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;
+
+
+#
+# Bug#6505 wrong sorting order
+#
+SELECT group_concat(a collate latin2_croatian_ci order by binary a) from t1 group by a collate latin2_croatian_ci;
+drop table t1;
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index b4cc118c62f..3e322ad2f5b 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -7,6 +7,9 @@
show variables where variable_name like "skip_show_database";
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';
select schema_name from information_schema.schemata;
@@ -53,15 +56,21 @@ select * from information_schema.COLUMNS where table_name="t1"
and column_name= "a";
show columns from mysqltest.t1 where field like "%a%";
+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;
connect (user3,localhost,mysqltest_2,,);
connection user3;
select table_name, column_name, privileges from information_schema.columns
where table_schema = 'mysqltest' and table_name = 't1';
show columns from mysqltest.t1;
+connect (user4,localhost,mysqltest_3,,mysqltest);
+connection user4;
+select table_name, column_name, privileges from information_schema.columns
+where table_schema = 'mysqltest' and table_name = 'v1';
connection default;
-drop view v1;
+drop view v1, mysqltest.v1;
drop tables mysqltest.t4, mysqltest.t1, t2, t3;
drop database mysqltest;
@@ -176,10 +185,10 @@ select * from information_schema.USER_PRIVILEGES where grantee like '%mysqltest_
select * from information_schema.SCHEMA_PRIVILEGES where grantee like '%mysqltest_1%';
select * from information_schema.TABLE_PRIVILEGES where grantee like '%mysqltest_1%';
select * from information_schema.COLUMN_PRIVILEGES where grantee like '%mysqltest_1%';
-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;
@@ -464,3 +473,16 @@ SELECT COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME= 't1';
drop table t1;
+
+#
+# Bug#10261 INFORMATION_SCHEMA.COLUMNS, incomplete result for non root user
+#
+
+create user mysqltest_4@localhost;
+connect (user4,localhost,mysqltest_4,,);
+connection user4;
+SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS
+where COLUMN_NAME='TABLE_NAME';
+connection default;
+delete from mysql.user where user='mysqltest_4';
+flush privileges;
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index bd07d2220d2..335f78941da 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -1300,3 +1300,12 @@ eval set storage_engine=$default;
# InnoDB specific varchar tests
create table t1 (v varchar(16384)) engine=innodb;
drop table t1;
+
+#
+# Bug #4082: integer truncation
+#
+
+create table t1(a int(1) , b int(1)) engine=innodb;
+insert into t1 values ('1111', '3333');
+select distinct concat(a, b) from t1;
+drop table t1;
diff --git a/mysql-test/t/insert_update.test b/mysql-test/t/insert_update.test
index 188de8a5379..0fa366586b3 100644
--- a/mysql-test/t/insert_update.test
+++ b/mysql-test/t/insert_update.test
@@ -80,3 +80,15 @@ INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
SELECT *, VALUES(a) FROM t1;
DROP TABLE t1;
DROP TABLE t2;
+
+#
+# Bug#9725 - "disapearing query/hang" and "unknown error" with "on duplicate key update"
+# INSERT INGORE...UPDATE gives bad error or breaks protocol.
+#
+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;
+insert ignore into t1 select a from t1 on duplicate key update a=a+1 ;
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index a92c8ffdc66..64f6674181c 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -2029,3 +2029,30 @@ select t1.a from (t1 inner join t2 on t1.a=t2.a) where t2.a=1;
select t1.a from ((t1 inner join t2 on t1.a=t2.a)) where t2.a=1;
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;
drop table t1,t2;
+
+#
+# Bug#9820
+#
+
+create table t1 (s1 varchar(5));
+insert into t1 values ('Wall');
+select min(s1) from t1 group by s1 with rollup;
+drop table t1;
+
+#
+# Bug#9799
+#
+
+create table t1 (s1 int) engine=myisam;
+insert into t1 values (0);
+select avg(distinct s1) from t1 group by s1 with rollup;
+drop table t1;
+
+#
+# Bug#9800
+#
+
+create table t1 (s1 int);
+insert into t1 values (null),(1);
+select distinct avg(s1) as x from t1 group by s1 with rollup;
+drop table t1;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 77fe5ab7601..b4066df1666 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -1634,8 +1634,6 @@ drop table if exists fib|
--enable_warnings
create table fib ( f bigint unsigned not null )|
-insert into fib values (1), (1)|
-
# We deliberately do it the awkward way, fetching the last two
# values from the table, in order to exercise various statements
# and table accesses at each turn.
@@ -1644,7 +1642,7 @@ drop procedure if exists fib|
--enable_warnings
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;
@@ -1659,6 +1657,20 @@ begin
end if;
end|
+# Minimum test: recursion of 3 levels
+
+insert into fib values (0), (1)|
+
+call fib(3)|
+
+select * from fib order by f asc|
+
+delete from fib|
+
+# Original test: 20 levels (may run into memory limits!)
+
+insert into fib values (0), (1)|
+
call fib(20)|
select * from fib order by f asc|
diff --git a/mysql-test/t/temp_table-master.opt b/mysql-test/t/temp_table-master.opt
new file mode 100644
index 00000000000..026d3d4640c
--- /dev/null
+++ b/mysql-test/t/temp_table-master.opt
@@ -0,0 +1 @@
+--tmpdir=$MYSQL_TEST_DIR/var//tmp
diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test
index eeb33515570..da7ce9b4722 100644
--- a/mysql-test/t/temp_table.test
+++ b/mysql-test/t/temp_table.test
@@ -104,3 +104,11 @@ drop table t1;
select * from t1;
drop view t1;
+# Bug #8497: tmpdir with extra slashes would cause failures
+#
+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;
+drop table t1, t2;
diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test
index 19230c02743..5ceb704eaf7 100644
--- a/mysql-test/t/type_newdecimal.test
+++ b/mysql-test/t/type_newdecimal.test
@@ -876,3 +876,19 @@ select 10.3330000000000/12.34500000;
set sql_mode='';
select 0/0;
+
+#
+# bug #9546
+#
+--disable_ps_protocol
+select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 as x;
+select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 1 as x;
+--enable_ps_protocol
+#
+# Bug #10004
+#
+select 0.190287977636363637 + 0.040372670 * 0 - 0;
+#
+# Bug #9527
+#
+select -0.123 * 0;
diff --git a/mysys/default.c b/mysys/default.c
index e3a0b8a20ad..5afefa5463d 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -152,10 +152,15 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
}
else if (defaults_extra_file)
{
- if (search_default_file(func, func_ctx, NullS,
- defaults_extra_file) < 0)
+ if (search_default_file_with_ext(func, func_ctx, "", "",
+ defaults_extra_file, 0) < 0)
goto err; /* Fatal error */
-
+ if (error > 0)
+ {
+ fprintf(stderr, "Could not open required defaults file: %s\n",
+ defaults_extra_file);
+ goto err;
+ }
}
}
}
@@ -526,7 +531,7 @@ static int search_default_file_with_ext(Process_option_func opt_handler,
}
#endif
if (!(fp= my_fopen(name, O_RDONLY, MYF(0))))
- return 0; /* Ignore wrong files */
+ return 1; /* Ignore wrong files */
while (fgets(buff, sizeof(buff) - 1, fp))
{
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index 878e1f6bfc6..4d23d01cd82 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -67,12 +67,11 @@ my_bool my_thread_global_init(void)
/*
Set mutex type to "fast" a.k.a "adaptive"
- The mutex kind determines what happens if a thread attempts to lock
- a mutex it already owns with pthread_mutex_lock(3). If the mutex
- is of the ``fast'' kind, pthread_mutex_lock(3) simply suspends
- the calling thread forever. If the mutex is of the ``error checking''
- kind, pthread_mutex_lock(3) returns immediately with the error
- code EDEADLK.
+ In this case the thread may steal the mutex from some other thread
+ that is waiting for the same mutex. This will save us some
+ context switches but may cause a thread to 'starve forever' while
+ waiting for the mutex (not likely if the code within the mutex is
+ short).
*/
pthread_mutexattr_init(&my_fast_mutexattr);
pthread_mutexattr_settype(&my_fast_mutexattr,
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index 17a9be17108..6c0487aee40 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -294,6 +294,22 @@ if [ x$NDBCLUSTER = x1 ]; then
rm -rf $BASE/ndb-stage
fi
+# Remove vendor from $system
+system=`echo $system | sed -e 's/[a-z]*-\(.*\)/\1/g'`
+
+# Map OS names to "our" OS names (eg. darwin6.8 -> osx10.2)
+system=`echo $system | sed -e 's/darwin6.*/osx10.2/g'`
+system=`echo $system | sed -e 's/darwin7.*/osx10.3/g'`
+system=`echo $system | sed -e 's/darwin8.*/osx10.4/g'`
+system=`echo $system | sed -e 's/\(aix4.3\).*/\1/g'`
+system=`echo $system | sed -e 's/\(aix5.1\).*/\1/g'`
+system=`echo $system | sed -e 's/\(aix5.2\).*/\1/g'`
+system=`echo $system | sed -e 's/\(aix5.3\).*/\1/g'`
+system=`echo $system | sed -e 's/osf5.1b/tru64/g'`
+system=`echo $system | sed -e 's/linux-gnu/linux/g'`
+system=`echo $system | sed -e 's/solaris2.\([0-9]*\)/solaris\1/g'`
+system=`echo $system | sed -e 's/sco3.2v\(.*\)/openserver\1/g'`
+
# Change the distribution to a long descriptive name
NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version-$system-$machine$SUFFIX
BASE2=$TMP/$NEW_NAME
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 04d81b2f95a..725674946ee 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -2012,9 +2012,7 @@ THR_LOCK_DATA **ha_berkeley::store_lock(THD *thd, THR_LOCK_DATA **to,
lock_type <= TL_WRITE) &&
!thd->in_lock_tables)
lock_type = TL_WRITE_ALLOW_WRITE;
- lock.type=lock_type;
- lock_on_read= ((table->reginfo.lock_type > TL_WRITE_ALLOW_READ) ? DB_RMW :
- 0);
+ lock.type= lock_type;
}
*to++= &lock;
return to;
diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h
index 10e61455867..1d49c3be0e9 100644
--- a/sql/ha_berkeley.h
+++ b/sql/ha_berkeley.h
@@ -57,7 +57,6 @@ class ha_berkeley: public handler
ulong alloced_rec_buff_length;
ulong changed_rows;
uint primary_key,last_dup_key, hidden_primary_key, version;
- u_int32_t lock_on_read;
bool key_read, using_ignore;
bool fix_rec_buff_for_blob(ulong length);
byte current_ident[BDB_HIDDEN_PRIMARY_KEY_LENGTH];
diff --git a/sql/ha_blackhole.cc b/sql/ha_blackhole.cc
index 5467ab8a978..c5062c4ea81 100644
--- a/sql/ha_blackhole.cc
+++ b/sql/ha_blackhole.cc
@@ -19,7 +19,7 @@
#pragma implementation // gcc: Class implementation
#endif
-#include <mysql_priv.h>
+#include "mysql_priv.h"
#ifdef HAVE_BLACKHOLE_DB
#include "ha_blackhole.h"
diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc
index 52ff776c5d6..e3212b095cf 100644
--- a/sql/ha_heap.cc
+++ b/sql/ha_heap.cc
@@ -424,7 +424,8 @@ THR_LOCK_DATA **ha_heap::store_lock(THD *thd,
int ha_heap::delete_table(const char *name)
{
char buff[FN_REFLEN];
- int error= heap_delete_table(fn_format(buff,name,"","",4+2));
+ int error= heap_delete_table(fn_format(buff,name,"","",
+ MY_REPLACE_EXT|MY_UNPACK_FILENAME));
return error == ENOENT ? 0 : error;
}
@@ -555,7 +556,8 @@ int ha_heap::create(const char *name, TABLE *table_arg,
hp_create_info.max_table_size=current_thd->variables.max_heap_table_size;
hp_create_info.with_auto_increment= found_real_auto_increment;
max_rows = (ha_rows) (hp_create_info.max_table_size / mem_per_row);
- error= heap_create(fn_format(buff,name,"","",4+2),
+ error= heap_create(fn_format(buff,name,"","",
+ MY_REPLACE_EXT|MY_UNPACK_FILENAME),
keys, keydef, share->reclength,
(ulong) ((share->max_rows < max_rows &&
share->max_rows) ?
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index bfaa2015ea3..2b6824e96d8 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -2452,18 +2452,6 @@ set_field_in_record_to_null(
record[null_offset] = record[null_offset] | field->null_bit;
}
-/******************************************************************
-Resets SQL NULL bits in a record to zero. */
-inline
-void
-reset_null_bits(
-/*============*/
- TABLE* table, /* in: MySQL table object */
- char* record) /* in: a row in MySQL format */
-{
- bzero(record, table->s->null_bytes);
-}
-
extern "C" {
/*****************************************************************
InnoDB uses this function to compare two data fields for which the data type
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 99fb05b24d3..372a178b59a 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -1,4 +1,4 @@
- /* Copyright (C) 2000-2003 MySQL AB
+/* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1227,7 +1227,7 @@ static void shrink_varchar(Field* field, const byte* & ptr, char* buf)
if (ptr[1] == 0) {
buf[0]= ptr[0];
} else {
- DBUG_ASSERT(false);
+ DBUG_ASSERT(FALSE);
buf[0]= 255;
}
memmove(buf + 1, ptr + 2, pack_len - 1);
@@ -1773,7 +1773,7 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
if (p.bound_type == -1)
{
DBUG_PRINT("error", ("key %d unknown flag %d", j, p.key->flag));
- DBUG_ASSERT(false);
+ DBUG_ASSERT(FALSE);
// Stop setting bounds but continue with what we have
op->end_of_bound(range_no);
DBUG_RETURN(0);
@@ -1850,7 +1850,7 @@ int ha_ndbcluster::ordered_index_scan(const key_range *start_key,
if (m_active_cursor == 0)
{
- restart= false;
+ restart= FALSE;
NdbOperation::LockMode lm=
(NdbOperation::LockMode)get_ndb_lock_type(m_lock.type);
if (!(op= trans->getNdbIndexScanOperation((NDBINDEX *)
@@ -1860,7 +1860,7 @@ int ha_ndbcluster::ordered_index_scan(const key_range *start_key,
ERR_RETURN(trans->getNdbError());
m_active_cursor= op;
} else {
- restart= true;
+ restart= TRUE;
op= (NdbIndexScanOperation*)m_active_cursor;
DBUG_ASSERT(op->getSorted() == sorted);
@@ -2741,7 +2741,7 @@ int ha_ndbcluster::close_scan()
m_ops_pending= 0;
}
- cursor->close(m_force_send, true);
+ cursor->close(m_force_send, TRUE);
m_active_cursor= m_multi_cursor= NULL;
DBUG_RETURN(0);
}
@@ -3050,8 +3050,10 @@ void ha_ndbcluster::start_bulk_insert(ha_rows rows)
m_rows_inserted= (ha_rows) 0;
if (rows == (ha_rows) 0)
+ {
/* We don't know how many will be inserted, guess */
m_rows_to_insert= m_autoincrement_prefetch;
+ }
else
m_rows_to_insert= rows;
@@ -4174,8 +4176,10 @@ ulonglong ha_ndbcluster::get_auto_increment()
Ndb *ndb= get_ndb();
if (m_rows_inserted > m_rows_to_insert)
+ {
/* We guessed too low */
m_rows_to_insert+= m_autoincrement_prefetch;
+ }
cache_size=
(int)
(m_rows_to_insert - m_rows_inserted < m_autoincrement_prefetch) ?
@@ -5554,7 +5558,7 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
/**
* blobs can't be batched currently
*/
- m_disable_multi_read= true;
+ m_disable_multi_read= TRUE;
DBUG_RETURN(handler::read_multi_range_first(found_range_p,
ranges,
range_count,
@@ -5562,7 +5566,7 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
buffer));
}
- m_disable_multi_read= false;
+ m_disable_multi_read= FALSE;
/**
* Copy arguments into member variables
@@ -5610,7 +5614,7 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
!op->readTuple(lm) &&
!set_primary_key(op, multi_range_curr->start_key.key) &&
!define_read_attrs(curr, op) &&
- (op->setAbortOption(AO_IgnoreError), true))
+ (op->setAbortOption(AO_IgnoreError), TRUE))
curr += reclength;
else
ERR_RETURN(op ? op->getNdbError() : m_active_trans->getNdbError());
@@ -5625,7 +5629,7 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
!op->readTuple(lm) &&
!set_index_key(op, key_info, multi_range_curr->start_key.key) &&
!define_read_attrs(curr, op) &&
- (op->setAbortOption(AO_IgnoreError), true))
+ (op->setAbortOption(AO_IgnoreError), TRUE))
curr += reclength;
else
ERR_RETURN(op ? op->getNdbError() : m_active_trans->getNdbError());
@@ -5660,7 +5664,7 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
end_of_buffer -= reclength;
}
else if ((scanOp= m_active_trans->getNdbIndexScanOperation(idx, tab))
- &&!scanOp->readTuples(lm, 0, parallelism, sorted, false, true)
+ &&!scanOp->readTuples(lm, 0, parallelism, sorted, FALSE, TRUE)
&&!generate_scan_filter(m_cond_stack, scanOp)
&&!define_read_attrs(end_of_buffer-reclength, scanOp))
{
@@ -5807,11 +5811,11 @@ ha_ndbcluster::read_multi_range_next(KEY_MULTI_RANGE ** multi_range_found_p)
continue;
}
- DBUG_ASSERT(false); // Should only get here via goto's
+ DBUG_ASSERT(FALSE); // Should only get here via goto's
close_scan:
if (res == 1)
{
- m_multi_cursor->close(false, true);
+ m_multi_cursor->close(FALSE, TRUE);
m_active_cursor= m_multi_cursor= 0;
DBUG_MULTI_RANGE(8);
continue;
@@ -6101,8 +6105,8 @@ const
COND*
ha_ndbcluster::cond_push(const COND *cond)
{
- Ndb_cond_stack *ndb_cond = new Ndb_cond_stack();
DBUG_ENTER("cond_push");
+ Ndb_cond_stack *ndb_cond = new Ndb_cond_stack();
DBUG_EXECUTE("where",print_where((COND *)cond, m_tabname););
if (m_cond_stack)
ndb_cond->next= m_cond_stack;
@@ -6118,7 +6122,6 @@ ha_ndbcluster::cond_push(const COND *cond)
{
cond_pop();
}
-
DBUG_RETURN(cond);
}
@@ -6997,7 +7000,7 @@ int
ha_ndbcluster::build_scan_filter_group(Ndb_cond* &cond, NdbScanFilter *filter)
{
uint level=0;
- bool negated= false;
+ bool negated= FALSE;
DBUG_ENTER("build_scan_filter_group");
do
@@ -7013,7 +7016,7 @@ ha_ndbcluster::build_scan_filter_group(Ndb_cond* &cond, NdbScanFilter *filter)
if ((negated) ? filter->begin(NdbScanFilter::NAND)
: filter->begin(NdbScanFilter::AND) == -1)
DBUG_RETURN(1);
- negated= false;
+ negated= FALSE;
cond= cond->next;
break;
}
@@ -7024,19 +7027,19 @@ ha_ndbcluster::build_scan_filter_group(Ndb_cond* &cond, NdbScanFilter *filter)
if ((negated) ? filter->begin(NdbScanFilter::NOR)
: filter->begin(NdbScanFilter::OR) == -1)
DBUG_RETURN(1);
- negated= false;
+ negated= FALSE;
cond= cond->next;
break;
}
case(Item_func::NOT_FUNC): {
cond= cond->next;
- negated= true;
+ negated= TRUE;
break;
}
default:
if (build_scan_filter_predicate(cond, filter, negated))
DBUG_RETURN(1);
- negated= false;
+ negated= FALSE;
break;
}
break;
diff --git a/sql/handler.cc b/sql/handler.cc
index 7318de1c503..a34b3bd8aac 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -366,11 +366,11 @@ int ha_init()
if (opt_bin_log)
{
- if (!(*ht= binlog_init()))
+ if (!(*ht= binlog_init())) // Always succeed
{
- mysql_bin_log.close(LOG_CLOSE_INDEX);
- opt_bin_log= 0;
- error= 1;
+ mysql_bin_log.close(LOG_CLOSE_INDEX); // Never used
+ opt_bin_log= 0; // Never used
+ error= 1; // Never used
}
else
ha_was_inited_ok(ht++);
@@ -2417,6 +2417,7 @@ TYPELIB *ha_known_exts(void)
return &known_extensions;
}
+
#ifdef HAVE_REPLICATION
/*
Reports to table handlers up to which position we have sent the binlog
@@ -2424,19 +2425,16 @@ TYPELIB *ha_known_exts(void)
SYNOPSIS
ha_repl_report_sent_binlog()
+ thd thread doing the binlog communication to the slave
+ log_file_name binlog file name
+ end_offse t the offset in the binlog file up to which we sent the
+ contents to the slave
NOTES
Only works for InnoDB at the moment
RETURN VALUE
Always 0 (= success)
-
- PARAMETERS
- THD *thd in: thread doing the binlog communication to
- the slave
- char *log_file_name in: binlog file name
- my_off_t end_offset in: the offset in the binlog file up to
- which we sent the contents to the slave
*/
int ha_repl_report_sent_binlog(THD *thd, char *log_file_name,
@@ -2445,17 +2443,17 @@ int ha_repl_report_sent_binlog(THD *thd, char *log_file_name,
#ifdef HAVE_INNOBASE_DB
return innobase_repl_report_sent_binlog(thd,log_file_name,end_offset);
#else
- /* remove warnings about unused parameters */
- thd=thd; log_file_name=log_file_name; end_offset=end_offset;
return 0;
#endif
}
+
/*
Reports to table handlers that we stop replication to a specific slave
SYNOPSIS
ha_repl_report_replication_stop()
+ thd thread doing the binlog communication to the slave
NOTES
Does nothing at the moment
@@ -2464,14 +2462,10 @@ int ha_repl_report_sent_binlog(THD *thd, char *log_file_name,
Always 0 (= success)
PARAMETERS
- THD *thd in: thread doing the binlog communication to
- the slave
*/
int ha_repl_report_replication_stop(THD *thd)
{
- thd = thd;
-
return 0;
}
#endif /* HAVE_REPLICATION */
diff --git a/sql/item.cc b/sql/item.cc
index f5c7f2d7c05..30c134ebdd5 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -510,10 +510,10 @@ bool Item_field::collect_item_field_processor(byte *arg)
while ((curr_item= item_list_it++))
{
if (curr_item->eq(this, 1))
- DBUG_RETURN(false); /* Already in the set. */
+ DBUG_RETURN(FALSE); /* Already in the set. */
}
item_list->push_back(this);
- DBUG_RETURN(false);
+ DBUG_RETURN(FALSE);
}
@@ -1035,7 +1035,7 @@ void Item_field::set_field(Field *field_par)
field=result_field=field_par; // for easy coding with fields
maybe_null=field->maybe_null();
decimals= field->decimals();
- max_length= field_par->field_length;
+ max_length= field_par->max_length();
table_name= *field_par->table_name;
field_name= field_par->field_name;
db_name= field_par->table->s->db;
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 8c44972e469..89897a9d74f 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1737,8 +1737,7 @@ my_decimal *Item_func_coalesce::val_decimal(my_decimal *decimal_value)
void Item_func_coalesce::fix_length_and_dec()
{
agg_result_type(&cached_result_type, args, arg_count);
- switch (cached_result_type)
- {
+ switch (cached_result_type) {
case STRING_RESULT:
count_only_length();
decimals= NOT_FIXED_DEC;
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 78357c457cb..96101f7b691 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -412,6 +412,7 @@ public:
const char *func_name() const { return "between"; }
void fix_length_and_dec();
void print(String *str);
+ bool is_bool_func() { return 1; }
CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
uint decimal_precision() const { return 1; }
};
diff --git a/sql/item_func.cc b/sql/item_func.cc
index edb4513b2d7..283d7463293 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -4664,29 +4664,40 @@ Item_func_sp::func_name() const
Field *
Item_func_sp::sp_result_field(void) const
{
- Field *field= 0;
- THD *thd= current_thd;
+ Field *field;
DBUG_ENTER("Item_func_sp::sp_result_field");
- if (m_sp)
+
+ if (!m_sp)
{
- if (dummy_table->s == NULL)
+ if (!(m_sp= sp_find_function(current_thd, m_name, TRUE)))
{
- char *empty_name= (char *) "";
- TABLE_SHARE *share;
- dummy_table->s= share= &dummy_table->share_not_to_be_used;
- dummy_table->alias = empty_name;
- dummy_table->maybe_null = maybe_null;
- dummy_table->in_use= current_thd;
- share->table_cache_key = empty_name;
- share->table_name = empty_name;
- share->table_name = empty_name;
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str);
+ DBUG_RETURN(0);
}
- field= m_sp->make_field(max_length, name, dummy_table);
}
- DBUG_RETURN(field);
+ if (!dummy_table->s)
+ {
+ char *empty_name= (char *) "";
+ TABLE_SHARE *share;
+ dummy_table->s= share= &dummy_table->share_not_to_be_used;
+ dummy_table->alias = empty_name;
+ dummy_table->maybe_null = maybe_null;
+ dummy_table->in_use= current_thd;
+ share->table_cache_key = empty_name;
+ share->table_name = empty_name;
+ }
+ DBUG_RETURN(m_sp->make_field(max_length, name, dummy_table));
}
+/*
+ Execute function & store value in field
+
+ RETURN
+ 0 value <> NULL
+ 1 value = NULL or error
+*/
+
int
Item_func_sp::execute(Field **flp)
{
@@ -4706,7 +4717,7 @@ Item_func_sp::execute(Field **flp)
f->null_bit= 1;
}
it->save_in_field(f, 1);
- return f->is_null();
+ return null_value= f->is_null();
}
@@ -4722,11 +4733,12 @@ Item_func_sp::execute(Item **itp)
#endif
if (! m_sp)
- m_sp= sp_find_function(thd, m_name, TRUE); // cache only
- if (! m_sp)
{
- my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str);
- DBUG_RETURN(-1);
+ if (!(m_sp= sp_find_function(thd, m_name, TRUE)))
+ {
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str);
+ DBUG_RETURN(-1);
+ }
}
old_client_capabilites= thd->client_capabilities;
@@ -4788,15 +4800,12 @@ Item_func_sp::make_field(Send_field *tmp_field)
{
Field *field;
DBUG_ENTER("Item_func_sp::make_field");
- if (! m_sp)
- m_sp= sp_find_function(current_thd, m_name, TRUE); // cache only
if ((field= sp_result_field()))
{
field->make_field(tmp_field);
delete field;
DBUG_VOID_RETURN;
}
- my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str);
init_make_field(tmp_field, MYSQL_TYPE_VARCHAR);
DBUG_VOID_RETURN;
}
@@ -4805,20 +4814,17 @@ Item_func_sp::make_field(Send_field *tmp_field)
enum enum_field_types
Item_func_sp::field_type() const
{
- Field *field= 0;
+ Field *field;
DBUG_ENTER("Item_func_sp::field_type");
if (result_field)
DBUG_RETURN(result_field->type());
- if (! m_sp)
- m_sp= sp_find_function(current_thd, m_name, TRUE); // cache only
if ((field= sp_result_field()))
{
enum_field_types result= field->type();
delete field;
DBUG_RETURN(result);
}
- my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str);
DBUG_RETURN(MYSQL_TYPE_VARCHAR);
}
@@ -4826,28 +4832,25 @@ Item_func_sp::field_type() const
Item_result
Item_func_sp::result_type() const
{
- Field *field= 0;
+ Field *field;
DBUG_ENTER("Item_func_sp::result_type");
DBUG_PRINT("info", ("m_sp = %p", m_sp));
if (result_field)
DBUG_RETURN(result_field->result_type());
- if (! m_sp)
- m_sp= sp_find_function(current_thd, m_name, TRUE); // cache only
if ((field= sp_result_field()))
{
Item_result result= field->result_type();
delete field;
DBUG_RETURN(result);
}
- my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str);
DBUG_RETURN(STRING_RESULT);
}
void
Item_func_sp::fix_length_and_dec()
{
- Field *field= result_field;
+ Field *field;
DBUG_ENTER("Item_func_sp::fix_length_and_dec");
if (result_field)
@@ -4857,20 +4860,12 @@ Item_func_sp::fix_length_and_dec()
DBUG_VOID_RETURN;
}
- if (! m_sp)
- m_sp= sp_find_function(current_thd, m_name, TRUE); // cache only
- if (! m_sp)
- {
- my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str);
- }
- else
- {
- field= sp_result_field();
- decimals= field->decimals();
- max_length= field->field_length;
- maybe_null= 1;
- }
- delete field;
+ if (!(field= sp_result_field()))
+ DBUG_VOID_RETURN;
+ decimals= field->decimals();
+ max_length= field->field_length;
+ maybe_null= 1;
+ delete field;
DBUG_VOID_RETURN;
}
@@ -4878,11 +4873,10 @@ Item_func_sp::fix_length_and_dec()
longlong Item_func_found_rows::val_int()
{
DBUG_ASSERT(fixed == 1);
- THD *thd= current_thd;
-
- return thd->found_rows();
+ return current_thd->found_rows();
}
+
Field *
Item_func_sp::tmp_table_field(TABLE *t_arg)
{
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index a7bc08ea170..76bf8189a0e 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -240,6 +240,8 @@ Item_sum_hybrid::Item_sum_hybrid(THD *thd, Item_sum_hybrid *item)
case REAL_RESULT:
sum= item->sum;
break;
+ case STRING_RESULT: // This can happen with ROLLUP. Note that the value is already
+ break; // copied at function call.
case ROW_RESULT:
default:
DBUG_ASSERT(0);
@@ -585,7 +587,10 @@ bool Item_sum_distinct::setup(THD *thd)
DBUG_ENTER("Item_sum_distinct::setup");
- DBUG_ASSERT(tree == 0); /* setup can not be called twice */
+ /*
+ Setup can be called twice for ROLLUP items. This is a bug.
+ Please add DBUG_ASSERT(tree == 0) here when it's fixed.
+ */
/*
Virtual table and the tree are created anew on each re-execution of
diff --git a/sql/log.cc b/sql/log.cc
index 1ec584f94bc..f55dc52af38 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -957,9 +957,9 @@ bool MYSQL_LOG::reset_logs(THD* thd)
my_delete(index_file_name, MYF(MY_WME)); // Reset (open will update)
if (!thd->slave_thread)
need_start_event=1;
- open_index_file(index_file_name, 0);
- open(save_name, save_log_type, 0,
- io_cache_type, no_auto_events, max_size, 0);
+ if (!open_index_file(index_file_name, 0))
+ open(save_name, save_log_type, 0,
+ io_cache_type, no_auto_events, max_size, 0);
my_free((gptr) save_name, MYF(0));
err:
@@ -1591,7 +1591,7 @@ bool MYSQL_LOG::write(Log_event *event_info)
present event could be about a non-transactional table, but still we need
to write to the binlog cache in that case to handle updates to mixed
trans/non-trans table types the best possible in binlogging)
- - or if the event asks for it (cache_stmt == true).
+ - or if the event asks for it (cache_stmt == TRUE).
*/
if (opt_using_transactions && thd)
{
diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc
index 14c15cdc4ef..f188d27ff78 100644
--- a/sql/my_decimal.cc
+++ b/sql/my_decimal.cc
@@ -43,9 +43,9 @@ int decimal_operation_results(int result)
break;
case E_DEC_OVERFLOW:
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
- ER_WARN_DATA_OUT_OF_RANGE,
- ER(ER_WARN_DATA_OUT_OF_RANGE),
- "", (long)-1);
+ ER_TRUNCATED_WRONG_VALUE,
+ ER(ER_TRUNCATED_WRONG_VALUE),
+ "DECIMAL", "");
break;
case E_DEC_DIV_ZERO:
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index a7ef88e7de1..715eaf28896 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -183,6 +183,11 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
#else
#define IF_INNOBASE_DB(A, B) (B)
#endif
+#ifdef __NETWARE__
+#define IF_NETWARE(A,B) (A)
+#else
+#define IF_NETWARE(A,B) (B)
+#endif
#if defined(__WIN__) || defined(OS2)
#define IF_WIN(A,B) (A)
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index c76331820d9..683f3e38588 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2666,8 +2666,8 @@ static int init_server_components()
Update log is removed since 5.0. But we still accept the option.
The idea is if the user already uses the binlog and the update log,
we completely ignore any option/variable related to the update log, like
- if the update log did not exist. But if the user uses only the update log,
- then we translate everything into binlog for him (with warnings).
+ if the update log did not exist. But if the user uses only the update
+ log, then we translate everything into binlog for him (with warnings).
Implementation of the above :
- If mysqld is started with --log-update and --log-bin,
ignore --log-update (print a warning), push a warning when SQL_LOG_UPDATE
@@ -2681,11 +2681,11 @@ static int init_server_components()
Note that we tell the user that --sql-bin-update-same is deprecated and
does nothing, and we don't take into account if he used this option or
- not; but internally we give this variable a value to have the behaviour we
- want (i.e. have SQL_LOG_UPDATE influence SQL_LOG_BIN or not).
+ not; but internally we give this variable a value to have the behaviour
+ we want (i.e. have SQL_LOG_UPDATE influence SQL_LOG_BIN or not).
As sql-bin-update-same, log-update and log-bin cannot be changed by the
- user after starting the server (they are not variables), the user will not
- later interfere with the settings we do here.
+ user after starting the server (they are not variables), the user will
+ not later interfere with the settings we do here.
*/
if (opt_bin_log)
{
@@ -2699,7 +2699,7 @@ version 5.0 and above. It is replaced by the binary log.");
opt_bin_log= 1;
if (opt_update_logname)
{
- // as opt_bin_log==0, no need to free opt_bin_logname
+ /* as opt_bin_log==0, no need to free opt_bin_logname */
if (!(opt_bin_logname= my_strdup(opt_update_logname, MYF(MY_WME))))
exit(EXIT_OUT_OF_MEMORY);
sql_print_error("The update log is no longer supported by MySQL in \
@@ -2714,8 +2714,8 @@ with --log-bin instead.");
}
if (opt_log_slave_updates && !opt_bin_log)
{
- sql_print_warning("You need to use --log-bin to make "
- "--log-slave-updates work.");
+ sql_print_warning("You need to use --log-bin to make "
+ "--log-slave-updates work.");
unireg_abort(1);
}
@@ -2777,7 +2777,15 @@ server.");
my_free(opt_bin_logname, MYF(MY_ALLOW_ZERO_PTR));
opt_bin_logname=my_strdup(buf, MYF(0));
}
- mysql_bin_log.open_index_file(opt_binlog_index_name, ln);
+ if (mysql_bin_log.open_index_file(opt_binlog_index_name, ln))
+ {
+ unireg_abort(1);
+ }
+
+ /*
+ Used to specify which type of lock we need to use for queries of type
+ INSERT ... SELECT. This will change when we have row level logging.
+ */
using_update_log=1;
}
@@ -2786,10 +2794,10 @@ server.");
sql_print_error("Can't init databases");
unireg_abort(1);
}
- tc_log= total_ha_2pc > 1 ? opt_bin_log ?
- (TC_LOG *)&mysql_bin_log :
- (TC_LOG *)&tc_log_mmap :
- (TC_LOG *)&tc_log_dummy;
+ tc_log= (total_ha_2pc > 1 ? (opt_bin_log ?
+ (TC_LOG *) &mysql_bin_log :
+ (TC_LOG *) &tc_log_mmap) :
+ (TC_LOG *) &tc_log_dummy);
if (tc_log->open(opt_bin_logname))
{
@@ -2804,7 +2812,7 @@ server.");
if (opt_bin_log && mysql_bin_log.open(opt_bin_logname, LOG_BIN, 0,
WRITE_CACHE, 0, max_binlog_size, 0))
- unireg_abort(1);
+ unireg_abort(1);
#ifdef HAVE_REPLICATION
if (opt_bin_log && expire_logs_days)
@@ -3569,11 +3577,8 @@ inline void kill_broken_server()
(!opt_disable_networking && ip_sock == INVALID_SOCKET))
{
select_thread_in_use = 0;
-#ifdef __NETWARE__
- kill_server(MYSQL_KILL_SIGNAL); /* never returns */
-#else
- kill_server((void*)MYSQL_KILL_SIGNAL); /* never returns */
-#endif /* __NETWARE__ */
+ /* The following call will never return */
+ kill_server(IF_NETWARE(MYSQL_KILL_SIGNAL, (void*) MYSQL_KILL_SIGNAL));
}
}
#define MAYBE_BROKEN_SYSCALL kill_broken_server();
@@ -4514,12 +4519,7 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite,
".",
(gptr*) &innobase_fast_shutdown,
(gptr*) &innobase_fast_shutdown, 0, GET_ULONG, OPT_ARG, 1, 0,
-#ifndef __NETWARE__
- 2,
-#else
- 1,
-#endif
- 0, 0, 0},
+ IF_NETWARE(1,2), 0, 0, 0},
{"innodb_file_per_table", OPT_INNODB_FILE_PER_TABLE,
"Stores each InnoDB table to an .ibd file in the database dir.",
(gptr*) &innobase_file_per_table,
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 4fbbeedb812..44539ec2d74 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -495,7 +495,7 @@ net_real_write(NET *net,const char *packet,ulong len)
thr_alarm(&alarmed,(uint) net->write_timeout,&alarm_buff);
#else
alarmed=0;
- vio_timeout(net->vio, net->write_timeout);
+ vio_timeout(net->vio, 1, net->write_timeout);
#endif /* NO_ALARM */
pos=(char*) packet; end=pos+len;
@@ -688,7 +688,7 @@ my_real_read(NET *net, ulong *complen)
if (net_blocking)
thr_alarm(&alarmed,net->read_timeout,&alarm_buff);
#else
- vio_timeout(net->vio, net->read_timeout);
+ vio_timeout(net->vio, 0, net->read_timeout);
#endif /* NO_ALARM */
pos = net->buff + net->where_b; /* net->packet -4 */
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 7dfee132ea9..85b5e7270ec 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -853,7 +853,7 @@ QUICK_ROR_INTERSECT_SELECT::QUICK_ROR_INTERSECT_SELECT(THD *thd_param,
bool retrieve_full_rows,
MEM_ROOT *parent_alloc)
: cpk_quick(NULL), thd(thd_param), need_to_fetch_row(retrieve_full_rows),
- scans_inited(false)
+ scans_inited(FALSE)
{
index= MAX_KEY;
head= table;
@@ -1022,7 +1022,7 @@ int QUICK_ROR_INTERSECT_SELECT::reset()
DBUG_ENTER("QUICK_ROR_INTERSECT_SELECT::reset");
if (!scans_inited && init_ror_merged_scan(TRUE))
DBUG_RETURN(1);
- scans_inited= true;
+ scans_inited= TRUE;
List_iterator_fast<QUICK_RANGE_SELECT> it(quick_selects);
QUICK_RANGE_SELECT *quick;
while ((quick= it++))
@@ -1066,7 +1066,7 @@ QUICK_ROR_INTERSECT_SELECT::~QUICK_ROR_INTERSECT_SELECT()
QUICK_ROR_UNION_SELECT::QUICK_ROR_UNION_SELECT(THD *thd_param,
TABLE *table)
- : thd(thd_param), scans_inited(false)
+ : thd(thd_param), scans_inited(FALSE)
{
index= MAX_KEY;
head= table;
@@ -1148,7 +1148,7 @@ int QUICK_ROR_UNION_SELECT::reset()
if (quick->init_ror_merged_scan(FALSE))
DBUG_RETURN(1);
}
- scans_inited= true;
+ scans_inited= TRUE;
}
queue_remove_all(&queue);
/*
@@ -2677,7 +2677,7 @@ static bool ror_intersect_add(ROR_INTERSECT_INFO *info,
{
/* Don't add this scan if it doesn't improve selectivity. */
DBUG_PRINT("info", ("The scan doesn't improve selectivity."));
- DBUG_RETURN(false);
+ DBUG_RETURN(FALSE);
}
info->out_rows *= selectivity_mult;
@@ -2865,7 +2865,7 @@ TRP_ROR_INTERSECT *get_best_ror_intersect(const PARAM *param, SEL_TREE *tree,
while (cur_ror_scan != tree->ror_scans_end && !intersect->is_covering)
{
/* S= S + first(R); R= R - first(R); */
- if (!ror_intersect_add(intersect, *cur_ror_scan, false))
+ if (!ror_intersect_add(intersect, *cur_ror_scan, FALSE))
{
cur_ror_scan++;
continue;
@@ -8080,7 +8080,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min()
}
else
{
- /* Apply the constant equality conditions to the non-group select fields. */
+ /* Apply the constant equality conditions to the non-group select fields */
if (key_infix_len > 0)
{
if ((result= file->index_read(record, group_prefix, real_prefix_len,
@@ -8114,9 +8114,10 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min()
*/
if (!result)
{
- if(key_cmp(index_info->key_part, group_prefix, real_prefix_len))
+ if (key_cmp(index_info->key_part, group_prefix, real_prefix_len))
key_restore(record, tmp_record, index_info, 0);
- } else if (result == HA_ERR_KEY_NOT_FOUND)
+ }
+ else if (result == HA_ERR_KEY_NOT_FOUND)
result= 0; /* There is a result in any case. */
}
}
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 134d3564ef8..ddeeb44c82b 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -313,7 +313,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
removed_tables is != 0 if we have used MIN() or MAX().
*/
if (removed_tables && used_tables != removed_tables)
- const_result= 0; // We didn't remove all tables
+ const_result= 0; // We didn't remove all tables
return const_result;
}
@@ -323,12 +323,14 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
SYNOPSIS
simple_pred()
- func_item in: Predicate item
+ func_item Predicate item
args out: Here we store the field followed by constants
- inv_order out: Is set to 1 if the predicate is of the form 'const op field'
+ inv_order out: Is set to 1 if the predicate is of the form
+ 'const op field'
RETURN
- 0 func_item is a simple predicate: a field is compared with constants
+ 0 func_item is a simple predicate: a field is compared with
+ constants
1 Otherwise
*/
diff --git a/sql/share/charsets/Index.xml b/sql/share/charsets/Index.xml
index 3c35ec98a92..a6bb4bad99b 100644
--- a/sql/share/charsets/Index.xml
+++ b/sql/share/charsets/Index.xml
@@ -367,6 +367,9 @@ To make maintaining easier please:
<order>Slovenian</order>
<order>Sorbian</order>
</collation>
+ <collation name="cp1250_croatian_ci" id="44">
+ <order>Croatian</order>
+ </collation>
<collation name="cp1250_czech_cs" id="34" order="Czech">
<flag>compiled</flag>
</collation>
diff --git a/sql/share/charsets/cp1250.xml b/sql/share/charsets/cp1250.xml
index 8e7102b6737..1e62e64ad5a 100644
--- a/sql/share/charsets/cp1250.xml
+++ b/sql/share/charsets/cp1250.xml
@@ -57,7 +57,7 @@
70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
80 81 82 83 84 85 86 87 88 89 9A 8B 9C 9D 9E 9F
90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 B3 A4 B9 A6 DF A8 A9 BA AB AC AD AE BF
+ A0 A1 A2 B3 A4 B9 A6 A7 A8 A9 BA AB AC AD AE BF
B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BE BD BE BF
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
@@ -82,7 +82,7 @@
A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
B0 B1 B2 A3 B4 B5 B6 B7 B8 A5 AA BB BC BD BC AF
C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE A7
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
</map>
@@ -132,6 +132,27 @@
</map>
</collation>
+<collation name="cp1250_croatian_ci">
+<map>
+00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+40 41 43 44 48 4B 4D 4E 4F 50 52 53 54 56 57 59
+5B 5C 5D 5F 62 64 66 67 68 69 6B 90 91 92 93 94
+95 41 43 44 48 4B 4D 4E 4F 50 52 53 54 56 57 59
+5B 5C 5D 5F 62 64 66 67 68 69 6B 96 97 98 99 9A
+9B 9C 9E 9F A0 A1 A2 A3 A4 A5 60 A6 5F 62 6C 6B
+A7 A8 A9 AA AB AC AD AE AF B0 60 B1 5F 62 6C 6B
+B2 B3 B4 54 B5 41 B6 B7 B8 B9 5F BA BB BC BD 6B
+BE BF C0 54 C1 C2 C3 C4 C5 41 5F C6 54 C7 54 6B
+5D 41 41 41 41 54 47 44 46 4B 4B 4B 4B 50 50 48
+4A 57 57 59 59 59 59 C8 5D 64 64 64 64 69 62 5F
+5D 41 41 41 41 54 47 44 46 4B 4B 4B 4B 50 50 48
+4A 57 57 59 59 59 59 C9 5D 64 64 64 64 69 62 FF
+</map>
+</collation>
+
<collation name="cp1250_czech_ci"/>
<collation name="cp1250_bin" flag="binary"/>
diff --git a/sql/share/charsets/latin2.xml b/sql/share/charsets/latin2.xml
index 3ae239cb8fd..7f00148a1df 100644
--- a/sql/share/charsets/latin2.xml
+++ b/sql/share/charsets/latin2.xml
@@ -135,22 +135,22 @@
<collation name="latin2_croatian_ci">
<map>
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 46 48 49 4A 4B 4C 4D 4E 4F 50 51 52
- 53 54 55 56 58 59 5A 5B 5C 5D 5E 5B 5C 5D 5E 5F
- 60 41 42 43 46 48 49 4A 4B 4C 4D 4E 4F 50 51 52
- 53 54 55 56 58 59 5A 5B 5C 5D 5E 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 57 8B 8C 8D 5F 8F
- 90 91 92 93 94 95 96 97 98 99 57 9B 9C 9D 5F 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- 41 41 41 41 5C 5B 45 43 44 45 45 45 49 49 49 49
- 47 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF
- 41 41 41 41 5C 5B 45 43 44 45 45 45 49 49 49 49
- 47 4E 4F 4F 4F 4F 5D F7 D8 55 55 55 59 59 DE FF
+00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+40 41 43 44 48 4B 4D 4E 4F 50 52 53 54 56 57 59
+5B 5C 5D 5F 62 64 66 67 68 69 6B C6 C7 C8 C9 CA
+CB 41 43 44 48 4B 4D 4E 4F 50 52 53 54 56 57 59
+5B 5C 5D 5F 62 64 66 67 68 69 6B CC CD CE CF D0
+D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0
+E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0
+F1 41 F2 54 F3 54 5F F4 F5 61 5F 62 6B F6 8E 6B
+F7 41 F8 54 F9 54 5F FA FB 61 5F 62 6B FC 8E 6B
+5D 41 41 41 41 54 47 44 46 4B 4B 4B 4B 50 50 48
+4A 57 57 59 59 59 59 FD 5D 64 64 64 64 69 62 5F
+5D 41 41 41 41 54 47 44 46 4B 4B 4B 4B 50 50 48
+4A 57 57 59 59 59 59 FE 5D 64 64 64 64 69 62 FF
</map>
</collation>
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 9fb4b1c7fac..0be93c3e41c 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -385,32 +385,33 @@ sp_head::create_typelib(List<String> *src)
return 0;
result->type_lengths= (unsigned int *)(result->type_names + result->count+1);
List_iterator<String> it(*src);
- String conv, *tmp;
- uint32 dummy;
- for (uint i=0; i<result->count; i++)
+ String conv;
+ for (uint i=0; i < result->count; i++)
{
- tmp = it++;
+ uint32 dummy;
+ uint length;
+ String *tmp= it++;
+
if (String::needs_conversion(tmp->length(), tmp->charset(),
cs, &dummy))
{
uint cnv_errs;
conv.copy(tmp->ptr(), tmp->length(), tmp->charset(), cs, &cnv_errs);
- char *buf= (char*) alloc_root(mem_root,conv.length()+1);
- memcpy(buf, conv.ptr(), conv.length());
- buf[conv.length()]= '\0';
- result->type_names[i]= buf;
- result->type_lengths[i]= conv.length();
+
+ length= conv.length();
+ result->type_names[i]= (char*) strmake_root(mem_root, conv.ptr(),
+ length);
}
- else {
- result->type_names[i]= strdup_root(mem_root, tmp->c_ptr());
- result->type_lengths[i]= tmp->length();
+ else
+ {
+ length= tmp->length();
+ result->type_names[i]= strmake_root(mem_root, tmp->ptr(), length);
}
// Strip trailing spaces.
- uint lengthsp= cs->cset->lengthsp(cs, result->type_names[i],
- result->type_lengths[i]);
- result->type_lengths[i]= lengthsp;
- ((uchar *)result->type_names[i])[lengthsp]= '\0';
+ length= cs->cset->lengthsp(cs, result->type_names[i], length);
+ result->type_lengths[i]= length;
+ ((uchar *)result->type_names[i])[length]= '\0';
}
result->type_names[result->count]= 0;
result->type_lengths[result->count]= 0;
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 2d2ad091471..743ab6cd45f 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -62,8 +62,7 @@ static bool allow_all_hosts=1;
static HASH acl_check_hosts, column_priv_hash, proc_priv_hash;
static DYNAMIC_ARRAY acl_wild_hosts;
static hash_filo *acl_cache;
-static uint grant_version=0;
-static uint priv_version=0; /* Version of priv tables. incremented by acl_init */
+static uint grant_version=0; /* Version of priv tables. incremented by acl_init */
static ulong get_access(TABLE *form,uint fieldnr, uint *next_field=0);
static int acl_compare(ACL_ACCESS *a,ACL_ACCESS *b);
static ulong get_sort(uint count,...);
@@ -152,7 +151,7 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
DBUG_RETURN(0); /* purecov: tested */
}
- priv_version++; /* Privileges updated */
+ grant_version++; /* Privileges updated */
mysql_proc_table_exists= 1; // Assume mysql.proc exists
/*
@@ -2172,10 +2171,14 @@ static int replace_column_table(GRANT_TABLE *g_t,
KEY_PART_INFO *key_part= table->key_info->key_part;
DBUG_ENTER("replace_column_table");
- table->field[0]->store(combo.host.str,combo.host.length, system_charset_info);
- table->field[1]->store(db,(uint) strlen(db), system_charset_info);
- table->field[2]->store(combo.user.str,combo.user.length, system_charset_info);
- table->field[3]->store(table_name,(uint) strlen(table_name), system_charset_info);
+ table->field[0]->store(combo.host.str,combo.host.length,
+ system_charset_info);
+ table->field[1]->store(db,(uint) strlen(db),
+ system_charset_info);
+ table->field[2]->store(combo.user.str,combo.user.length,
+ system_charset_info);
+ table->field[3]->store(table_name,(uint) strlen(table_name),
+ system_charset_info);
/* Get length of 3 first key parts */
key_prefix_length= (key_part[0].store_length + key_part[1].store_length +
@@ -2187,17 +2190,17 @@ static int replace_column_table(GRANT_TABLE *g_t,
/* first fix privileges for all columns in column list */
List_iterator <LEX_COLUMN> iter(columns);
- class LEX_COLUMN *xx;
+ class LEX_COLUMN *column;
table->file->ha_index_init(0);
- while ((xx=iter++))
+ while ((column= iter++))
{
- ulong privileges = xx->rights;
+ ulong privileges= column->rights;
bool old_row_exists=0;
byte user_key[MAX_KEY_LENGTH];
key_restore(table->record[0],key,table->key_info,
key_prefix_length);
- table->field[4]->store(xx->column.ptr(),xx->column.length(),
+ table->field[4]->store(column->column.ptr(), column->column.length(),
system_charset_info);
/* Get key for the first 4 columns */
key_copy(user_key, table->record[0], table->key_info,
@@ -2212,15 +2215,15 @@ static int replace_column_table(GRANT_TABLE *g_t,
{
my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0),
combo.user.str, combo.host.str,
- table_name); /* purecov: inspected */
- result= -1; /* purecov: inspected */
- continue; /* purecov: inspected */
+ table_name); /* purecov: inspected */
+ result= -1; /* purecov: inspected */
+ continue; /* purecov: inspected */
}
old_row_exists = 0;
restore_record(table, s->default_values); // Get empty record
key_restore(table->record[0],key,table->key_info,
key_prefix_length);
- table->field[4]->store(xx->column.ptr(),xx->column.length(),
+ table->field[4]->store(column->column.ptr(),column->column.length(),
system_charset_info);
}
else
@@ -2240,6 +2243,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
if (old_row_exists)
{
+ GRANT_COLUMN *grant_column;
if (privileges)
error=table->file->update_row(table->record[1],table->record[0]);
else
@@ -2250,21 +2254,21 @@ static int replace_column_table(GRANT_TABLE *g_t,
result= -1; /* purecov: inspected */
goto end; /* purecov: inspected */
}
- GRANT_COLUMN *grant_column = column_hash_search(g_t,
- xx->column.ptr(),
- xx->column.length());
+ grant_column= column_hash_search(g_t, column->column.ptr(),
+ column->column.length());
if (grant_column) // Should always be true
- grant_column->rights = privileges; // Update hash
+ grant_column->rights= privileges; // Update hash
}
else // new grant
{
+ GRANT_COLUMN *grant_column;
if ((error=table->file->write_row(table->record[0])))
{
table->file->print_error(error,MYF(0)); /* purecov: inspected */
result= -1; /* purecov: inspected */
goto end; /* purecov: inspected */
}
- GRANT_COLUMN *grant_column = new GRANT_COLUMN(xx->column,privileges);
+ grant_column= new GRANT_COLUMN(column->column,privileges);
my_hash_insert(&g_t->hash_columns,(byte*) grant_column);
}
}
@@ -2716,6 +2720,7 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
rw_wrlock(&LOCK_grant);
MEM_ROOT *old_root= thd->mem_root;
thd->mem_root= &memex;
+ grant_version++;
while ((Str = str_list++))
{
@@ -3684,9 +3689,9 @@ ulong get_column_grant(THD *thd, GRANT_INFO *grant,
grant_column= column_hash_search(grant_table, field_name,
(uint) strlen(field_name));
if (!grant_column)
- priv= grant->privilege;
+ priv= (grant->privilege | grant_table->privs);
else
- priv= grant->privilege | grant_column->rights;
+ priv= (grant->privilege | grant_table->privs | grant_column->rights);
}
rw_unlock(&LOCK_grant);
return priv;
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 30780eb1802..abdb21dae63 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1488,6 +1488,7 @@ bool wait_for_tables(THD *thd)
{
/* Now we can open all tables without any interference */
thd->proc_info="Reopen tables";
+ thd->version= refresh_version;
result=reopen_tables(thd,0,0);
}
pthread_mutex_unlock(&LOCK_open);
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 729f9751bba..f2b363a622b 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -897,7 +897,11 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
goto err;
if ((error=table->file->update_row(table->record[1],table->record[0])))
+ {
+ if ((error == HA_ERR_FOUND_DUPP_KEY) && info->ignore)
+ break;
goto err;
+ }
info->updated++;
break;
}
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 43728cc38ba..bc6d7821268 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1055,7 +1055,7 @@ pthread_handler_decl(handle_one_connection,arg)
/* now that we've called my_thread_init(), it is safe to call DBUG_* */
#if defined(__WIN__)
- init_signals(); // IRENA; testing ?
+ init_signals();
#elif !defined(OS2) && !defined(__NETWARE__)
sigset_t set;
VOID(sigemptyset(&set)); // Get mask in use
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 6e28e50b217..47c7de6eba7 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -5403,10 +5403,15 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
tab->select_cond=sel->cond=tmp;
if (thd->variables.engine_condition_pushdown)
{
+ COND *push_cond=
+ make_cond_for_table(cond,current_map,current_map);
tab->table->file->pushed_cond= NULL;
- /* Push condition to handler */
- if (!tab->table->file->cond_push(tmp))
- tab->table->file->pushed_cond= tmp;
+ if (push_cond)
+ {
+ /* Push condition to handler */
+ if (!tab->table->file->cond_push(push_cond))
+ tab->table->file->pushed_cond= push_cond;
+ }
}
}
else
@@ -5530,13 +5535,6 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
thd->memdup((gptr) sel, sizeof(SQL_SELECT));
tab->cache.select->cond=tmp;
tab->cache.select->read_tables=join->const_table_map;
- if (thd->variables.engine_condition_pushdown &&
- (!tab->table->file->pushed_cond))
- {
- /* Push condition to handler */
- if (!tab->table->file->cond_push(tmp))
- tab->table->file->pushed_cond= tmp;
- }
}
}
}
@@ -7955,20 +7953,20 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
temp_pool_slot = bitmap_set_next(&temp_pool);
if (temp_pool_slot != MY_BIT_NONE) // we got a slot
- sprintf(filename, "%s_%lx_%i", tmp_file_prefix,
- current_pid, temp_pool_slot);
+ sprintf(path, "%s_%lx_%i", tmp_file_prefix,
+ current_pid, temp_pool_slot);
else
{
/* if we run out of slots or we are not using tempool */
- sprintf(filename,"%s%lx_%lx_%x",tmp_file_prefix,current_pid,
+ sprintf(path,"%s%lx_%lx_%x", tmp_file_prefix,current_pid,
thd->thread_id, thd->tmp_table++);
}
/*
- No need for change table name to lower case as we are only creating
+ No need to change table name to lower case as we are only creating
MyISAM or HEAP tables here
*/
- sprintf(path, "%s%s", mysql_tmpdir, filename);
+ fn_format(path, path, mysql_tmpdir, "", MY_REPLACE_EXT|MY_UNPACK_FILENAME);
if (group)
{
@@ -11657,11 +11655,13 @@ cp_buffer_from_ref(THD *thd, TABLE_REF *ref)
enum enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
for (store_key **copy=ref->key_copy ; *copy ; copy++)
+ {
if ((*copy)->copy())
{
thd->count_cuted_fields= save_count_cuted_fields;
return 1; // Something went wrong
}
+ }
thd->count_cuted_fields= save_count_cuted_fields;
return 0;
}
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index cf0050a774b..9e3f82f9fd6 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1600,6 +1600,8 @@ LEX_STRING *make_lex_string(THD *thd, LEX_STRING *lex_str,
/* INFORMATION_SCHEMA name */
LEX_STRING information_schema_name= {(char*)"information_schema", 18};
+
+/* This is only used internally, but we need it here as a forward reference */
extern ST_SCHEMA_TABLE schema_tables[];
typedef struct st_index_field_values
@@ -1693,8 +1695,8 @@ bool uses_only_table_name_fields(Item *item, TABLE_LIST *table)
CHARSET_INFO *cs= system_charset_info;
ST_SCHEMA_TABLE *schema_table= table->schema_table;
ST_FIELD_INFO *field_info= schema_table->fields_info;
- const char *field_name1= field_info[schema_table->idx_field1].field_name;
- const char *field_name2= field_info[schema_table->idx_field2].field_name;
+ const char *field_name1= schema_table->idx_field1 >= 0 ? field_info[schema_table->idx_field1].field_name : "";
+ const char *field_name2= schema_table->idx_field2 >= 0 ? field_info[schema_table->idx_field2].field_name : "";
if (table->table != item_field->field->table ||
(cs->coll->strnncollsp(cs, (uchar *) field_name1, strlen(field_name1),
(uchar *) item_field->field_name,
@@ -2000,11 +2002,12 @@ err:
bool store_schema_shemata(THD* thd, TABLE *table, const char *db_name,
- const char* cs_name)
+ CHARSET_INFO *cs)
{
restore_record(table, s->default_values);
table->field[1]->store(db_name, strlen(db_name), system_charset_info);
- table->field[2]->store(cs_name, strlen(cs_name), system_charset_info);
+ table->field[2]->store(cs->csname, strlen(cs->csname), system_charset_info);
+ table->field[3]->store(cs->name, strlen(cs->name), system_charset_info);
return schema_table_store_record(thd, table);
}
@@ -2035,7 +2038,7 @@ int fill_schema_shemata(THD *thd, TABLE_LIST *tables, COND *cond)
if (with_i_schema) // information schema name is always first in list
{
if (store_schema_shemata(thd, table, file_name,
- system_charset_info->csname))
+ system_charset_info))
DBUG_RETURN(1);
with_i_schema= 0;
continue;
@@ -2060,7 +2063,7 @@ int fill_schema_shemata(THD *thd, TABLE_LIST *tables, COND *cond)
strmov(path+length, MY_DB_OPT_FILE);
load_db_opt(thd, path, &create);
if (store_schema_shemata(thd, table, file_name,
- create.default_table_charset->csname))
+ create.default_table_charset))
DBUG_RETURN(1);
}
}
@@ -2300,10 +2303,11 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
uint col_access;
check_access(thd,SELECT_ACL | EXTRA_ACL, base_name,
&tables->grant.privilege, 0, 0);
- col_access= get_column_grant(thd, &tables->grant, tables->db,
- tables->table_name,
+ col_access= get_column_grant(thd, &tables->grant,
+ base_name, file_name,
field->field_name) & COL_ACLS;
- if (lex->orig_sql_command != SQLCOM_SHOW_FIELDS && !col_access)
+ if (lex->orig_sql_command != SQLCOM_SHOW_FIELDS &&
+ !tables->schema_table && !col_access)
continue;
for (uint bitnr=0; col_access ; col_access>>=1,bitnr++)
{
@@ -2313,11 +2317,16 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
end=strmov(end,grant_types.type_names[bitnr]);
}
}
+ if (tables->schema_table) // any user has 'select' privilege on all
+ // I_S table columns
+ table->field[17]->store(grant_types.type_names[0],
+ strlen(grant_types.type_names[0]), cs);
+ else
+ table->field[17]->store(tmp+1,end == tmp ? 0 : (uint) (end-tmp-1), cs);
+
#else
*end= 0;
#endif
- table->field[17]->store(tmp+1,end == tmp ? 0 : (uint) (end-tmp-1), cs);
-
table->field[1]->store(base_name, strlen(base_name), cs);
table->field[2]->store(file_name, strlen(file_name), cs);
table->field[3]->store(field->field_name, strlen(field->field_name),
@@ -3482,6 +3491,7 @@ ST_FIELD_INFO schema_fields_info[]=
{"CATALOG_NAME", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
{"SCHEMA_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Database"},
{"DEFAULT_CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 0, 0},
+ {"DEFAULT_COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 0, 0},
{"SQL_PATH", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
};
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 38944e3117d..bbe7c53147b 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -38,6 +38,7 @@ static int copy_data_between_tables(TABLE *from,TABLE *to,
bool ignore,
uint order_num, ORDER *order,
ha_rows *copied,ha_rows *deleted);
+static bool prepare_blob_field(THD *thd, create_field *sql_field);
/*
delete (drop) tables.
@@ -700,21 +701,20 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
String conv, *tmp;
for (uint i= 0; (tmp= it++); i++)
{
+ uint lengthsp;
if (String::needs_conversion(tmp->length(), tmp->charset(),
cs, &dummy))
{
uint cnv_errs;
conv.copy(tmp->ptr(), tmp->length(), tmp->charset(), cs, &cnv_errs);
- char *buf= (char*) sql_alloc(conv.length()+1);
- memcpy(buf, conv.ptr(), conv.length());
- buf[conv.length()]= '\0';
- interval->type_names[i]= buf;
+ interval->type_names[i]= strmake_root(thd->mem_root, conv.ptr(),
+ conv.length());
interval->type_lengths[i]= conv.length();
}
// Strip trailing spaces.
- uint lengthsp= cs->cset->lengthsp(cs, interval->type_names[i],
- interval->type_lengths[i]);
+ lengthsp= cs->cset->lengthsp(cs, interval->type_names[i],
+ interval->type_lengths[i]);
interval->type_lengths[i]= lengthsp;
((uchar *)interval->type_names[i])[lengthsp]= '\0';
}
@@ -781,37 +781,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
}
sql_field->create_length_to_internal_length();
- if (sql_field->length > MAX_FIELD_VARCHARLENGTH &&
- !(sql_field->flags & BLOB_FLAG))
- {
- /* Convert long VARCHAR columns to TEXT or BLOB */
- char warn_buff[MYSQL_ERRMSG_SIZE];
-
- if (sql_field->def)
- {
- my_error(ER_TOO_BIG_FIELDLENGTH, MYF(0), sql_field->field_name,
- MAX_FIELD_VARCHARLENGTH / sql_field->charset->mbmaxlen);
- DBUG_RETURN(-1);
- }
- sql_field->sql_type= FIELD_TYPE_BLOB;
- sql_field->flags|= BLOB_FLAG;
- sprintf(warn_buff, ER(ER_AUTO_CONVERT), sql_field->field_name,
- "VARCHAR",
- (sql_field->charset == &my_charset_bin) ? "BLOB" : "TEXT");
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_AUTO_CONVERT,
- warn_buff);
- }
-
- if ((sql_field->flags & BLOB_FLAG) && sql_field->length)
- {
- if (sql_field->sql_type == FIELD_TYPE_BLOB)
- {
- /* The user has given a length to the blob column */
- sql_field->sql_type= get_blob_type_from_length(sql_field->length);
- sql_field->pack_length= calc_pack_length(sql_field->sql_type, 0);
- }
- sql_field->length= 0; // Probably from an item
- }
+ if (prepare_blob_field(thd, sql_field))
+ DBUG_RETURN(-1);
if (!(sql_field->flags & NOT_NULL_FLAG))
null_fields++;
@@ -1352,6 +1323,58 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
/*
+ Extend long VARCHAR fields to blob & prepare field if it's a blob
+
+ SYNOPSIS
+ prepare_blob_field()
+ sql_field Field to check
+
+ RETURN
+ 0 ok
+ 1 Error (sql_field can't be converted to blob)
+ In this case the error is given
+*/
+
+static bool prepare_blob_field(THD *thd, create_field *sql_field)
+{
+ DBUG_ENTER("prepare_blob_field");
+
+ if (sql_field->length > MAX_FIELD_VARCHARLENGTH &&
+ !(sql_field->flags & BLOB_FLAG))
+ {
+ /* Convert long VARCHAR columns to TEXT or BLOB */
+ char warn_buff[MYSQL_ERRMSG_SIZE];
+
+ if (sql_field->def)
+ {
+ my_error(ER_TOO_BIG_FIELDLENGTH, MYF(0), sql_field->field_name,
+ MAX_FIELD_VARCHARLENGTH / sql_field->charset->mbmaxlen);
+ DBUG_RETURN(1);
+ }
+ sql_field->sql_type= FIELD_TYPE_BLOB;
+ sql_field->flags|= BLOB_FLAG;
+ sprintf(warn_buff, ER(ER_AUTO_CONVERT), sql_field->field_name,
+ "VARCHAR",
+ (sql_field->charset == &my_charset_bin) ? "BLOB" : "TEXT");
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_AUTO_CONVERT,
+ warn_buff);
+ }
+
+ if ((sql_field->flags & BLOB_FLAG) && sql_field->length)
+ {
+ if (sql_field->sql_type == FIELD_TYPE_BLOB)
+ {
+ /* The user has given a length to the blob column */
+ sql_field->sql_type= get_blob_type_from_length(sql_field->length);
+ sql_field->pack_length= calc_pack_length(sql_field->sql_type, 0);
+ }
+ sql_field->length= 0;
+ }
+ DBUG_RETURN(0);
+}
+
+
+/*
Preparation of create_field for SP function return values.
Based on code used in the inner loop of mysql_prepare_table() above
@@ -1395,33 +1418,12 @@ void sp_prepare_create_field(THD *thd, create_field *sql_field)
FIELDFLAG_TREAT_BIT_AS_CHAR;
}
sql_field->create_length_to_internal_length();
+ DBUG_ASSERT(sql_field->def == 0);
+ /* Can't go wrong as sql_field->def is not defined */
+ (void) prepare_blob_field(thd, sql_field);
+}
- if (sql_field->length > MAX_FIELD_VARCHARLENGTH &&
- !(sql_field->flags & BLOB_FLAG))
- {
- /* Convert long VARCHAR columns to TEXT or BLOB */
- char warn_buff[MYSQL_ERRMSG_SIZE];
-
- sql_field->sql_type= FIELD_TYPE_BLOB;
- sql_field->flags|= BLOB_FLAG;
- sprintf(warn_buff, ER(ER_AUTO_CONVERT), sql_field->field_name,
- "VARCHAR",
- (sql_field->charset == &my_charset_bin) ? "BLOB" : "TEXT");
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_AUTO_CONVERT,
- warn_buff);
- }
- if ((sql_field->flags & BLOB_FLAG) && sql_field->length)
- {
- if (sql_field->sql_type == FIELD_TYPE_BLOB)
- {
- /* The user has given a length to the blob column */
- sql_field->sql_type= get_blob_type_from_length(sql_field->length);
- sql_field->pack_length= calc_pack_length(sql_field->sql_type, 0);
- }
- sql_field->length= 0; // Probably from an item
- }
-}
/*
Create a table
@@ -2342,6 +2344,13 @@ send_result_message:
}
close_thread_tables(thd);
table->table=0; // For query cache
+ /*
+ thd->lex->derived_tables may be set to non zero value if we open
+ a view. It is necessary to clear thd->lex->derived_tables flag
+ to prevent processing of derived tables during next open_and_lock_tables
+ if next table is a real table.
+ */
+ thd->lex->derived_tables= 0;
if (protocol->write())
goto err;
}
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index c2cd0d59cc3..722568e7f53 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -183,7 +183,7 @@ TEST_join(JOIN *join)
else if (tab->select->quick)
{
fprintf(DBUG_FILE, " quick select used:\n");
- tab->select->quick->dbug_dump(18, false);
+ tab->select->quick->dbug_dump(18, FALSE);
}
else
VOID(fputs(" select used\n",DBUG_FILE));
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 5b6f12eab52..680a80431c5 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -28,7 +28,7 @@ static File_option triggers_file_parameters[]=
mysql_create_or_drop_trigger()
thd - current thread context (including trigger definition in LEX)
tables - table list containing one table for which trigger is created.
- create - whenever we create (true) or drop (false) trigger
+ create - whenever we create (TRUE) or drop (FALSE) trigger
NOTE
This function is mainly responsible for opening and locking of table and
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 80bf409f7a4..2231df3f4c1 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1409,8 +1409,7 @@ create_function_tail:
sp->m_returns_cs= new_field->charset;
- if (new_field->sql_type == FIELD_TYPE_SET ||
- new_field->sql_type == FIELD_TYPE_ENUM)
+ if (new_field->interval_list.elements)
{
new_field->interval=
sp->create_typelib(&new_field->interval_list);
@@ -4459,8 +4458,6 @@ simple_expr:
{ $$= new Item_func_export_set($3, $5, $7, $9); }
| EXPORT_SET '(' expr ',' expr ',' expr ',' expr ',' expr ')'
{ $$= new Item_func_export_set($3, $5, $7, $9, $11); }
- | FALSE_SYM
- { $$= new Item_int((char*) "FALSE",0,1); }
| FORMAT_SYM '(' expr ',' NUM ')'
{ $$= new Item_func_format($3,atoi($5.str)); }
| FROM_UNIXTIME '(' expr ')'
@@ -4619,8 +4616,6 @@ simple_expr:
{ $$= new Item_func_trim($5,$3); }
| TRUNCATE_SYM '(' expr ',' expr ')'
{ $$= new Item_func_round($3,$5,1); }
- | TRUE_SYM
- { $$= new Item_int((char*) "TRUE",1,1); }
| ident '.' ident '(' udf_expr_list ')'
{
LEX *lex= Lex;
@@ -6835,6 +6830,8 @@ literal:
| NUM_literal { $$ = $1; }
| NULL_SYM { $$ = new Item_null();
Lex->next_state=MY_LEX_OPERATOR_OR_IDENT;}
+ | FALSE_SYM { $$= new Item_int((char*) "FALSE",0,1); }
+ | TRUE_SYM { $$= new Item_int((char*) "TRUE",1,1); }
| HEX_NUM { $$ = new Item_hex_string($1.str, $1.length);}
| BIN_NUM { $$= new Item_bin_string($1.str, $1.length); }
| UNDERSCORE_CHARSET HEX_NUM
diff --git a/sql/unireg.cc b/sql/unireg.cc
index e29b97a3f03..00fc80a25fe 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -504,6 +504,7 @@ static bool pack_header(uchar *forminfo, enum db_type table_type,
int2store(forminfo+280,22); /* Rows needed */
int2store(forminfo+282,null_fields);
int2store(forminfo+284,com_length);
+ /* Up to forminfo+288 is free to use for additional information */
DBUG_RETURN(0);
} /* pack_header */
diff --git a/storage/ndb/src/cw/cpcd/Process.cpp b/storage/ndb/src/cw/cpcd/Process.cpp
index 2509f34e882..b0ebbadb017 100644
--- a/storage/ndb/src/cw/cpcd/Process.cpp
+++ b/storage/ndb/src/cw/cpcd/Process.cpp
@@ -220,8 +220,11 @@ set_ulimit(const BaseString & pair){
if(!(list[1].trim() == "unlimited")){
value = atoi(list[1].c_str());
}
-
+#if defined(__INTEL_COMPILER)
+ struct rlimit64 rlp;
+#else
struct rlimit rlp;
+#endif
#define _RLIMIT_FIX(x) { res = getrlimit(x,&rlp); if(!res){ rlp.rlim_cur = value; res = setrlimit(x, &rlp); }}
if(list[0].trim() == "c"){
diff --git a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
index 284e2cda2e6..0b68bc966d6 100644
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
@@ -4218,12 +4218,14 @@ calcLHbits(Uint32 * lhPageBits, Uint32 * lhDistrBits,
tmp <<= 1;
distrBits++;
}//while
+#ifdef ndb_classical_lhdistrbits
if (tmp != totalFragments) {
tmp >>= 1;
if ((fid >= (totalFragments - tmp)) && (fid < (tmp - 1))) {
distrBits--;
}//if
}//if
+#endif
* lhPageBits = pageBits;
* lhDistrBits = distrBits;
diff --git a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
index f76440a462a..b3fc6e04d6c 100644
--- a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
+++ b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
@@ -799,7 +799,11 @@ AsyncFile::rmrfReq(Request * request, char * path, bool removePath){
request->error = errno;
return;
}
+#if defined(__INTEL_COMPILER)
+ struct dirent64 * dp;
+#else
struct dirent * dp;
+#endif
while ((dp = readdir(dirp)) != NULL){
if ((strcmp(".", dp->d_name) != 0) && (strcmp("..", dp->d_name) != 0)) {
BaseString::snprintf(path_add, (size_t)path_max_copy, "%s%s",
diff --git a/storage/ndb/src/kernel/error/ErrorReporter.cpp b/storage/ndb/src/kernel/error/ErrorReporter.cpp
index 35cd3f099d9..7c77e7932ee 100644
--- a/storage/ndb/src/kernel/error/ErrorReporter.cpp
+++ b/storage/ndb/src/kernel/error/ErrorReporter.cpp
@@ -237,6 +237,11 @@ WriteMessage(ErrorCategory thrdType, int thrdMessageID,
// Create a new file, and skip the first 69 bytes,
// which are info about the current offset
stream = fopen(theErrorFileName, "w");
+ if(stream == NULL)
+ {
+ fprintf(stderr,"Unable to open error log file: %s\n", theErrorFileName);
+ return -1;
+ }
fprintf(stream, "%s%u%s", "Current byte-offset of file-pointer is: ", 69,
" \n\n\n");
diff --git a/storage/ndb/src/ndbapi/Ndb.cpp b/storage/ndb/src/ndbapi/Ndb.cpp
index c01ce823dc0..5efef1b0112 100644
--- a/storage/ndb/src/ndbapi/Ndb.cpp
+++ b/storage/ndb/src/ndbapi/Ndb.cpp
@@ -764,7 +764,7 @@ Ndb::getAutoIncrementValue(const char* aTableName, Uint32 cacheSize)
DBUG_RETURN(~(Uint64)0);
const NdbTableImpl *table= info->m_table_impl;
Uint64 tupleId = getTupleIdFromNdb(table->m_tableId, cacheSize);
- DBUG_PRINT("info", ("value %u", tupleId));
+ DBUG_PRINT("info", ("value %ul", (ulong) tupleId));
DBUG_RETURN(tupleId);
}
@@ -776,7 +776,7 @@ Ndb::getAutoIncrementValue(const NdbDictionary::Table * aTable, Uint32 cacheSize
DBUG_RETURN(~(Uint64)0);
const NdbTableImpl* table = & NdbTableImpl::getImpl(*aTable);
Uint64 tupleId = getTupleIdFromNdb(table->m_tableId, cacheSize);
- DBUG_PRINT("info", ("value %u", tupleId));
+ DBUG_PRINT("info", ("value %ul", (ulong) tupleId));
DBUG_RETURN(tupleId);
}
@@ -796,7 +796,8 @@ Ndb::getTupleIdFromNdb(Uint32 aTableId, Uint32 cacheSize)
if ( theFirstTupleId[aTableId] != theLastTupleId[aTableId] )
{
theFirstTupleId[aTableId]++;
- DBUG_PRINT("info", ("next cached value %u", theFirstTupleId[aTableId]));
+ DBUG_PRINT("info", ("next cached value %ul",
+ (ulong) theFirstTupleId[aTableId]));
DBUG_RETURN(theFirstTupleId[aTableId]);
}
else // theFirstTupleId == theLastTupleId
@@ -817,7 +818,7 @@ Ndb::readAutoIncrementValue(const char* aTableName)
DBUG_RETURN(~(Uint64)0);
}
Uint64 tupleId = readTupleIdFromNdb(table->m_tableId);
- DBUG_PRINT("info", ("value %u", tupleId));
+ DBUG_PRINT("info", ("value %ul", (ulong) tupleId));
DBUG_RETURN(tupleId);
}
@@ -829,7 +830,7 @@ Ndb::readAutoIncrementValue(const NdbDictionary::Table * aTable)
DBUG_RETURN(~(Uint64)0);
const NdbTableImpl* table = & NdbTableImpl::getImpl(*aTable);
Uint64 tupleId = readTupleIdFromNdb(table->m_tableId);
- DBUG_PRINT("info", ("value %u", tupleId));
+ DBUG_PRINT("info", ("value %ul", (ulong) tupleId));
DBUG_RETURN(tupleId);
}
diff --git a/strings/decimal.c b/strings/decimal.c
index 4b7dc8803ee..3fa06132cf1 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -1612,13 +1612,19 @@ static int do_add(decimal_t *from1, decimal_t *from2, decimal_t *to)
x=intg1 > intg2 ? from1->buf[0] :
intg2 > intg1 ? from2->buf[0] :
from1->buf[0] + from2->buf[0] ;
- if (unlikely(x > DIG_MASK*9)) /* yes, there is */
+ if (unlikely(x > DIG_MAX-1)) /* yes, there is */
{
intg0++;
to->buf[0]=0; /* safety */
}
FIX_INTG_FRAC_ERROR(to->len, intg0, frac0, error);
+ if (unlikely(error == E_DEC_OVERFLOW))
+ {
+ max_decimal(to->len * DIG_PER_DEC1, 0, to);
+ return error;
+ }
+
buf0=to->buf+intg0+frac0;
to->sign=from1->sign;
@@ -1703,19 +1709,23 @@ static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to)
carry=1;
else if (intg2 == intg1)
{
- while (unlikely(stop1[frac1-1] == 0))
- frac1--;
- while (unlikely(stop2[frac2-1] == 0))
- frac2--;
- while (buf1 < stop1+frac1 && buf2 < stop2+frac2 && *buf1 == *buf2)
+ dec1 *end1= stop1 + (frac1 - 1);
+ dec1 *end2= stop2 + (frac2 - 1);
+ while (unlikely((buf1 <= end1) && (*end1 == 0)))
+ end1--;
+ while (unlikely((buf2 <= end2) && (*end2 == 0)))
+ end2--;
+ frac1= (end1 - stop1) + 1;
+ frac2= (end2 - stop2) + 1;
+ while (buf1 <=end1 && buf2 <= end2 && *buf1 == *buf2)
buf1++, buf2++;
- if (buf1 < stop1+frac1)
- if (buf2 < stop2+frac2)
+ if (buf1 <= end1)
+ if (buf2 <= end2)
carry= *buf2 > *buf1;
else
carry= 0;
else
- if (buf2 < stop2+frac2)
+ if (buf2 <= end2)
carry=1;
else /* short-circuit everything: from1 == from2 */
{
@@ -1914,6 +1924,17 @@ int decimal_mul(decimal_t *from1, decimal_t *from2, decimal_t *to)
for (; carry; buf0--)
ADD(*buf0, *buf0, 0, carry);
}
+
+ /* Now we have to check for -0.000 case */
+ if (to->sign)
+ {
+ dec1 *buf= to->buf;
+ dec1 *end= to->buf + intg0 + frac0;
+ for (; (buf<end) && !*buf; buf++);
+ if (buf == end)
+ /* So we got decimal zero */
+ decimal_make_zero(to);
+ }
return error;
}
diff --git a/vio/vio_priv.h b/vio/vio_priv.h
index 9a925a2c4c9..3a75a08021d 100644
--- a/vio/vio_priv.h
+++ b/vio/vio_priv.h
@@ -23,7 +23,7 @@
#include <m_string.h>
#include <violite.h>
-void vio_ignore_timeout(Vio *vio, uint timeout);
+void vio_ignore_timeout(Vio *vio, uint which, uint timeout);
#ifdef HAVE_OPENSSL
#include "my_net.h" /* needed because of struct in_addr */
@@ -31,7 +31,7 @@ void vio_ignore_timeout(Vio *vio, uint timeout);
void vio_ssl_delete(Vio* vio);
int vio_ssl_read(Vio *vio,gptr buf, int size);
int vio_ssl_write(Vio *vio,const gptr buf,int size);
-void vio_ssl_timeout(Vio *vio, uint timeout);
+void vio_ssl_timeout(Vio *vio, uint which, uint timeout);
/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible. */
int vio_ssl_fastsend(Vio *vio);
diff --git a/vio/viosocket.c b/vio/viosocket.c
index ea85a69e2d4..ee8e85880ba 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -364,12 +364,14 @@ my_bool vio_poll_read(Vio *vio,uint timeout)
void vio_timeout(Vio *vio __attribute__((unused)),
- uint timeout __attribute__((unused)))
+ uint which __attribute__((unused)),
+ uint timeout __attribute__((unused)))
{
#ifdef __WIN__
ulong wait_timeout= (ulong) timeout * 1000;
- (void) setsockopt(vio->sd, SOL_SOCKET, SO_RCVTIMEO, (char*) &wait_timeout,
- sizeof(wait_timeout));
+ (void) setsockopt(vio->sd, SOL_SOCKET,
+ which ? SO_SNDTIMEO : SO_RCVTIMEO, (char*) &wait_timeout,
+ sizeof(wait_timeout));
#endif /* __WIN__ */
}
diff --git a/vio/viossl.c b/vio/viossl.c
index 400d8842fd3..4233b276346 100644
--- a/vio/viossl.c
+++ b/vio/viossl.c
@@ -424,7 +424,8 @@ int vio_ssl_blocking(Vio * vio __attribute__((unused)),
void vio_ssl_timeout(Vio *vio __attribute__((unused)),
- uint timeout __attribute__((unused)))
+ uint which __attribute__((unused)),
+ uint timeout __attribute__((unused)))
{
/* Not yet implemented (non critical) */
}