summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xBUILD/compile-pentium-debug-max-no-embedded13
-rw-r--r--client/mysql.cc4
-rw-r--r--client/mysqlcheck.c3
-rw-r--r--client/mysqldump.c30
-rw-r--r--client/mysqlimport.c3
-rw-r--r--configure.in5
-rw-r--r--include/m_ctype.h4
-rw-r--r--include/m_string.h6
-rw-r--r--include/my_global.h14
-rw-r--r--include/mysql.h7
-rw-r--r--innobase/srv/srv0srv.c2
-rw-r--r--libmysql/Makefile.shared2
-rw-r--r--libmysql/client_settings.h1
-rw-r--r--libmysql/libmysql.c142
-rw-r--r--libmysqld/lib_sql.cc30
-rw-r--r--myisam/ft_boolean_search.c48
-rw-r--r--myisam/ft_parser.c40
-rw-r--r--mysql-test/r/cast.result6
-rw-r--r--mysql-test/r/ctype_many.result123
-rw-r--r--mysql-test/r/ctype_utf8.result81
-rw-r--r--mysql-test/r/derived.result6
-rw-r--r--mysql-test/r/fulltext.result3
-rw-r--r--mysql-test/r/func_system.result14
-rw-r--r--mysql-test/r/grant.result8
-rw-r--r--mysql-test/r/mysqldump.result51
-rw-r--r--mysql-test/r/rpl_log.result22
-rw-r--r--mysql-test/r/show_check.result48
-rw-r--r--mysql-test/r/subselect.result13
-rw-r--r--mysql-test/r/union.result38
-rw-r--r--mysql-test/r/warnings.result6
-rw-r--r--mysql-test/t/cast.test2
-rw-r--r--mysql-test/t/ctype_many.test5
-rw-r--r--mysql-test/t/ctype_utf8.test44
-rw-r--r--mysql-test/t/fulltext.test4
-rw-r--r--mysql-test/t/func_system.test6
-rw-r--r--mysql-test/t/grant.test8
-rw-r--r--mysql-test/t/mysqldump.test24
-rw-r--r--mysql-test/t/rpl_log.test2
-rw-r--r--mysql-test/t/show_check.test40
-rw-r--r--mysql-test/t/subselect.test13
-rw-r--r--mysql-test/t/union.test21
-rw-r--r--mysys/mf_keycache.c4
-rw-r--r--mysys/my_new.cc4
-rw-r--r--mytest-old.c169
-rw-r--r--sql-common/client.c4
-rw-r--r--sql/field.cc32
-rw-r--r--sql/field.h9
-rw-r--r--sql/gstream.cc2
-rw-r--r--sql/init.cc3
-rw-r--r--sql/item.cc2
-rw-r--r--sql/item.h2
-rw-r--r--sql/item_func.cc2
-rw-r--r--sql/item_strfunc.cc40
-rw-r--r--sql/item_strfunc.h14
-rw-r--r--sql/item_sum.h6
-rw-r--r--sql/mysql_priv.h2
-rw-r--r--sql/protocol.cc9
-rw-r--r--sql/set_var.cc1
-rw-r--r--sql/share/czech/errmsg.txt8
-rw-r--r--sql/share/danish/errmsg.txt8
-rw-r--r--sql/share/dutch/errmsg.txt8
-rw-r--r--sql/share/english/errmsg.txt8
-rw-r--r--sql/share/estonian/errmsg.txt8
-rw-r--r--sql/share/french/errmsg.txt8
-rw-r--r--sql/share/german/errmsg.txt6
-rw-r--r--sql/share/greek/errmsg.txt8
-rw-r--r--sql/share/hungarian/errmsg.txt8
-rw-r--r--sql/share/italian/errmsg.txt8
-rw-r--r--sql/share/japanese/errmsg.txt8
-rw-r--r--sql/share/korean/errmsg.txt8
-rw-r--r--sql/share/norwegian-ny/errmsg.txt8
-rw-r--r--sql/share/norwegian/errmsg.txt8
-rw-r--r--sql/share/polish/errmsg.txt8
-rw-r--r--sql/share/portuguese/errmsg.txt6
-rw-r--r--sql/share/romanian/errmsg.txt8
-rw-r--r--sql/share/russian/errmsg.txt10
-rw-r--r--sql/share/serbian/errmsg.txt8
-rw-r--r--sql/share/slovak/errmsg.txt8
-rw-r--r--sql/share/spanish/errmsg.txt8
-rw-r--r--sql/share/swedish/errmsg.txt18
-rw-r--r--sql/share/ukrainian/errmsg.txt10
-rw-r--r--sql/sql_acl.cc4
-rw-r--r--sql/sql_analyse.cc2
-rw-r--r--sql/sql_class.h5
-rw-r--r--sql/sql_lex.cc89
-rw-r--r--sql/sql_parse.cc50
-rw-r--r--sql/sql_select.cc4
-rw-r--r--sql/sql_show.cc76
-rw-r--r--sql/sql_string.cc2
-rw-r--r--sql/sql_table.cc21
-rw-r--r--sql/sql_union.cc4
-rw-r--r--sql/sql_yacc.yy37
-rw-r--r--strings/Makefile.am6
-rw-r--r--strings/atof.c207
-rw-r--r--strings/ctype-mb.c17
-rw-r--r--strings/ctype-simple.c6
-rw-r--r--strings/ctype-ucs2.c6
-rw-r--r--strings/strtod.c140
-rw-r--r--tests/client_test.c495
99 files changed, 1453 insertions, 1159 deletions
diff --git a/BUILD/compile-pentium-debug-max-no-embedded b/BUILD/compile-pentium-debug-max-no-embedded
new file mode 100755
index 00000000000..4554e38fdc1
--- /dev/null
+++ b/BUILD/compile-pentium-debug-max-no-embedded
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+path=`dirname $0`
+. "$path/SETUP.sh"
+
+extra_flags="$pentium_cflags $debug_cflags"
+c_warnings="$c_warnings $debug_extra_warnings"
+cxx_warnings="$cxx_warnings $debug_extra_warnings"
+extra_configs="$pentium_configs $debug_configs"
+
+extra_configs="$extra_configs --with-berkeley-db --with-innodb --without-isam --with-openssl --with-raid"
+
+. "$path/FINISH.sh"
diff --git a/client/mysql.cc b/client/mysql.cc
index 665a8dde82d..eb466a86c91 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -839,7 +839,9 @@ static int get_options(int argc, char **argv)
opt_reconnect= 0;
connect_flag= 0; /* Not in interactive mode */
}
- if (!(charset_info= get_charset_by_csname(default_charset,
+
+ if (strcmp(default_charset, charset_info->csname) &&
+ !(charset_info= get_charset_by_csname(default_charset,
MY_CS_PRIMARY, MYF(MY_WME))))
exit(1);
if (argc > 1)
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 1768d948373..03ab45957d4 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -311,7 +311,8 @@ static int get_options(int *argc, char ***argv)
}
/* TODO: This variable is not yet used */
- if (!(charset_info= get_charset_by_csname(default_charset,
+ if (strcmp(default_charset, charset_info->csname) &&
+ !(charset_info= get_charset_by_csname(default_charset,
MY_CS_PRIMARY, MYF(MY_WME))))
exit(1);
if (*argc > 0 && opt_alldbs)
diff --git a/client/mysqldump.c b/client/mysqldump.c
index c30156613ce..efe899c1faa 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -369,11 +369,16 @@ static void write_header(FILE *sql_file, char *db_name)
}
if (!opt_set_names)
fprintf(sql_file,"\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=%s */;\n",default_charset);
- fprintf(md_result_file,"\
+ if (!path)
+ {
+ fprintf(md_result_file,"\
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n\
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n\
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;\n\
");
+ }
+ fprintf(sql_file,
+ "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=\"%s\" */;\n",
+ path?"":"NO_AUTO_VALUE_ON_ZERO");
}
return;
} /* write_header */
@@ -385,12 +390,15 @@ static void write_footer(FILE *sql_file)
fputs("</mysqldump>\n", sql_file);
else if (!opt_compact)
{
- fprintf(md_result_file,"\n\
-/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;\n\
+ fprintf(sql_file,"\n/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;\n");
+ if (!path)
+ {
+ fprintf(md_result_file,"\
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;\n\
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;\n");
+ }
if (!opt_set_names)
- fprintf(md_result_file,
+ fprintf(sql_file,
"/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n");
fputs("\n", sql_file);
}
@@ -539,7 +547,8 @@ static int get_options(int *argc, char ***argv)
my_progname);
return(1);
}
- if (!(charset_info= get_charset_by_csname(default_charset,
+ if (strcmp(default_charset, charset_info->csname) &&
+ !(charset_info= get_charset_by_csname(default_charset,
MY_CS_PRIMARY, MYF(MY_WME))))
exit(1);
if ((*argc < 1 && !opt_alldbs) || (*argc > 0 && opt_alldbs))
@@ -667,7 +676,7 @@ static char *quote_name(const char *name, char *buff, my_bool force)
while (*name)
{
if (*name == QUOTE_CHAR)
- *to= QUOTE_CHAR;
+ *to++= QUOTE_CHAR;
*to++= *name++;
}
to[0]=QUOTE_CHAR;
@@ -1155,7 +1164,11 @@ static uint getTableStructure(char *table, char* db)
strpos=strmov(strpos,"(");
}
if (sql_file != md_result_file)
+ {
+ fputs("\n", sql_file);
+ write_footer(sql_file);
my_fclose(sql_file, MYF(MY_WME));
+ }
DBUG_RETURN(numFields);
} /* getTableStructure */
@@ -1942,7 +1955,8 @@ MASTER_LOG_POS=%s ;\n",row[0],row[1]);
}
}
dbDisconnect(current_host);
- write_footer(md_result_file);
+ if (!path)
+ write_footer(md_result_file);
if (md_result_file != stdout)
my_fclose(md_result_file, MYF(0));
my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 5ad6d1dc429..d47ae48b1ac 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -238,7 +238,8 @@ static int get_options(int *argc, char ***argv)
fprintf(stderr, "You can't use --ignore (-i) and --replace (-r) at the same time.\n");
return(1);
}
- if (!(charset_info= get_charset_by_csname(default_charset,
+ if (strcmp(default_charset, charset_info->csname) &&
+ !(charset_info= get_charset_by_csname(default_charset,
MY_CS_PRIMARY, MYF(MY_WME))))
exit(1);
if (*argc < 2)
diff --git a/configure.in b/configure.in
index cc49bb5d0b9..bd337ca72cd 100644
--- a/configure.in
+++ b/configure.in
@@ -457,6 +457,9 @@ then
FIND_PROC="$PS \$\$PID | grep mysqld > /dev/null"
else
case $SYSTEM_TYPE in
+ *freebsd*)
+ FIND_PROC="$PS p \$\$PID | grep mysqld > /dev/null"
+ ;;
*darwin*)
FIND_PROC="$PS -uaxww | grep mysqld | grep \" \$\$PID \" > /dev/null"
;;
@@ -1830,7 +1833,7 @@ AC_CHECK_FUNCS(alarm bmove \
strtol strtoul strtoll strtoull snprintf tempnam thr_setconcurrency \
gethostbyaddr_r gethostbyname_r getpwnam \
bfill bzero bcmp strstr strpbrk strerror \
- tell atod memcpy memmove \
+ tell isinf memcpy memmove \
setupterm strcasecmp sighold vidattr lrand48 localtime_r gmtime_r \
sigset sigthreadmask pthread_sigmask pthread_setprio pthread_setprio_np \
pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \
diff --git a/include/m_ctype.h b/include/m_ctype.h
index 247b2220920..5870458af56 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -392,7 +392,11 @@ extern my_bool my_parse_charset_xml(const char *bug, uint len,
#define use_mb(s) ((s)->cset->ismbchar != NULL)
#define my_ismbchar(s, a, b) ((s)->cset->ismbchar((s), (a), (b)))
+#ifdef USE_MB
#define my_mbcharlen(s, a) ((s)->cset->mbcharlen((s),(a)))
+#else
+#define my_mbcharlen(s, a) 1
+#endif
#define my_caseup(s, a, l) ((s)->cset->caseup((s), (a), (l)))
#define my_casedn(s, a, l) ((s)->cset->casedn((s), (a), (l)))
diff --git a/include/m_string.h b/include/m_string.h
index 5db7158f110..21aa736acd4 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -201,7 +201,7 @@ extern int strcmp(const char *, const char *);
extern size_t strlen(const char *);
#endif
#endif
-#ifndef HAVE_STRNLEN
+#ifndef HAVE_STRNLEN
extern uint strnlen(const char *s, uint n);
#endif
@@ -215,7 +215,9 @@ extern char *strstr(const char *, const char *);
#endif
extern int is_prefix(const char *, const char *);
-/* Conversion rutins */
+/* Conversion routines */
+double my_strtod(const char *str, char **end);
+double my_atof(const char *nptr);
#ifdef USE_MY_ITOA
extern char *my_itoa(int val,char *dst,int radix);
diff --git a/include/my_global.h b/include/my_global.h
index c439250f0da..4a1786f70e2 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -524,7 +524,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define FN_EXTCHAR '.'
#define FN_HOMELIB '~' /* ~/ is used as abbrev for home dir */
#define FN_CURLIB '.' /* ./ is used as abbrev for current dir */
-#define FN_PARENTDIR ".." /* Parentdirectory; Must be a string */
+#define FN_PARENTDIR ".." /* Parent directory; Must be a string */
#define FN_DEVCHAR ':'
#ifndef FN_LIBCHAR
@@ -583,14 +583,6 @@ typedef SOCKET_SIZE_TYPE size_socket;
/* Some defines of functions for portability */
-#ifndef HAVE_ATOD
-#define atod atof
-#endif
-#ifdef USE_MY_ATOF
-#define atof my_atof
-extern void init_my_atof(void);
-extern double my_atof(const char*);
-#endif
#undef remove /* Crashes MySQL on SCO 5.0.0 */
#ifndef __WIN__
#ifdef OS2
@@ -679,6 +671,10 @@ extern double my_atof(const char*);
#define FLT_MAX ((float)3.40282346638528860e+38)
#endif
+#ifndef HAVE_ISINF
+#define isinf(X) 0
+#endif
+
/*
Max size that must be added to a so that we know Size to make
adressable obj.
diff --git a/include/mysql.h b/include/mysql.h
index d1b467f9649..35d9aa62040 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -57,9 +57,6 @@ typedef int my_socket;
#include "mysql_com.h"
#include "mysql_version.h"
#include "typelib.h"
-#ifndef DBUG_OFF
-#define CHECK_EXTRA_ARGUMENTS
-#endif
#include "my_list.h" /* for LISTs used in 'MYSQL' and 'MYSQL_STMT' */
@@ -537,6 +534,8 @@ typedef struct st_mysql_stmt
char *query; /* query buffer */
MEM_ROOT mem_root; /* root allocations */
my_ulonglong last_fetched_column; /* last fetched column */
+ my_ulonglong affected_rows; /* copy of mysql->affected_rows
+ after statement execution */
unsigned long stmt_id; /* Id for prepared statement */
unsigned int last_errno; /* error code */
unsigned int param_count; /* parameters count */
@@ -575,6 +574,8 @@ typedef struct st_mysql_methods
int (*unbuffered_fetch)(MYSQL *mysql, char **row);
void (*free_embedded_thd)(MYSQL *mysql);
const char *(*read_statistic)(MYSQL *mysql);
+ int (*next_result)(MYSQL *mysql);
+ int (*read_change_user_result)(MYSQL *mysql, char *buff, const char *passwd);
#endif
} MYSQL_METHODS;
diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
index d2368c5341f..4ff9a9ce1f7 100644
--- a/innobase/srv/srv0srv.c
+++ b/innobase/srv/srv0srv.c
@@ -2448,7 +2448,7 @@ srv_sprintf_innodb_monitor(
"----------------------\n");
buf += sprintf(buf,
"Total memory allocated " ULINTPF
- "; in additional pool allocated" ULINTPF "\n",
+ "; in additional pool allocated " ULINTPF "\n",
ut_total_allocated_memory,
mem_pool_get_reserved(mem_comm_pool));
diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared
index 1cffae4dc56..678abc91859 100644
--- a/libmysql/Makefile.shared
+++ b/libmysql/Makefile.shared
@@ -32,7 +32,7 @@ target_sources = libmysql.c password.c manager.c \
get_password.c errmsg.c
mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
- strmake.lo strend.lo \
+ strmake.lo strend.lo strtod.lo \
strnlen.lo strfill.lo is_prefix.lo \
int2str.lo str2int.lo strinstr.lo strcont.lo \
strcend.lo bcmp.lo ctype-latin1.lo \
diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h
index b1a85f567f9..4558f0f2abe 100644
--- a/libmysql/client_settings.h
+++ b/libmysql/client_settings.h
@@ -58,6 +58,7 @@ int cli_stmt_execute(MYSQL_STMT *stmt);
MYSQL_DATA * cli_read_binary_rows(MYSQL_STMT *stmt);
int cli_unbuffered_fetch(MYSQL *mysql, char **row);
const char * cli_read_statistic(MYSQL *mysql);
+int cli_read_change_user_result(MYSQL *mysql, char *buff, const char *passwd);
#ifdef EMBEDDED_LIBRARY
int init_embedded_server(int argc, char **argv, char **groups);
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 977657f8998..0eea5ee7007 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -606,13 +606,42 @@ mysql_connect(MYSQL *mysql,const char *host,
/**************************************************************************
Change user and database
**************************************************************************/
+int cli_read_change_user_result(MYSQL *mysql, char *buff, const char *passwd)
+{
+ NET *net= &mysql->net;
+ ulong pkt_length;
+
+ pkt_length= net_safe_read(mysql);
+
+ if (pkt_length == packet_error)
+ return 1;
+
+ if (pkt_length == 1 && net->read_pos[0] == 254 &&
+ mysql->server_capabilities & CLIENT_SECURE_CONNECTION)
+ {
+ /*
+ By sending this very specific reply server asks us to send scrambled
+ password in old format. The reply contains scramble_323.
+ */
+ scramble_323(buff, mysql->scramble, passwd);
+ if (my_net_write(net, buff, SCRAMBLE_LENGTH_323 + 1) || net_flush(net))
+ {
+ net->last_errno= CR_SERVER_LOST;
+ strmov(net->sqlstate, unknown_sqlstate);
+ strmov(net->last_error,ER(net->last_errno));
+ return 1;
+ }
+ /* Read what server thinks about out new auth message report */
+ if (net_safe_read(mysql) == packet_error)
+ return 1;
+ }
+ return 0;
+}
my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
const char *passwd, const char *db)
{
char buff[512],*end=buff;
- NET *net= &mysql->net;
- ulong pkt_length;
DBUG_ENTER("mysql_change_user");
if (!user)
@@ -646,31 +675,8 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
/* Write authentication package */
simple_command(mysql,COM_CHANGE_USER, buff,(ulong) (end-buff),1);
- pkt_length= net_safe_read(mysql);
-
- if (pkt_length == packet_error)
- goto error;
-
- if (pkt_length == 1 && net->read_pos[0] == 254 &&
- mysql->server_capabilities & CLIENT_SECURE_CONNECTION)
- {
- /*
- By sending this very specific reply server asks us to send scrambled
- password in old format. The reply contains scramble_323.
- */
- scramble_323(buff, mysql->scramble, passwd);
- if (my_net_write(net, buff, SCRAMBLE_LENGTH_323 + 1) || net_flush(net))
- {
- net->last_errno= CR_SERVER_LOST;
- strmov(net->sqlstate, unknown_sqlstate);
- strmov(net->last_error,ER(net->last_errno));
- goto error;
- }
- /* Read what server thinks about out new auth message report */
- if (net_safe_read(mysql) == packet_error)
- goto error;
- }
-
+ if ((*mysql->methods->read_change_user_result)(mysql, buff, passwd))
+ DBUG_RETURN(1);
/* Free old connect information */
my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR));
@@ -681,9 +687,6 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
mysql->passwd=my_strdup(passwd,MYF(MY_WME));
mysql->db= db ? my_strdup(db,MYF(MY_WME)) : 0;
DBUG_RETURN(0);
-
-error:
- DBUG_RETURN(1);
}
#if defined(HAVE_GETPWUID) && defined(NO_GETPWUID_DECL)
@@ -1653,14 +1656,6 @@ mysql_prepare(MYSQL *mysql, const char *query, ulong length)
DBUG_ENTER("mysql_prepare");
DBUG_ASSERT(mysql != 0);
-#ifdef CHECK_EXTRA_ARGUMENTS
- if (!query)
- {
- set_mysql_error(mysql, CR_NULL_POINTER, unknown_sqlstate);
- DBUG_RETURN(0);
- }
-#endif
-
if (!(stmt= (MYSQL_STMT *) my_malloc(sizeof(MYSQL_STMT),
MYF(MY_WME | MY_ZEROFILL))) ||
!(stmt->query= my_strdup_with_length((byte *) query, length, MYF(0))))
@@ -2018,6 +2013,7 @@ static my_bool execute(MYSQL_STMT * stmt, char *packet, ulong length)
set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
DBUG_RETURN(1);
}
+ stmt->affected_rows= mysql->affected_rows;
DBUG_RETURN(0);
}
@@ -2086,19 +2082,6 @@ int STDCALL mysql_execute(MYSQL_STMT *stmt)
{
DBUG_ENTER("mysql_execute");
- if (stmt->state == MY_ST_UNKNOWN)
- {
- set_stmt_error(stmt, CR_NO_PREPARE_STMT, unknown_sqlstate);
- DBUG_RETURN(1);
- }
-#ifdef CHECK_EXTRA_ARGUMENTS
- if (stmt->param_count && !stmt->param_buffers)
- {
- /* Parameters exists, but no bound buffers */
- set_stmt_error(stmt, CR_NOT_ALL_PARAMS_BOUND, unknown_sqlstate);
- DBUG_RETURN(1);
- }
-#endif
if ((*stmt->mysql->methods->stmt_execute)(stmt))
DBUG_RETURN(1);
@@ -2127,7 +2110,7 @@ ulong STDCALL mysql_param_count(MYSQL_STMT * stmt)
my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt)
{
- return stmt->mysql->last_used_con->affected_rows;
+ return stmt->affected_rows;
}
@@ -2144,19 +2127,6 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind)
MYSQL_BIND *param, *end;
DBUG_ENTER("mysql_bind_param");
-#ifdef CHECK_EXTRA_ARGUMENTS
- if (stmt->state == MY_ST_UNKNOWN)
- {
- set_stmt_error(stmt, CR_NO_PREPARE_STMT, unknown_sqlstate);
- DBUG_RETURN(1);
- }
- if (!stmt->param_count)
- {
- set_stmt_error(stmt, CR_NO_PARAMETERS_EXISTS, unknown_sqlstate);
- DBUG_RETURN(1);
- }
-#endif
-
/* Allocated on prepare */
memcpy((char*) stmt->params, (char*) bind,
sizeof(MYSQL_BIND) * stmt->param_count);
@@ -2279,11 +2249,6 @@ mysql_send_long_data(MYSQL_STMT *stmt, uint param_number,
DBUG_PRINT("enter",("param no : %d, data : %lx, length : %ld",
param_number, data, length));
- if (param_number >= stmt->param_count)
- {
- set_stmt_error(stmt, CR_INVALID_PARAMETER_NO, unknown_sqlstate);
- DBUG_RETURN(1);
- }
param= stmt->params+param_number;
if (param->buffer_type < MYSQL_TYPE_TINY_BLOB ||
param->buffer_type > MYSQL_TYPE_STRING)
@@ -2853,18 +2818,6 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
DBUG_ENTER("mysql_bind_result");
DBUG_ASSERT(stmt != 0);
-#ifdef CHECK_EXTRA_ARGUMENTS
- if (stmt->state == MY_ST_UNKNOWN)
- {
- set_stmt_error(stmt, CR_NO_PREPARE_STMT, unknown_sqlstate);
- DBUG_RETURN(1);
- }
- if (!bind)
- {
- set_stmt_error(stmt, CR_NULL_POINTER, unknown_sqlstate);
- DBUG_RETURN(1);
- }
-#endif
if (!(bind_count= stmt->field_count) &&
!(bind_count= alloc_stmt_fields(stmt)))
DBUG_RETURN(0);
@@ -3035,6 +2988,15 @@ int STDCALL mysql_fetch(MYSQL_STMT *stmt)
}
else /* un-buffered */
{
+ if (mysql->status != MYSQL_STATUS_GET_RESULT)
+ {
+ if (!stmt->field_count)
+ goto no_data;
+
+ set_stmt_error(stmt, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
+ DBUG_RETURN(1);
+ }
+
if((*mysql->methods->unbuffered_fetch)(mysql, ( char **)&row))
{
set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno,
@@ -3065,7 +3027,7 @@ no_data:
mysql_fetch_column()
stmt Prepared statement handler
bind Where data should be placed. Should be filled in as
- when calling mysql_bind_param()
+ when calling mysql_bind_result()
column Column to fetch (first column is 0)
ulong offset Offset in result data (to fetch blob in pieces)
This is normally 0
@@ -3083,14 +3045,6 @@ int STDCALL mysql_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
if (!stmt->current_row)
goto no_data;
-#ifdef CHECK_EXTRA_ARGUMENTS
- if (column >= stmt->field_count)
- {
- set_stmt_errmsg(stmt, "Invalid column descriptor",1, unknown_sqlstate);
- DBUG_RETURN(1);
- }
-#endif
-
if (param->null_field)
{
if (bind->is_null)
@@ -3223,6 +3177,7 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
DBUG_RETURN(0);
}
mysql->affected_rows= result->row_count= result->data->rows;
+ stmt->affected_rows= result->row_count;
result->data_cursor= result->data->data;
result->fields= stmt->fields;
result->field_count= stmt->field_count;
@@ -3510,7 +3465,6 @@ my_bool STDCALL mysql_more_results(MYSQL *mysql)
/*
Reads and returns the next query results
*/
-
int STDCALL mysql_next_result(MYSQL *mysql)
{
DBUG_ENTER("mysql_next_result");
@@ -3529,8 +3483,8 @@ int STDCALL mysql_next_result(MYSQL *mysql)
mysql->affected_rows= ~(my_ulonglong) 0;
if (mysql->last_used_con->server_status & SERVER_MORE_RESULTS_EXISTS)
- DBUG_RETURN((*mysql->methods->read_query_result)(mysql));
-
+ DBUG_RETURN((*mysql->methods->next_result)(mysql));
+
DBUG_RETURN(-1); /* No more results */
}
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index e36e878d4b1..ee6451f4a17 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -245,6 +245,25 @@ static MYSQL_RES * emb_mysql_store_result(MYSQL *mysql)
return mysql_store_result(mysql);
}
+int emb_next_result(MYSQL *mysql)
+{
+ THD *thd= (THD*)mysql->thd;
+ DBUG_ENTER("emb_next_result");
+
+ if (emb_advanced_command(mysql, COM_QUERY,0,0,
+ thd->query_rest.ptr(),thd->query_rest.length(),1)
+ || emb_mysql_read_query_result(mysql))
+ DBUG_RETURN(1);
+
+ DBUG_RETURN(0); /* No more results */
+}
+
+int emb_read_change_user_result(MYSQL *mysql,
+ char *buff __attribute__((unused)),
+ const char *passwd __attribute__((unused)))
+{
+ return mysql_errno(mysql);
+}
MYSQL_METHODS embedded_methods=
{
@@ -259,7 +278,9 @@ MYSQL_METHODS embedded_methods=
emb_read_binary_rows,
emb_unbuffered_fetch,
emb_free_embedded_thd,
- emb_read_statistic
+ emb_read_statistic,
+ emb_next_result,
+ emb_read_change_user_result
};
C_MODE_END
@@ -599,8 +620,8 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
}
else
{
- client_field->def= strdup_root(field_alloc, tmp.ptr());
- client_field->def_length= tmp.length();
+ client_field->def= strdup_root(field_alloc, res->ptr());
+ client_field->def_length= res->length();
}
}
else
@@ -676,7 +697,10 @@ send_ok(THD *thd,ha_rows affected_rows,ulonglong id,const char *message)
mysql->affected_rows= affected_rows;
mysql->insert_id= id;
if (message)
+ {
strmake(thd->net.last_error, message, sizeof(thd->net.last_error)-1);
+ mysql->info= thd->net.last_error;
+ }
DBUG_VOID_RETURN;
}
diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c
index 8cbb7a71a43..447744b0521 100644
--- a/myisam/ft_boolean_search.c
+++ b/myisam/ft_boolean_search.c
@@ -61,12 +61,12 @@ typedef struct st_ftb_expr FTB_EXPR;
struct st_ftb_expr
{
FTB_EXPR *up;
- my_off_t docid[2];
+ uint flags;
/* ^^^^^^^^^^^^^^^^^^ FTB_{EXPR,WORD} common section */
+ my_off_t docid[2];
float weight;
float cur_weight;
byte *quot, *qend;
- uint flags;
uint yesses; /* number of "yes" words matched */
uint nos; /* number of "no" words matched */
uint ythresh; /* number of "yes" words in expr */
@@ -76,13 +76,13 @@ struct st_ftb_expr
typedef struct st_ftb_word
{
FTB_EXPR *up;
- MI_KEYDEF *keyinfo;
- my_off_t docid[2]; /* for index search and for scan */
+ uint flags;
/* ^^^^^^^^^^^^^^^^^^ FTB_{EXPR,WORD} common section */
+ my_off_t docid[2]; /* for index search and for scan */
my_off_t key_root;
+ MI_KEYDEF *keyinfo;
float weight;
uint ndepth;
- uint flags;
uint len;
uchar off;
byte word[1];
@@ -193,7 +193,7 @@ static void _ftb_parse_query(FTB *ftb, byte **start, byte *end,
}
static int _ftb_no_dupes_cmp(void* not_used __attribute__((unused)),
- const void *a,const void *b)
+ const void *a,const void *b)
{
return CMP_NUM((*((my_off_t*)a)), (*((my_off_t*)b)));
}
@@ -238,9 +238,9 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
if ((ftbw->flags & FTB_FLAG_YES) && ftbw->up->up==0)
{
/*
- This word MUST BE present in every document returned,
- so we can stop the search right now
- */
+ This word MUST BE present in every document returned,
+ so we can stop the search right now
+ */
ftb->state=INDEX_DONE;
return 1; /* search is done */
}
@@ -250,7 +250,7 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
/* going up to the first-level tree to continue search there */
_mi_dpointer(info, (uchar*) (ftbw->word+ftbw->off+HA_FT_WLEN),
- ftbw->key_root);
+ ftbw->key_root);
ftbw->key_root=info->s->state.key_root[ftb->keynr];
ftbw->keyinfo=info->s->keyinfo+ftb->keynr;
ftbw->off=0;
@@ -297,7 +297,7 @@ static void _ftb_init_index_search(FT_INFO *ftb)
if (ftbw->flags & FTB_FLAG_TRUNC)
{
/*
- special treatment for truncation operator
+ special treatment for truncation operator
1. there are some (besides this) +words
| no need to search in the index, it can never ADD new rows
| to the result, and to remove half-matched rows we do scan anyway
@@ -348,7 +348,7 @@ static void _ftb_init_index_search(FT_INFO *ftb)
FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
- uint query_len)
+ uint query_len)
{
FTB *ftb;
FTB_EXPR *ftbe;
@@ -419,7 +419,7 @@ static int _ftb_strstr(const byte *s0, const byte *e0,
while (p0 < e0)
{
while (p0 < e0 && cs->to_upper[(uint) (uchar) *p0++] !=
- cs->to_upper[(uint) (uchar) *s1])
+ cs->to_upper[(uint) (uchar) *s1])
/* no-op */;
if (p0 >= e0)
return 0;
@@ -429,7 +429,7 @@ static int _ftb_strstr(const byte *s0, const byte *e0,
p1=s1+1;
while (p0 < e0 && p1 < e1 && cs->to_upper[(uint) (uchar) *p0] ==
- cs->to_upper[(uint) (uchar) *p1])
+ cs->to_upper[(uint) (uchar) *p1])
p0++, p1++;
if (p1 == e1 && (!e_before || p0 == e0 || !true_word_char(cs, p0[0])))
return 1;
@@ -487,12 +487,12 @@ static void _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_
if (yn & FTB_FLAG_NO)
{
/*
- NOTE: special sort function of queue assures that all
- (yn & FTB_FLAG_NO) != 0
- events for every particular subexpression will
- "auto-magically" happen BEFORE all the
- (yn & FTB_FLAG_YES) != 0 events. So no
- already matched expression can become not-matched again.
+ NOTE: special sort function of queue assures that all
+ (yn & FTB_FLAG_NO) != 0
+ events for every particular subexpression will
+ "auto-magically" happen BEFORE all the
+ (yn & FTB_FLAG_YES) != 0 events. So no
+ already matched expression can become not-matched again.
*/
++ftbe->nos;
break;
@@ -500,7 +500,7 @@ static void _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_
else
{
if (ftbe->ythresh)
- weight/=3;
+ weight/=3;
ftbe->cur_weight += weight;
if ((int) ftbe->yesses < ythresh)
break;
@@ -535,8 +535,8 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record)
ftb->queue.first_cmp_arg=(void *)&curdoc;
while (ftb->state == INDEX_SEARCH &&
- (curdoc=((FTB_WORD *)queue_top(& ftb->queue))->docid[0]) !=
- HA_POS_ERROR)
+ (curdoc=((FTB_WORD *)queue_top(& ftb->queue))->docid[0]) !=
+ HA_POS_ERROR)
{
while (curdoc == (ftbw=(FTB_WORD *)queue_top(& ftb->queue))->docid[0])
{
@@ -554,7 +554,7 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record)
/* curdoc matched ! */
if (is_tree_inited(&ftb->no_dupes) &&
tree_insert(&ftb->no_dupes, &curdoc, 0,
- ftb->no_dupes.custom_arg)->count >1)
+ ftb->no_dupes.custom_arg)->count >1)
/* but it managed already to get past this line once */
continue;
diff --git a/myisam/ft_parser.c b/myisam/ft_parser.c
index 0318bcbed10..f68bf3f030c 100644
--- a/myisam/ft_parser.c
+++ b/myisam/ft_parser.c
@@ -93,27 +93,30 @@ byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end,
for (;doc<end;doc++)
{
if (true_word_char(cs,*doc)) break;
- if (*doc == FTB_RQUOT && param->quot) {
+ if (*doc == FTB_RQUOT && param->quot)
+ {
param->quot=doc;
*start=doc+1;
return 3; /* FTB_RBR */
}
- if ((*doc == FTB_LBR || *doc == FTB_RBR || *doc == FTB_LQUOT)
- && !param->quot)
- {
- /* param->prev=' '; */
- *start=doc+1;
- if (*doc == FTB_LQUOT) param->quot=*start;
- return (*doc == FTB_RBR)+2;
- }
- if (param->prev == ' ' && !param->quot)
+ if (!param->quot)
{
- if (*doc == FTB_YES ) { param->yesno=+1; continue; } else
- if (*doc == FTB_EGAL) { param->yesno= 0; continue; } else
- if (*doc == FTB_NO ) { param->yesno=-1; continue; } else
- if (*doc == FTB_INC ) { param->plusminus++; continue; } else
- if (*doc == FTB_DEC ) { param->plusminus--; continue; } else
- if (*doc == FTB_NEG ) { param->pmsign=!param->pmsign; continue; }
+ if (*doc == FTB_LBR || *doc == FTB_RBR || *doc == FTB_LQUOT)
+ {
+ /* param->prev=' '; */
+ *start=doc+1;
+ if (*doc == FTB_LQUOT) param->quot=*start;
+ return (*doc == FTB_RBR)+2;
+ }
+ if (param->prev == ' ')
+ {
+ if (*doc == FTB_YES ) { param->yesno=+1; continue; } else
+ if (*doc == FTB_EGAL) { param->yesno= 0; continue; } else
+ if (*doc == FTB_NO ) { param->yesno=-1; continue; } else
+ if (*doc == FTB_INC ) { param->plusminus++; continue; } else
+ if (*doc == FTB_DEC ) { param->plusminus--; continue; } else
+ if (*doc == FTB_NEG ) { param->pmsign=!param->pmsign; continue; }
+ }
}
param->prev=*doc;
param->yesno=(FTB_YES==' ') ? 1 : (param->quot != 0);
@@ -139,6 +142,11 @@ byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end,
return 1;
}
}
+ if (param->quot)
+ {
+ param->quot=*start=doc;
+ return 3; /* FTB_RBR */
+ }
return 0;
}
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index c60d8e19fb4..877a349d188 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -64,12 +64,6 @@ test
select cast(_koi8r'ÔÅÓÔ' as char character set cp1251);
cast(_koi8r'ÔÅÓÔ' as char character set cp1251)
òåñò
-select convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci");
-convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci")
-test
-select convert(_koi8r'ÔÅÓÔ', "koi8r_general_ci", "cp1251_general_ci");
-convert(_koi8r'ÔÅÓÔ', "koi8r_general_ci", "cp1251_general_ci")
-òåñò
create table t1 select cast(_koi8r'ÔÅÓÔ' as char character set cp1251) as t;
show create table t1;
Table Create Table
diff --git a/mysql-test/r/ctype_many.result b/mysql-test/r/ctype_many.result
index 173d41ecdd1..8bfc6e98226 100644
--- a/mysql-test/r/ctype_many.result
+++ b/mysql-test/r/ctype_many.result
@@ -340,129 +340,6 @@ CYR CAPIT SOFT SIGN ø ø
CYR CAPIT E ü ü
CYR CAPIT YU à à
CYR CAPIT YA ñ ñ
-select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
-CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci') comment
-a LAT SMALL A
-b LAT SMALL B
-c LAT SMALL C
-d LAT SMALL D
-e LAT SMALL E
-f LAT SMALL F
-g LAT SMALL G
-h LAT SMALL H
-i LAT SMALL I
-j LAT SMALL J
-k LAT SMALL K
-l LAT SMALL L
-m LAT SMALL M
-n LAT SMALL N
-o LAT SMALL O
-p LAT SMALL P
-q LAT SMALL Q
-r LAT SMALL R
-s LAT SMALL S
-t LAT SMALL T
-u LAT SMALL U
-v LAT SMALL V
-w LAT SMALL W
-x LAT SMALL X
-y LAT SMALL Y
-z LAT SMALL Z
-A LAT CAPIT A
-B LAT CAPIT B
-C LAT CAPIT C
-D LAT CAPIT D
-E LAT CAPIT E
-F LAT CAPIT F
-G LAT CAPIT G
-H LAT CAPIT H
-I LAT CAPIT I
-J LAT CAPIT J
-K LAT CAPIT K
-L LAT CAPIT L
-M LAT CAPIT M
-N LAT CAPIT N
-O LAT CAPIT O
-P LAT CAPIT P
-Q LAT CAPIT Q
-R LAT CAPIT R
-S LAT CAPIT S
-T LAT CAPIT T
-U LAT CAPIT U
-V LAT CAPIT V
-W LAT CAPIT W
-X LAT CAPIT X
-Y LAT CAPIT Y
-Z LAT CAPIT Z
-â CYR SMALL A
-÷ CYR SMALL BE
-þ CYR SMALL VE
-ú CYR SMALL GE
-ä CYR SMALL DE
-å CYR SMALL IE
-? CYR SMALL IO
-ã CYR SMALL ZHE
-ÿ CYR SMALL ZE
-ê CYR SMALL I
-ì CYR SMALL KA
-í CYR SMALL EL
-î CYR SMALL EM
-ï CYR SMALL EN
-ð CYR SMALL O
-ò CYR SMALL PE
-ô CYR SMALL ER
-õ CYR SMALL ES
-æ CYR SMALL TE
-è CYR SMALL U
-ö CYR SMALL EF
-é CYR SMALL HA
-ç CYR SMALL TSE
-à CYR SMALL CHE
-ù CYR SMALL SHA
-ü CYR SMALL SCHA
-ñ CYR SMALL HARD SIGN
-ý CYR SMALL YERU
-û CYR SMALL SOFT SIGN
-ø CYR SMALL E
-á CYR SMALL YU
-ó CYR SMALL YA
-Â CYR CAPIT A
-× CYR CAPIT BE
-Þ CYR CAPIT VE
-Ú CYR CAPIT GE
-Ä CYR CAPIT DE
-Å CYR CAPIT IE
-? CYR CAPIT IO
-Ã CYR CAPIT ZHE
-ß CYR CAPIT ZE
-Ê CYR CAPIT I
-Ì CYR CAPIT KA
-Í CYR CAPIT EL
-Î CYR CAPIT EM
-Ï CYR CAPIT EN
-Ð CYR CAPIT O
-Ò CYR CAPIT PE
-Ô CYR CAPIT ER
-Õ CYR CAPIT ES
-Æ CYR CAPIT TE
-È CYR CAPIT U
-Ö CYR CAPIT EF
-É CYR CAPIT HA
-Ç CYR CAPIT TSE
-À CYR CAPIT CHE
-Ù CYR CAPIT SHA
-Ü CYR CAPIT SCHA
-Ñ CYR CAPIT HARD SIGN
-Ý CYR CAPIT YERU
-Û CYR CAPIT SOFT SIGN
-Ø CYR CAPIT E
-Á CYR CAPIT YU
-Ó CYR CAPIT YA
-explain extended select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 116
-Warnings:
-Note 1003 select high_priority convert(test.t1.koi8_ru_f,_latin1'utf8_general_ci',_latin1'cp1251_general_ci') AS `CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci')`,test.t1.comment AS `comment` from test.t1
ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL;
UPDATE t1 SET bin_f=koi8_ru_f;
SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1;
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 4c699052113..c2c2f548de7 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -88,3 +88,84 @@ select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
s1 hex(s1) char_length(s1) octet_length(s1)
Á D0B0 1 2
drop table t1;
+create table t1 (s1 tinytext character set utf8);
+insert into t1 select repeat('a',300);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+insert into t1 select repeat('Ñ',300);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+insert into t1 select repeat('aÑ',300);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+insert into t1 select repeat('Ña',300);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+insert into t1 select repeat('ÑÑ',300);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+select hex(s1) from t1;
+hex(s1)
+616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161
+D18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18F
+61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F
+D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61
+D18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18F
+select length(s1),char_length(s1) from t1;
+length(s1) char_length(s1)
+255 255
+254 127
+255 170
+255 170
+254 127
+drop table t1;
+create table t1 (s1 text character set utf8);
+insert into t1 select repeat('a',66000);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+insert into t1 select repeat('Ñ',66000);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+insert into t1 select repeat('aÑ',66000);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+insert into t1 select repeat('Ña',66000);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+insert into t1 select repeat('ÑÑ',66000);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+select length(s1),char_length(s1) from t1;
+length(s1) char_length(s1)
+65535 65535
+65534 32767
+65535 43690
+65535 43690
+65534 32767
+drop table t1;
+create table t1 (s1 char(10) character set utf8);
+insert into t1 values (0x41FF);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+select hex(s1) from t1;
+hex(s1)
+41
+drop table t1;
+create table t1 (s1 varchar(10) character set utf8);
+insert into t1 values (0x41FF);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+select hex(s1) from t1;
+hex(s1)
+41
+drop table t1;
+create table t1 (s1 text character set utf8);
+insert into t1 values (0x41FF);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+select hex(s1) from t1;
+hex(s1)
+41
+drop table t1;
+create table t1 (a char(160) character set utf8, primary key(a));
+ERROR HY000: Incorrect sub part key. The used key part isn't a string, the used length is longer than the key part or the storage engine doesn't support unique sub keys
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index 049d88c5154..be743be386b 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -213,7 +213,7 @@ ERROR 42000: You have an error in your SQL syntax. Check the manual that corres
create table t1 (a int);
insert into t1 values (1),(2),(3);
update (select * from t1) as t1 set a = 5;
-ERROR HY000: The target table t1 of the UPDATE is not updatable.
+ERROR HY000: The target table t1 of the UPDATE is not updatable
delete from (select * from t1);
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(select * from t1)' at line 1
insert into (select * from t1) values (5);
@@ -264,7 +264,7 @@ N M
2 2
3 0
UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2, P2.N = 2;
-ERROR HY000: The target table P2 of the UPDATE is not updatable.
+ERROR HY000: The target table P2 of the UPDATE is not updatable
UPDATE `t1` AS P1 INNER JOIN (SELECT aaaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
ERROR 42S22: Unknown column 'aaaa' in 'field list'
delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
@@ -272,7 +272,7 @@ select * from t1;
N M
3 0
delete P1.*,P2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
-ERROR HY000: The target table P2 of the DELETE is not updatable.
+ERROR HY000: The target table P2 of the DELETE is not updatable
delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
ERROR 42S22: Unknown column 'aaa' in 'field list'
drop table t1;
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index 2ca4f55d24c..4207eb4f9a8 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -144,6 +144,9 @@ select * from t1 where MATCH a,b AGAINST ('"text i"' IN BOOLEAN MODE);
a b
select * from t1 where MATCH a,b AGAINST ('"xt indexes"' IN BOOLEAN MODE);
a b
+select * from t1 where MATCH a,b AGAINST('"space model' IN BOOLEAN MODE);
+a b
+Full-text search in MySQL implements vector space model
select * from t1 where MATCH a AGAINST ("search" IN BOOLEAN MODE);
a b
Full-text search in MySQL implements vector space model
diff --git a/mysql-test/r/func_system.result b/mysql-test/r/func_system.result
index a0437ca1c56..338902e3f3a 100644
--- a/mysql-test/r/func_system.result
+++ b/mysql-test/r/func_system.result
@@ -51,6 +51,20 @@ t1 CREATE TABLE `t1` (
`version` char(40) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+select charset(charset(_utf8'a')), charset(collation(_utf8'a'));
+charset(charset(_utf8'a')) charset(collation(_utf8'a'))
+utf8 utf8
+select collation(charset(_utf8'a')), collation(collation(_utf8'a'));
+collation(charset(_utf8'a')) collation(collation(_utf8'a'))
+utf8_general_ci utf8_general_ci
+create table t1 select charset(_utf8'a'), collation(_utf8'a');
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `charset(_utf8'a')` char(64) character set utf8 NOT NULL default '',
+ `collation(_utf8'a')` char(64) character set utf8 NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
select TRUE,FALSE,NULL;
TRUE FALSE NULL
1 0 NULL
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 89426edb000..0b6ebe9b0ad 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -136,7 +136,7 @@ grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION;
show grants for drop_user2@localhost;
Grants for drop_user2@localhost
GRANT ALL PRIVILEGES ON *.* TO 'drop_user2'@'localhost' WITH GRANT OPTION
-revoke all privileges, grant from drop_user2@localhost;
+revoke all privileges, grant option from drop_user2@localhost;
drop user drop_user2@localhost;
grant ALL PRIVILEGES on *.* to drop_user@localhost with GRANT OPTION;
grant ALL PRIVILEGES on test.* to drop_user@localhost with GRANT OPTION;
@@ -146,12 +146,12 @@ Grants for drop_user@localhost
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
GRANT ALL PRIVILEGES ON `test`.* TO 'drop_user'@'localhost' WITH GRANT OPTION
GRANT SELECT (a) ON `test`.`t1` TO 'drop_user'@'localhost'
-revoke all privileges, grant from drop_user@localhost;
+revoke all privileges, grant option from drop_user@localhost;
show grants for drop_user@localhost;
Grants for drop_user@localhost
GRANT USAGE ON *.* TO 'drop_user'@'localhost'
drop user drop_user@localhost;
-revoke all privileges, grant from drop_user@localhost;
+revoke all privileges, grant option from drop_user@localhost;
ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users
grant select(a) on test.t1 to drop_user1@localhost;
grant select on test.t1 to drop_user2@localhost;
@@ -160,7 +160,7 @@ grant select on *.* to drop_user4@localhost;
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
drop_user4@localhost;
ERROR HY000: Can't drop one or more of the requested users
-revoke all privileges, grant from drop_user1@localhost, drop_user2@localhost,
+revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost,
drop_user3@localhost, drop_user4@localhost;
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
drop_user4@localhost;
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 0414d6fa738..fe1b83a1089 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -25,7 +25,7 @@ INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` decimal(240,20) default NULL
@@ -50,7 +50,7 @@ INSERT INTO t1 VALUES (-9e999999);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` double default NULL
@@ -119,7 +119,7 @@ INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5');
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` varchar(255) default NULL
@@ -142,7 +142,7 @@ CREATE TABLE t1 (a int) ENGINE=MYISAM;
INSERT INTO t1 VALUES (1), (2);
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
@@ -161,7 +161,7 @@ UNLOCK TABLES;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
@@ -179,3 +179,44 @@ UNLOCK TABLES;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
DROP TABLE t1;
+create table ```a` (i int);
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
+DROP TABLE IF EXISTS ```a`;
+CREATE TABLE ```a` (
+ `i` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE ```a` DISABLE KEYS */;
+LOCK TABLES ```a` WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE ```a` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+
+drop table ```a`;
+create table t1(a int);
+insert into t1 values (1),(2),(3);
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="" */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+
+1
+2
+3
+drop table t1;
diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result
index 2f8a54369c9..34d41c5dfac 100644
--- a/mysql-test/r/rpl_log.result
+++ b/mysql-test/r/rpl_log.result
@@ -16,6 +16,7 @@ load data infile '../../std_data/words.dat' into table t1 ignore 1 lines;
select count(*) from t1;
count(*)
69
+create table t2 like t1;
drop table t1;
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
@@ -27,7 +28,8 @@ master-bin.000001 263 Query 1 263 use `test`; drop table t1
master-bin.000001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
master-bin.000001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581
master-bin.000001 1056 Exec_load 1 1056 ;file_id=1
-master-bin.000001 1079 Query 1 1079 use `test`; drop table t1
+master-bin.000001 1079 Query 1 1079 use `test`; create table t2 like t1
+master-bin.000001 1137 Query 1 1137 use `test`; drop table t1
show binlog events from 79 limit 1;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
@@ -38,6 +40,10 @@ master-bin.000001 172 Intvar 1 172 INSERT_ID=1
show binlog events from 79 limit 2,1;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 200 Query 1 200 use `test`; insert into t1 values (NULL)
+show binlog events from 79 limit 2,2;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 200 Query 1 200 use `test`; insert into t1 values (NULL)
+master-bin.000001 263 Query 1 263 use `test`; drop table t1
flush logs;
create table t5 (a int);
drop table t5;
@@ -57,8 +63,9 @@ master-bin.000001 263 Query 1 263 use `test`; drop table t1
master-bin.000001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
master-bin.000001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581
master-bin.000001 1056 Exec_load 1 1056 ;file_id=1
-master-bin.000001 1079 Query 1 1079 use `test`; drop table t1
-master-bin.000001 1127 Rotate 1 1127 master-bin.000002;pos=4
+master-bin.000001 1079 Query 1 1079 use `test`; create table t2 like t1
+master-bin.000001 1137 Query 1 1137 use `test`; drop table t1
+master-bin.000001 1185 Rotate 1 1185 master-bin.000002;pos=4
show binlog events in 'master-bin.000002';
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000002 4 Query 1 4 use `test`; create table t5 (a int)
@@ -85,10 +92,11 @@ slave-bin.000001 263 Query 1 263 use `test`; drop table t1
slave-bin.000001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
slave-bin.000001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581
slave-bin.000001 1065 Exec_load 1 1065 ;file_id=1
-slave-bin.000001 1088 Query 1 1088 use `test`; drop table t1
-slave-bin.000001 1136 Query 1 1136 use `test`; create table t5 (a int)
-slave-bin.000001 1194 Query 1 1194 use `test`; drop table t5
-slave-bin.000001 1242 Rotate 2 1242 slave-bin.000002;pos=4
+slave-bin.000001 1088 Query 1 1088 use `test`; create table t2 like t1
+slave-bin.000001 1146 Query 1 1146 use `test`; drop table t1
+slave-bin.000001 1194 Query 1 1194 use `test`; create table t5 (a int)
+slave-bin.000001 1252 Query 1 1252 use `test`; drop table t5
+slave-bin.000001 1300 Rotate 2 1300 slave-bin.000002;pos=4
show binlog events in 'slave-bin.000002' from 4;
Log_name Pos Event_type Server_id Orig_log_pos Info
slave-bin.000002 4 Query 1 4 use `test`; create table t1 (n int)
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 290f916ae72..235c6cd0ecf 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -265,3 +265,51 @@ c decimal(4,3) YES NULL
d double(4,3) YES NULL
f float(4,3) YES NULL
drop table t1;
+SET sql_mode='';
+SET sql_quote_show_create=OFF;
+CREATE TABLE ```ab``cd``` (i INT);
+SHOW CREATE TABLE ```ab``cd```;
+Table Create Table
+`ab`cd` CREATE TABLE ```ab``cd``` (
+ i int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE ```ab``cd```;
+CREATE TABLE ```ab````cd``` (i INT);
+SHOW CREATE TABLE ```ab````cd```;
+Table Create Table
+`ab``cd` CREATE TABLE ```ab````cd``` (
+ i int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE ```ab````cd```;
+CREATE TABLE ```a` (i INT);
+SHOW CREATE TABLE ```a`;
+Table Create Table
+`a CREATE TABLE ```a` (
+ i int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE ```a`;
+SET sql_mode='ANSI_QUOTES';
+CREATE TABLE """a" (i INT);
+SHOW CREATE TABLE """a";
+Table Create Table
+"a CREATE TABLE """a" (
+ i int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE """a";
+SET sql_mode='';
+SET sql_quote_show_create=OFF;
+CREATE TABLE t1 (i INT);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE t1 (
+ i int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE `table` (i INT);
+SHOW CREATE TABLE `table`;
+Table Create Table
+table CREATE TABLE `table` (
+ i int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE `table`;
+SET sql_quote_show_create=ON;
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index f8a3251b6f9..ee3492c8111 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -970,7 +970,7 @@ ERROR 42S02: Table 'test.t1' doesn't exist
CREATE TABLE t1 (a int, KEY(a));
HANDLER t1 OPEN;
HANDLER t1 READ a=((SELECT 1));
-ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use
+ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT 1))' at line 1
HANDLER t1 CLOSE;
drop table t1;
create table t1 (a int);
@@ -1603,3 +1603,14 @@ id max_anno_dep PIPPO
50 1990 0
51 1990 NULL
DROP TABLE t1, t2;
+create table t1 (a int);
+insert into t1 values (1), (2), (3);
+SET SQL_SELECT_LIMIT=1;
+select sum(a) from (select * from t1) as a;
+sum(a)
+6
+select 2 in (select * from t1);
+2 in (select * from t1)
+1
+SET SQL_SELECT_LIMIT=default;
+drop table t1;
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 4a514e3dd18..23ed06dee6a 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -350,7 +350,7 @@ select found_rows();
found_rows()
4
(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 1;
-ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use
+ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION all SELECT * FROM t2 LIMIT 2;
a
1
@@ -539,7 +539,7 @@ aa
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(2) NOT NULL default ''
+ `a` char(2) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT 12 as a UNION select "aa" as a;
@@ -550,7 +550,7 @@ aa
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(2) NOT NULL default ''
+ `a` char(2) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT 12 as a UNION select 12.2 as a;
@@ -561,7 +561,7 @@ a
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` double(4,1) NOT NULL default '0.0'
+ `a` double(4,1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t2 (it1 tinyint, it2 tinyint not null, i int not null, ib bigint, f float, d double, y year, da date, dt datetime, sc char(10), sv varchar(10), b blob, tx text);
@@ -585,7 +585,7 @@ it2
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `it2` int(11) NOT NULL default '0'
+ `it2` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT i from t2 UNION select f from t2;
@@ -799,7 +799,7 @@ select * from t1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `1` bigint(1) NOT NULL default '0'
+ `1` bigint(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 select _latin1"test" union select _latin2"testt" ;
@@ -808,7 +808,7 @@ create table t1 select _latin2"test" union select _latin2"testt" ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `test` char(5) character set latin2 NOT NULL default ''
+ `test` char(5) character set latin2 default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (s char(200));
@@ -869,3 +869,27 @@ show status like 'Slow_queries';
Variable_name Value
Slow_queries 3
drop table t1;
+create table t1 ( RID int(11) not null default '0', IID int(11) not null default '0', nada varchar(50) not null,NAME varchar(50) not null,PHONE varchar(50) not null) engine=MyISAM;
+insert into t1 ( RID,IID,nada,NAME,PHONE) values (1, 1, 'main', 'a', '111'), (2, 1, 'main', 'b', '222'), (3, 1, 'main', 'c', '333'), (4, 1, 'main', 'd', '444'), (5, 1, 'main', 'e', '555'), (6, 2, 'main', 'c', '333'), (7, 2, 'main', 'd', '454'), (8, 2, 'main', 'e', '555'), (9, 2, 'main', 'f', '666'), (10, 2, 'main', 'g', '777');
+select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 A left join t1 B on A.NAME = B.NAME and B.IID = 2 where A.IID = 1 and (A.PHONE <> B.PHONE or B.NAME is null) union select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 B left join t1 A on B.NAME = A.NAME and A.IID = 1 where B.IID = 2 and (A.PHONE <> B.PHONE or A.NAME is null);
+NAME PHONE NAME PHONE
+a 111 NULL NULL
+b 222 NULL NULL
+d 444 d 454
+NULL NULL f 666
+NULL NULL g 777
+drop table t1;
+create table t1 ( id int, name char(10) not null, name2 char(10) not null ) engine=innodb;
+insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
+select name2 from t1 union all select name from t1 union all select id from t1;
+name2
+fff
+sss
+ttt
+first
+second
+third
+1
+2
+3
+drop table t1;
diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
index bff950584a1..ae1605c99f4 100644
--- a/mysql-test/r/warnings.result
+++ b/mysql-test/r/warnings.result
@@ -125,11 +125,11 @@ Warning 1266 Using storage engine MyISAM for table 't1'
drop table t1;
create table t1 (id int) type=heap;
Warnings:
-Warning 1287 'TYPE=storage_engine' is deprecated. Use 'ENGINE=storage_engine' instead.
+Warning 1287 'TYPE=storage_engine' is deprecated, use 'ENGINE=storage_engine' instead
alter table t1 type=myisam;
Warnings:
-Warning 1287 'TYPE=storage_engine' is deprecated. Use 'ENGINE=storage_engine' instead.
+Warning 1287 'TYPE=storage_engine' is deprecated, use 'ENGINE=storage_engine' instead
drop table t1;
set table_type=MYISAM;
Warnings:
-Warning 1287 'table_type' is deprecated. Use 'storage_engine' instead.
+Warning 1287 'table_type' is deprecated, use 'storage_engine' instead
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index ab0242990fc..fab35bb334a 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -28,8 +28,6 @@ select CAST(DATE "2004-01-22 21:45:33" AS CHAR(4) BINARY);
set names binary;
select cast(_latin1'test' as char character set latin2);
select cast(_koi8r'ÔÅÓÔ' as char character set cp1251);
-select convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci");
-select convert(_koi8r'ÔÅÓÔ', "koi8r_general_ci", "cp1251_general_ci");
create table t1 select cast(_koi8r'ÔÅÓÔ' as char character set cp1251) as t;
show create table t1;
drop table t1;
diff --git a/mysql-test/t/ctype_many.test b/mysql-test/t/ctype_many.test
index 7b44439aa50..26057e7c997 100644
--- a/mysql-test/t/ctype_many.test
+++ b/mysql-test/t/ctype_many.test
@@ -147,11 +147,6 @@ UPDATE t1 SET utf8_f=CONVERT(koi8_ru_f USING utf8);
SET CHARACTER SET koi8r;
SELECT * FROM t1;
-#
-# codecovarage for Item_func_conv_charset3
-#
-select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
-explain extended select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL;
UPDATE t1 SET bin_f=koi8_ru_f;
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 9da7b32eb6d..49b1ed94757 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -61,3 +61,47 @@ create table t1 (s1 char(1) character set utf8);
insert into t1 values (_koi8r'ÁÂ');
select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
drop table t1;
+
+create table t1 (s1 tinytext character set utf8);
+insert into t1 select repeat('a',300);
+insert into t1 select repeat('Ñ',300);
+insert into t1 select repeat('aÑ',300);
+insert into t1 select repeat('Ña',300);
+insert into t1 select repeat('ÑÑ',300);
+select hex(s1) from t1;
+select length(s1),char_length(s1) from t1;
+drop table t1;
+
+create table t1 (s1 text character set utf8);
+insert into t1 select repeat('a',66000);
+insert into t1 select repeat('Ñ',66000);
+insert into t1 select repeat('aÑ',66000);
+insert into t1 select repeat('Ña',66000);
+insert into t1 select repeat('ÑÑ',66000);
+select length(s1),char_length(s1) from t1;
+drop table t1;
+
+#
+# Bug #2368 Multibyte charsets do not check that incoming data is well-formed
+#
+create table t1 (s1 char(10) character set utf8);
+insert into t1 values (0x41FF);
+select hex(s1) from t1;
+drop table t1;
+
+create table t1 (s1 varchar(10) character set utf8);
+insert into t1 values (0x41FF);
+select hex(s1) from t1;
+drop table t1;
+
+create table t1 (s1 text character set utf8);
+insert into t1 values (0x41FF);
+select hex(s1) from t1;
+drop table t1;
+
+#
+# Bug 2699
+# UTF8 breaks primary keys for cols > 85 characters
+#
+--error 1089
+create table t1 (a char(160) character set utf8, primary key(a));
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index 98b9eb114ab..48a3bc54240 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -65,6 +65,10 @@ select * from t1 where MATCH a,b AGAINST ('"text search" +"now support"' IN BOOL
select * from t1 where MATCH a,b AGAINST ('"text i"' IN BOOLEAN MODE);
select * from t1 where MATCH a,b AGAINST ('"xt indexes"' IN BOOLEAN MODE);
+# bug#2708 crash
+
+select * from t1 where MATCH a,b AGAINST('"space model' IN BOOLEAN MODE);
+
# boolean w/o index:
select * from t1 where MATCH a AGAINST ("search" IN BOOLEAN MODE);
diff --git a/mysql-test/t/func_system.test b/mysql-test/t/func_system.test
index f3b9b4ffc3f..a05b80ca56b 100644
--- a/mysql-test/t/func_system.test
+++ b/mysql-test/t/func_system.test
@@ -23,4 +23,10 @@ create table t1 (version char(40)) select database(), user(), version() as 'vers
show create table t1;
drop table t1;
+select charset(charset(_utf8'a')), charset(collation(_utf8'a'));
+select collation(charset(_utf8'a')), collation(collation(_utf8'a'));
+create table t1 select charset(_utf8'a'), collation(_utf8'a');
+show create table t1;
+drop table t1;
+
select TRUE,FALSE,NULL;
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index 5cf3e10f972..ea7d7fa44af 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -100,18 +100,18 @@ select 1; -- To test that the previous command didn't cause problems
create table t1 (a int);
grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION;
show grants for drop_user2@localhost;
-revoke all privileges, grant from drop_user2@localhost;
+revoke all privileges, grant option from drop_user2@localhost;
drop user drop_user2@localhost;
grant ALL PRIVILEGES on *.* to drop_user@localhost with GRANT OPTION;
grant ALL PRIVILEGES on test.* to drop_user@localhost with GRANT OPTION;
grant select(a) on test.t1 to drop_user@localhost;
show grants for drop_user@localhost;
-revoke all privileges, grant from drop_user@localhost;
+revoke all privileges, grant option from drop_user@localhost;
show grants for drop_user@localhost;
drop user drop_user@localhost;
--error 1269
-revoke all privileges, grant from drop_user@localhost;
+revoke all privileges, grant option from drop_user@localhost;
grant select(a) on test.t1 to drop_user1@localhost;
grant select on test.t1 to drop_user2@localhost;
@@ -120,7 +120,7 @@ grant select on *.* to drop_user4@localhost;
--error 1268
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
drop_user4@localhost;
-revoke all privileges, grant from drop_user1@localhost, drop_user2@localhost,
+revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost,
drop_user3@localhost, drop_user4@localhost;
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
drop_user4@localhost;
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 9bfaaa51b09..3e9f67b0ab1 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -63,3 +63,27 @@ INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --skip-comments --compatible=mysql40 test t1
--exec $MYSQL_DUMP --skip-comments --compatible=mysql323 test t1
DROP TABLE t1;
+
+#
+# Bug #2592 'mysqldum doesn't quote "tricky" names correctly'
+#
+
+create table ```a` (i int);
+--exec $MYSQL_DUMP --skip-comments test
+drop table ```a`;
+
+#
+# Bug #2705 'mysqldump --tab extra output'
+#
+
+create table t1(a int);
+insert into t1 values (1),(2),(3);
+--exec $MYSQL_DUMP --skip-comments --tab=$MYSQL_TEST_DIR/var/tmp/ test
+--exec cat $MYSQL_TEST_DIR/var/tmp/t1.sql
+--exec cat $MYSQL_TEST_DIR/var/tmp/t1.txt
+--exec rm $MYSQL_TEST_DIR/var/tmp/t1.sql
+--exec rm $MYSQL_TEST_DIR/var/tmp/t1.txt
+--exec $MYSQL_DUMP --tab=$MYSQL_TEST_DIR/var/tmp/ test
+--exec rm $MYSQL_TEST_DIR/var/tmp/t1.sql
+--exec rm $MYSQL_TEST_DIR/var/tmp/t1.txt
+drop table t1;
diff --git a/mysql-test/t/rpl_log.test b/mysql-test/t/rpl_log.test
index 7ae0a4dc3c2..5f59b1034dc 100644
--- a/mysql-test/t/rpl_log.test
+++ b/mysql-test/t/rpl_log.test
@@ -35,12 +35,14 @@ drop table t1;
create table t1 (word char(20) not null);
load data infile '../../std_data/words.dat' into table t1 ignore 1 lines;
select count(*) from t1;
+create table t2 like t1;
drop table t1;
--replace_result $VERSION VERSION
show binlog events;
show binlog events from 79 limit 1;
show binlog events from 79 limit 2;
show binlog events from 79 limit 2,1;
+show binlog events from 79 limit 2,2;
flush logs;
# We need an extra update before doing save_master_pos.
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index d262f02c978..1d64cfd2105 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -142,3 +142,43 @@ drop table t1;
create table t1 (c decimal(3,3), d double(3,3), f float(3,3));
show columns from t1;
drop table t1;
+
+#
+# Test for Bug #2593 "SHOW CREATE TABLE doesn't properly double quotes"
+#
+
+SET sql_mode='';
+SET sql_quote_show_create=OFF;
+
+CREATE TABLE ```ab``cd``` (i INT);
+SHOW CREATE TABLE ```ab``cd```;
+DROP TABLE ```ab``cd```;
+
+CREATE TABLE ```ab````cd``` (i INT);
+SHOW CREATE TABLE ```ab````cd```;
+DROP TABLE ```ab````cd```;
+
+CREATE TABLE ```a` (i INT);
+SHOW CREATE TABLE ```a`;
+DROP TABLE ```a`;
+
+SET sql_mode='ANSI_QUOTES';
+
+CREATE TABLE """a" (i INT);
+SHOW CREATE TABLE """a";
+DROP TABLE """a";
+
+# to test quotes around keywords.. :
+
+SET sql_mode='';
+SET sql_quote_show_create=OFF;
+
+CREATE TABLE t1 (i INT);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE `table` (i INT);
+SHOW CREATE TABLE `table`;
+DROP TABLE `table`;
+
+SET sql_quote_show_create=ON;
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index c5e4ce42ffe..42fb2afbe89 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -522,7 +522,7 @@ set @a:=(SELECT a from t1);
CREATE TABLE t1 (a int, KEY(a));
HANDLER t1 OPEN;
--- error 1149
+-- error 1064
HANDLER t1 READ a=((SELECT 1));
HANDLER t1 CLOSE;
drop table t1;
@@ -1049,3 +1049,14 @@ INSERT INTO `t2` VALUES (16,1987),(50,1990),(51,1990);
SELECT cns.id, cns.max_anno_dep, cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM t2 AS cns;
DROP TABLE t1, t2;
+
+#
+# GLOBAL LIMIT
+#
+create table t1 (a int);
+insert into t1 values (1), (2), (3);
+SET SQL_SELECT_LIMIT=1;
+select sum(a) from (select * from t1) as a;
+select 2 in (select * from t1);
+SET SQL_SELECT_LIMIT=default;
+drop table t1;
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 55f53fb4c17..c88ac4e70d8 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -213,7 +213,7 @@ select found_rows();
(SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2 LIMIT 1);
select found_rows();
# This used to work in 4.0 but not anymore in 4.1
---error 1149
+--error 1064
(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 1;
#select found_rows();
@@ -465,3 +465,22 @@ show status like 'Slow_queries';
select count(*) from t1 where a=7 union select count(*) from t1 where b=13;
show status like 'Slow_queries';
drop table t1;
+
+#
+# bug #2508
+#
+create table t1 ( RID int(11) not null default '0', IID int(11) not null default '0', nada varchar(50) not null,NAME varchar(50) not null,PHONE varchar(50) not null) engine=MyISAM;
+insert into t1 ( RID,IID,nada,NAME,PHONE) values (1, 1, 'main', 'a', '111'), (2, 1, 'main', 'b', '222'), (3, 1, 'main', 'c', '333'), (4, 1, 'main', 'd', '444'), (5, 1, 'main', 'e', '555'), (6, 2, 'main', 'c', '333'), (7, 2, 'main', 'd', '454'), (8, 2, 'main', 'e', '555'), (9, 2, 'main', 'f', '666'), (10, 2, 'main', 'g', '777');
+select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 A left join t1 B on A.NAME = B.NAME and B.IID = 2 where A.IID = 1 and (A.PHONE <> B.PHONE or B.NAME is null) union select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 B left join t1 A on B.NAME = A.NAME and A.IID = 1 where B.IID = 2 and (A.PHONE <> B.PHONE or A.NAME is null);
+drop table t1;
+
+#
+# bug #2552
+#
+--disable_warnings
+create table t1 ( id int, name char(10) not null, name2 char(10) not null ) engine=innodb;
+--enable_warnings
+insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
+select name2 from t1 union all select name from t1 union all select id from t1;
+drop table t1;
+
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index 08737221fb2..52b7f153e0d 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -627,7 +627,7 @@ writes: %ld r_requests: %ld reads: %ld",
a pointer to the last element.
*/
-static inline void link_into_queue(KEYCACHE_WQUEUE *wqueue,
+static void link_into_queue(KEYCACHE_WQUEUE *wqueue,
struct st_my_thread_var *thread)
{
struct st_my_thread_var *last;
@@ -662,7 +662,7 @@ static inline void link_into_queue(KEYCACHE_WQUEUE *wqueue,
See NOTES for link_into_queue
*/
-static inline void unlink_from_queue(KEYCACHE_WQUEUE *wqueue,
+static void unlink_from_queue(KEYCACHE_WQUEUE *wqueue,
struct st_my_thread_var *thread)
{
KEYCACHE_DBUG_PRINT("unlink_from_queue", ("thread %ld", thread->id));
diff --git a/mysys/my_new.cc b/mysys/my_new.cc
index ec27502d8aa..14423c3afd5 100644
--- a/mysys/my_new.cc
+++ b/mysys/my_new.cc
@@ -19,10 +19,10 @@
with gcc 3.0.x to avoid including libstdc++
*/
-#ifdef USE_MYSYS_NEW
-
#include "mysys_priv.h"
+#ifdef USE_MYSYS_NEW
+
void *operator new (size_t sz)
{
return (void *) malloc (sz ? sz : 1);
diff --git a/mytest-old.c b/mytest-old.c
deleted file mode 100644
index 8b4029f5e1e..00000000000
--- a/mytest-old.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*C4*/
-/****************************************************************/
-/* Author: Jethro Wright, III TS : 3/ 4/1998 9:15 */
-/* Date: 02/18/1998 */
-/* mytest.c : do some testing of the libmySQL.DLL.... */
-/* */
-/* History: */
-/* 02/18/1998 jw3 also sprach zarathustra.... */
-/****************************************************************/
-
-
-#include <windows.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <mysql.h>
-
-#define DEFALT_SQL_STMT "SELECT * FROM db"
-#ifndef offsetof
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-
-
-/********************************************************
-**
-** main :-
-**
-********************************************************/
-
-int
-main( int argc, char * argv[] )
-{
-
- char szSQL[ 200 ], aszFlds[ 25 ][ 25 ], * pszT, szDB[ 50 ] ;
- int i, j, k, l, x ;
- MYSQL * myData ;
- MYSQL_RES * res ;
- MYSQL_FIELD * fd ;
- MYSQL_ROW row ;
-
- //....just curious....
- printf( "sizeof( MYSQL ) == %d\n", sizeof( MYSQL ) ) ;
- if ( argc == 2 )
- {
- strcpy( szDB, argv[ 1 ] ) ;
- strcpy( szSQL, DEFALT_SQL_STMT ) ;
- if (!strcmp(szDB,"--debug"))
- {
- strcpy( szDB, "mysql" ) ;
- printf("Some mysql struct information (size and offset):\n");
- printf("net:\t%3d %3d\n",sizeof(myData->net),offsetof(MYSQL,net));
- printf("host:\t%3d %3d\n",sizeof(myData->host),offsetof(MYSQL,host));
- printf("port:\t%3d %3d\n",sizeof(myData->port),offsetof(MYSQL,port));
- printf("protocol_version:\t%3d %3d\n",sizeof(myData->protocol_version),
- offsetof(MYSQL,protocol_version));
- printf("thread_id:\t%3d %3d\n",sizeof(myData->thread_id),
- offsetof(MYSQL,thread_id));
- printf("affected_rows:\t%3d %3d\n",sizeof(myData->affected_rows),
- offsetof(MYSQL,affected_rows));
- printf("packet_length:\t%3d %3d\n",sizeof(myData->packet_length),
- offsetof(MYSQL,packet_length));
- printf("status:\t%3d %3d\n",sizeof(myData->status),
- offsetof(MYSQL,status));
- printf("fields:\t%3d %3d\n",sizeof(myData->fields),
- offsetof(MYSQL,fields));
- printf("field_alloc:\t%3d %3d\n",sizeof(myData->field_alloc),
- offsetof(MYSQL,field_alloc));
- printf("free_me:\t%3d %3d\n",sizeof(myData->free_me),
- offsetof(MYSQL,free_me));
- printf("options:\t%3d %3d\n",sizeof(myData->options),
- offsetof(MYSQL,options));
- puts("");
- }
- }
- else if ( argc > 2 ) {
- strcpy( szDB, argv[ 1 ] ) ;
- strcpy( szSQL, argv[ 2 ] ) ;
- }
- else {
- strcpy( szDB, "mysql" ) ;
- strcpy( szSQL, DEFALT_SQL_STMT ) ;
- }
- //....
-
- if ( (myData = mysql_init((MYSQL*) 0)) &&
- mysql_real_connect( myData, NULL, NULL, NULL, NULL, MYSQL_PORT,
- NULL, 0 ) )
- {
- if ( mysql_select_db( myData, szDB ) < 0 ) {
- printf( "Can't select the %s database !\n", szDB ) ;
- mysql_close( myData ) ;
- return 2 ;
- }
- }
- else {
- printf( "Can't connect to the mysql server on port %d !\n",
- MYSQL_PORT ) ;
- mysql_close( myData ) ;
- return 1 ;
- }
- //....
- if ( ! mysql_query( myData, szSQL ) ) {
- res = mysql_store_result( myData ) ;
- i = (int) mysql_num_rows( res ) ; l = 1 ;
- printf( "Query: %s\nNumber of records found: %ld\n", szSQL, i ) ;
- //....we can get the field-specific characteristics here....
- for ( x = 0 ; fd = mysql_fetch_field( res ) ; x++ )
- strcpy( aszFlds[ x ], fd->name ) ;
- //....
- while ( row = mysql_fetch_row( res ) ) {
- j = mysql_num_fields( res ) ;
- printf( "Record #%ld:-\n", l++ ) ;
- for ( k = 0 ; k < j ; k++ )
- printf( " Fld #%d (%s): %s\n", k + 1, aszFlds[ k ],
- (((row[k]==NULL)||(!strlen(row[k])))?"NULL":row[k])) ;
- puts( "==============================\n" ) ;
- }
- mysql_free_result( res ) ;
- }
- else printf( "Couldn't execute %s on the server !\n", szSQL ) ;
- //....
- puts( "==== Diagnostic info ====" ) ;
- pszT = mysql_get_client_info() ;
- printf( "Client info: %s\n", pszT ) ;
- //....
- pszT = mysql_get_host_info( myData ) ;
- printf( "Host info: %s\n", pszT ) ;
- //....
- pszT = mysql_get_server_info( myData ) ;
- printf( "Server info: %s\n", pszT ) ;
- //....
- res = mysql_list_processes( myData ) ; l = 1 ;
- if (res)
- {
- for ( x = 0 ; fd = mysql_fetch_field( res ) ; x++ )
- strcpy( aszFlds[ x ], fd->name ) ;
- while ( row = mysql_fetch_row( res ) ) {
- j = mysql_num_fields( res ) ;
- printf( "Process #%ld:-\n", l++ ) ;
- for ( k = 0 ; k < j ; k++ )
- printf( " Fld #%d (%s): %s\n", k + 1, aszFlds[ k ],
- (((row[k]==NULL)||(!strlen(row[k])))?"NULL":row[k])) ;
- puts( "==============================\n" ) ;
- }
- }
- else
- {
- printf("Got error %s when retreiving processlist\n",mysql_error(myData));
- }
- //....
- res = mysql_list_tables( myData, "%" ) ; l = 1 ;
- for ( x = 0 ; fd = mysql_fetch_field( res ) ; x++ )
- strcpy( aszFlds[ x ], fd->name ) ;
- while ( row = mysql_fetch_row( res ) ) {
- j = mysql_num_fields( res ) ;
- printf( "Table #%ld:-\n", l++ ) ;
- for ( k = 0 ; k < j ; k++ )
- printf( " Fld #%d (%s): %s\n", k + 1, aszFlds[ k ],
- (((row[k]==NULL)||(!strlen(row[k])))?"NULL":row[k])) ;
- puts( "==============================\n" ) ;
- }
- //....
- pszT = mysql_stat( myData ) ;
- puts( pszT ) ;
- //....
- mysql_close( myData ) ;
- return 0 ;
-
-}
diff --git a/sql-common/client.c b/sql-common/client.c
index 1c58bd04d0e..36b2c6122dd 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1420,7 +1420,9 @@ static MYSQL_METHODS client_methods=
cli_read_binary_rows,
cli_unbuffered_fetch,
NULL,
- cli_read_statistic
+ cli_read_statistic,
+ cli_read_query_result,
+ cli_read_change_user_result
#endif
};
diff --git a/sql/field.cc b/sql/field.cc
index 4ac277dacca..1e926c0926e 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4485,19 +4485,9 @@ void Field_blob::store_length(uint32 number)
{
switch (packlength) {
case 1:
- if (number > 255)
- {
- number=255;
- set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
- }
ptr[0]= (uchar) number;
break;
case 2:
- if (number > (uint16) ~0)
- {
- number= (uint16) ~0;
- set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
- }
#ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first)
{
@@ -4508,11 +4498,6 @@ void Field_blob::store_length(uint32 number)
shortstore(ptr,(unsigned short) number);
break;
case 3:
- if (number > (uint32) (1L << 24))
- {
- number= (uint32) (1L << 24)-1L;
- set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
- }
int3store(ptr,number);
break;
case 4:
@@ -4573,6 +4558,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
bool was_conversion;
char buff[80];
String tmpstr(buff,sizeof(buff), &my_charset_bin);
+ uint copy_length;
uint32 not_used;
/* Convert character set if nesessary */
@@ -4583,12 +4569,22 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
from= tmpstr.ptr();
length= tmpstr.length();
}
- Field_blob::store_length(length);
- if (was_conversion || table->copy_blobs || length <= MAX_FIELD_WIDTH)
+
+ copy_length= max_data_length();
+ if (copy_length > length)
+ copy_length= length;
+ copy_length= field_charset->cset->wellformedlen(field_charset,
+ from,from+copy_length,
+ field_length);
+ if (copy_length < length)
+ set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
+
+ Field_blob::store_length(copy_length);
+ if (was_conversion || table->copy_blobs || copy_length <= MAX_FIELD_WIDTH)
{ // Must make a copy
if (from != value.ptr()) // For valgrind
{
- value.copy(from,length,charset());
+ value.copy(from,copy_length,charset());
from=value.ptr();
}
}
diff --git a/sql/field.h b/sql/field.h
index 0d834b48976..90e78c5421a 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -953,6 +953,15 @@ public:
void sort_string(char *buff,uint length);
uint32 pack_length() const
{ return (uint32) (packlength+table->blob_ptr_size); }
+ uint32 max_data_length() const
+ {
+ switch (packlength) {
+ case 1: return 255;
+ case 2: return (uint32) 0xFFFFL;
+ case 3: return (uint32) 0xFFFFFF;
+ default: return (uint32) 0xFFFFFFFF;
+ }
+ }
void reset(void) { bzero(ptr, packlength+sizeof(char*)); }
void reset_fields() { bzero((char*) &value,sizeof(value)); }
void store_length(uint32 number);
diff --git a/sql/gstream.cc b/sql/gstream.cc
index a97ed9cae03..17b85af22bd 100644
--- a/sql/gstream.cc
+++ b/sql/gstream.cc
@@ -101,7 +101,7 @@ int GTextReadStream::get_next_number(double *d)
char *endptr;
- *d = strtod(cur, &endptr);
+ *d = my_strtod(cur, &endptr);
if (endptr)
{
diff --git a/sql/init.cc b/sql/init.cc
index 033dfd72843..084db57f8aa 100644
--- a/sql/init.cc
+++ b/sql/init.cc
@@ -34,9 +34,6 @@ void unireg_init(ulong options)
current_pid=(ulong) getpid(); /* Save for later ref */
init_time(); /* Init time-functions (read zone) */
-#ifdef USE_MY_ATOF
- init_my_atof(); /* use our atof */
-#endif
#ifndef EMBEDDED_LIBRARY
my_abort_hook=unireg_abort; /* Abort with close of databases */
#endif
diff --git a/sql/item.cc b/sql/item.cc
index b9a6a164a86..eb2550fdbcc 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -569,6 +569,8 @@ void Item_param::set_time(TIME *tm, timestamp_type type)
ltime.second_part= tm->second_part;
+ ltime.neg= tm->neg;
+
ltime.time_type= type;
item_is_time= true;
diff --git a/sql/item.h b/sql/item.h
index a5648c5889b..4d081905e0d 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -442,7 +442,7 @@ class Item_real :public Item
public:
const double value;
// Item_real() :value(0) {}
- Item_real(const char *str_arg,uint length) :value(atof(str_arg))
+ Item_real(const char *str_arg,uint length) :value(my_atof(str_arg))
{
name=(char*) str_arg;
decimals=(uint8) nr_of_decimals(str_arg);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index b337364c88a..0327204dbfd 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2256,7 +2256,7 @@ double user_var_entry::val(my_bool *null_value)
case INT_RESULT:
return (double) *(longlong*) value;
case STRING_RESULT:
- return atof(value); // This is null terminated
+ return my_atof(value); // This is null terminated
case ROW_RESULT:
DBUG_ASSERT(1); // Impossible
break;
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index fd1222d5f1a..ed6e44262c7 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2124,42 +2124,6 @@ void Item_func_conv_charset::print(String *str)
str->append(')');
}
-String *Item_func_conv_charset3::val_str(String *str)
-{
- char cs1[30], cs2[30];
- String to_cs_buff(cs1, sizeof(cs1), default_charset_info);
- String from_cs_buff(cs2, sizeof(cs2), default_charset_info);
- String *arg= args[0]->val_str(str);
- String *to_cs= args[1]->val_str(&to_cs_buff);
- String *from_cs= args[2]->val_str(&from_cs_buff);
- CHARSET_INFO *from_charset;
- CHARSET_INFO *to_charset;
-
- if (!arg || args[0]->null_value ||
- !to_cs || args[1]->null_value ||
- !from_cs || args[2]->null_value ||
- !(from_charset=get_charset_by_name(from_cs->ptr(), MYF(MY_WME))) ||
- !(to_charset=get_charset_by_name(to_cs->ptr(), MYF(MY_WME))))
- {
- null_value= 1;
- return 0;
- }
-
- if (str_value.copy(arg->ptr(), arg->length(), from_charset, to_charset))
- {
- null_value= 1;
- return 0;
- }
- null_value= 0;
- return &str_value;
-}
-
-
-void Item_func_conv_charset3::fix_length_and_dec()
-{
- max_length = args[0]->max_length;
-}
-
String *Item_func_set_collation::val_str(String *str)
{
str=args[0]->val_str(str);
@@ -2226,7 +2190,7 @@ String *Item_func_charset::val_str(String *str)
if ((null_value=(args[0]->null_value || !res->charset())))
return 0;
str->copy(res->charset()->csname,strlen(res->charset()->csname),
- &my_charset_latin1, default_charset());
+ &my_charset_latin1, collation.collation);
return str;
}
@@ -2237,7 +2201,7 @@ String *Item_func_collation::val_str(String *str)
if ((null_value=(args[0]->null_value || !res->charset())))
return 0;
str->copy(res->charset()->name,strlen(res->charset()->name),
- &my_charset_latin1, default_charset());
+ &my_charset_latin1, collation.collation);
return str;
}
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 465300e721e..4832ddbd1b1 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -619,16 +619,6 @@ public:
void print(String *str) { print_op(str); }
};
-class Item_func_conv_charset3 :public Item_str_func
-{
-public:
- Item_func_conv_charset3(Item *arg1,Item *arg2,Item *arg3)
- :Item_str_func(arg1,arg2,arg3) {}
- String *val_str(String *);
- void fix_length_and_dec();
- const char *func_name() const { return "convert"; }
-};
-
class Item_func_charset :public Item_str_func
{
public:
@@ -637,8 +627,8 @@ public:
const char *func_name() const { return "charset"; }
void fix_length_and_dec()
{
- max_length=40; // should be enough
collation.set(system_charset_info);
+ max_length= 64 * collation.collation->mbmaxlen; // should be enough
};
};
@@ -650,8 +640,8 @@ public:
const char *func_name() const { return "collation"; }
void fix_length_and_dec()
{
- max_length=40; // should be enough
collation.set(system_charset_info);
+ max_length= 64 * collation.collation->mbmaxlen; // should be enough
};
};
diff --git a/sql/item_sum.h b/sql/item_sum.h
index bb03f029997..0848886d6d8 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -284,7 +284,7 @@ class Item_sum_avg :public Item_sum_num
ulonglong count;
public:
- Item_sum_avg(Item *item_par) :Item_sum_num(item_par),count(0) {}
+ Item_sum_avg(Item *item_par) :Item_sum_num(item_par), sum(0.0), count(0) {}
Item_sum_avg(THD *thd, Item_sum_avg *item)
:Item_sum_num(thd, item), sum(item->sum), count(item->count) {}
enum Sumfunctype sum_func () const {return AVG_FUNC;}
@@ -736,7 +736,7 @@ class Item_func_group_concat : public Item_sum
enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;}
const char *func_name() const { return "group_concat"; }
- enum Type type() const { return SUM_FUNC_ITEM; }
+ enum Type type() const { return SUM_FUNC_ITEM; }
virtual Item_result result_type () const { return STRING_RESULT; }
void clear();
bool add();
@@ -748,7 +748,7 @@ class Item_func_group_concat : public Item_sum
double val()
{
String *res; res=val_str(&str_value);
- return res ? atof(res->c_ptr()) : 0.0;
+ return res ? my_atof(res->c_ptr()) : 0.0;
}
longlong val_int()
{
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 76acc74a358..5e265412be7 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -764,6 +764,8 @@ uint find_type(TYPELIB *lib, const char *find, uint length, bool part_match);
uint check_word(TYPELIB *lib, const char *val, const char *end,
const char **end_of_word);
+bool is_keyword(const char *name, uint len);
+
/* sql_parse.cc */
void free_items(Item *item);
void cleanup_items(Item *item);
diff --git a/sql/protocol.cc b/sql/protocol.cc
index bef567ad346..40adc9e8961 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -313,6 +313,7 @@ send_ok(THD *thd, ha_rows affected_rows, ulonglong id, const char *message)
DBUG_VOID_RETURN;
}
+static char eof_buff[1]= { (char) 254 }; /* Marker for end of fields */
/*
Send eof (= end of result set) to the client
@@ -339,12 +340,11 @@ send_ok(THD *thd, ha_rows affected_rows, ulonglong id, const char *message)
void
send_eof(THD *thd, bool no_flush)
{
- static char eof_buff[1]= { (char) 254 }; /* Marker for end of fields */
NET *net= &thd->net;
DBUG_ENTER("send_eof");
if (net->vio != 0)
{
- if (!no_flush && (thd->client_capabilities & CLIENT_PROTOCOL_41))
+ if (thd->client_capabilities & CLIENT_PROTOCOL_41)
{
uchar buff[5];
uint tmp= min(thd->total_warn_count, 65535);
@@ -384,9 +384,8 @@ send_eof(THD *thd, bool no_flush)
bool send_old_password_request(THD *thd)
{
- static char buff[1]= { (char) 254 };
NET *net= &thd->net;
- return my_net_write(net, buff, 1) || net_flush(net);
+ return my_net_write(net, eof_buff, 1) || net_flush(net);
}
#endif /* EMBEDDED_LIBRARY */
@@ -585,7 +584,7 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
#endif
}
- send_eof(thd, 1);
+ my_net_write(&thd->net, eof_buff, 1);
DBUG_RETURN(prepare_for_send(list));
err:
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 93de5333f6b..7f5cf9503bf 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -701,7 +701,6 @@ struct show_var_st init_vars[]= {
{"port", (char*) &mysqld_port, SHOW_INT},
{"protocol_version", (char*) &protocol_version, SHOW_INT},
{sys_preload_buff_size.name, (char*) &sys_preload_buff_size, SHOW_SYS},
- {sys_pseudo_thread_id.name, (char*) &sys_pseudo_thread_id, SHOW_SYS},
{sys_query_alloc_block_size.name, (char*) &sys_query_alloc_block_size,
SHOW_SYS},
#ifdef HAVE_QUERY_CACHE
diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt
index 1fff3b16910..70a32fe8ac4 100644
--- a/sql/share/czech/errmsg.txt
+++ b/sql/share/czech/errmsg.txt
@@ -286,7 +286,7 @@ character-set=latin2
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -299,7 +299,7 @@ character-set=latin2
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"The target table %-.100s of the %s is not updatable",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt
index 9e80f7e6430..a0067918fd2 100644
--- a/sql/share/danish/errmsg.txt
+++ b/sql/share/danish/errmsg.txt
@@ -280,7 +280,7 @@ character-set=latin1
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support, they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -293,7 +293,7 @@ character-set=latin1
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"The target table %-.100s of the %s is not updateable",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt
index 44a92db452f..4941ec5c3b1 100644
--- a/sql/share/dutch/errmsg.txt
+++ b/sql/share/dutch/errmsg.txt
@@ -288,7 +288,7 @@ character-set=latin1
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -301,7 +301,7 @@ character-set=latin1
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"The target table %-.100s of the %s is not updateable",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt
index ac795af0207..513370d80d0 100644
--- a/sql/share/english/errmsg.txt
+++ b/sql/share/english/errmsg.txt
@@ -277,7 +277,7 @@ character-set=latin1
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -290,7 +290,7 @@ character-set=latin1
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"The target table %-.100s of the %s is not updatable",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt
index 984a988d169..9c44e82c4fc 100644
--- a/sql/share/estonian/errmsg.txt
+++ b/sql/share/estonian/errmsg.txt
@@ -282,7 +282,7 @@ character-set=latin7
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -295,7 +295,7 @@ character-set=latin7
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"The target table %-.100s of the %s is not updateable",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt
index 1b2778e0ddd..1b79323ddbf 100644
--- a/sql/share/french/errmsg.txt
+++ b/sql/share/french/errmsg.txt
@@ -277,7 +277,7 @@ character-set=latin1
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -290,7 +290,7 @@ character-set=latin1
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"The target table %-.100s of the %s is not updateable",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt
index a54f36b9c5c..53f7c762af0 100644
--- a/sql/share/german/errmsg.txt
+++ b/sql/share/german/errmsg.txt
@@ -302,7 +302,7 @@ character-set=latin1
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"The target table %-.100s of the %s is not updateable",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt
index c2bfd1ad4a0..ead697d6fb0 100644
--- a/sql/share/greek/errmsg.txt
+++ b/sql/share/greek/errmsg.txt
@@ -277,7 +277,7 @@ character-set=greek
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -290,7 +290,7 @@ character-set=greek
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"The target table %-.100s of the %s is not updateable",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt
index 5ad0aa7d3be..1cc15e647a2 100644
--- a/sql/share/hungarian/errmsg.txt
+++ b/sql/share/hungarian/errmsg.txt
@@ -279,7 +279,7 @@ character-set=latin2
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -292,7 +292,7 @@ character-set=latin2
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"The target table %-.100s of the %s is not updateable",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt
index 20b8f96b078..09c9577d166 100644
--- a/sql/share/italian/errmsg.txt
+++ b/sql/share/italian/errmsg.txt
@@ -277,7 +277,7 @@ character-set=latin1
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -290,7 +290,7 @@ character-set=latin1
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"The target table %-.100s of the %s is not updateable",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt
index 00a8c53fce7..11af58c116c 100644
--- a/sql/share/japanese/errmsg.txt
+++ b/sql/share/japanese/errmsg.txt
@@ -279,7 +279,7 @@ character-set=ujis
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -292,7 +292,7 @@ character-set=ujis
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"The target table %-.100s of the %s is not updateable",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt
index ba2e523e9db..133b1ce68f2 100644
--- a/sql/share/korean/errmsg.txt
+++ b/sql/share/korean/errmsg.txt
@@ -277,7 +277,7 @@ character-set=euckr
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -290,7 +290,7 @@ character-set=euckr
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"The target table %-.100s of the %s is not updateable",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt
index f66372b0c35..fa9eed5503c 100644
--- a/sql/share/norwegian-ny/errmsg.txt
+++ b/sql/share/norwegian-ny/errmsg.txt
@@ -279,7 +279,7 @@ character-set=latin1
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -292,7 +292,7 @@ character-set=latin1
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"The target table %-.100s of the %s is not updateable",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt
index 39f368a8b28..a5afec86b99 100644
--- a/sql/share/norwegian/errmsg.txt
+++ b/sql/share/norwegian/errmsg.txt
@@ -279,7 +279,7 @@ character-set=latin1
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -292,7 +292,7 @@ character-set=latin1
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"The target table %-.100s of the %s is not updateable",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt
index e4da21544ac..fca1af7fb04 100644
--- a/sql/share/polish/errmsg.txt
+++ b/sql/share/polish/errmsg.txt
@@ -281,7 +281,7 @@ character-set=latin2
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -294,7 +294,7 @@ character-set=latin2
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"The target table %-.100s of the %s is not updateble",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt
index 5c4e9c68d01..40d89ccb99c 100644
--- a/sql/share/portuguese/errmsg.txt
+++ b/sql/share/portuguese/errmsg.txt
@@ -291,7 +291,7 @@ character-set=latin1
"Key cache desconhecida '%-.100s'",
"MySQL foi inicializado em modo --skip-name-resolve. Você necesita reincializá-lo sem esta opção para este grant funcionar",
"Motor de tabela desconhecido '%s'",
-"'%s' é desatualizado. Use '%s' em seu lugar.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' é desatualizado. Use '%s' em seu lugar",
+"The target table %-.100s of the %s is not updateable",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt
index 268d6aed7db..d21e40ef07c 100644
--- a/sql/share/romanian/errmsg.txt
+++ b/sql/share/romanian/errmsg.txt
@@ -281,7 +281,7 @@ character-set=latin2
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -294,7 +294,7 @@ character-set=latin2
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"The target table %-.100s of the %s is not updateable",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt
index 2d41badf981..d2f593bb19f 100644
--- a/sql/share/russian/errmsg.txt
+++ b/sql/share/russian/errmsg.txt
@@ -89,7 +89,7 @@ character-set=koi8r
"îÅ×ÏÚÍÏÖÎÏ ÓÏÚÄÁÔØ IP-ÓÏËÅÔ",
"÷ ÔÁÂÌÉÃÅ '%-.64s' ÎÅÔ ÔÁËÏÇÏ ÉÎÄÅËÓÁ, ËÁË × CREATE INDEX. óÏÚÄÁÊÔÅ ÔÁÂÌÉÃÕ ÚÁÎÏ×Ï",
"áÒÇÕÍÅÎÔ ÒÁÚÄÅÌÉÔÅÌÑ ÐÏÌÅÊ - ÎÅ ÔÏÔ, ËÏÔÏÒÙÊ ÏÖÉÄÁÌÓÑ. ïÂÒÁÝÁÊÔÅÓØ Ë ÄÏËÕÍÅÎÔÁÃÉÉ",
-"æÉËÓÉÒÏ×ÁÎÎÙÊ ÒÁÚÍÅÒ ÚÁÐÉÓÉ Ó ÐÏÌÑÍÉ ÔÉÐÁ BLOB ÉÓÐÏÌØÚÏ×ÁÔØ ÎÅÌØÚÑ. ðÒÉÍÅÎÑÊÔÅ 'fields terminated by'.",
+"æÉËÓÉÒÏ×ÁÎÎÙÊ ÒÁÚÍÅÒ ÚÁÐÉÓÉ Ó ÐÏÌÑÍÉ ÔÉÐÁ BLOB ÉÓÐÏÌØÚÏ×ÁÔØ ÎÅÌØÚÑ, ÐÒÉÍÅÎÑÊÔÅ 'fields terminated by'",
"æÁÊÌ '%-.64s' ÄÏÌÖÅÎ ÎÁÈÏÄÉÔØÓÑ × ÔÏÍ ÖÅ ËÁÔÁÌÏÇÅ, ÞÔÏ É ÂÁÚÁ ÄÁÎÎÙÈ, ÉÌÉ ÂÙÔØ ÏÂÝÅÄÏÓÔÕÐÎÙÍ ÄÌÑ ÞÔÅÎÉÑ",
"æÁÊÌ '%-.80s' ÕÖÅ ÓÕÝÅÓÔ×ÕÅÔ",
"úÁÐÉÓÅÊ: %ld õÄÁÌÅÎÏ: %ld ðÒÏÐÕÝÅÎÏ: %ld ðÒÅÄÕÐÒÅÖÄÅÎÉÊ: %ld",
@@ -279,7 +279,7 @@ character-set=koi8r
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"óÅÒ×ÅÒ ÚÁÐÕÝÅÎ × ÒÅÖÉÍÅ --secure-auth (ÂÅÚÏÐÁÓÎÏÊ Á×ÔÏÒÉÚÁÃÉÉ), ÎÏ ÄÌÑ ÐÏÌØÚÏ×ÁÔÅÌÑ '%s@%s' ÐÁÒÏÌØ ÓÏÈÒÁÎ£Î × ÓÔÁÒÏÍ ÆÏÒÍÁÔÅ; ÎÅÏÂÈÏÄÉÍÏ ÏÂÎÏ×ÉÔØ ÆÏÒÍÁÔ ÐÁÒÏÌÑ",
"ðÏÌÅ ÉÌÉ ÓÓÙÌËÁ '%-.64s%s%-.64s%s%-.64s' ÉÚ SELECTÁ #%d ÂÙÌÁ ÎÁÊÄÅÎÁ × SELECTÅ #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -292,7 +292,7 @@ character-set=koi8r
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"ôÁÂÌÉÃÁ %-.100s × %s ÎÅ ÍÏÖÅÔ ÉÚÍÅÎÑÔÓÑ.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"ôÁÂÌÉÃÁ %-.100s × %s ÎÅ ÍÏÖÅÔ ÉÚÍÅÎÑÔÓÑ",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt
index 8fa7933b871..2090078a7a1 100644
--- a/sql/share/serbian/errmsg.txt
+++ b/sql/share/serbian/errmsg.txt
@@ -271,7 +271,7 @@ character-set=cp1250
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -284,7 +284,7 @@ character-set=cp1250
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working"
+"'%s' is deprecated, use '%s' instead",
+"The target table %-.100s of the %s is not updatable",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working"
"MySQL is started in --skip-grant-tables mode. You can't use this command"
diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt
index 2e4e93d1a83..e490ebfd43b 100644
--- a/sql/share/slovak/errmsg.txt
+++ b/sql/share/slovak/errmsg.txt
@@ -285,7 +285,7 @@ character-set=latin2
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -298,7 +298,7 @@ character-set=latin2
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"The target table %-.100s of the %s is not updateable",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt
index 9ad72ef2641..d8af0c461b9 100644
--- a/sql/share/spanish/errmsg.txt
+++ b/sql/share/spanish/errmsg.txt
@@ -279,7 +279,7 @@ character-set=latin1
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -292,7 +292,7 @@ character-set=latin1
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"The target table %-.100s of the %s is not updateable",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt
index eaa1c26f5a3..1ab57a6f6e2 100644
--- a/sql/share/swedish/errmsg.txt
+++ b/sql/share/swedish/errmsg.txt
@@ -277,20 +277,20 @@ character-set=latin1
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart",
"SQL thread is not to be started so UNTIL options are ignored",
-"Incorrect index name '%-.100s'",
-"Incorrect catalog name '%-.100s'",
+"Felaktigt index namn '%-.100s'",
+"Felaktigt katalog namn '%-.100s'",
"Storleken av "Query cache" kunde inte sättas till %lu, ny storlek är %lu",
"Kolumn '%-.64s' kan inte vara del av ett FULLTEXT index",
-"Unknown key cache '%-.100s'",
+"Okänd nyckel cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
-"Okänd tabell typ '%s'",
-"'%s' är deprikerad. Använd '%s' istället.",
-"The target table %-.100s of the %s is not updatable.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
-"MySQL is started in --skip-grant-tables mode. You can't use this command",
+"'%s' is deprecated, use '%s' instead",
+"Tabel %-.100s använd med '%s' är inte uppdateringsbar",
+"'%s' är inte aktiverad; För att aktivera detta måste du bygga om MySQL med '%s' definerad",
+"MySQL är started i --skip-grant-tables mod. Pga av detta kan du inte använda detta program",
+
diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt
index 84cca8d8fbb..73e1a6a5a63 100644
--- a/sql/share/ukrainian/errmsg.txt
+++ b/sql/share/ukrainian/errmsg.txt
@@ -152,7 +152,7 @@ character-set=koi8u
"ðÏ×ÎÏ×ÁÖÅÎØ ÎÅ ×ÉÚÎÁÞÅÎÏ ÄÌÑ ËÏÒÉÓÔÕ×ÁÞÁ '%-.32s' Ú ÈÏÓÔÕ '%-.64s'",
"%-.16s ËÏÍÁÎÄÁ ÚÁÂÏÒÏÎÅÎÁ ËÏÒÉÓÔÕ×ÁÞÕ: '%-.32s'@'%-.64s' Õ ÔÁÂÌÉæ '%-.64s'",
"%-.16s ËÏÍÁÎÄÁ ÚÁÂÏÒÏÎÅÎÁ ËÏÒÉÓÔÕ×ÁÞÕ: '%-.32s'@'%-.64s' ÄÌÑ ÓÔÏ×ÂÃÑ '%-.64s' Õ ÔÁÂÌÉæ '%-.64s'",
-"èÉÂÎÁ GRANT/REVOKE ËÏÍÁÎÄÁ. ðÒÏÞÉÔÁÊÔÅ ÄÏËÕÍÅÎÔÁæÀ ÓÔÏÓÏ×ÎÏ ÔÏÇÏ, Ñ˦ ÐÒÁ×Á ÍÏÖÎÁ ×ÉËÏÒÉÓÔÏ×Õ×ÁÔÉ.",
+"èÉÂÎÁ GRANT/REVOKE ËÏÍÁÎÄÁ; ÐÒÏÞÉÔÁÊÔÅ ÄÏËÕÍÅÎÔÁæÀ ÓÔÏÓÏ×ÎÏ ÔÏÇÏ, Ñ˦ ÐÒÁ×Á ÍÏÖÎÁ ×ÉËÏÒÉÓÔÏ×Õ×ÁÔÉ",
"áÒÇÕÍÅÎÔ host ÁÂÏ user ÄÌÑ GRANT ÚÁÄÏ×ÇÉÊ",
"ôÁÂÌÉÃÑ '%-.64s.%-.64s' ÎÅ ¦ÓÎÕ¤",
"ðÏ×ÎÏ×ÁÖÅÎØ ÎÅ ×ÉÚÎÁÞÅÎÏ ÄÌÑ ËÏÒÉÓÔÕ×ÁÞÁ '%-.32s' Ú ÈÏÓÔÕ '%-.64s' ÄÌÑ ÔÁÂÌÉæ '%-.64s'",
@@ -282,7 +282,7 @@ character-set=koi8u
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
-"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"óÔÏ×ÂÅÃØ ÁÂÏ ÐÏÓÉÌÁÎÎÑ '%-.64s%s%-.64s%s%-.64s' ¦Ú SELECTÕ #%d ÂÕÌÏ ÚÎÁÊÄÅÎÅ Õ SELECT¦ #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
@@ -295,7 +295,7 @@ character-set=koi8u
"Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
-"'%s' is deprecated. Use '%s' instead.",
-"ôÁÂÌÉÃÑ %-.100s Õ %s ÎÅ ÍÏÖÅ ÏÎÏ×ÌÀ×ÁÔÉÓØ.",
-"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working",
+"'%s' is deprecated, use '%s' instead",
+"ôÁÂÌÉÃÑ %-.100s Õ %s ÎÅ ÍÏÖÅ ÏÎÏ×ÌÀ×ÁÔÉÓØ",
+"The '%s' feature was disabled; you need MySQL built with '%s' define to have it working",
"MySQL is started in --skip-grant-tables mode. You can't use this command",
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 5a03a5b7324..9329ea3fd28 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2551,7 +2551,7 @@ my_bool grant_init(THD *org_thd)
do
{
GRANT_TABLE *mem_check;
- if (!(mem_check=new GRANT_TABLE(t_table,c_table)) || !mem_check->ok())
+ if (!(mem_check=new GRANT_TABLE(t_table,c_table)))
{
/* This could only happen if we are out memory */
grant_option= FALSE; /* purecov: deadcode */
@@ -2570,7 +2570,7 @@ my_bool grant_init(THD *org_thd)
}
}
- if (my_hash_insert(&column_priv_hash,(byte*) mem_check))
+ if (mem_check->ok() && my_hash_insert(&column_priv_hash,(byte*) mem_check))
{
grant_option= FALSE;
goto end_unlock;
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index 9e73e06d9c6..3c9563165fe 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -225,7 +225,7 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
info->decimals++;
if (str == end)
{
- info->dval = atod(begin);
+ info->dval = my_atof(begin);
return 1;
}
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 426e4552004..d79cb186de2 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -565,6 +565,7 @@ public:
struct st_mysql_bind *client_params;
char *extra_data;
ulong extra_length;
+ String query_rest;
#endif
NET net; // client connection descriptor
MEM_ROOT warn_root; // For warnings and errors
@@ -1075,11 +1076,11 @@ public:
uint hidden_field_count;
uint group_parts,group_length,group_null_parts;
uint quick_group;
- bool using_indirect_summary_function;
+ bool using_indirect_summary_function, all_nulls;
TMP_TABLE_PARAM()
:copy_funcs_it(copy_funcs), copy_field(0), group_parts(0),
- group_length(0), group_null_parts(0)
+ group_length(0), group_null_parts(0), all_nulls(0)
{}
~TMP_TABLE_PARAM()
{
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 65357328927..5ffe8c1c365 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -181,6 +181,23 @@ static int find_keyword(LEX *lex, uint len, bool function)
return 0;
}
+/*
+ Check if name is a keyword
+
+ SYNOPSIS
+ is_keyword()
+ name checked name
+ len length of checked name
+
+ RETURN VALUES
+ 0 name is a keyword
+ 1 name isn't a keyword
+*/
+
+bool is_keyword(const char *name, uint len)
+{
+ return get_hash_symbol(name,len,0)!=0;
+}
/* make a copy of token before ptr and set yytoklen */
@@ -193,6 +210,13 @@ static LEX_STRING get_token(LEX *lex,uint length)
return tmp;
}
+/*
+ todo:
+ There are no dangerous charsets in mysql for function
+ get_quoted_token yet. But it should be fixed in the
+ future to operate multichar strings (like ucs2)
+*/
+
static LEX_STRING get_quoted_token(LEX *lex,uint length, char quote)
{
LEX_STRING tmp;
@@ -420,7 +444,6 @@ inline static uint int_token(const char *str,uint length)
return ((uchar) str[-1] <= (uchar) cmp[-1]) ? smaller : bigger;
}
-
/*
yylex remember the following states from the following yylex()
@@ -667,32 +690,16 @@ int yylex(void *arg, void *yythd)
case MY_LEX_USER_VARIABLE_DELIMITER:
{
- char delim= c; // Used char
+ uint double_quotes= 0;
+ char quote_char= c; // Used char
lex->tok_start=lex->ptr; // Skip first `
-#ifdef USE_MB
- if (use_mb(cs))
+ while ((c=yyGet()))
{
- while ((c=yyGet()) && c != delim && c != (uchar) NAMES_SEP_CHAR)
- {
- if (my_mbcharlen(cs, c) > 1)
- {
- int l;
- if ((l = my_ismbchar(cs,
- (const char *)lex->ptr-1,
- (const char *)lex->end_of_query)) == 0)
- break;
- lex->ptr += l-1;
- }
- }
- yylval->lex_str=get_token(lex,yyLength());
- }
- else
-#endif
- {
- uint double_quotes= 0;
- char quote_char= c;
- while ((c=yyGet()))
+ int l;
+ if ((l= my_mbcharlen(cs, c)) == 1)
{
+ if (c == (uchar) NAMES_SEP_CHAR)
+ break; /* Old .frm format can't handle this char */
if (c == quote_char)
{
if (yyPeek() != quote_char)
@@ -701,16 +708,22 @@ int yylex(void *arg, void *yythd)
double_quotes++;
continue;
}
- if (c == (uchar) NAMES_SEP_CHAR)
- break;
}
- if (double_quotes)
- yylval->lex_str=get_quoted_token(lex,yyLength() - double_quotes,
- quote_char);
+#ifdef USE_MB
+ else if (l > 1)
+ {
+ lex->ptr += l-1;
+ }
else
- yylval->lex_str=get_token(lex,yyLength());
+ break;
+#endif
}
- if (c == delim)
+ if (double_quotes)
+ yylval->lex_str=get_quoted_token(lex,yyLength() - double_quotes,
+ quote_char);
+ else
+ yylval->lex_str=get_token(lex,yyLength());
+ if (c == quote_char)
yySkip(); // Skip end `
lex->next_state= MY_LEX_START;
return(IDENT_QUOTED);
@@ -885,8 +898,13 @@ int yylex(void *arg, void *yythd)
}
/* fall true */
case MY_LEX_EOL:
- lex->next_state=MY_LEX_END; // Mark for next loop
- return(END_OF_INPUT);
+ if (lex->ptr >= lex->end_of_query)
+ {
+ lex->next_state=MY_LEX_END; // Mark for next loop
+ return(END_OF_INPUT);
+ }
+ state=MY_LEX_CHAR;
+ break;
case MY_LEX_END:
lex->next_state=MY_LEX_END;
return(0); // We found end of input last time
@@ -1603,8 +1621,9 @@ void st_select_lex::print_limit(THD *thd, String *str)
if (!thd)
thd= current_thd;
- if (select_limit != thd->variables.select_limit ||
- select_limit != HA_POS_ERROR ||
+ if ((select_limit != thd->variables.select_limit &&
+ this == &thd->lex->select_lex) ||
+ (select_limit != HA_POS_ERROR && this != &thd->lex->select_lex) ||
offset_limit != 0L)
{
str->append(" limit ", 7);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index dd68337d5dd..6acb5901efc 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -206,7 +206,21 @@ int check_user(THD *thd, enum enum_server_command command,
#ifdef NO_EMBEDDED_ACCESS_CHECKS
thd->master_access= GLOBAL_ACLS; // Full rights
- return 0;
+ /* Change database if necessary: OK or FAIL is sent in mysql_change_db */
+ if (db && db[0])
+ {
+ thd->db= 0;
+ thd->db_length= 0;
+ if (mysql_change_db(thd, db))
+ {
+ if (thd->user_connect)
+ decrease_user_connections(thd->user_connect);
+ DBUG_RETURN(-1);
+ }
+ }
+ else
+ send_ok(thd);
+ DBUG_RETURN(0);
#else
my_bool opt_secure_auth_local;
@@ -1280,7 +1294,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
send_error(thd); // dump to NET
break;
}
-#ifndef EMBEDDED_LIBRARY
case COM_CHANGE_USER:
{
thd->change_user();
@@ -1299,13 +1312,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
*passwd++ : strlen(passwd);
db+= passwd_len + 1;
+#ifndef EMBEDDED_LIBRARY
/* Small check for incomming packet */
if ((uint) ((uchar*) db - net->read_pos) > packet_length)
{
send_error(thd, ER_UNKNOWN_COM_ERROR);
break;
}
-
+#endif
/* Convert database name to utf8 */
db_buff[copy_and_convert(db_buff, sizeof(db_buff)-1,
system_charset_info, db, strlen(db),
@@ -1356,7 +1370,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
break;
}
-#endif /* EMBEDDED_LIBRARY */
case COM_EXECUTE:
{
mysql_stmt_execute(thd, packet);
@@ -1395,11 +1408,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
char *packet= thd->lex->found_colon;
/*
Multiple queries exits, execute them individually
+ in embedded server - just store them to be executed later
*/
+#ifndef EMBEDDED_LIBRARY
if (thd->lock || thd->open_tables || thd->derived_tables)
close_thread_tables(thd);
-
- ulong length= thd->query_length-(ulong)(thd->lex->found_colon-thd->query);
+#endif
+ ulong length= thd->query_length-(ulong)(packet-thd->query);
/* Remove garbage at start of query */
while (my_isspace(thd->charset(), *packet) && length > 0)
@@ -1412,7 +1427,22 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query_id= query_id++;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
+#ifndef EMBEDDED_LIBRARY
mysql_parse(thd, packet, length);
+#else
+ /*
+ 'packet' can point inside the query_rest's buffer
+ so we have to do memmove here
+ */
+ if (thd->query_rest.length() > length)
+ {
+ memmove(thd->query_rest.c_ptr(), packet, length);
+ thd->query_rest.length(length);
+ }
+ else
+ thd->query_rest.copy(length);
+ break;
+#endif /*EMBEDDED_LIBRARY*/
}
if (!(specialflag & SPECIAL_NO_PRIOR))
@@ -3719,7 +3749,9 @@ mysql_init_select(LEX *lex)
{
SELECT_LEX *select_lex= lex->current_select;
select_lex->init_select();
- select_lex->select_limit= lex->thd->variables.select_limit;
+ select_lex->select_limit= (&lex->select_lex == select_lex) ?
+ lex->thd->variables.select_limit : /* Primry UNION */
+ HA_POS_ERROR; /* subquery */
if (select_lex == &lex->select_lex)
{
lex->exchange= 0;
@@ -3771,7 +3803,9 @@ mysql_new_select(LEX *lex, bool move_down)
fake->select_number= INT_MAX;
fake->make_empty_select();
fake->linkage= GLOBAL_OPTIONS_TYPE;
- fake->select_limit= lex->thd->variables.select_limit;
+ fake->select_limit= (&lex->unit == unit) ?
+ lex->thd->variables.select_limit : /* Primry UNION */
+ HA_POS_ERROR; /* subquery */
}
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 592820e6e19..69e3469bd7f 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -4985,6 +4985,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
tmp_from_field, group != 0,not_all_columns);
if (!new_field)
goto err; // Should be OOM
+ if (param->all_nulls)
+ new_field->flags&= ~NOT_NULL_FLAG; // Because of outer join
tmp_from_field++;
*(reg_field++)= new_field;
reclength+=new_field->pack_length();
@@ -5020,6 +5022,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
goto err; // Got OOM
continue; // Some kindf of const item
}
+ if (param->all_nulls)
+ new_field->flags&= ~NOT_NULL_FLAG; // Because of outer join
if (type == Item::SUM_FUNC_ITEM)
((Item_sum *) item)->result_field= new_field;
tmp_from_field++;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 0929167ad37..8ed44d618fb 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1089,8 +1089,7 @@ mysqld_dump_create_info(THD *thd, TABLE *table, int fd)
DBUG_RETURN(0);
}
-/* possible TODO: call find_keyword() from sql_lex.cc here */
-static bool require_quotes(const char *name, uint length)
+static inline const char *require_quotes(const char *name, uint length)
{
uint i, d, c;
for (i=0; i<length; i+=d)
@@ -1098,7 +1097,37 @@ static bool require_quotes(const char *name, uint length)
c=((uchar *)name)[i];
d=my_mbcharlen(system_charset_info, c);
if (d==1 && !system_charset_info->ident_map[c])
- return 1;
+ return name+i;
+ }
+ return 0;
+}
+
+/*
+ Looking for char in multibyte string
+
+ SYNOPSIS
+ look_for_char()
+ name string for looking at
+ length length of name
+ q '\'' or '\"' for looking for
+
+ RETURN VALUES
+ # pointer to found char in string
+ 0 string doesn't contain required char
+*/
+
+static inline const char *look_for_char(const char *name,
+ uint length, char q)
+{
+ const char *cur= name;
+ const char *end= cur+length;
+ uint symbol_length;
+ for (; cur<end; cur+= symbol_length)
+ {
+ char c= *cur;
+ symbol_length= my_mbcharlen(system_charset_info, c);
+ if (symbol_length==1 && c==q)
+ return cur;
}
return 0;
}
@@ -1107,21 +1136,52 @@ void
append_identifier(THD *thd, String *packet, const char *name, uint length)
{
char qtype;
+ uint part_len;
+ const char *qplace;
if (thd->variables.sql_mode & MODE_ANSI_QUOTES)
qtype= '\"';
else
qtype= '`';
- if ((thd->options & OPTION_QUOTE_SHOW_CREATE) ||
- require_quotes(name, length))
+ if (is_keyword(name,length))
{
- packet->append(&qtype, 1);
+ packet->append(&qtype, 1, system_charset_info);
packet->append(name, length, system_charset_info);
- packet->append(&qtype, 1);
+ packet->append(&qtype, 1, system_charset_info);
}
else
{
- packet->append(name, length, system_charset_info);
+ if (!(qplace= require_quotes(name, length)))
+ {
+ if (!(thd->options & OPTION_QUOTE_SHOW_CREATE))
+ packet->append(name, length, system_charset_info);
+ else
+ {
+ packet->append(&qtype, 1, system_charset_info);
+ packet->append(name, length, system_charset_info);
+ packet->append(&qtype, 1, system_charset_info);
+ }
+ }
+ else
+ {
+ packet->shrink(packet->length()+length+2);
+ packet->append(&qtype, 1, system_charset_info);
+ if (*qplace != qtype)
+ qplace= look_for_char(qplace+1,length-(qplace-name)-1,qtype);
+ while (qplace)
+ {
+ if ((part_len= qplace-name))
+ {
+ packet->append(name, part_len, system_charset_info);
+ length-= part_len;
+ }
+ packet->append(qplace, 1, system_charset_info);
+ name= qplace;
+ qplace= look_for_char(name+1,length-1,qtype);
+ }
+ packet->append(name, length, system_charset_info);
+ packet->append(&qtype, 1, system_charset_info);
+ }
}
}
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 83a048297af..c6eda5f9fb2 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -453,7 +453,7 @@ bool String::append(const char *s,uint32 arg_length, CHARSET_INFO *cs)
if (!arg_length) // Default argument
if (!(arg_length= (uint32) strlen(s)))
return FALSE;
- if (str_charset->mbmaxlen > 1)
+ if (cs != str_charset && str_charset->mbmaxlen > 1)
{
uint32 add_length=arg_length * str_charset->mbmaxlen;
if (realloc(str_length+ add_length))
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 12494703419..fb86e446fb7 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -880,7 +880,12 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
column->field_name);
DBUG_RETURN(-1);
}
- key_part_info->length=(uint8) length;
+ if (length > file->max_key_part_length())
+ {
+ my_error(ER_WRONG_SUB_KEY,MYF(0));
+ DBUG_RETURN(-1);
+ }
+ key_part_info->length=(uint16) length;
/* Use packed keys for long strings on the first column */
if (!(db_options & HA_OPTION_NO_PACK_KEYS) &&
(length >= KEY_DEFAULT_PACK_LENGTH &&
@@ -1863,6 +1868,20 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
table_name); /* purecov: inspected */
DBUG_RETURN(-1); /* purecov: inspected */
}
+ else
+ {
+ // Must be written before unlock
+ mysql_update_log.write(thd,thd->query, thd->query_length);
+ if (mysql_bin_log.is_open())
+ {
+ thd->clear_error();
+ Query_log_event qinfo(thd, thd->query, thd->query_length,
+ test(create_info->options &
+ HA_LEX_CREATE_TMP_TABLE));
+ mysql_bin_log.write(&qinfo);
+ }
+ }
+
DBUG_RETURN(0);
table_exists:
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 75fd9be88bd..f2e9016aec3 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -206,6 +206,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
if (first_select->next_select())
{
union_result->tmp_table_param.field_count= types.elements;
+ union_result->tmp_table_param.all_nulls= true;
if (!(table= create_tmp_table(thd_arg,
&union_result->tmp_table_param, types,
(ORDER*) 0, !union_option, 1,
@@ -315,6 +316,7 @@ int st_select_lex_unit::exec()
if it use same tables
*/
uint tablenr=0;
+ ulong query_id= thd->query_id;
for (TABLE_LIST *table_list= (TABLE_LIST*) sl->table_list.first;
table_list;
table_list= table_list->next, tablenr++)
@@ -329,6 +331,8 @@ int st_select_lex_unit::exec()
*/
setup_table_map(table_list->table, table_list, tablenr);
}
+ for (unsigned int i=0; i < table_list->table->fields; i++)
+ table_list->table->field[i]->query_id= query_id;
}
res= sl->join->optimize();
}
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 7ef5d219f07..009840b03b8 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -2152,13 +2152,13 @@ select_init:
SELECT_LEX * sel= lex->current_select;
if (sel->set_braces(1))
{
- send_error(lex->thd, ER_SYNTAX_ERROR);
+ yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
if (sel->linkage == UNION_TYPE &&
!sel->master_unit()->first_select()->braces)
{
- send_error(lex->thd, ER_SYNTAX_ERROR);
+ yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
/* select in braces, can't contain global parameters */
@@ -2174,13 +2174,13 @@ select_init2:
SELECT_LEX * sel= lex->current_select;
if (lex->current_select->set_braces(0))
{
- send_error(lex->thd, ER_SYNTAX_ERROR);
+ yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
if (sel->linkage == UNION_TYPE &&
sel->master_unit()->first_select()->braces)
{
- send_error(lex->thd, ER_SYNTAX_ERROR);
+ yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
}
@@ -2574,8 +2574,6 @@ simple_expr:
}
| CONVERT_SYM '(' expr USING charset_name ')'
{ $$= new Item_func_conv_charset($3,$5); }
- | CONVERT_SYM '(' expr ',' expr ',' expr ')'
- { $$= new Item_func_conv_charset3($3,$7,$5); }
| DEFAULT '(' simple_ident ')'
{ $$= new Item_default_value($3); }
| VALUES '(' simple_ident ')'
@@ -2736,7 +2734,7 @@ simple_expr:
{
if ($1->type() != Item::ROW_ITEM)
{
- send_error(Lex->thd, ER_SYNTAX_ERROR);
+ yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
$$= new Item_func_interval((Item_row *)$1);
@@ -3072,7 +3070,7 @@ in_sum_expr:
LEX *lex= Lex;
if (lex->current_select->inc_in_sum_expr())
{
- send_error(lex->thd, ER_SYNTAX_ERROR);
+ yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
}
@@ -3243,8 +3241,8 @@ select_derived:
if (((int)lex->sql_command >= (int)SQLCOM_HA_OPEN &&
lex->sql_command <= (int)SQLCOM_HA_READ) ||
lex->sql_command == (int)SQLCOM_KILL)
- {
- send_error(lex->thd, ER_SYNTAX_ERROR);
+ {
+ yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE ||
@@ -3475,9 +3473,12 @@ order_dir:
opt_limit_clause_init:
/* empty */
{
- SELECT_LEX *sel= Select;
+ LEX *lex= Lex;
+ SELECT_LEX *sel= lex->current_select;
sel->offset_limit= 0L;
- sel->select_limit= Lex->thd->variables.select_limit;
+ sel->select_limit= (&lex->select_lex == sel) ?
+ Lex->thd->variables.select_limit : /* primary SELECT */
+ HA_POS_ERROR; /* subquery */
}
| limit_clause {}
;
@@ -3879,7 +3880,7 @@ opt_insert_update:
for a moment */
if (Lex->sql_command != SQLCOM_INSERT)
{
- send_error(Lex->thd, ER_SYNTAX_ERROR);
+ yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
}
@@ -4486,7 +4487,7 @@ param_marker:
}
else
{
- yyerror("You have an error in your SQL syntax");
+ yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
}
@@ -5208,7 +5209,7 @@ revoke_command:
grant_privileges ON opt_table FROM user_list
{}
|
- ALL PRIVILEGES ',' GRANT FROM user_list
+ ALL PRIVILEGES ',' GRANT OPTION FROM user_list
{
Lex->sql_command = SQLCOM_REVOKE_ALL;
}
@@ -5534,7 +5535,7 @@ union_list:
}
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
{
- send_error(lex->thd, ER_SYNTAX_ERROR);
+ yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
if (mysql_new_select(lex, 0))
@@ -5634,8 +5635,8 @@ subselect_start:
if (((int)lex->sql_command >= (int)SQLCOM_HA_OPEN &&
lex->sql_command <= (int)SQLCOM_HA_READ) ||
lex->sql_command == (int)SQLCOM_KILL)
- {
- send_error(lex->thd, ER_SYNTAX_ERROR);
+ {
+ yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
if (mysql_new_select(Lex, 1))
diff --git a/strings/Makefile.am b/strings/Makefile.am
index 61219c8abb9..89f32ac6b40 100644
--- a/strings/Makefile.am
+++ b/strings/Makefile.am
@@ -22,19 +22,19 @@ pkglib_LIBRARIES = libmystrings.a
# Exact one of ASSEMBLER_X
if ASSEMBLER_x86
ASRCS = strings-x86.s longlong2str-x86.s my_strtoll10-x86.s
-CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c
+CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c
else
if ASSEMBLER_sparc32
# These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile
ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s
-CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c my_strtoll10.c
+CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c my_strtoll10.c
else
#no assembler
ASRCS =
# These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile
-CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c my_strtoll10.c
+CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c my_strtoll10.c
endif
endif
diff --git a/strings/atof.c b/strings/atof.c
deleted file mode 100644
index 0e0aa598718..00000000000
--- a/strings/atof.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/* Copyright (C) 2000 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
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/*
- A quicker atof. About 2-10 times faster than standard atof on sparc.
- This don't handle iee-options (NaN...) and the presission :s is a little
- less for some high exponential numbers (+-1 at 14th place).
- Returns 0.0 if overflow or wrong number.
- Must be inited with init_my_atof to handle possibly overflows.
-*/
-
-#include <my_global.h>
-#ifdef USE_MY_ATOF /* Skipp if we don't want it */
-#include <m_ctype.h>
-#include <floatingpoint.h>
-#include <signal.h>
-
-/* Read a double. If float is wrong return 0.
- float ::= [space]* [sign] {digit}+ decimal-point {digit}+ [exponent] |
- [sign] {digit}+ [decimal-point {digit}*] exponent |
- [sign] {digit}+ decimal-point [{digit}*] exponent |
- [sign] decimal-point {digit}* exponent |
- exponent :: = exponent-marker [sign] {digit}+
- exponent-marker ::= E e
- */
-
-
-#define is_exponent_marker(ch) (ch == 'E' || ch == 'e')
-
-static void my_atof_overflow _A((int sig,int code, struct sigcontext *scp,
- char *addr));
-static int parse_sign _A((char **str));
-static void parse_float_number_part _A((char **str,double *number, int *length));
-static void parse_decimal_number_part _A((char **str,double *number));
-static int parse_int_number_part _A((char **str,uint *number));
-
-static int volatile overflow,in_my_atof;
-static sigfpe_handler_type old_overflow_handler;
-
-void init_my_atof()
-{
- old_overflow_handler = (sigfpe_handler_type)
- ieee_handler("get", "overflow", old_overflow_handler);
- VOID(ieee_handler("set", "overflow", my_atof_overflow));
- return;
-}
-
-static void my_atof_overflow(sig, code, scp, addr)
-int sig;
-int code;
-struct sigcontext *scp;
-char *addr;
-{
- if (!in_my_atof)
- old_overflow_handler(sig,code,scp,addr);
- else
- overflow=1;
- return;
-}
-
-double my_atof(src)
-const char *src;
-{
- int sign, exp_sign; /* is number negative (+1) or positive (-1) */
- int length_before_point;
- double after_point; /* Number after decimal point and before exp */
- uint exponent; /* Exponent value */
- double exp_log,exp_val;
- char *tmp_src;
- double result_number;
-
- tmp_src = (char*) src;
- while (isspace(tmp_src[0]))
- tmp_src++; /* Skipp pre-space */
- sign = parse_sign(&tmp_src);
- overflow=0;
- in_my_atof=1;
- parse_float_number_part(&tmp_src, &result_number, &length_before_point);
- if (*tmp_src == '.')
- {
- tmp_src++;
- parse_decimal_number_part(&tmp_src, &after_point);
- result_number += after_point;
- }
- else if (length_before_point == 0)
- {
- in_my_atof=0;
- return 0.0;
- }
- if (is_exponent_marker(*tmp_src))
- {
- tmp_src++;
- exp_sign = parse_sign(&tmp_src);
- overflow|=parse_int_number_part(&tmp_src, &exponent);
-
- exp_log=10.0; exp_val=1.0;
- for (;;)
- {
- if (exponent & 1)
- {
- exp_val*= exp_log;
- exponent--;
- }
- if (!exponent)
- break;
- exp_log*=exp_log;
- exponent>>=1;
- }
- if (exp_sign < 0)
- result_number*=exp_val;
- else
- result_number/=exp_val;
- }
- if (sign > 0)
- result_number= -result_number;
-
- in_my_atof=0;
- if (overflow)
- return 0.0;
- return result_number;
-}
-
-
-static int parse_sign(str)
-char **str;
-{
- if (**str == '-')
- {
- (*str)++;
- return 1;
- }
- if (**str == '+')
- (*str)++;
- return -1;
-}
-
- /* Get number with may be separated with ',' */
-
-static void parse_float_number_part(str, number, length)
-char **str;
-double *number;
-int *length;
-{
- *number = 0;
- *length = 0;
-
- for (;;)
- {
- while (isdigit(**str))
- {
- (*length)++;
- *number = (*number * 10) + (**str - '0');
- (*str)++;
- }
- if (**str != ',')
- return; /* Skipp possibly ',' */
- (*str)++;
- }
-}
-
-static void parse_decimal_number_part(str, number)
-char **str;
-double *number;
-{
- double exp_log;
-
- *number = 0;
- exp_log=1/10.0;
- while (isdigit(**str))
- {
- *number+= (**str - '0')*exp_log;
- exp_log/=10;
- (*str)++;
- }
-}
-
- /* Parses int suitably for exponent */
-
-static int parse_int_number_part(str, number)
-char **str;
-uint *number;
-{
- *number = 0;
- while (isdigit(**str))
- {
- if (*number >= ((uint) ~0)/10)
- return 1; /* Don't overflow */
- *number = (*number * 10) + **str - '0';
- (*str)++;
- }
- return 0;
-}
-
-#endif
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index 323662f023c..b35162c8fb6 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -274,18 +274,21 @@ uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)),
return pos ? e+2-b0 : b-b0;
}
-uint my_wellformedlen_mb(CHARSET_INFO *cs __attribute__((unused)),
- const char *b, const char *e, uint pos)
+uint my_wellformedlen_mb(CHARSET_INFO *cs,
+ const char *b, const char *e, uint pos)
{
- uint mblen;
- const char *b0=b;
+ my_wc_t wc;
+ int mblen;
+ const char *b0= b;
- while (pos && b<e)
+ while (pos)
{
- b+= (mblen= my_ismbchar(cs,b,e)) ? mblen : 1;
+ if ((mblen= cs->cset->mb_wc(cs, &wc, b, e)) <0)
+ break;
+ b+= mblen;
pos--;
}
- return b-b0;
+ return b - b0;
}
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index ed042c7de1a..baefe17c32f 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -684,7 +684,7 @@ noconv:
double my_strntod_8bit(CHARSET_INFO *cs __attribute__((unused)),
- char *str, uint length,
+ char *str, uint length,
char **end, int *err)
{
char end_char;
@@ -702,12 +702,12 @@ double my_strntod_8bit(CHARSET_INFO *cs __attribute__((unused)),
#else
if (length == INT_MAX32 || str[length] == 0)
#endif
- result= strtod(str, end);
+ result= my_strtod(str, end);
else
{
end_char= str[length];
str[length]= 0;
- result= strtod(str, end);
+ result= my_strtod(str, end);
str[length]= end_char; /* Restore end char */
}
*err= errno;
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index bb74e0cf56b..ec306d9af35 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -856,7 +856,7 @@ double my_strntod_ucs2(CHARSET_INFO *cs __attribute__((unused)),
if (length >= sizeof(buf))
length= sizeof(buf)-1;
end= s+length;
-
+
while ((cnv=cs->cset->mb_wc(cs,&wc,s,end)) > 0)
{
s+=cnv;
@@ -865,9 +865,9 @@ double my_strntod_ucs2(CHARSET_INFO *cs __attribute__((unused)),
*b++= (char) wc;
}
*b= 0;
-
+
errno= 0;
- res=strtod(buf, endptr);
+ res=my_strtod(buf, endptr);
*err= errno;
if (endptr)
*endptr=(char*) (*endptr-buf+nptr);
diff --git a/strings/strtod.c b/strings/strtod.c
new file mode 100644
index 00000000000..ea6acbac6c4
--- /dev/null
+++ b/strings/strtod.c
@@ -0,0 +1,140 @@
+/*
+ An alternative implementation of "strtod()" that is both
+ simplier, and thread-safe.
+
+ From mit-threads as bundled with MySQL 3.22
+
+ SQL:2003 specifies a number as
+
+<signed numeric literal> ::= [ <sign> ] <unsigned numeric literal>
+
+<unsigned numeric literal> ::=
+ <exact numeric literal>
+ | <approximate numeric literal>
+
+<exact numeric literal> ::=
+ <unsigned integer> [ <period> [ <unsigned integer> ] ]
+ | <period> <unsigned integer>
+
+<approximate numeric literal> ::= <mantissa> E <exponent>
+
+<mantissa> ::= <exact numeric literal>
+
+<exponent> ::= <signed integer>
+
+ So do we.
+
+ */
+
+#include "my_base.h"
+#include "m_ctype.h"
+
+static double scaler10[] = {
+ 1.0, 1e10, 1e20, 1e30, 1e40, 1e50, 1e60, 1e70, 1e80, 1e90
+};
+static double scaler1[] = {
+ 1.0, 10.0, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9
+};
+
+// let's use a static array for not to accumulate the error
+static double pastpoint[] = {
+ 1e-1, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6, 1e-7, 1e-8, 1e-9,
+ 1e-10, 1e-11, 1e-12, 1e-13, 1e-14, 1e-15, 1e-16, 1e-17, 1e-18, 1e-19,
+ 1e-20, 1e-21, 1e-22, 1e-23, 1e-24, 1e-25, 1e-26, 1e-27, 1e-28, 1e-29,
+ 1e-30, 1e-31, 1e-32, 1e-33, 1e-34, 1e-35, 1e-36, 1e-37, 1e-38, 1e-39,
+ 1e-40, 1e-41, 1e-42, 1e-43, 1e-44, 1e-45, 1e-46, 1e-47, 1e-48, 1e-49,
+ 1e-50, 1e-51, 1e-52, 1e-53, 1e-54, 1e-55, 1e-56, 1e-57, 1e-58, 1e-59,
+};
+
+double my_strtod(const char *str, char **end)
+{
+ double result= 0.0;
+ int negative, ndigits;
+ const char *old_str;
+
+ while (my_isspace(&my_charset_latin1, *str))
+ str++;
+
+ if ((negative= (*str == '-')) || *str=='+')
+ str++;
+
+ old_str= str;
+ while (my_isdigit (&my_charset_latin1, *str))
+ {
+ result= result*10.0 + (*str - '0');
+ str++;
+ }
+ ndigits= str-old_str;
+
+ if (*str == '.')
+ {
+ int n= 0;
+ str++;
+ old_str= str;
+ while (my_isdigit (&my_charset_latin1, *str))
+ {
+ if (n < sizeof(pastpoint)/sizeof(pastpoint[0]))
+ {
+ result+= pastpoint[n] * (*str - '0');
+ n++;
+ }
+ str++;
+ }
+ ndigits+= str-old_str;
+ if (!ndigits) str--;
+ }
+ if (ndigits && (*str=='e' || *str=='E'))
+ {
+ int exp= 0;
+ int neg= 0;
+ const char *old_str= str++;
+
+ if ((neg= (*str == '-')) || *str == '+')
+ str++;
+
+ if (!my_isdigit (&my_charset_latin1, *str))
+ str= old_str;
+ else
+ {
+ double scaler= 1.0;
+ while (my_isdigit (&my_charset_latin1, *str))
+ {
+ exp= exp*10 + *str - '0';
+ str++;
+ }
+ if (exp >= 1000)
+ {
+ if (neg)
+ result= 0.0;
+ else
+ result= DBL_MAX;
+ goto done;
+ }
+ while (exp >= 100)
+ {
+ scaler*= 1.0e100;
+ exp-= 100;
+ }
+ scaler*= scaler10[exp/10]*scaler1[exp%10];
+ if (neg)
+ result/= scaler;
+ else
+ result*= scaler;
+ }
+ }
+
+done:
+ if (end)
+ *end = (char *)str;
+
+ if (isinf(result))
+ result=DBL_MAX;
+
+ return negative ? -result : result;
+}
+
+double my_atof(const char *nptr)
+{
+ return (strtod(nptr, 0));
+}
+
diff --git a/tests/client_test.c b/tests/client_test.c
index 66637dcb04b..eda168d7230 100644
--- a/tests/client_test.c
+++ b/tests/client_test.c
@@ -153,6 +153,17 @@ static void print_st_error(MYSQL_STMT *stmt, const char *msg)
else if (msg) fprintf(stderr, " [MySQL] %s\n", msg);
}
+/*
+ This is to be what mysql_query() is for mysql_real_query(), for
+ mysql_prepare(): a variant without the 'length' parameter.
+*/
+MYSQL_STMT *STDCALL
+mysql_simple_prepare(MYSQL *mysql, const char *query)
+{
+ return mysql_prepare(mysql, query, strlen(query));
+}
+
+
/********************************************************
* connect to the server *
*********************************************************/
@@ -459,14 +470,14 @@ uint my_process_stmt_result(MYSQL_STMT *stmt)
/********************************************************
* process the stmt result set *
*********************************************************/
-uint my_stmt_result(const char *buff, unsigned long length)
+uint my_stmt_result(const char *buff)
{
MYSQL_STMT *stmt;
uint row_count;
int rc;
fprintf(stdout,"\n\n %s", buff);
- stmt= mysql_prepare(mysql,buff,length);
+ stmt= mysql_simple_prepare(mysql,buff);
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -605,7 +616,7 @@ static void execute_prepare_query(const char *query, ulonglong exp_count)
ulonglong affected_rows;
int rc;
- stmt= mysql_prepare(mysql,query,strlen(query));
+ stmt= mysql_simple_prepare(mysql,query);
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -913,7 +924,7 @@ static void test_prepare_simple()
/* alter table */
strmov(query,"ALTER TABLE test_prepare_simple ADD new char(20)");
- stmt = mysql_prepare(mysql, query, 70);
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,0);
@@ -921,7 +932,7 @@ static void test_prepare_simple()
/* insert */
strmov(query,"INSERT INTO test_prepare_simple VALUES(?,?)");
- stmt = mysql_prepare(mysql, query, 70);
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,2);
@@ -929,7 +940,7 @@ static void test_prepare_simple()
/* update */
strmov(query,"UPDATE test_prepare_simple SET id=? WHERE id=? AND name= ?");
- stmt = mysql_prepare(mysql, query, 100);
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,3);
@@ -937,7 +948,7 @@ static void test_prepare_simple()
/* delete */
strmov(query,"DELETE FROM test_prepare_simple WHERE id=10");
- stmt = mysql_prepare(mysql, query, 60);
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,0);
@@ -948,18 +959,16 @@ static void test_prepare_simple()
/* delete */
strmov(query,"DELETE FROM test_prepare_simple WHERE id=?");
- stmt = mysql_prepare(mysql, query, 50);
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,1);
- rc = mysql_execute(stmt);
- mystmt_r(stmt, rc);
mysql_stmt_close(stmt);
/* select */
strmov(query,"SELECT * FROM test_prepare_simple WHERE id=? AND name= ?");
- stmt = mysql_prepare(mysql, query, 100);
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,2);
@@ -997,7 +1006,7 @@ static void test_prepare_field_result()
/* insert */
strmov(query,"SELECT int_c,var_c,date_c as date,ts_c,char_c FROM \
test_prepare_field_result as t1 WHERE int_c=?");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,1);
@@ -1045,11 +1054,11 @@ static void test_prepare_syntax()
myquery(rc);
strmov(query,"INSERT INTO test_prepare_syntax VALUES(?");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init_r(stmt);
strmov(query,"SELECT id,name FROM test_prepare_syntax WHERE id=? AND WHERE");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init_r(stmt);
/* now fetch the results ..*/
@@ -1095,7 +1104,7 @@ static void test_prepare()
/* insert by prepare */
strxmov(query,"INSERT INTO my_prepare VALUES(?,?,?,?,?,?,?)",NullS);
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,7);
@@ -1159,9 +1168,9 @@ static void test_prepare()
myquery(rc);
/* test the results now, only one row should exists */
- assert(tiny_data == (char) my_stmt_result("SELECT * FROM my_prepare",50));
+ assert(tiny_data == (char) my_stmt_result("SELECT * FROM my_prepare"));
- stmt = mysql_prepare(mysql,"SELECT * FROM my_prepare",50);
+ stmt = mysql_simple_prepare(mysql,"SELECT * FROM my_prepare");
mystmt_init(stmt);
rc = mysql_bind_result(stmt, bind);
@@ -1266,7 +1275,7 @@ static void test_double_compare()
myquery(rc);
strmov(query, "UPDATE test_double_compare SET col1=100 WHERE col1 = ? AND col2 = ? AND COL3 = ?");
- stmt = mysql_prepare(mysql,query, strlen(query));
+ stmt = mysql_simple_prepare(mysql,query);
mystmt_init(stmt);
verify_param_count(stmt,3);
@@ -1347,11 +1356,11 @@ static void test_null()
/* insert by prepare, wrong column name */
strmov(query,"INSERT INTO test_null(col3,col2) VALUES(?,?)");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init_r(stmt);
strmov(query,"INSERT INTO test_null(col1,col2) VALUES(?,?)");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,2);
@@ -1393,7 +1402,7 @@ static void test_null()
myquery(rc);
nData*= 2;
- assert(nData == my_stmt_result("SELECT * FROM test_null", 30));
+ assert(nData == my_stmt_result("SELECT * FROM test_null"));
/* Fetch results */
bind[0].buffer_type= MYSQL_TYPE_LONG;
@@ -1403,7 +1412,7 @@ static void test_null()
bind[0].is_null= &is_null[0];
bind[1].is_null= &is_null[1];
- stmt = mysql_prepare(mysql,"SELECT * FROM test_null",30);
+ stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_null");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -1475,9 +1484,9 @@ static void test_fetch_null()
strmov((char *)query , "SELECT * FROM test_fetch_null");
- assert(3 == my_stmt_result(query,50));
+ assert(3 == my_stmt_result(query));
- stmt = mysql_prepare(mysql, query, 50);
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
rc = mysql_bind_result(stmt,bind);
@@ -1516,7 +1525,7 @@ static void test_select_version()
myheader("test_select_version");
- stmt = mysql_prepare(mysql, "SELECT @@version", 30);
+ stmt = mysql_simple_prepare(mysql, "SELECT @@version");
mystmt_init(stmt);
verify_param_count(stmt,0);
@@ -1538,7 +1547,7 @@ static void test_select_simple()
myheader("test_select_simple");
- stmt = mysql_prepare(mysql, "SHOW TABLES FROM mysql", 50);
+ stmt = mysql_simple_prepare(mysql, "SHOW TABLES FROM mysql");
mystmt_init(stmt);
verify_param_count(stmt,0);
@@ -1630,7 +1639,7 @@ static void test_select_prepare()
rc = mysql_commit(mysql);
myquery(rc);
- stmt = mysql_prepare(mysql,"SELECT * FROM test_select",50);
+ stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_select");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -1660,7 +1669,7 @@ static void test_select_prepare()
rc = mysql_commit(mysql);
myquery(rc);
- stmt = mysql_prepare(mysql,"SELECT * FROM test_select",25);
+ stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_select");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -1715,7 +1724,7 @@ static void test_select()
myquery(rc);
strmov(query,"SELECT * FROM test_select WHERE id=? AND name=?");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,2);
@@ -1774,7 +1783,7 @@ session_id char(9) NOT NULL, \
myquery(rc);
strmov(query,"SELECT * FROM test_select WHERE session_id = ?");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,1);
@@ -1852,7 +1861,7 @@ static void test_bug1180()
myquery(rc);
strmov(query,"SELECT * FROM test_select WHERE ?=\"1111\" and session_id = \"abc\"");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,1);
@@ -1932,7 +1941,7 @@ static void test_bug1644()
myquery(rc);
strmov(query, "INSERT INTO foo_dfr VALUES (?,?,?,? )");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt, 4);
@@ -2030,7 +2039,7 @@ static void test_select_show()
rc = mysql_query(mysql, "CREATE TABLE test_show(id int(4) NOT NULL primary key, name char(2))");
myquery(rc);
- stmt = mysql_prepare(mysql, "show columns from test_show", 30);
+ stmt = mysql_simple_prepare(mysql, "show columns from test_show");
mystmt_init(stmt);
verify_param_count(stmt,0);
@@ -2041,11 +2050,11 @@ static void test_select_show()
my_process_stmt_result(stmt);
mysql_stmt_close(stmt);
- stmt = mysql_prepare(mysql, "show tables from mysql like ?", 50);
+ stmt = mysql_simple_prepare(mysql, "show tables from mysql like ?");
mystmt_init_r(stmt);
strxmov(query,"show tables from ", current_db, " like \'test_show\'", NullS);
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -2054,7 +2063,7 @@ static void test_select_show()
my_process_stmt_result(stmt);
mysql_stmt_close(stmt);
- stmt = mysql_prepare(mysql, "describe test_show", 30);
+ stmt = mysql_simple_prepare(mysql, "describe test_show");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -2063,7 +2072,7 @@ static void test_select_show()
my_process_stmt_result(stmt);
mysql_stmt_close(stmt);
- stmt = mysql_prepare(mysql, "show keys from test_show", 30);
+ stmt = mysql_simple_prepare(mysql, "show keys from test_show");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -2115,7 +2124,7 @@ static void test_simple_update()
/* insert by prepare */
strmov(query,"UPDATE test_update SET col2=? WHERE col1=?");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,2);
@@ -2190,11 +2199,11 @@ static void test_long_data()
myquery(rc);
strmov(query,"INSERT INTO test_long_data(col1,col2) VALUES(?)");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init_r(stmt);
strmov(query,"INSERT INTO test_long_data(col1,col2,col3) VALUES(?,?,?)");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,3);
@@ -2282,7 +2291,7 @@ static void test_long_data_str()
myquery(rc);
strmov(query,"INSERT INTO test_long_data_str VALUES(?,?)");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,2);
@@ -2373,7 +2382,7 @@ static void test_long_data_str1()
myquery(rc);
strmov(query,"INSERT INTO test_long_data_str VALUES(?,?)");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,2);
@@ -2462,7 +2471,7 @@ static void test_long_data_bin()
myquery(rc);
strmov(query,"INSERT INTO test_long_data_bin VALUES(?,?)");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,2);
@@ -2557,7 +2566,7 @@ static void test_simple_delete()
/* insert by prepare */
strmov(query,"DELETE FROM test_simple_delete WHERE col1=? AND col2=? AND col3=100");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,2);
@@ -2637,7 +2646,7 @@ static void test_update()
myquery(rc);
strmov(query,"INSERT INTO test_update(col2,col3) VALUES(?,?)");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,2);
@@ -2667,7 +2676,7 @@ static void test_update()
mysql_stmt_close(stmt);
strmov(query,"UPDATE test_update SET col2=? WHERE col3=?");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,2);
@@ -2733,7 +2742,7 @@ static void test_prepare_noparam()
/* insert by prepare */
strmov(query,"INSERT INTO my_prepare VALUES(10,'venu')");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,0);
@@ -2812,7 +2821,7 @@ static void test_bind_result()
bind[1].length= &length1;
bind[1].is_null= &is_null[1];
- stmt = mysql_prepare(mysql, "SELECT * FROM test_bind_result", 50);
+ stmt = mysql_simple_prepare(mysql, "SELECT * FROM test_bind_result");
mystmt_init(stmt);
rc = mysql_bind_result(stmt,bind);
@@ -2933,7 +2942,7 @@ static void test_bind_result_ext()
bind[7].length= &bLength;
bind[7].buffer_length= sizeof(bData);
- stmt = mysql_prepare(mysql, "select * from test_bind_result", 50);
+ stmt = mysql_simple_prepare(mysql, "select * from test_bind_result");
mystmt_init(stmt);
rc = mysql_bind_result(stmt,bind);
@@ -3058,7 +3067,7 @@ static void test_bind_result_ext1()
bind[i].length= &length[i];
}
- stmt = mysql_prepare(mysql, "select * from test_bind_result", 50);
+ stmt = mysql_simple_prepare(mysql, "select * from test_bind_result");
mystmt_init(stmt);
rc = mysql_bind_result(stmt,bind);
@@ -3118,7 +3127,7 @@ static void bind_fetch(int row_count)
MYSQL_BIND bind[7];
my_bool is_null[7];
- stmt = mysql_prepare(mysql,"INSERT INTO test_bind_fetch VALUES(?,?,?,?,?,?,?)",100);
+ stmt = mysql_simple_prepare(mysql,"INSERT INTO test_bind_fetch VALUES(?,?,?,?,?,?,?)");
mystmt_init(stmt);
verify_param_count(stmt, 7);
@@ -3151,9 +3160,9 @@ static void bind_fetch(int row_count)
mysql_stmt_close(stmt);
assert(row_count == (int)
- my_stmt_result("SELECT * FROM test_bind_fetch",50));
+ my_stmt_result("SELECT * FROM test_bind_fetch"));
- stmt = mysql_prepare(mysql,"SELECT * FROM test_bind_fetch",50);
+ stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_bind_fetch");
myquery(rc);
for (i= 0; i < (int) array_elements(bind); i++)
@@ -3321,9 +3330,9 @@ static void test_fetch_date()
bind[6].buffer_length= sizeof(ts_6);
bind[6].length= &ts6_length;
- assert(1 == my_stmt_result("SELECT * FROM test_bind_result",50));
+ assert(1 == my_stmt_result("SELECT * FROM test_bind_result"));
- stmt = mysql_prepare(mysql, "SELECT * FROM test_bind_result", 50);
+ stmt = mysql_simple_prepare(mysql, "SELECT * FROM test_bind_result");
mystmt_init(stmt);
rc = mysql_bind_result(stmt,bind);
@@ -3651,7 +3660,7 @@ static void test_prepare_ext()
/* insert by prepare - all integers */
strmov(query,(char *)"INSERT INTO test_prepare_ext(c1,c2,c3,c4,c5,c6) VALUES(?,?,?,?,?,?)");
- stmt = mysql_prepare(mysql,query, strlen(query));
+ stmt = mysql_simple_prepare(mysql,query);
mystmt_init(stmt);
verify_param_count(stmt,6);
@@ -3704,7 +3713,7 @@ static void test_prepare_ext()
rc = mysql_commit(mysql);
myquery(rc);
- stmt = mysql_prepare(mysql,"SELECT c1,c2,c3,c4,c5,c6 FROM test_prepare_ext",100);
+ stmt = mysql_simple_prepare(mysql,"SELECT c1,c2,c3,c4,c5,c6 FROM test_prepare_ext");
mystmt_init(stmt);
/* get the result */
@@ -3850,7 +3859,7 @@ static void test_insert()
myquery(rc);
/* insert by prepare */
- stmt = mysql_prepare(mysql, "INSERT INTO test_prep_insert VALUES(?,?)", 70);
+ stmt = mysql_simple_prepare(mysql, "INSERT INTO test_prep_insert VALUES(?,?)");
mystmt_init(stmt);
verify_param_count(stmt,2);
@@ -3922,7 +3931,7 @@ static void test_prepare_resultset()
name varchar(50),extra double)");
myquery(rc);
- stmt = mysql_prepare(mysql, "SELECT * FROM test_prepare_resultset", 60);
+ stmt = mysql_simple_prepare(mysql, "SELECT * FROM test_prepare_resultset");
mystmt_init(stmt);
verify_param_count(stmt,0);
@@ -4034,25 +4043,25 @@ static void test_stmt_close()
myquery(rc);
strmov(query,"ALTER TABLE test_stmt_close ADD name varchar(20)");
- stmt1= mysql_prepare(lmysql, query, 70);
+ stmt1= mysql_simple_prepare(lmysql, query);
mystmt_init(stmt1);
verify_param_count(stmt1, 0);
strmov(query,"INSERT INTO test_stmt_close(id) VALUES(?)");
- stmt_x= mysql_prepare(mysql, query, 70);
+ stmt_x= mysql_simple_prepare(mysql, query);
mystmt_init(stmt_x);
verify_param_count(stmt_x, 1);
strmov(query,"UPDATE test_stmt_close SET id=? WHERE id=?");
- stmt3= mysql_prepare(lmysql, query, 70);
+ stmt3= mysql_simple_prepare(lmysql, query);
mystmt_init(stmt3);
verify_param_count(stmt3, 2);
strmov(query,"SELECT * FROM test_stmt_close WHERE id=?");
- stmt2= mysql_prepare(lmysql, query, 70);
+ stmt2= mysql_simple_prepare(lmysql, query);
mystmt_init(stmt2);
verify_param_count(stmt2, 1);
@@ -4119,7 +4128,7 @@ static void test_set_variable()
mysql_autocommit(mysql, TRUE);
- stmt1 = mysql_prepare(mysql, "show variables like 'max_error_count'", 50);
+ stmt1 = mysql_simple_prepare(mysql, "show variables like 'max_error_count'");
mystmt_init(stmt1);
get_bind[0].buffer_type= MYSQL_TYPE_STRING;
@@ -4150,7 +4159,7 @@ static void test_set_variable()
rc = mysql_fetch(stmt1);
assert(rc == MYSQL_NO_DATA);
- stmt = mysql_prepare(mysql, "set max_error_count=?", 50);
+ stmt = mysql_simple_prepare(mysql, "set max_error_count=?");
mystmt_init(stmt);
set_bind[0].buffer_type= MYSQL_TYPE_LONG;
@@ -4225,7 +4234,7 @@ static void test_insert_meta()
myquery(rc);
strmov(query,"INSERT INTO test_prep_insert VALUES(10,'venu1','test')");
- stmt = mysql_prepare(mysql, query, 70);
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,0);
@@ -4236,7 +4245,7 @@ static void test_insert_meta()
mysql_stmt_close(stmt);
strmov(query,"INSERT INTO test_prep_insert VALUES(?,'venu',?)");
- stmt = mysql_prepare(mysql, query, 70);
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,2);
@@ -4288,7 +4297,7 @@ static void test_update_meta()
myquery(rc);
strmov(query,"UPDATE test_prep_update SET col1=10, col2='venu1' WHERE col3='test'");
- stmt = mysql_prepare(mysql, query, 100);
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,0);
@@ -4299,7 +4308,7 @@ static void test_update_meta()
mysql_stmt_close(stmt);
strmov(query,"UPDATE test_prep_update SET col1=?, col2='venu' WHERE col3=?");
- stmt = mysql_prepare(mysql, query, 100);
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,2);
@@ -4355,7 +4364,7 @@ static void test_select_meta()
myquery(rc);
strmov(query,"SELECT * FROM test_prep_select WHERE col1=10");
- stmt = mysql_prepare(mysql, query, 70);
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,0);
@@ -4364,7 +4373,7 @@ static void test_select_meta()
mytest_r(result);
strmov(query,"SELECT col1, col3 from test_prep_select WHERE col1=? AND col3='test' AND col2= ?");
- stmt = mysql_prepare(mysql, query, 120);
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
verify_param_count(stmt,2);
@@ -4499,10 +4508,10 @@ static void test_multi_stmt()
rc = mysql_query(mysql,"INSERT INTO test_multi_table values(10,'mysql')");
myquery(rc);
- stmt = mysql_prepare(mysql, "SELECT * FROM test_multi_table WHERE id = ?", 100);
+ stmt = mysql_simple_prepare(mysql, "SELECT * FROM test_multi_table WHERE id = ?");
mystmt_init(stmt);
- stmt2 = mysql_prepare(mysql, "UPDATE test_multi_table SET name='updated' WHERE id=10",100);
+ stmt2 = mysql_simple_prepare(mysql, "UPDATE test_multi_table SET name='updated' WHERE id=10");
mystmt_init(stmt2);
verify_param_count(stmt,1);
@@ -4544,7 +4553,7 @@ static void test_multi_stmt()
assert(rc == MYSQL_NO_DATA);
/* alter the table schema now */
- stmt1 = mysql_prepare(mysql,"DELETE FROM test_multi_table WHERE id = ? AND name=?",100);
+ stmt1 = mysql_simple_prepare(mysql,"DELETE FROM test_multi_table WHERE id = ? AND name=?");
mystmt_init(stmt1);
verify_param_count(stmt1,2);
@@ -4584,7 +4593,7 @@ static void test_multi_stmt()
rc = mysql_fetch(stmt);
assert(rc == MYSQL_NO_DATA);
- assert(0 == my_stmt_result("SELECT * FROM test_multi_table",50));
+ assert(0 == my_stmt_result("SELECT * FROM test_multi_table"));
mysql_stmt_close(stmt);
mysql_stmt_close(stmt2);
@@ -4631,7 +4640,7 @@ static void test_manual_sample()
/* Prepare a insert query with 3 parameters */
strmov(query, "INSERT INTO test_table(col1,col2,col3) values(?,?,?)");
- if (!(stmt = mysql_prepare(mysql,query,strlen(query))))
+ if (!(stmt = mysql_simple_prepare(mysql,query)))
{
fprintf(stderr, "\n prepare, insert failed");
fprintf(stderr, "\n %s", mysql_error(mysql));
@@ -4735,7 +4744,7 @@ static void test_manual_sample()
fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
exit(0);
}
- assert(2 == my_stmt_result("SELECT * FROM test_table",50));
+ assert(2 == my_stmt_result("SELECT * FROM test_table"));
/* DROP THE TABLE */
if (mysql_query(mysql,"DROP TABLE test_table"))
@@ -4770,7 +4779,7 @@ static void test_prepare_alter()
rc = mysql_query(mysql,"INSERT INTO test_prep_alter values(10,'venu'),(20,'mysql')");
myquery(rc);
- stmt = mysql_prepare(mysql, "INSERT INTO test_prep_alter VALUES(?,'monty')", 100);
+ stmt = mysql_simple_prepare(mysql, "INSERT INTO test_prep_alter VALUES(?,'monty')");
mystmt_init(stmt);
verify_param_count(stmt,1);
@@ -4796,7 +4805,7 @@ static void test_prepare_alter()
rc = mysql_execute(stmt);
mystmt(stmt, rc);
- assert(4 == my_stmt_result("SELECT * FROM test_prep_alter",50));
+ assert(4 == my_stmt_result("SELECT * FROM test_prep_alter"));
mysql_stmt_close(stmt);
}
@@ -4978,7 +4987,7 @@ static void test_store_result()
bind[1].is_null= &is_null[1];
length1= 0;
- stmt = mysql_prepare(mysql, "SELECT * FROM test_store_result", 50);
+ stmt = mysql_simple_prepare(mysql, "SELECT * FROM test_store_result");
mystmt_init(stmt);
rc = mysql_bind_result(stmt,bind);
@@ -5089,7 +5098,7 @@ static void test_store_result1()
rc = mysql_commit(mysql);
myquery(rc);
- stmt = mysql_prepare(mysql,"SELECT * FROM test_store_result",100);
+ stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_store_result");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -5160,7 +5169,7 @@ static void test_store_result2()
bind[0].is_null= 0;
strmov((char *)query , "SELECT col1 FROM test_store_result where col1= ?");
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
rc = mysql_bind_param(stmt,bind);
@@ -5252,7 +5261,7 @@ static void test_subselect()
bind[0].length= 0;
bind[0].is_null= 0;
- stmt = mysql_prepare(mysql, "INSERT INTO test_sub2(id) SELECT * FROM test_sub1 WHERE id=?", 100);
+ stmt = mysql_simple_prepare(mysql, "INSERT INTO test_sub2(id) SELECT * FROM test_sub1 WHERE id=?", 100);
mystmt_init(stmt);
rc = mysql_bind_param(stmt,bind);
@@ -5275,13 +5284,13 @@ static void test_subselect()
mysql_stmt_close(stmt);
- assert(3 == my_stmt_result("SELECT * FROM test_sub2",50));
+ assert(3 == my_stmt_result("SELECT * FROM test_sub2"));
strmov((char *)query , "SELECT ROW(1,7) IN (select id, id1 from test_sub2 WHERE id1=?)");
- assert(1 == my_stmt_result("SELECT ROW(1,7) IN (select id, id1 from test_sub2 WHERE id1=8)",100));
- assert(1 == my_stmt_result("SELECT ROW(1,7) IN (select id, id1 from test_sub2 WHERE id1=7)",100));
+ assert(1 == my_stmt_result("SELECT ROW(1,7) IN (select id, id1 from test_sub2 WHERE id1=8)"));
+ assert(1 == my_stmt_result("SELECT ROW(1,7) IN (select id, id1 from test_sub2 WHERE id1=7)"));
- stmt = mysql_prepare(mysql, query, 150);
+ stmt = mysql_simple_prepare(mysql, query, 150);
mystmt_init(stmt);
rc = mysql_bind_param(stmt,bind);
@@ -5335,7 +5344,7 @@ static void test_bind_date_conv(uint row_count)
ulong second_part;
uint year, month, day, hour, minute, sec;
- stmt = mysql_prepare(mysql,"INSERT INTO test_date VALUES(?,?,?,?)", 100);
+ stmt = mysql_simple_prepare(mysql,"INSERT INTO test_date VALUES(?,?,?,?)");
mystmt_init(stmt);
verify_param_count(stmt, 4);
@@ -5389,9 +5398,9 @@ static void test_bind_date_conv(uint row_count)
mysql_stmt_close(stmt);
- assert(row_count == my_stmt_result("SELECT * FROM test_date",50));
+ assert(row_count == my_stmt_result("SELECT * FROM test_date"));
- stmt = mysql_prepare(mysql,"SELECT * FROM test_date",50);
+ stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_date");
myquery(rc);
rc = mysql_bind_result(stmt, bind);
@@ -5586,30 +5595,27 @@ static void test_pure_coverage()
rc = mysql_query(mysql,"CREATE TABLE test_pure(c1 int, c2 varchar(20))");
myquery(rc);
- stmt = mysql_prepare(mysql,"insert into test_pure(c67788) values(10)",100);
+ stmt = mysql_simple_prepare(mysql,"insert into test_pure(c67788) values(10)");
mystmt_init_r(stmt);
-#ifndef DBUG_OFF
- stmt = mysql_prepare(mysql,(const char *)0,0);
- mystmt_init_r(stmt);
-
- stmt = mysql_prepare(mysql,"insert into test_pure(c2) values(10)",100);
+ /* Query without params and result should allow to bind 0 arrays */
+ stmt = mysql_simple_prepare(mysql,"insert into test_pure(c2) values(10)");
mystmt_init(stmt);
+
+ rc = mysql_bind_param(stmt, (MYSQL_BIND*)0);
+ mystmt(stmt, rc);
+
+ rc = mysql_execute(stmt);
+ mystmt(stmt, rc);
- rc = mysql_bind_param(stmt, bind);
- mystmt_r(stmt, rc);
-
+ rc = mysql_bind_result(stmt, (MYSQL_BIND*)0);
+ mystmt(stmt, rc);
+
mysql_stmt_close(stmt);
-#endif
- stmt = mysql_prepare(mysql,"insert into test_pure(c2) values(?)",100);
+ stmt = mysql_simple_prepare(mysql,"insert into test_pure(c2) values(?)");
mystmt_init(stmt);
-#ifndef DBUG_OFF
- rc = mysql_execute(stmt);
- mystmt_r(stmt, rc);/* No parameters supplied */
-#endif
-
bind[0].length= &length;
bind[0].is_null= 0;
bind[0].buffer_length= 0;
@@ -5622,28 +5628,20 @@ static void test_pure_coverage()
rc = mysql_bind_param(stmt, bind);
mystmt(stmt, rc);
- rc = mysql_send_long_data(stmt, 20, (char *)"venu", 4);
- mystmt_r(stmt, rc); /* wrong param number */
-
rc = mysql_stmt_store_result(stmt);
mystmt(stmt, rc);
mysql_stmt_close(stmt);
- stmt = mysql_prepare(mysql,"select * from test_pure",100);
+ stmt = mysql_simple_prepare(mysql,"select * from test_pure");
mystmt(stmt, rc);
rc = mysql_execute(stmt);
mystmt(stmt, rc);
-#ifndef DBUG_OFF
- rc = mysql_bind_result(stmt, (MYSQL_BIND *)0);
- mystmt_r(stmt, rc);
-
bind[0].buffer_type= MYSQL_TYPE_GEOMETRY;
rc = mysql_bind_result(stmt, bind);
mystmt_r(stmt, rc); /* unsupported buffer type */
-#endif
rc = mysql_stmt_store_result(stmt);
mystmt(stmt, rc);
@@ -5682,7 +5680,7 @@ static void test_buffers()
,('Database'),('Open-Source'),('Popular')");
myquery(rc);
- stmt = mysql_prepare(mysql,"select str from test_buffer",100);
+ stmt = mysql_simple_prepare(mysql,"select str from test_buffer");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -5760,7 +5758,7 @@ static void test_open_direct()
rc = mysql_query(mysql,"CREATE TABLE test_open_direct(id int, name char(6))");
myquery(rc);
- stmt = mysql_prepare(mysql,"INSERT INTO test_open_direct values(10,'mysql')", 100);
+ stmt = mysql_simple_prepare(mysql,"INSERT INTO test_open_direct values(10,'mysql')");
mystmt_init(stmt);
rc = mysql_query(mysql, "SELECT * FROM test_open_direct");
@@ -5799,7 +5797,7 @@ static void test_open_direct()
mysql_stmt_close(stmt);
/* run a direct query in the middle of a fetch */
- stmt= mysql_prepare(mysql,"SELECT * FROM test_open_direct",100);
+ stmt= mysql_simple_prepare(mysql,"SELECT * FROM test_open_direct");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -5818,7 +5816,7 @@ static void test_open_direct()
myquery(rc);
/* run a direct query with store result */
- stmt= mysql_prepare(mysql,"SELECT * FROM test_open_direct",100);
+ stmt= mysql_simple_prepare(mysql,"SELECT * FROM test_open_direct");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -5849,8 +5847,8 @@ static void test_fetch_nobuffs()
myheader("test_fetch_nobuffs");
- stmt = mysql_prepare(mysql,"SELECT DATABASE(), CURRENT_USER(), \
- CURRENT_DATE(), CURRENT_TIME()",100);
+ stmt = mysql_simple_prepare(mysql,"SELECT DATABASE(), CURRENT_USER(), \
+ CURRENT_DATE(), CURRENT_TIME()");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -5923,7 +5921,7 @@ static void test_ushort_bug()
myquery(rc);
- stmt = mysql_prepare(mysql,"SELECT * FROM test_ushort",50);
+ stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_ushort");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -6007,7 +6005,7 @@ static void test_sshort_bug()
myquery(rc);
- stmt = mysql_prepare(mysql,"SELECT * FROM test_sshort",50);
+ stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_sshort");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -6091,7 +6089,7 @@ static void test_stiny_bug()
myquery(rc);
- stmt = mysql_prepare(mysql,"SELECT * FROM test_stiny",50);
+ stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_stiny");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -6176,7 +6174,7 @@ static void test_field_misc()
mysql_free_result(result);
- stmt = mysql_prepare(mysql,"SELECT @@autocommit",20);
+ stmt = mysql_simple_prepare(mysql,"SELECT @@autocommit");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -6196,7 +6194,7 @@ static void test_field_misc()
mysql_free_result(result);
mysql_stmt_close(stmt);
- stmt = mysql_prepare(mysql, "SELECT @@table_type", 30);
+ stmt = mysql_simple_prepare(mysql, "SELECT @@table_type");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -6220,7 +6218,7 @@ static void test_field_misc()
mysql_stmt_close(stmt);
- stmt = mysql_prepare(mysql, "SELECT @@table_type", 30);
+ stmt = mysql_simple_prepare(mysql, "SELECT @@table_type");
mystmt_init(stmt);
result = mysql_get_metadata(stmt);
@@ -6240,7 +6238,7 @@ static void test_field_misc()
mysql_free_result(result);
mysql_stmt_close(stmt);
- stmt = mysql_prepare(mysql, "SELECT @@max_error_count", 30);
+ stmt = mysql_simple_prepare(mysql, "SELECT @@max_error_count");
mystmt_init(stmt);
result = mysql_get_metadata(stmt);
@@ -6260,7 +6258,7 @@ static void test_field_misc()
mysql_free_result(result);
mysql_stmt_close(stmt);
- stmt = mysql_prepare(mysql, "SELECT @@max_allowed_packet", 30);
+ stmt = mysql_simple_prepare(mysql, "SELECT @@max_allowed_packet");
mystmt_init(stmt);
result = mysql_get_metadata(stmt);
@@ -6280,7 +6278,7 @@ static void test_field_misc()
mysql_free_result(result);
mysql_stmt_close(stmt);
- stmt = mysql_prepare(mysql, "SELECT @@sql_warnings", 30);
+ stmt = mysql_simple_prepare(mysql, "SELECT @@sql_warnings");
mystmt_init(stmt);
result = mysql_get_metadata(stmt);
@@ -6341,7 +6339,7 @@ static void test_set_option()
mysql_free_result(result);
fprintf(stdout,"\n with SQL_SELECT_LIMIT=2 (prepare)");
- stmt = mysql_prepare(mysql, "SELECT * FROM test_limit", 50);
+ stmt = mysql_simple_prepare(mysql, "SELECT * FROM test_limit");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -6356,7 +6354,7 @@ static void test_set_option()
rc= mysql_query(mysql,"SET OPTION SQL_SELECT_LIMIT=DEFAULT");
myquery(rc);
- stmt = mysql_prepare(mysql, "SELECT * FROM test_limit", 50);
+ stmt = mysql_simple_prepare(mysql, "SELECT * FROM test_limit");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -6433,18 +6431,20 @@ static void test_prepare_grant()
execute_prepare_query("INSERT INTO test_grant(a) VALUES(NULL)",1);
execute_prepare_query("INSERT INTO test_grant VALUES(NULL)",1);
execute_prepare_query("UPDATE test_grant SET a=9 WHERE a=1",1);
- assert(4 == my_stmt_result("SELECT a FROM test_grant",50));
-
+ assert(4 == my_stmt_result("SELECT a FROM test_grant"));
+
+ /* Both DELETE expected to fail as user does not have DELETE privs */
+
rc = mysql_query(mysql,"DELETE FROM test_grant");
myquery_r(rc);
- stmt= mysql_prepare(mysql,"DELETE FROM test_grant",50);
+ stmt= mysql_simple_prepare(mysql,"DELETE FROM test_grant");
mystmt_init(stmt);
rc = mysql_execute(stmt);
myquery_r(rc);
- assert(4 == my_stmt_result("SELECT * FROM test_grant",50));
+ assert(4 == my_stmt_result("SELECT * FROM test_grant"));
mysql_close(lmysql);
mysql= org_mysql;
@@ -6487,7 +6487,7 @@ static void test_frm_bug()
rc= mysql_query(mysql,"flush tables");
myquery(rc);
- stmt = mysql_prepare(mysql, "show variables like 'datadir'", 50);
+ stmt = mysql_simple_prepare(mysql, "show variables like 'datadir'");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -6570,7 +6570,7 @@ static void test_decimal_bug()
rc = mysql_query(mysql, "insert into test_decimal_bug value(8),(10.22),(5.61)");
myquery(rc);
- stmt = mysql_prepare(mysql,"select c1 from test_decimal_bug where c1= ?",50);
+ stmt = mysql_simple_prepare(mysql,"select c1 from test_decimal_bug where c1= ?");
mystmt_init(stmt);
bind[0].buffer_type= MYSQL_TYPE_DOUBLE;
@@ -6666,7 +6666,7 @@ static void test_explain_bug()
rc = mysql_query(mysql, "CREATE TABLE test_explain(id int, name char(2))");
myquery(rc);
- stmt = mysql_prepare(mysql, "explain test_explain", 30);
+ stmt = mysql_simple_prepare(mysql, "explain test_explain");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -6702,7 +6702,7 @@ static void test_explain_bug()
mysql_free_result(result);
mysql_stmt_close(stmt);
- stmt = mysql_prepare(mysql, "explain select id, name FROM test_explain", 50);
+ stmt = mysql_simple_prepare(mysql, "explain select id, name FROM test_explain");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -6950,10 +6950,10 @@ static void test_logs()
myheader("test_logs");
- rc = mysql_real_query(mysql, "DROP TABLE IF EXISTS test_logs", 100);
+ rc = mysql_query(mysql, "DROP TABLE IF EXISTS test_logs");
myquery(rc);
- rc = mysql_real_query(mysql, "CREATE TABLE test_logs(id smallint, name varchar(20))", 100);
+ rc = mysql_query(mysql, "CREATE TABLE test_logs(id smallint, name varchar(20))");
myquery(rc);
length= (ulong)(strmov((char *)data,"INSERT INTO test_logs VALUES(?,?)") - data);
@@ -7015,7 +7015,7 @@ static void test_logs()
mysql_stmt_close(stmt);
length= (ulong)(strmov((char *)data, "SELECT * FROM test_logs WHERE id=?") - data);
- stmt = mysql_prepare(mysql, data, length+2);
+ stmt = mysql_prepare(mysql, data, length);
mystmt_init(stmt);
rc = mysql_bind_param(stmt, bind);
@@ -7125,7 +7125,7 @@ static void test_nstmts()
mysql_stmt_close(stmt);
}
- stmt = mysql_prepare(mysql," select count(*) from test_nstmts", 50);
+ stmt = mysql_simple_prepare(mysql," select count(*) from test_nstmts");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -7172,7 +7172,7 @@ static void test_fetch_seek()
rc = mysql_query(mysql, "insert into test_seek(c2) values('venu'),('mysql'),('open'),('source')");
myquery(rc);
- stmt = mysql_prepare(mysql,"select * from test_seek",50);
+ stmt = mysql_simple_prepare(mysql,"select * from test_seek");
mystmt_init(stmt);
bind[0].buffer_type= MYSQL_TYPE_LONG;
@@ -7267,7 +7267,7 @@ static void test_fetch_offset()
rc = mysql_query(mysql, "insert into test_column values('abcdefghij'),(null)");
myquery(rc);
- stmt = mysql_prepare(mysql,"select * from test_column",50);
+ stmt = mysql_simple_prepare(mysql,"select * from test_column");
mystmt_init(stmt);
bind[0].buffer_type= MYSQL_TYPE_STRING;
@@ -7291,9 +7291,6 @@ static void test_fetch_offset()
rc = mysql_fetch(stmt);
mystmt(stmt,rc);
- rc = mysql_fetch_column(stmt,bind,4,0);
- mystmt_r(stmt,rc);
-
data[0]= '\0';
rc = mysql_fetch_column(stmt,bind,0,0);
mystmt(stmt,rc);
@@ -7350,7 +7347,7 @@ static void test_fetch_column()
rc = mysql_query(mysql, "insert into test_column(c2) values('venu'),('mysql')");
myquery(rc);
- stmt = mysql_prepare(mysql,"select * from test_column order by c2 desc", 50);
+ stmt = mysql_simple_prepare(mysql,"select * from test_column order by c2 desc");
mystmt_init(stmt);
bind[0].buffer_type= MYSQL_TYPE_LONG;
@@ -7411,9 +7408,6 @@ static void test_fetch_column()
fprintf(stdout, "\n col 0: %d(%ld)", c1, l1);
assert(c1 == 1 && l1 == 4);
- rc = mysql_fetch_column(stmt,bind,10,0);
- mystmt_r(stmt,rc);
-
rc = mysql_fetch(stmt);
mystmt(stmt,rc);
@@ -7537,7 +7531,7 @@ static void test_mem_overun()
assert(1 == my_process_result(mysql));
- stmt = mysql_prepare(mysql, "select * from t_mem_overun",30);
+ stmt = mysql_simple_prepare(mysql, "select * from t_mem_overun");
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -7583,7 +7577,7 @@ static void test_free_result()
rc = mysql_query(mysql, "insert into test_free_result values(),(),()");
myquery(rc);
- stmt = mysql_prepare(mysql,"select * from test_free_result",50);
+ stmt = mysql_simple_prepare(mysql,"select * from test_free_result");
mystmt_init(stmt);
bind[0].buffer_type= MYSQL_TYPE_LONG;
@@ -7662,7 +7656,7 @@ static void test_free_store_result()
rc = mysql_query(mysql, "insert into test_free_result values(),(),()");
myquery(rc);
- stmt = mysql_prepare(mysql,"select * from test_free_result",50);
+ stmt = mysql_simple_prepare(mysql,"select * from test_free_result");
mystmt_init(stmt);
bind[0].buffer_type= MYSQL_TYPE_LONG;
@@ -7749,7 +7743,7 @@ static void test_sqlmode()
strcpy(query, "INSERT INTO test_piping VALUES(?||?)");
fprintf(stdout,"\n query: %s", query);
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
fprintf(stdout,"\n total parameters: %ld", mysql_param_count(stmt));
@@ -7781,7 +7775,7 @@ static void test_sqlmode()
strcpy(query, "SELECT connection_id ()");
fprintf(stdout,"\n query: %s", query);
- stmt = mysql_prepare(mysql, query, 70);
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init_r(stmt);
/* ANSI */
@@ -7792,7 +7786,7 @@ static void test_sqlmode()
strcpy(query, "INSERT INTO test_piping VALUES(?||?)");
fprintf(stdout,"\n query: %s", query);
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
fprintf(stdout,"\n total parameters: %ld", mysql_param_count(stmt));
@@ -7809,7 +7803,7 @@ static void test_sqlmode()
/* ANSI mode spaces ... */
strcpy(query, "SELECT connection_id ()");
fprintf(stdout,"\n query: %s", query);
- stmt = mysql_prepare(mysql, query, 70);
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -7832,7 +7826,7 @@ static void test_sqlmode()
strcpy(query, "SELECT connection_id ()");
fprintf(stdout,"\n query: %s", query);
- stmt = mysql_prepare(mysql, query, 70);
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
rc = mysql_execute(stmt);
@@ -7873,7 +7867,7 @@ static void test_ts()
rc = mysql_commit(mysql);
myquery(rc);
- stmt = mysql_prepare(mysql,"INSERT INTO test_ts VALUES(?,?,?),(?,?,?)",50);
+ stmt = mysql_simple_prepare(mysql,"INSERT INTO test_ts VALUES(?,?,?),(?,?,?)");
mystmt_init(stmt);
ts.year= 2003;
@@ -7912,7 +7906,7 @@ static void test_ts()
verify_col_data("test_ts","b","21:07:46");
verify_col_data("test_ts","c","2003-07-12 21:07:46");
- stmt = mysql_prepare(mysql,"SELECT * FROM test_ts",50);
+ stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_ts");
mystmt_init(stmt);
prep_res = mysql_get_metadata(stmt);
@@ -7983,7 +7977,7 @@ static void test_bug1500()
rc= mysql_commit(mysql);
myquery(rc);
- stmt= mysql_prepare(mysql,"SELECT i FROM test_bg1500 WHERE i IN (?,?,?)",44);
+ stmt= mysql_simple_prepare(mysql,"SELECT i FROM test_bg1500 WHERE i IN (?,?,?)");
mystmt_init(stmt);
verify_param_count(stmt,3);
@@ -8018,8 +8012,8 @@ static void test_bug1500()
rc= mysql_commit(mysql);
myquery(rc);
- stmt= mysql_prepare(mysql,
- "SELECT s FROM test_bg1500 WHERE MATCH (s) AGAINST (?)",53);
+ stmt= mysql_simple_prepare(mysql,
+ "SELECT s FROM test_bg1500 WHERE MATCH (s) AGAINST (?)");
mystmt_init(stmt);
verify_param_count(stmt,1);
@@ -8046,8 +8040,8 @@ static void test_bug1500()
mysql_stmt_close(stmt);
/* This should work too */
- stmt= mysql_prepare(mysql,
- "SELECT s FROM test_bg1500 WHERE MATCH (s) AGAINST (CONCAT(?,'digger'))", 70);
+ stmt= mysql_simple_prepare(mysql,
+ "SELECT s FROM test_bg1500 WHERE MATCH (s) AGAINST (CONCAT(?,'digger'))");
mystmt_init(stmt);
verify_param_count(stmt,1);
@@ -8084,7 +8078,7 @@ static void test_bug1946()
rc= mysql_query(mysql,"CREATE TABLE prepare_command(ID INT)");
myquery(rc);
- stmt = mysql_prepare(mysql, query, strlen(query));
+ stmt = mysql_simple_prepare(mysql, query);
mystmt_init(stmt);
rc= mysql_real_query(mysql, query, strlen(query));
assert(rc != 0);
@@ -8095,6 +8089,163 @@ static void test_bug1946()
rc= mysql_query(mysql,"DROP TABLE prepare_command");
}
+static void test_parse_error_and_bad_length()
+{
+ MYSQL_STMT *stmt;
+ int rc;
+
+ /* check that we get 4 syntax errors over the 4 calls */
+ myheader("test_parse_error_and_bad_length");
+
+ rc= mysql_query(mysql,"SHOW DATABAAAA");
+ assert(rc);
+ fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql));
+ rc= mysql_real_query(mysql,"SHOW DATABASES",100);
+ assert(rc);
+ fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql));
+
+ stmt= mysql_simple_prepare(mysql,"SHOW DATABAAAA");
+ assert(!stmt);
+ fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql));
+ stmt= mysql_prepare(mysql,"SHOW DATABASES",100);
+ assert(!stmt);
+ fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql));
+}
+
+
+static void test_bug2247()
+{
+ MYSQL_STMT *stmt;
+ MYSQL_RES *res;
+ int rc;
+ int i;
+ const char *create= "CREATE TABLE bug2247(id INT UNIQUE AUTO_INCREMENT)";
+ const char *insert= "INSERT INTO bug2247 VALUES (NULL)";
+ const char *select= "SELECT id FROM bug2247";
+ const char *update= "UPDATE bug2247 SET id=id+10";
+ const char *drop= "DROP TABLE IF EXISTS bug2247";
+ ulonglong exp_count;
+ enum { NUM_ROWS= 5 };
+
+ myheader("test_bug2247");
+
+ fprintf(stdout, "\nChecking if stmt_affected_rows is not affected by\n"
+ "mysql_query ... ");
+ /* create table and insert few rows */
+ rc = mysql_query(mysql, drop);
+ myquery(rc);
+
+ rc= mysql_query(mysql, create);
+ myquery(rc);
+
+ stmt= mysql_prepare(mysql, insert, strlen(insert));
+ mystmt_init(stmt);
+ for (i= 0; i < NUM_ROWS; ++i)
+ {
+ rc= mysql_execute(stmt);
+ mystmt(stmt, rc);
+ }
+ exp_count= mysql_stmt_affected_rows(stmt);
+ assert(exp_count == 1);
+
+ rc= mysql_query(mysql, select);
+ myquery(rc);
+ /*
+ mysql_store_result overwrites mysql->affected_rows. Check that
+ mysql_stmt_affected_rows() returns the same value, whereas
+ mysql_affected_rows() value is correct.
+ */
+ res= mysql_store_result(mysql);
+ mytest(res);
+
+ assert(mysql_affected_rows(mysql) == NUM_ROWS);
+ assert(exp_count == mysql_stmt_affected_rows(stmt));
+
+ rc= mysql_query(mysql, update);
+ myquery(rc);
+ assert(mysql_affected_rows(mysql) == NUM_ROWS);
+ assert(exp_count == mysql_stmt_affected_rows(stmt));
+
+ mysql_free_result(res);
+ mysql_stmt_close(stmt);
+
+ /* check that mysql_stmt_store_result modifies mysql_stmt_affected_rows */
+ stmt= mysql_prepare(mysql, select, strlen(select));
+ mystmt_init(stmt);
+
+ rc= mysql_execute(stmt);
+ mystmt(stmt, rc);
+ rc= mysql_stmt_store_result(stmt);
+ mystmt(stmt, rc);
+ exp_count= mysql_stmt_affected_rows(stmt);
+ assert(exp_count == NUM_ROWS);
+
+ rc= mysql_query(mysql, insert);
+ myquery(rc);
+ assert(mysql_affected_rows(mysql) == 1);
+ assert(mysql_stmt_affected_rows(stmt) == exp_count);
+
+ mysql_stmt_close(stmt);
+ fprintf(stdout, "OK");
+}
+
+/*
+ Test for bug#2248 "mysql_fetch without prior mysql_execute hangs"
+*/
+
+static void test_bug2248()
+{
+ MYSQL_STMT *stmt;
+ int rc;
+ const char *query1= "SELECT DATABASE()";
+ const char *query2= "INSERT INTO test_bug2248 VALUES (10)";
+
+ myheader("test_bug2248");
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bug2248");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "CREATE TABLE test_bug2248 (id int)");
+ myquery(rc);
+
+ stmt= mysql_prepare(mysql, query1, strlen(query1));
+ mystmt_init(stmt);
+
+ /* This should not hang */
+ rc= mysql_fetch(stmt);
+ mystmt_r(stmt,rc);
+
+ /* And this too */
+ rc= mysql_stmt_store_result(stmt);
+ mystmt_r(stmt,rc);
+
+ mysql_stmt_close(stmt);
+
+ stmt= mysql_prepare(mysql, query2, strlen(query2));
+ mystmt_init(stmt);
+
+ rc= mysql_execute(stmt);
+ mystmt(stmt,rc);
+
+ /* This too should not hang but should return proper error */
+ rc= mysql_fetch(stmt);
+ assert(rc==MYSQL_NO_DATA);
+
+ /* This too should not hang but should not bark */
+ rc= mysql_stmt_store_result(stmt);
+ mystmt(stmt,rc);
+
+ /* This should return proper error */
+ rc= mysql_fetch(stmt);
+ mystmt_r(stmt,rc);
+ assert(rc==MYSQL_NO_DATA);
+
+ mysql_stmt_close(stmt);
+
+ rc= mysql_query(mysql,"DROP TABLE test_bug2248");
+ myquery(rc);
+}
+
/*
Read and parse arguments and MySQL options from my.cnf
@@ -8340,6 +8491,12 @@ int main(int argc, char **argv)
test_bug1644(); /* BUG#1644 */
test_bug1946(); /* test that placeholders are allowed only in
prepared queries */
+ test_bug2248(); /* BUG#2248 */
+ test_parse_error_and_bad_length(); /* test if bad length param in
+ mysql_prepare() triggers error */
+ test_bug2247(); /* test that mysql_stmt_affected_rows() returns
+ number of rows affected by last prepared
+ statement execution */
end_time= time((time_t *)0);
total_time+= difftime(end_time, start_time);