summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xBUILD/compile-solaris-sparc-forte15
-rw-r--r--client/mysql.cc20
-rw-r--r--client/mysql_upgrade.c2
-rw-r--r--client/mysqladmin.cc8
-rw-r--r--client/mysqlcheck.c4
-rw-r--r--client/mysqldump.c12
-rw-r--r--client/mysqlslap.c10
-rw-r--r--client/mysqltest.c6
-rw-r--r--client/sql_string.cc6
-rw-r--r--configure.in3
-rw-r--r--extra/replace.c9
-rw-r--r--include/m_ctype.h25
-rw-r--r--include/my_sys.h1
-rw-r--r--include/myisam.h2
-rw-r--r--libmysql/libmysql.c75
-rw-r--r--libmysql/manager.c4
-rw-r--r--mysql-test/r/ctype_cp932_binlog_stm.result4
-rw-r--r--mysys/my_fopen.c1
-rw-r--r--mysys/my_open.c1
-rw-r--r--mysys/my_static.c1
-rw-r--r--mysys/thr_alarm.c51
-rw-r--r--regex/regcomp.c4
-rw-r--r--scripts/mysql_install_db.sh39
-rw-r--r--server-tools/instance-manager/angel.cc3
-rw-r--r--server-tools/instance-manager/thread_registry.cc4
-rw-r--r--sql-common/client.c12
-rw-r--r--sql-common/my_time.c9
-rw-r--r--sql-common/pack.c8
-rw-r--r--sql/event_db_repository.cc9
-rw-r--r--sql/event_queue.cc5
-rw-r--r--sql/field.cc6
-rw-r--r--sql/ha_partition.cc48
-rw-r--r--sql/ha_partition.h10
-rw-r--r--sql/handler.cc26
-rw-r--r--sql/handler.h71
-rw-r--r--sql/item.cc14
-rw-r--r--sql/item_cmpfunc.cc4
-rw-r--r--sql/item_cmpfunc.h1
-rw-r--r--sql/item_func.cc4
-rw-r--r--sql/item_strfunc.cc17
-rw-r--r--sql/item_strfunc.h19
-rw-r--r--sql/item_subselect.cc16
-rw-r--r--sql/item_xmlfunc.cc20
-rw-r--r--sql/key.cc1
-rw-r--r--sql/log.cc6
-rw-r--r--sql/log_event.cc43
-rw-r--r--sql/log_event_old.cc6
-rw-r--r--sql/mysql_priv.h6
-rw-r--r--sql/mysqld.cc52
-rw-r--r--sql/opt_range.cc59
-rw-r--r--sql/opt_sum.cc31
-rw-r--r--sql/partition_info.cc8
-rw-r--r--sql/rpl_filter.cc8
-rw-r--r--sql/set_var.cc15
-rw-r--r--sql/set_var.h10
-rw-r--r--sql/sp.cc13
-rw-r--r--sql/sp_cache.cc11
-rw-r--r--sql/sp_head.cc17
-rw-r--r--sql/sql_acl.cc47
-rw-r--r--sql/sql_class.cc15
-rw-r--r--sql/sql_class.h4
-rw-r--r--sql/sql_db.cc21
-rw-r--r--sql/sql_delete.cc6
-rw-r--r--sql/sql_handler.cc4
-rw-r--r--sql/sql_help.cc10
-rw-r--r--sql/sql_insert.cc14
-rw-r--r--sql/sql_lex.cc8
-rw-r--r--sql/sql_plugin.cc29
-rw-r--r--sql/sql_select.cc44
-rw-r--r--sql/sql_servers.cc21
-rw-r--r--sql/sql_show.cc13
-rw-r--r--sql/sql_string.cc12
-rw-r--r--sql/sql_table.cc2
-rw-r--r--sql/sql_udf.cc7
-rw-r--r--sql/sql_yacc.yy13
-rw-r--r--sql/strfunc.cc6
-rw-r--r--sql/table.cc38
-rw-r--r--sql/table.h1
-rw-r--r--sql/tztime.cc16
-rw-r--r--storage/archive/archive_reader.c2
-rw-r--r--storage/archive/azio.c13
-rw-r--r--storage/blackhole/ha_blackhole.cc10
-rw-r--r--storage/blackhole/ha_blackhole.h11
-rw-r--r--storage/csv/ha_tina.cc4
-rw-r--r--storage/example/ha_example.cc8
-rw-r--r--storage/example/ha_example.h4
-rw-r--r--storage/heap/ha_heap.cc14
-rw-r--r--storage/heap/ha_heap.h11
-rw-r--r--storage/heap/hp_test1.c18
-rw-r--r--storage/heap/hp_test2.c67
-rw-r--r--storage/myisam/ft_boolean_search.c29
-rw-r--r--storage/myisam/ft_nlq_search.c4
-rw-r--r--storage/myisam/ft_parser.c25
-rw-r--r--storage/myisam/ft_stopwords.c2
-rw-r--r--storage/myisam/ha_myisam.cc15
-rw-r--r--storage/myisam/ha_myisam.h11
-rw-r--r--storage/myisam/mi_check.c15
-rw-r--r--storage/myisam/mi_delete.c8
-rw-r--r--storage/myisam/mi_dynrec.c36
-rw-r--r--storage/myisam/mi_extra.c8
-rw-r--r--storage/myisam/mi_key.c5
-rw-r--r--storage/myisam/mi_keycache.c3
-rw-r--r--storage/myisam/mi_locking.c4
-rw-r--r--storage/myisam/mi_log.c15
-rw-r--r--storage/myisam/mi_open.c32
-rw-r--r--storage/myisam/mi_packrec.c10
-rw-r--r--storage/myisam/mi_page.c4
-rw-r--r--storage/myisam/mi_rkey.c1
-rw-r--r--storage/myisam/mi_search.c2
-rw-r--r--storage/myisam/mi_statrec.c30
-rw-r--r--storage/myisam/mi_test1.c75
-rw-r--r--storage/myisam/mi_test2.c36
-rw-r--r--storage/myisam/mi_test3.c12
-rw-r--r--storage/myisam/mi_update.c6
-rw-r--r--storage/myisam/mi_write.c6
-rw-r--r--storage/myisam/myisamdef.h30
-rw-r--r--storage/myisam/myisamlog.c5
-rw-r--r--storage/myisam/myisampack.c6
-rw-r--r--storage/myisam/rt_test.c34
-rw-r--r--storage/myisam/sort.c18
-rw-r--r--storage/myisam/sp_test.c36
-rw-r--r--storage/myisammrg/ha_myisammrg.cc16
-rw-r--r--storage/myisammrg/ha_myisammrg.h11
-rw-r--r--storage/myisammrg/myrg_create.c4
-rw-r--r--storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp2
-rw-r--r--storage/ndb/src/kernel/vm/DynArr256.cpp2
-rw-r--r--storage/ndb/src/ndbapi/Ndb.cpp1
-rw-r--r--strings/strtod.c3
-rw-r--r--tests/bug25714.c3
-rw-r--r--tests/mysql_client_test.c38
-rw-r--r--vio/viosocket.c2
131 files changed, 1109 insertions, 884 deletions
diff --git a/BUILD/compile-solaris-sparc-forte b/BUILD/compile-solaris-sparc-forte
index 2a8b7dbae48..b9fffcb7fdd 100755
--- a/BUILD/compile-solaris-sparc-forte
+++ b/BUILD/compile-solaris-sparc-forte
@@ -3,7 +3,13 @@
# Assume Forte is installed in /opt/SUNWSpro and ld is installed in
# /usr/ccs/bin
-PATH=/opt/SUNWspro/bin/:/usr/ccs/bin:$PATH
+PATH=/opt/SUNWspro/bin:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin:$PATH
+
+prefix="/usr/local/mysql"
+if test -n "$MYSQL_BUILD_PREFIX"
+then
+ prefix="$MYSQL_BUILD_PREFIX"
+fi
make -k maintainer-clean || true
/bin/rm -f */.deps/*.P config.cache
@@ -12,9 +18,9 @@ path=`dirname $0`
. "$path/autorun.sh"
# For "optimal" code for this computer add -fast to EXTRA
-# To compile 64 bit, add -xarch=v9 to EXTRA_64_BIT
+# To compile 32/64 bit, uncomment/comment EXTRA_64_BIT
-EXTRA_64_BIT="-xarch=v9" # Remove comment to get 64 bit binaries
+EXTRA_64_BIT="-m64"
EXTRA="-fast" # Remove comment to target current machine
#
@@ -22,10 +28,9 @@ EXTRA="-fast" # Remove comment to target current machine
#
STD="-mt -D_FORTEC_ $EXTRA $EXTRA_64_BIT"
-ASFLAGS="$EXTRA_64_BIT" \
CC=cc-5.0 CFLAGS="-Xa -xstrconst $STD" \
CXX=CC CXXFLAGS="-noex $STD" \
-./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client
+./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --prefix=$PREFIX
make -j 4
if [ $? = 0 ]
diff --git a/client/mysql.cc b/client/mysql.cc
index c0423e0c897..25d59d42ef4 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -193,6 +193,8 @@ void tee_putc(int c, FILE *file);
static void tee_print_sized_data(const char *, unsigned int, unsigned int, bool);
/* The names of functions that actually do the manipulation. */
static int get_options(int argc,char **argv);
+extern "C" my_bool get_one_option(int optid, const struct my_option *opt,
+ char *argument);
static int com_quit(String *str,char*),
com_go(String *str,char*), com_ego(String *str,char*),
com_print(String *str,char*),
@@ -343,8 +345,8 @@ static ulong start_timer(void);
static void end_timer(ulong start_time,char *buff);
static void mysql_end_timer(ulong start_time,char *buff);
static void nice_time(double sec,char *buff,bool part_second);
-static sig_handler mysql_end(int sig);
-static sig_handler handle_sigint(int sig);
+extern "C" sig_handler mysql_end(int sig);
+extern "C" sig_handler handle_sigint(int sig);
int main(int argc,char *argv[])
{
@@ -812,7 +814,7 @@ and you are welcome to modify and redistribute it under the GPL license\n");
}
-static my_bool
+my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
@@ -1403,7 +1405,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
#ifdef HAVE_READLINE
static char *new_command_generator(const char *text, int);
-static char **new_mysql_completion (const char *text, int start, int end);
+extern "C" char **new_mysql_completion (const char *text, int start, int end);
/*
Tell the GNU Readline library how to complete. We want to try to complete
@@ -1412,9 +1414,9 @@ static char **new_mysql_completion (const char *text, int start, int end);
*/
#if defined(USE_NEW_READLINE_INTERFACE) || defined(USE_LIBEDIT_INTERFACE)
-char *no_completion(const char*,int)
+extern "C" char *no_completion(const char*,int)
#else
-char *no_completion()
+extern "C" char *no_completion()
#endif
{
return 0; /* No filename completion */
@@ -1516,9 +1518,9 @@ static void initialize_readline (char *name)
array of matches, or NULL if there aren't any.
*/
-static char **new_mysql_completion (const char *text,
- int start __attribute__((unused)),
- int end __attribute__((unused)))
+char **new_mysql_completion (const char *text,
+ int start __attribute__((unused)),
+ int end __attribute__((unused)))
{
if (!status.batch && !quick)
#if defined(USE_NEW_READLINE_INTERFACE)
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index 5da0235c913..698cbeaaaa1 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -451,7 +451,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
MYF(MY_WME))) < 0)
die("Failed to create temporary file for defaults");
- if (my_write(fd, query, strlen(query),
+ if (my_write(fd, (uchar*) query, strlen(query),
MYF(MY_FNABP | MY_WME)))
die("Failed to write to '%s'", query_file_path);
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index ce48ad03d33..91fb7386916 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -71,10 +71,12 @@ static uint ex_var_count, max_var_length, max_val_length;
static void print_version(void);
static void usage(void);
+extern "C" my_bool get_one_option(int optid, const struct my_option *opt,
+ char *argument);
static my_bool sql_connect(MYSQL *mysql, uint wait);
static int execute_commands(MYSQL *mysql,int argc, char **argv);
static int drop_db(MYSQL *mysql,const char *db);
-static sig_handler endprog(int signal_number);
+extern "C" sig_handler endprog(int signal_number);
static void nice_time(ulong sec,char *buff);
static void print_header(MYSQL_RES *result);
static void print_top(MYSQL_RES *result);
@@ -230,7 +232,7 @@ static struct my_option my_long_options[] =
static const char *load_default_groups[]= { "mysqladmin","client",0 };
-static my_bool
+my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
@@ -430,7 +432,7 @@ int main(int argc,char *argv[])
}
-static sig_handler endprog(int signal_number __attribute__((unused)))
+sig_handler endprog(int signal_number __attribute__((unused)))
{
interrupted=1;
}
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index ee8d5c0d6d3..316412d7df9 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -677,7 +677,7 @@ static void print_result()
*/
if (found_error && opt_auto_repair && what_to_do != DO_REPAIR &&
strcmp(row[3],"OK"))
- insert_dynamic(&tables4repair, prev);
+ insert_dynamic(&tables4repair, (uchar*) prev);
found_error=0;
if (opt_silent)
continue;
@@ -697,7 +697,7 @@ static void print_result()
}
/* add the last table to be repaired to the list */
if (found_error && opt_auto_repair && what_to_do != DO_REPAIR)
- insert_dynamic(&tables4repair, prev);
+ insert_dynamic(&tables4repair, (uchar*) prev);
mysql_free_result(res);
}
diff --git a/client/mysqldump.c b/client/mysqldump.c
index bea360a1fb3..f5d94fab8e6 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -3737,9 +3737,9 @@ static int init_dumping(char *database, int init_func(char*))
/* Return 1 if we should copy the table */
-my_bool include_table(uchar* hash_key, uint len)
+my_bool include_table(uchar *hash_key, size_t len)
{
- return !hash_search(&ignore_table, (uchar*) hash_key, len);
+ return !hash_search(&ignore_table, hash_key, len);
}
@@ -3767,7 +3767,7 @@ static int dump_all_tables_in_db(char *database)
for (numrows= 0 ; (table= getTableName(1)) ; )
{
char *end= strmov(afterdot, table);
- if (include_table(hash_key,end - hash_key))
+ if (include_table((uchar*) hash_key,end - hash_key))
{
numrows++;
dynstr_append_checked(&query, quote_name(table, table_buff, 1));
@@ -3788,7 +3788,7 @@ static int dump_all_tables_in_db(char *database)
while ((table= getTableName(0)))
{
char *end= strmov(afterdot, table);
- if (include_table(hash_key, end - hash_key))
+ if (include_table((uchar*) hash_key, end - hash_key))
{
dump_table(table,database);
my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
@@ -3860,7 +3860,7 @@ static my_bool dump_all_views_in_db(char *database)
for (numrows= 0 ; (table= getTableName(1)); )
{
char *end= strmov(afterdot, table);
- if (include_table(hash_key,end - hash_key))
+ if (include_table((uchar*) hash_key,end - hash_key))
{
numrows++;
dynstr_append_checked(&query, quote_name(table, table_buff, 1));
@@ -3881,7 +3881,7 @@ static my_bool dump_all_views_in_db(char *database)
while ((table= getTableName(0)))
{
char *end= strmov(afterdot, table);
- if (include_table(hash_key, end - hash_key))
+ if (include_table((uchar*) hash_key, end - hash_key))
get_view_structure(table, database);
}
if (opt_xml)
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index a550dcae260..78f9efe8bd2 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -1354,7 +1354,7 @@ get_options(int *argc,char ***argv)
}
tmp_string= (char *)my_malloc(sbuf.st_size + 1,
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
- my_read(data_file, tmp_string, sbuf.st_size, MYF(0));
+ my_read(data_file, (uchar*) tmp_string, sbuf.st_size, MYF(0));
tmp_string[sbuf.st_size]= '\0';
my_close(data_file,MYF(0));
parse_delimiter(tmp_string, &create_statements, delimiter[0]);
@@ -1381,7 +1381,7 @@ get_options(int *argc,char ***argv)
}
tmp_string= (char *)my_malloc(sbuf.st_size + 1,
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
- my_read(data_file, tmp_string, sbuf.st_size, MYF(0));
+ my_read(data_file, (uchar*) tmp_string, sbuf.st_size, MYF(0));
tmp_string[sbuf.st_size]= '\0';
my_close(data_file,MYF(0));
if (user_supplied_query)
@@ -1412,7 +1412,7 @@ get_options(int *argc,char ***argv)
}
tmp_string= (char *)my_malloc(sbuf.st_size + 1,
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
- my_read(data_file, tmp_string, sbuf.st_size, MYF(0));
+ my_read(data_file, (uchar*) tmp_string, sbuf.st_size, MYF(0));
tmp_string[sbuf.st_size]= '\0';
my_close(data_file,MYF(0));
if (user_supplied_pre_statements)
@@ -1443,7 +1443,7 @@ get_options(int *argc,char ***argv)
}
tmp_string= (char *)my_malloc(sbuf.st_size + 1,
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
- my_read(data_file, tmp_string, sbuf.st_size, MYF(0));
+ my_read(data_file, (uchar*) tmp_string, sbuf.st_size, MYF(0));
tmp_string[sbuf.st_size]= '\0';
my_close(data_file,MYF(0));
if (user_supplied_post_statements)
@@ -2076,7 +2076,7 @@ print_conclusions_csv(conclusions *con)
con->users, /* Children used */
con->avg_rows /* Queries run */
);
- my_write(csv_file, buffer, (uint)strlen(buffer), MYF(0));
+ my_write(csv_file, (uchar*) buffer, (uint)strlen(buffer), MYF(0));
}
void
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 7ba57f7515c..1c98ea3bf50 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -1514,7 +1514,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
void var_set_query_get_value(struct st_command *command, VAR *var)
{
- ulong row_no;
+ long row_no;
int col_no= -1;
MYSQL_RES* res;
MYSQL* mysql= &cur_con->mysql;
@@ -1591,7 +1591,7 @@ void var_set_query_get_value(struct st_command *command, VAR *var)
while ((row= mysql_fetch_row(res)))
{
- if (++rows == row_no)
+ if (++rows == (ulong) row_no)
{
DBUG_PRINT("info", ("At row %ld, column %d is '%s'",
@@ -2584,7 +2584,7 @@ void do_send_quit(struct st_command *command)
DBUG_PRINT("info", ("con->name: %s", con->name));
if (!strcmp(con->name, name))
{
- simple_command(&con->mysql,COM_QUIT,NullS,0,1);
+ simple_command(&con->mysql,COM_QUIT,0,0,1);
DBUG_VOID_RETURN;
}
}
diff --git a/client/sql_string.cc b/client/sql_string.cc
index 57a5df7ce96..c41463999aa 100644
--- a/client/sql_string.cc
+++ b/client/sql_string.cc
@@ -805,10 +805,8 @@ copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
const uchar *from_end= (const uchar*) from+from_length;
char *to_start= to;
uchar *to_end= (uchar*) to+to_length;
- int (*mb_wc)(struct charset_info_st *, my_wc_t *, const uchar *,
- const uchar *) = from_cs->cset->mb_wc;
- int (*wc_mb)(struct charset_info_st *, my_wc_t, uchar *s, uchar *e)=
- to_cs->cset->wc_mb;
+ my_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc;
+ my_charset_conv_wc_mb wc_mb= to_cs->cset->wc_mb;
uint error_count= 0;
while (1)
diff --git a/configure.in b/configure.in
index 23a926a5ce8..42284a426c1 100644
--- a/configure.in
+++ b/configure.in
@@ -743,7 +743,7 @@ AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \
sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h linux/config.h \
sys/prctl.h \
- sys/resource.h sys/param.h port.h)
+ sys/resource.h sys/param.h port.h ieeefp.h)
AC_CHECK_HEADERS([xfs/xfs.h])
@@ -757,6 +757,7 @@ AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity))
AC_CHECK_LIB(nsl_r, gethostbyname_r, [],
AC_CHECK_LIB(nsl, gethostbyname_r))
AC_CHECK_FUNC(gethostbyname_r)
+AC_CHECK_LIB(mtmalloc, malloc)
AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
AC_CHECK_FUNC(yp_get_default_domain, ,
diff --git a/extra/replace.c b/extra/replace.c
index f7112403b06..9d1d8335014 100644
--- a/extra/replace.c
+++ b/extra/replace.c
@@ -309,9 +309,9 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
old_count*sizeof(*pa->flag));
}
pa->flag[pa->typelib.count]=0; /* Reset flag */
- pa->typelib.type_names[pa->typelib.count++]= pa->str+pa->length;
+ pa->typelib.type_names[pa->typelib.count++]= (char*) (pa->str+pa->length);
pa->typelib.type_names[pa->typelib.count]= NullS; /* Put end-mark */
- VOID(strmov(pa->str+pa->length,name));
+ VOID(strmov((char*) pa->str + pa->length, name));
pa->length+=length;
DBUG_RETURN(0);
} /* insert_pointer_name */
@@ -988,7 +988,8 @@ int n;
return 0;
/* Read in new stuff. */
- if ((i=(int) my_read(fd, buffer + bufbytes, (uint) bufread,MYF(MY_WME))) < 0)
+ if ((i=(int) my_read(fd, (uchar*) buffer + bufbytes,
+ (size_t) bufread, MYF(MY_WME))) < 0)
return -1;
/* Kludge to pretend every nonempty file ends with a newline. */
@@ -1039,7 +1040,7 @@ FILE *in,*out;
return 1;
if (!my_eof)
out_buff[length++]=save_char; /* Don't write added newline */
- if (my_fwrite(out,out_buff,length,MYF(MY_WME | MY_NABP)))
+ if (my_fwrite(out, (uchar*) out_buff, length, MYF(MY_WME | MY_NABP)))
DBUG_RETURN(1);
}
}
diff --git a/include/m_ctype.h b/include/m_ctype.h
index cc6a3a4fb4e..de79aade177 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -164,6 +164,14 @@ extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler;
extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler;
extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler;
+/* Some typedef to make it easy for C++ to make function pointers */
+typedef int (*my_charset_conv_mb_wc)(struct charset_info_st *, my_wc_t *,
+ const uchar *, const uchar *);
+typedef int (*my_charset_conv_wc_mb)(struct charset_info_st *, my_wc_t,
+ uchar *, uchar *);
+typedef size_t (*my_charset_conv_case)(struct charset_info_st *,
+ char *, size_t, char *, size_t);
+
/* See strings/CHARSET_INFO.txt about information on this structure */
typedef struct my_charset_handler_st
@@ -182,11 +190,9 @@ typedef struct my_charset_handler_st
size_t (*numcells)(struct charset_info_st *, const char *b, const char *e);
/* Unicode conversion */
- int (*mb_wc)(struct charset_info_st *cs,my_wc_t *wc,
- const uchar *s,const uchar *e);
- int (*wc_mb)(struct charset_info_st *cs,my_wc_t wc,
- uchar *s,uchar *e);
-
+ my_charset_conv_mb_wc mb_wc;
+ my_charset_conv_wc_mb wc_mb;
+
/* CTYPE scanner */
int (*ctype)(struct charset_info_st *cs, int *ctype,
const uchar *s, const uchar *e);
@@ -194,11 +200,10 @@ typedef struct my_charset_handler_st
/* Functions for case and sort conversion */
size_t (*caseup_str)(struct charset_info_st *, char *);
size_t (*casedn_str)(struct charset_info_st *, char *);
- size_t (*caseup)(struct charset_info_st *, char *src, size_t srclen,
- char *dst, size_t dstlen);
- size_t (*casedn)(struct charset_info_st *, char *src, size_t srclen,
- char *dst, size_t dstlen);
-
+
+ my_charset_conv_case caseup;
+ my_charset_conv_case casedn;
+
/* Charset dependant snprintf() */
size_t (*snprintf)(struct charset_info_st *, char *to, size_t n,
const char *fmt,
diff --git a/include/my_sys.h b/include/my_sys.h
index 76c9a7f02c7..2ce36760032 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -225,6 +225,7 @@ extern CHARSET_INFO compiled_charsets[];
/* statistics */
extern ulong my_file_opened,my_stream_opened, my_tmp_file_created;
+extern ulong my_file_total_opened;
extern uint mysys_usage_id;
extern my_bool my_init_done;
diff --git a/include/myisam.h b/include/myisam.h
index 5d93ded3d6e..6a76a298dee 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -455,7 +455,7 @@ typedef struct st_sort_info
enum data_file_type new_data_file_type;
MI_INFO *info;
MI_CHECK *param;
- char *buff;
+ uchar *buff;
SORT_KEY_BLOCKS *key_block,*key_block_end;
SORT_FT_BUF *ft_buf;
/* sync things */
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index b2f59ba2a5a..bf082ea8f31 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -341,7 +341,7 @@ my_bool STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
DBUG_RETURN(1);
master->reconnect= 1;
mysql->last_used_con = master;
- DBUG_RETURN(simple_command(master, COM_QUERY, q, length, 1));
+ DBUG_RETURN(simple_command(master, COM_QUERY, (const uchar*) q, length, 1));
}
@@ -375,7 +375,8 @@ my_bool STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
0,0,0,0))
DBUG_RETURN(1);
slave_to_use->reconnect= 1;
- DBUG_RETURN(simple_command(slave_to_use, COM_QUERY, q, length, 1));
+ DBUG_RETURN(simple_command(slave_to_use, COM_QUERY, (const uchar*) q,
+ length, 1));
}
@@ -669,7 +670,8 @@ int cli_read_change_user_result(MYSQL *mysql, char *buff, const char *passwd)
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))
+ if (my_net_write(net, (uchar*) buff, SCRAMBLE_LENGTH_323 + 1) ||
+ net_flush(net))
{
net->last_errno= CR_SERVER_LOST;
strmov(net->sqlstate, unknown_sqlstate);
@@ -720,7 +722,7 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
end= strmov(end, db ? db : "") + 1;
/* Write authentication package */
- simple_command(mysql,COM_CHANGE_USER, buff,(ulong) (end-buff),1);
+ simple_command(mysql,COM_CHANGE_USER, (uchar*) buff, (ulong) (end-buff), 1);
rc= (*mysql->methods->read_change_user_result)(mysql, buff, passwd);
@@ -830,7 +832,7 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename)
if ((*options->local_infile_init)(&li_ptr, net_filename,
options->local_infile_userdata))
{
- VOID(my_net_write(net,"",0)); /* Server needs one packet */
+ VOID(my_net_write(net,(const uchar*) "",0)); /* Server needs one packet */
net_flush(net);
strmov(net->sqlstate, unknown_sqlstate);
net->last_errno= (*options->local_infile_error)(li_ptr,
@@ -844,7 +846,7 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename)
(*options->local_infile_read)(li_ptr, buf,
packet_length)) > 0)
{
- if (my_net_write(net,buf,readcount))
+ if (my_net_write(net, (uchar*) buf, readcount))
{
DBUG_PRINT("error",
("Lost connection to MySQL server during LOAD DATA of local file"));
@@ -856,7 +858,7 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename)
}
/* Send empty packet to mark end of file */
- if (my_net_write(net,"",0) || net_flush(net))
+ if (my_net_write(net, (const uchar*) "", 0) || net_flush(net))
{
strmov(net->sqlstate, unknown_sqlstate);
net->last_errno=CR_SERVER_LOST;
@@ -1242,7 +1244,8 @@ mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)
end=strmake(strmake(buff, table,128)+1,wild ? wild : "",128);
free_old_query(mysql);
- if (simple_command(mysql,COM_FIELD_LIST,buff,(ulong) (end-buff),1) ||
+ if (simple_command(mysql, COM_FIELD_LIST, (uchar*) buff,
+ (ulong) (end-buff), 1) ||
!(fields= (*mysql->methods->list_fields)(mysql)))
DBUG_RETURN(NULL);
@@ -1313,7 +1316,7 @@ mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level)
uchar level[1];
DBUG_ENTER("mysql_shutdown");
level[0]= (uchar) shutdown_level;
- DBUG_RETURN(simple_command(mysql, COM_SHUTDOWN, (char *)level, 1, 0));
+ DBUG_RETURN(simple_command(mysql, COM_SHUTDOWN, level, 1, 0));
}
@@ -1323,14 +1326,14 @@ mysql_refresh(MYSQL *mysql,uint options)
uchar bits[1];
DBUG_ENTER("mysql_refresh");
bits[0]= (uchar) options;
- DBUG_RETURN(simple_command(mysql,COM_REFRESH,(char*) bits,1,0));
+ DBUG_RETURN(simple_command(mysql, COM_REFRESH, bits, 1, 0));
}
int STDCALL
mysql_kill(MYSQL *mysql,ulong pid)
{
- char buff[4];
+ uchar buff[4];
DBUG_ENTER("mysql_kill");
int4store(buff,pid);
DBUG_RETURN(simple_command(mysql,COM_PROCESS_KILL,buff,sizeof(buff),0));
@@ -1340,7 +1343,7 @@ mysql_kill(MYSQL *mysql,ulong pid)
int STDCALL
mysql_set_server_option(MYSQL *mysql, enum enum_mysql_set_option option)
{
- char buff[2];
+ uchar buff[2];
DBUG_ENTER("mysql_set_server_option");
int2store(buff, (uint) option);
DBUG_RETURN(simple_command(mysql, COM_SET_OPTION, buff, sizeof(buff), 0));
@@ -2059,7 +2062,7 @@ mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, ulong length)
if ((int) stmt->state > (int) MYSQL_STMT_INIT_DONE)
{
/* This is second prepare with another statement */
- char buff[MYSQL_STMT_HEADER]; /* 4 bytes - stmt id */
+ uchar buff[MYSQL_STMT_HEADER]; /* 4 bytes - stmt id */
if (reset_stmt_handle(stmt, RESET_LONG_DATA | RESET_STORE_RESULT))
DBUG_RETURN(1);
@@ -2089,7 +2092,7 @@ mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, ulong length)
}
}
- if (stmt_command(mysql, COM_STMT_PREPARE, query, length, stmt))
+ if (stmt_command(mysql, COM_STMT_PREPARE, (const uchar*) query, length, stmt))
{
set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno,
mysql->net.sqlstate);
@@ -2425,9 +2428,9 @@ static void store_param_str(NET *net, MYSQL_BIND *param)
{
/* param->length is always set in mysql_stmt_bind_param */
ulong length= *param->length;
- char *to= (char *) net_store_length((char *) net->write_pos, length);
+ uchar *to= net_store_length(net->write_pos, length);
memcpy(to, param->buffer, length);
- net->write_pos= (uchar*) to+length;
+ net->write_pos= to+length;
}
@@ -2495,10 +2498,9 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
{
MYSQL *mysql= stmt->mysql;
NET *net= &mysql->net;
- char buff[4 /* size of stmt id */ +
- 5 /* execution flags */];
+ uchar buff[4 /* size of stmt id */ +
+ 5 /* execution flags */];
my_bool res;
-
DBUG_ENTER("execute");
DBUG_DUMP("packet", packet, length);
@@ -2508,7 +2510,7 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
int4store(buff+5, 1); /* iteration count */
res= test(cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff),
- packet, length, 1, NULL) ||
+ (uchar*) packet, length, 1, NULL) ||
(*mysql->methods->read_query_result)(mysql));
stmt->affected_rows= mysql->affected_rows;
stmt->server_status= mysql->server_status;
@@ -2587,7 +2589,7 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
}
length= (ulong) (net->write_pos - net->buff);
/* TODO: Look into avoding the following memdup */
- if (!(param_data= my_memdup((const char*) net->buff, length, MYF(0))))
+ if (!(param_data= my_memdup(net->buff, length, MYF(0))))
{
set_stmt_error(stmt, CR_OUT_OF_MEMORY, unknown_sqlstate);
DBUG_RETURN(1);
@@ -2714,8 +2716,8 @@ stmt_read_row_from_cursor(MYSQL_STMT *stmt, unsigned char **row)
MYSQL *mysql= stmt->mysql;
NET *net= &mysql->net;
MYSQL_DATA *result= &stmt->result;
- char buff[4 /* statement id */ +
- 4 /* number of rows to fetch */];
+ uchar buff[4 /* statement id */ +
+ 4 /* number of rows to fetch */];
free_root(&result->alloc, MYF(MY_KEEP_PREALLOC));
result->data= NULL;
@@ -2724,7 +2726,7 @@ stmt_read_row_from_cursor(MYSQL_STMT *stmt, unsigned char **row)
int4store(buff, stmt->stmt_id);
int4store(buff + 4, stmt->prefetch_rows); /* number of rows to fetch */
if ((*mysql->methods->advanced_command)(mysql, COM_STMT_FETCH,
- buff, sizeof(buff), NullS, 0,
+ buff, sizeof(buff), (uchar*) 0, 0,
1, NULL))
{
set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
@@ -3380,7 +3382,7 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number,
{
MYSQL *mysql= stmt->mysql;
/* Packet header: stmt id (4 bytes), param no (2 bytes) */
- char buff[MYSQL_LONG_DATA_HEADER];
+ uchar buff[MYSQL_LONG_DATA_HEADER];
int4store(buff, stmt->stmt_id);
int2store(buff + 4, param_number);
@@ -3391,7 +3393,7 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number,
This is intentional to save bandwidth.
*/
if ((*mysql->methods->advanced_command)(mysql, COM_STMT_SEND_LONG_DATA,
- buff, sizeof(buff), data,
+ buff, sizeof(buff), (uchar*) data,
length, 1, NULL))
{
set_stmt_errmsg(stmt, mysql->net.last_error,
@@ -3719,19 +3721,20 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
}
default:
{
- char buff[22]; /* Enough for longlong */
- char *end= longlong10_to_str(value, buff, is_unsigned ? 10: -10);
+ uchar buff[22]; /* Enough for longlong */
+ uchar *end= (uchar*) longlong10_to_str(value, (char*) buff,
+ is_unsigned ? 10: -10);
/* Resort to string conversion which supports all typecodes */
uint length= (uint) (end-buff);
if (field->flags & ZEROFILL_FLAG && length < field->length &&
field->length < 21)
{
- bmove_upp((char*) buff+field->length,buff+length, length);
- bfill((char*) buff, field->length - length,'0');
+ bmove_upp(buff+field->length,buff+length, length);
+ bfill(buff, field->length - length,'0');
length= field->length;
}
- fetch_string_with_conversion(param, buff, length);
+ fetch_string_with_conversion(param, (char*) buff, length);
break;
}
}
@@ -4785,14 +4788,14 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
Server side cursor exist, tell server to start sending the rows
*/
NET *net= &mysql->net;
- char buff[4 /* statement id */ +
- 4 /* number of rows to fetch */];
+ uchar buff[4 /* statement id */ +
+ 4 /* number of rows to fetch */];
/* Send row request to the server */
int4store(buff, stmt->stmt_id);
int4store(buff + 4, (int)~0); /* number of rows to fetch */
if (cli_advanced_command(mysql, COM_STMT_FETCH, buff, sizeof(buff),
- NullS, 0, 1, NULL))
+ (uchar*) 0, 0, 1, NULL))
{
set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
DBUG_RETURN(1);
@@ -4976,7 +4979,7 @@ static my_bool reset_stmt_handle(MYSQL_STMT *stmt, uint flags)
Reset the server side statement and close the server side
cursor if it exists.
*/
- char buff[MYSQL_STMT_HEADER]; /* packet header: 4 bytes for stmt id */
+ uchar buff[MYSQL_STMT_HEADER]; /* packet header: 4 bytes for stmt id */
int4store(buff, stmt->stmt_id);
if ((*mysql->methods->advanced_command)(mysql, COM_STMT_RESET, buff,
sizeof(buff), 0, 0, 0, NULL))
@@ -5037,7 +5040,7 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt)
net_clear_error(&mysql->net);
if ((int) stmt->state > (int) MYSQL_STMT_INIT_DONE)
{
- char buff[MYSQL_STMT_HEADER]; /* 4 bytes - stmt id */
+ uchar buff[MYSQL_STMT_HEADER]; /* 4 bytes - stmt id */
if (mysql->unbuffered_fetch_owner == &stmt->unbuffered_fetch_cancelled)
mysql->unbuffered_fetch_owner= 0;
diff --git a/libmysql/manager.c b/libmysql/manager.c
index 2989c9dcccf..53ffffa55c0 100644
--- a/libmysql/manager.c
+++ b/libmysql/manager.c
@@ -158,7 +158,7 @@ MYSQL_MANAGER* STDCALL mysql_manager_connect(MYSQL_MANAGER* con,
}
sprintf(msg_buf,"%-.16s %-.16s\n",user,passwd);
msg_len=strlen(msg_buf);
- if (my_net_write(&con->net,msg_buf,msg_len) || net_flush(&con->net))
+ if (my_net_write(&con->net,(uchar*) msg_buf,msg_len) || net_flush(&con->net))
{
con->last_errno=con->net.last_errno;
strmov(con->last_error,"Write error on socket");
@@ -218,7 +218,7 @@ int STDCALL mysql_manager_command(MYSQL_MANAGER* con,const char* cmd,
{
if (!cmd_len)
cmd_len=strlen(cmd);
- if (my_net_write(&con->net,(char*)cmd,cmd_len) || net_flush(&con->net))
+ if (my_net_write(&con->net,(const uchar*)cmd,cmd_len) || net_flush(&con->net))
{
con->last_errno=errno;
strmov(con->last_error,"Write error on socket");
diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result
index c6ca7a3f008..cbdafc95b2a 100644
--- a/mysql-test/r/ctype_cp932_binlog_stm.result
+++ b/mysql-test/r/ctype_cp932_binlog_stm.result
@@ -41,8 +41,8 @@ BEGIN
INSERT INTO t4 VALUES (ins1, ins2, ind);
END
master-bin.000001 783 Query 1 999 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93))
-master-bin.000001 999 Query 1 1085 use `test`; DROP PROCEDURE bug18293
-master-bin.000001 1085 Query 1 1161 use `test`; DROP TABLE t4
+master-bin.000001 999 Query 1 1088 use `test`; DROP PROCEDURE bug18293
+master-bin.000001 1088 Query 1 1167 use `test`; DROP TABLE t4
End of 5.0 tests
SHOW BINLOG EVENTS FROM 364;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c
index 09f710c1ef4..44156da6ae3 100644
--- a/mysys/my_fopen.c
+++ b/mysys/my_fopen.c
@@ -76,6 +76,7 @@ FILE *my_fopen(const char *filename, int flags, myf MyFlags)
my_strdup(filename,MyFlags)))
{
my_stream_opened++;
+ my_file_total_opened++;
my_file_info[fileno(fd)].type = STREAM_BY_FOPEN;
pthread_mutex_unlock(&THR_LOCK_open);
DBUG_PRINT("exit",("stream: 0x%lx", (long) fd));
diff --git a/mysys/my_open.c b/mysys/my_open.c
index 5ad48e66b68..938dbc5dde2 100644
--- a/mysys/my_open.c
+++ b/mysys/my_open.c
@@ -151,6 +151,7 @@ File my_register_filename(File fd, const char *FileName, enum file_type
if ((my_file_info[fd].name = (char*) my_strdup(FileName,MyFlags)))
{
my_file_opened++;
+ my_file_total_opened++;
my_file_info[fd].type = type_of_file;
#if defined(THREAD) && !defined(HAVE_PREAD)
pthread_mutex_init(&my_file_info[fd].mutex,MY_MUTEX_INIT_FAST);
diff --git a/mysys/my_static.c b/mysys/my_static.c
index b8bff0e9810..cb482b19b57 100644
--- a/mysys/my_static.c
+++ b/mysys/my_static.c
@@ -30,6 +30,7 @@ const char *my_progname=0;
char NEAR curr_dir[FN_REFLEN]= {0},
NEAR home_dir_buff[FN_REFLEN]= {0};
ulong my_stream_opened=0,my_file_opened=0, my_tmp_file_created=0;
+ulong my_file_total_opened= 0;
int NEAR my_umask=0664, NEAR my_umask_dir=0777;
#ifndef THREAD
int NEAR my_errno=0;
diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c
index 2934e724724..afa5aadece7 100644
--- a/mysys/thr_alarm.c
+++ b/mysys/thr_alarm.c
@@ -38,7 +38,7 @@ uint thr_client_alarm;
static int alarm_aborted=1; /* No alarm thread */
my_bool thr_alarm_inited= 0;
volatile my_bool alarm_thread_running= 0;
-
+time_t next_alarm_expire_time= ~ (time_t) 0;
static sig_handler process_alarm_part2(int sig);
#if !defined(__WIN__)
@@ -71,6 +71,7 @@ void init_thr_alarm(uint max_alarms)
sigset_t s;
DBUG_ENTER("init_thr_alarm");
alarm_aborted=0;
+ next_alarm_expire_time= ~ (time_t) 0;
init_queue(&alarm_queue,max_alarms+1,offsetof(ALARM,expire_time),0,
compare_ulong,NullS);
sigfillset(&full_signal_set); /* Neaded to block signals */
@@ -150,22 +151,28 @@ void resize_thr_alarm(uint max_alarms)
my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
{
- ulong now;
+ time_t now;
+#ifndef USE_ONE_SIGNAL_HAND
sigset_t old_mask;
+#endif
my_bool reschedule;
struct st_my_thread_var *current_my_thread_var= my_thread_var;
DBUG_ENTER("thr_alarm");
DBUG_PRINT("enter",("thread: %s sec: %d",my_thread_name(),sec));
- now=(ulong) my_time(0);
+ now= my_time(0);
+#ifndef USE_ONE_SIGNAL_HAND
pthread_sigmask(SIG_BLOCK,&full_signal_set,&old_mask);
+#endif
pthread_mutex_lock(&LOCK_alarm); /* Lock from threads & alarms */
if (alarm_aborted > 0)
{ /* No signal thread */
DBUG_PRINT("info", ("alarm aborted"));
*alrm= 0; /* No alarm */
pthread_mutex_unlock(&LOCK_alarm);
+#ifndef USE_ONE_SIGNAL_HAND
pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
+#endif
DBUG_RETURN(1);
}
if (alarm_aborted < 0)
@@ -179,14 +186,14 @@ my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
fprintf(stderr,"Warning: thr_alarm queue is full\n");
*alrm= 0; /* No alarm */
pthread_mutex_unlock(&LOCK_alarm);
+#ifndef USE_ONE_SIGNAL_HAND
pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
+#endif
DBUG_RETURN(1);
}
max_used_alarms=alarm_queue.elements+1;
}
- reschedule= (!alarm_queue.elements ||
- (int) (((ALARM*) queue_top(&alarm_queue))->expire_time - now) >
- (int) sec);
+ reschedule= (ulong) next_alarm_expire_time > (ulong) now + sec;
if (!alarm_data)
{
if (!(alarm_data=(ALARM*) my_malloc(sizeof(ALARM),MYF(MY_WME))))
@@ -194,7 +201,9 @@ my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
DBUG_PRINT("info", ("failed my_malloc()"));
*alrm= 0; /* No alarm */
pthread_mutex_unlock(&LOCK_alarm);
+#ifndef USE_ONE_SIGNAL_HAND
pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
+#endif
DBUG_RETURN(1);
}
alarm_data->malloced=1;
@@ -212,12 +221,17 @@ my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
{
DBUG_PRINT("info", ("reschedule"));
if (pthread_equal(pthread_self(),alarm_thread))
+ {
alarm(sec); /* purecov: inspected */
+ next_alarm_expire_time= now + sec;
+ }
else
reschedule_alarms(); /* Reschedule alarms */
}
pthread_mutex_unlock(&LOCK_alarm);
+#ifndef USE_ONE_SIGNAL_HAND
pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
+#endif
(*alrm)= &alarm_data->alarmed;
DBUG_RETURN(0);
}
@@ -230,11 +244,15 @@ my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
void thr_end_alarm(thr_alarm_t *alarmed)
{
ALARM *alarm_data;
+#ifndef USE_ONE_SIGNAL_HAND
sigset_t old_mask;
+#endif
uint i, found=0;
DBUG_ENTER("thr_end_alarm");
+#ifndef USE_ONE_SIGNAL_HAND
pthread_sigmask(SIG_BLOCK,&full_signal_set,&old_mask);
+#endif
pthread_mutex_lock(&LOCK_alarm);
alarm_data= (ALARM*) ((uchar*) *alarmed - offsetof(ALARM,alarmed));
@@ -261,7 +279,9 @@ void thr_end_alarm(thr_alarm_t *alarmed)
(long) *alarmed));
}
pthread_mutex_unlock(&LOCK_alarm);
+#ifndef USE_ONE_SIGNAL_HAND
pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
+#endif
DBUG_VOID_RETURN;
}
@@ -380,10 +400,18 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused)))
alarm(0); /* Remove old alarm */
#endif
alarm((uint) (alarm_data->expire_time-now));
+ next_alarm_expire_time= alarm_data->expire_time;
}
#endif
}
}
+ else
+ {
+ /*
+ Ensure that next time we call thr_alarm(), we will schedule a new alarm
+ */
+ next_alarm_expire_time= ~(time_t) 0;
+ }
DBUG_VOID_RETURN;
}
@@ -537,6 +565,7 @@ static void *alarm_handler(void *arg __attribute__((unused)))
{
abstime.tv_sec=sleep_time;
abstime.tv_nsec=0;
+ next_alarm_expire_time= sleep_time;
if ((error=pthread_cond_timedwait(&COND_alarm,&LOCK_alarm,&abstime)) &&
error != ETIME && error != ETIMEDOUT)
{
@@ -549,12 +578,16 @@ static void *alarm_handler(void *arg __attribute__((unused)))
}
else if (alarm_aborted == -1)
break;
- else if ((error=pthread_cond_wait(&COND_alarm,&LOCK_alarm)))
+ else
{
+ next_alarm_expire_time= ~ (time_t) 0;
+ if ((error=pthread_cond_wait(&COND_alarm,&LOCK_alarm)))
+ {
#ifdef MAIN
- printf("Got error: %d from ptread_cond_wait (errno: %d)\n",
- error,errno);
+ printf("Got error: %d from ptread_cond_wait (errno: %d)\n",
+ error,errno);
#endif
+ }
}
process_alarm(0);
}
diff --git a/regex/regcomp.c b/regex/regcomp.c
index 9cba56a97dd..398e132d97d 100644
--- a/regex/regcomp.c
+++ b/regex/regcomp.c
@@ -1479,8 +1479,8 @@ sopno pos;
}
{
int length=(HERE()-pos-1)*sizeof(sop);
- bmove_upp((char *) &p->strip[pos+1]+length,
- (char *) &p->strip[pos]+length,
+ bmove_upp((uchar *) &p->strip[pos+1]+length,
+ (uchar *) &p->strip[pos]+length,
length);
}
#ifdef OLD_CODE
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index bd90e6916b1..7e5412aa8c3 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -22,6 +22,7 @@ in_rpm=0
windows=0
defaults=""
user=""
+source_install=0
case "$1" in
--no-defaults|--defaults-file=*|--defaults-extra-file=*)
@@ -74,6 +75,13 @@ parse_arguments() {
# package.
windows=1 ;;
+ --source-install)
+ # This is used when you want to run mysqld directly from the
+ # source tree (for example when you are developing MySQL and
+ # only want to create the default tables but don't want to
+ # install mysqld yet.
+ source_install=1 ;;
+
*)
if test -n "$pick_args"
then
@@ -119,22 +127,37 @@ parse_arguments `$print_defaults $defaults mysqld mysql_install_db`
parse_arguments PICK-ARGS-FROM-ARGV "$@"
test -z "$ldata" && ldata=@localstatedir@
-if test -z "$basedir"
+if test -z "$basedir" -a "$source_install" = 0
then
basedir=@prefix@
bindir=@bindir@
+ extra_bindir="$bindir"
execdir=@libexecdir@
pkgdatadir=@pkgdatadir@
else
- bindir="$basedir/bin"
+ if test -z "$basedir"
+ then
+ bindir="$basedir/bin"
+ extra_bindir="$bindir"
+ fi
if test -x "$basedir/libexec/mysqld"
then
execdir="$basedir/libexec"
elif test -x "$basedir/sbin/mysqld"
then
execdir="$basedir/sbin"
- else
+ elif test -x "$basedir/bin/mysqld"
+ then
execdir="$basedir/bin"
+ elif test -x "./sql/mysqld"
+ then
+ execdir="./sql"
+ bindir="./client"
+ extra_bindir="./extra"
+ else
+ echo "Can't find mysqld executable through --basedir=$basedir."
+ echo "Please verify that you have MySQL installed in this location"
+ exit 1;
fi
fi
@@ -221,14 +244,14 @@ hostname=`@HOSTNAME@`
# Check if hostname is valid
if test "$windows" = 0 -a "$in_rpm" = 0 -a $force = 0
then
- resolved=`$bindir/resolveip $hostname 2>&1`
+ resolved=`$extra_bindir/resolveip $hostname 2>&1`
if [ $? -ne 0 ]
then
- resolved=`$bindir/resolveip localhost 2>&1`
+ resolved=`$extra_bindir/resolveip localhost 2>&1`
if [ $? -ne 0 ]
then
echo "Neither host '$hostname' nor 'localhost' could be looked up with"
- echo "$bindir/resolveip"
+ echo "$extra_bindir/resolveip"
echo "Please configure the 'hostname' command to return a correct"
echo "hostname."
echo "If you want to solve this at a later stage, restart this script"
@@ -274,7 +297,7 @@ fi
# Peform the install of system tables
mysqld_bootstrap="${MYSQLD_BOOTSTRAP-$mysqld}"
mysqld_install_cmd_line="$mysqld_bootstrap $defaults $mysqld_opt --bootstrap \
---basedir=$basedir --datadir=$ldata --loose-skip-innodb \
+--basedir=$basedir --datadir=$ldata --log-warnings=0 --loose-skip-innodb \
--loose-skip-ndbcluster $args --max_allowed_packet=8M \
--net_buffer_length=16K"
@@ -322,7 +345,7 @@ then
if test "$in_rpm" = "0"
then
echo "You can start the MySQL daemon with:"
- echo "cd @prefix@ ; $bindir/mysqld_safe &"
+ echo "cd @prefix@ ; $scriptdir/mysqld_safe &"
echo
echo "You can test the MySQL daemon with mysql-test-run.pl"
echo "cd mysql-test ; perl mysql-test-run.pl"
diff --git a/server-tools/instance-manager/angel.cc b/server-tools/instance-manager/angel.cc
index a1892112dc8..64515c8498c 100644
--- a/server-tools/instance-manager/angel.cc
+++ b/server-tools/instance-manager/angel.cc
@@ -176,6 +176,8 @@ static bool create_pid_file()
appropriately.
*************************************************************************/
+extern "C" void reap_child(int);
+
void reap_child(int __attribute__((unused)) signo)
{
/* NOTE: As we have only one child, no need to cycle waitpid(). */
@@ -197,6 +199,7 @@ void reap_child(int __attribute__((unused)) signo)
Set termination status and return.
*************************************************************************/
+extern "C" void terminate(int signo);
void terminate(int signo)
{
shutdown_request_signo= signo;
diff --git a/server-tools/instance-manager/thread_registry.cc b/server-tools/instance-manager/thread_registry.cc
index 72d81523022..489caa0aaa8 100644
--- a/server-tools/instance-manager/thread_registry.cc
+++ b/server-tools/instance-manager/thread_registry.cc
@@ -27,7 +27,9 @@
enum { THREAD_KICK_OFF_SIGNAL= SIGUSR2 };
-static void handle_signal(int __attribute__((unused)) sig_no)
+extern "C" void handle_signal(int);
+
+void handle_signal(int __attribute__((unused)) sig_no)
{
}
#endif
diff --git a/sql-common/client.c b/sql-common/client.c
index ce891a37b21..baf154dcc43 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -2302,7 +2302,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
db= 0;
}
/* Write authentication package */
- if (my_net_write(net,buff,(ulong) (end-buff)) || net_flush(net))
+ if (my_net_write(net, (uchar*) buff, (size_t) (end-buff)) || net_flush(net))
{
set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate,
ER(CR_SERVER_LOST_EXTENDED),
@@ -2334,7 +2334,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
password in old format.
*/
scramble_323(buff, mysql->scramble, passwd);
- if (my_net_write(net, buff, SCRAMBLE_LENGTH_323 + 1) || net_flush(net))
+ if (my_net_write(net, (uchar*) buff, SCRAMBLE_LENGTH_323 + 1) ||
+ net_flush(net))
{
set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate,
ER(CR_SERVER_LOST_EXTENDED),
@@ -2531,7 +2532,8 @@ mysql_select_db(MYSQL *mysql, const char *db)
DBUG_ENTER("mysql_select_db");
DBUG_PRINT("enter",("db: '%s'",db));
- if ((error=simple_command(mysql,COM_INIT_DB,db,(ulong) strlen(db),0)))
+ if ((error=simple_command(mysql,COM_INIT_DB, (const uchar*) db,
+ (ulong) strlen(db),0)))
DBUG_RETURN(error);
my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
mysql->db=my_strdup(db,MYF(MY_WME));
@@ -2644,7 +2646,7 @@ void STDCALL mysql_close(MYSQL *mysql)
free_old_query(mysql);
mysql->status=MYSQL_STATUS_READY; /* Force command */
mysql->reconnect=0;
- simple_command(mysql,COM_QUIT,NullS,0,1);
+ simple_command(mysql,COM_QUIT,(uchar*) 0,0,1);
end_server(mysql); /* Sets mysql->net.vio= 0 */
}
mysql_close_free_options(mysql);
@@ -2775,7 +2777,7 @@ mysql_send_query(MYSQL* mysql, const char* query, ulong length)
mysql->last_used_con = mysql;
#endif
- DBUG_RETURN(simple_command(mysql, COM_QUERY, query, length, 1));
+ DBUG_RETURN(simple_command(mysql, COM_QUERY, (uchar*) query, length, 1));
}
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index 7c8719bc9e0..a1a3e0b6c77 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -301,9 +301,6 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
field_length= 6; /* 6 digits */
}
continue;
-
- /* No part seconds */
- date[++i]= 0;
}
while (str != end &&
(my_ispunct(&my_charset_latin1,*str) ||
@@ -569,12 +566,12 @@ my_bool str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
/* Fix the date to assume that seconds was given */
if (!found_hours && !found_days)
{
- bmove_upp((char*) (date+4), (char*) (date+state),
+ bmove_upp((uchar*) (date+4), (uchar*) (date+state),
sizeof(long)*(state-1));
- bzero((char*) date, sizeof(long)*(4-state));
+ bzero((uchar*) date, sizeof(long)*(4-state));
}
else
- bzero((char*) (date+state), sizeof(long)*(4-state));
+ bzero((uchar*) (date+state), sizeof(long)*(4-state));
}
fractional:
diff --git a/sql-common/pack.c b/sql-common/pack.c
index f6cda4e5b86..7ff89471b45 100644
--- a/sql-common/pack.c
+++ b/sql-common/pack.c
@@ -99,23 +99,23 @@ uchar *net_store_length(uchar *packet, ulonglong length)
if (length < (ulonglong) LL(251))
{
*packet=(uchar) length;
- return (char*) packet+1;
+ return packet+1;
}
/* 251 is reserved for NULL */
if (length < (ulonglong) LL(65536))
{
*packet++=252;
int2store(packet,(uint) length);
- return (char*) packet+2;
+ return packet+2;
}
if (length < (ulonglong) LL(16777216))
{
*packet++=253;
int3store(packet,(ulong) length);
- return (char*) packet+3;
+ return packet+3;
}
*packet++=254;
int8store(packet,length);
- return (char*) packet+8;
+ return packet+8;
}
diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc
index b7bcb6344fd..48477b1ba46 100644
--- a/sql/event_db_repository.cc
+++ b/sql/event_db_repository.cc
@@ -390,8 +390,9 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table,
}
key_copy(key_buf, event_table->record[0], key_info, key_len);
- if (!(ret= event_table->file->index_read(event_table->record[0], key_buf,
- (key_part_map)1, HA_READ_PREFIX)))
+ if (!(ret= event_table->file->index_read_map(event_table->record[0], key_buf,
+ (key_part_map)1,
+ HA_READ_PREFIX)))
{
DBUG_PRINT("info",("Found rows. Let's retrieve them. ret=%d", ret));
do
@@ -839,8 +840,8 @@ Event_db_repository::find_named_event(LEX_STRING db, LEX_STRING name,
key_copy(key, table->record[0], table->key_info, table->key_info->key_length);
- if (table->file->index_read_idx(table->record[0], 0, key, HA_WHOLE_KEY,
- HA_READ_KEY_EXACT))
+ if (table->file->index_read_idx_map(table->record[0], 0, key, HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT))
{
DBUG_PRINT("info", ("Row not found"));
DBUG_RETURN(TRUE);
diff --git a/sql/event_queue.cc b/sql/event_queue.cc
index 95f207844fc..e611432c6a2 100644
--- a/sql/event_queue.cc
+++ b/sql/event_queue.cc
@@ -52,8 +52,9 @@
execute_at.second_part is not considered during comparison
*/
-static int
-event_queue_element_compare_q(void *vptr, uchar* a, uchar *b)
+extern "C" int event_queue_element_compare_q(void *, uchar *, uchar *);
+
+int event_queue_element_compare_q(void *vptr, uchar* a, uchar *b)
{
my_time_t lhs = ((Event_queue_element *)a)->execute_at;
my_time_t rhs = ((Event_queue_element *)b)->execute_at;
diff --git a/sql/field.cc b/sql/field.cc
index dd0c862d05b..4f85d15f7a9 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -6081,12 +6081,12 @@ uint Field::is_equal(Create_field *new_field)
/* If one of the fields is binary and the other one isn't return 1 else 0 */
-bool Field_str::compare_str_field_flags(Create_field *new_field, uint32 flags)
+bool Field_str::compare_str_field_flags(Create_field *new_field, uint32 flag_arg)
{
return (((new_field->flags & (BINCMP_FLAG | BINARY_FLAG)) &&
- !(flags & (BINCMP_FLAG | BINARY_FLAG))) ||
+ !(flag_arg & (BINCMP_FLAG | BINARY_FLAG))) ||
(!(new_field->flags & (BINCMP_FLAG | BINARY_FLAG)) &&
- (flags & (BINCMP_FLAG | BINARY_FLAG))));
+ (flag_arg & (BINCMP_FLAG | BINARY_FLAG))));
}
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index d46b3a3bb08..6521be1cb9a 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -1125,7 +1125,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
0 Success
*/
-int ha_partition::prepare_new_partition(TABLE *table,
+int ha_partition::prepare_new_partition(TABLE *tbl,
HA_CREATE_INFO *create_info,
handler *file, const char *part_name,
partition_element *p_elem)
@@ -1134,13 +1134,13 @@ int ha_partition::prepare_new_partition(TABLE *table,
bool create_flag= FALSE;
DBUG_ENTER("prepare_new_partition");
- if ((error= set_up_table_before_create(table, part_name, create_info,
+ if ((error= set_up_table_before_create(tbl, part_name, create_info,
0, p_elem)))
goto error;
- if ((error= file->create(part_name, table, create_info)))
+ if ((error= file->create(part_name, tbl, create_info)))
goto error;
create_flag= TRUE;
- if ((error= file->ha_open(table, part_name, m_mode, m_open_test_lock)))
+ if ((error= file->ha_open(tbl, part_name, m_mode, m_open_test_lock)))
goto error;
/*
Note: if you plan to add another call that may return failure,
@@ -1776,7 +1776,7 @@ partition_element *ha_partition::find_partition_element(uint part_id)
4) Data file name on partition
*/
-int ha_partition::set_up_table_before_create(TABLE *table,
+int ha_partition::set_up_table_before_create(TABLE *tbl,
const char *partition_name_with_path,
HA_CREATE_INFO *info,
uint part_id,
@@ -1793,8 +1793,8 @@ int ha_partition::set_up_table_before_create(TABLE *table,
if (!part_elem)
DBUG_RETURN(1); // Fatal error
}
- table->s->max_rows= part_elem->part_max_rows;
- table->s->min_rows= part_elem->part_min_rows;
+ tbl->s->max_rows= part_elem->part_max_rows;
+ tbl->s->min_rows= part_elem->part_min_rows;
partition_name= strrchr(partition_name_with_path, FN_LIBCHAR);
if ((part_elem->index_file_name &&
(error= append_file_to_dir(thd,
@@ -3400,11 +3400,11 @@ int ha_partition::index_end()
used in conjuntion with multi read ranges.
*/
-int ha_partition::index_read(uchar * buf, const uchar * key,
- key_part_map keypart_map,
- enum ha_rkey_function find_flag)
+int ha_partition::index_read_map(uchar *buf, const uchar *key,
+ key_part_map keypart_map,
+ enum ha_rkey_function find_flag)
{
- DBUG_ENTER("ha_partition::index_read");
+ DBUG_ENTER("ha_partition::index_read_map");
end_range= 0;
m_index_scan_type= partition_index_read;
@@ -3566,7 +3566,7 @@ int ha_partition::common_first_last(uchar *buf)
index_read_last()
buf Read row in MySQL Row Format
key Key
- keylen Length of key
+ keypart_map Which part of key is used
RETURN VALUE
>0 Error code
@@ -3577,8 +3577,8 @@ int ha_partition::common_first_last(uchar *buf)
Can only be used on indexes supporting HA_READ_ORDER
*/
-int ha_partition::index_read_last(uchar *buf, const uchar *key,
- key_part_map keypart_map)
+int ha_partition::index_read_last_map(uchar *buf, const uchar *key,
+ key_part_map keypart_map)
{
DBUG_ENTER("ha_partition::index_read_last");
@@ -3929,9 +3929,9 @@ int ha_partition::handle_unordered_scan_next_partition(uchar * buf)
switch (m_index_scan_type) {
case partition_index_read:
DBUG_PRINT("info", ("index_read on partition %d", i));
- error= file->index_read(buf, m_start_key.key,
- m_start_key.keypart_map,
- m_start_key.flag);
+ error= file->index_read_map(buf, m_start_key.key,
+ m_start_key.keypart_map,
+ m_start_key.flag);
break;
case partition_index_first:
DBUG_PRINT("info", ("index_first on partition %d", i));
@@ -4020,10 +4020,10 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order)
switch (m_index_scan_type) {
case partition_index_read:
- error= file->index_read(rec_buf_ptr,
- m_start_key.key,
- m_start_key.keypart_map,
- m_start_key.flag);
+ error= file->index_read_map(rec_buf_ptr,
+ m_start_key.key,
+ m_start_key.keypart_map,
+ m_start_key.flag);
break;
case partition_index_first:
error= file->index_first(rec_buf_ptr);
@@ -4034,9 +4034,9 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order)
reverse_order= TRUE;
break;
case partition_index_read_last:
- error= file->index_read_last(rec_buf_ptr,
- m_start_key.key,
- m_start_key.keypart_map);
+ error= file->index_read_last_map(rec_buf_ptr,
+ m_start_key.key,
+ m_start_key.keypart_map);
reverse_order= TRUE;
break;
default:
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index 895f001fa6a..555f7a72740 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -387,9 +387,9 @@ public:
index_init initializes an index before using it and index_end does
any end processing needed.
*/
- virtual int index_read(uchar * buf, const uchar * key,
- key_part_map keypart_map,
- enum ha_rkey_function find_flag);
+ virtual int index_read_map(uchar * buf, const uchar * key,
+ key_part_map keypart_map,
+ enum ha_rkey_function find_flag);
virtual int index_init(uint idx, bool sorted);
virtual int index_end();
@@ -402,8 +402,8 @@ public:
virtual int index_first(uchar * buf);
virtual int index_last(uchar * buf);
virtual int index_next_same(uchar * buf, const uchar * key, uint keylen);
- virtual int index_read_last(uchar * buf, const uchar * key,
- key_part_map keypart_map);
+ virtual int index_read_last_map(uchar * buf, const uchar * key,
+ key_part_map keypart_map);
/*
read_first_row is virtual method but is only implemented by
diff --git a/sql/handler.cc b/sql/handler.cc
index bab384e19fd..8c7f9035c23 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -25,8 +25,6 @@
#include "mysql_priv.h"
#include "rpl_filter.h"
-
-
#include <myisampack.h>
#include <errno.h>
@@ -64,7 +62,7 @@ static const LEX_STRING sys_table_aliases[]=
};
const char *ha_row_type[] = {
- "", "FIXED", "DYNAMIC", "COMPRESSED", "REDUNDANT", "COMPACT", "?","?","?"
+ "", "FIXED", "DYNAMIC", "COMPRESSED", "REDUNDANT", "COMPACT", "PAGE", "?","?","?"
};
const char *tx_isolation_names[] =
@@ -1988,9 +1986,9 @@ void handler::get_auto_increment(ulonglong offset, ulonglong increment,
key_copy(key, table->record[0],
table->key_info + table->s->next_number_index,
table->s->next_number_key_offset);
- error= index_read(table->record[1], key,
- make_prev_keypart_map(table->s->next_number_keypart),
- HA_READ_PREFIX_LAST);
+ error= index_read_map(table->record[1], key,
+ make_prev_keypart_map(table->s->next_number_keypart),
+ HA_READ_PREFIX_LAST);
/*
MySQL needs to call us for next row: assume we are inserting ("a",null)
here, we return 3, and next this statement will want to insert
@@ -3213,10 +3211,10 @@ int handler::read_range_first(const key_range *start_key,
if (!start_key) // Read first record
result= index_first(table->record[0]);
else
- result= index_read(table->record[0],
- start_key->key,
- start_key->keypart_map,
- start_key->flag);
+ result= index_read_map(table->record[0],
+ start_key->key,
+ start_key->keypart_map,
+ start_key->flag);
if (result)
DBUG_RETURN((result == HA_ERR_KEY_NOT_FOUND)
? HA_ERR_END_OF_FILE
@@ -3288,15 +3286,15 @@ int handler::compare_key(key_range *range)
}
-int handler::index_read_idx(uchar * buf, uint index, const uchar * key,
- key_part_map keypart_map,
- enum ha_rkey_function find_flag)
+int handler::index_read_idx_map(uchar * buf, uint index, const uchar * key,
+ key_part_map keypart_map,
+ enum ha_rkey_function find_flag)
{
int error, error1;
error= index_init(index, 0);
if (!error)
{
- error= index_read(buf, key, keypart_map, find_flag);
+ error= index_read_map(buf, key, keypart_map, find_flag);
error1= index_end();
}
return error ? error : error1;
diff --git a/sql/handler.h b/sql/handler.h
index 7cf7bfe043d..1b7c106f42c 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -278,7 +278,7 @@ enum legacy_db_type
enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED,
ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED,
- ROW_TYPE_REDUNDANT, ROW_TYPE_COMPACT, ROW_TYPE_PAGES };
+ ROW_TYPE_REDUNDANT, ROW_TYPE_COMPACT, ROW_TYPE_PAGE };
enum enum_binlog_func {
BFN_RESET_LOGS= 1,
@@ -321,6 +321,7 @@ enum enum_binlog_command {
#define HA_CREATE_USED_PASSWORD (1L << 17)
#define HA_CREATE_USED_CONNECTION (1L << 18)
#define HA_CREATE_USED_KEY_BLOCK_SIZE (1L << 19)
+#define HA_CREATE_USED_TRANSACTIONAL (1L << 20)
typedef ulonglong my_xid; // this line is the same as in log_event.h
#define MYSQL_XID_PREFIX "MySQLXid"
@@ -759,6 +760,7 @@ class partition_info;
struct st_partition_iter;
#define NOT_A_PARTITION_ID ((uint32)-1)
+enum ha_choice { HA_CHOICE_UNDEF, HA_CHOICE_NO, HA_CHOICE_YES };
typedef struct st_ha_create_information
{
@@ -781,6 +783,8 @@ typedef struct st_ha_create_information
uint options; /* OR of HA_CREATE_ options */
uint merge_insert_method;
uint extra_size; /* length of extra data segment */
+ /* 0 not used, 1 if not transactional, 2 if transactional */
+ enum ha_choice transactional;
bool table_existed; /* 1 in create if table existed */
bool frm_only; /* 1 if no ha_create_table() */
bool varchar; /* 1 if table has a VARCHAR */
@@ -1248,27 +1252,28 @@ public:
enum ha_rkey_function find_flag)
{ return HA_ERR_WRONG_COMMAND; }
public:
-/**
- @brief
- Positions an index cursor to the index specified in the handle. Fetches the
- row if available. If the key value is null, begin at the first key of the
- index.
-*/
- virtual int index_read(uchar * buf, const uchar * key, key_part_map keypart_map,
- enum ha_rkey_function find_flag)
- {
- uint key_len= calculate_key_len(table, active_index, key, keypart_map);
- return index_read(buf, key, key_len, find_flag);
- }
-/**
- @brief
- Positions an index cursor to the index specified in the handle. Fetches the
- row if available. If the key value is null, begin at the first key of the
- index.
-*/
- virtual int index_read_idx(uchar * buf, uint index, const uchar * key,
+ /**
+ @brief
+ Positions an index cursor to the index specified in the handle. Fetches the
+ row if available. If the key value is null, begin at the first key of the
+ index.
+ */
+ virtual int index_read_map(uchar * buf, const uchar * key,
key_part_map keypart_map,
- enum ha_rkey_function find_flag);
+ enum ha_rkey_function find_flag)
+ {
+ uint key_len= calculate_key_len(table, active_index, key, keypart_map);
+ return index_read(buf, key, key_len, find_flag);
+ }
+ /**
+ @brief
+ Positions an index cursor to the index specified in the handle. Fetches the
+ row if available. If the key value is null, begin at the first key of the
+ index.
+ */
+ virtual int index_read_idx_map(uchar * buf, uint index, const uchar * key,
+ key_part_map keypart_map,
+ enum ha_rkey_function find_flag);
virtual int index_next(uchar * buf)
{ return HA_ERR_WRONG_COMMAND; }
virtual int index_prev(uchar * buf)
@@ -1282,17 +1287,17 @@ public:
virtual int index_read_last(uchar * buf, const uchar * key, uint key_len)
{ return (my_errno=HA_ERR_WRONG_COMMAND); }
public:
-/**
- @brief
- The following functions works like index_read, but it find the last
- row with the current key value or prefix.
-*/
- virtual int index_read_last(uchar * buf, const uchar * key,
- key_part_map keypart_map)
- {
- uint key_len= calculate_key_len(table, active_index, key, keypart_map);
- return index_read_last(buf, key, key_len);
- }
+ /**
+ @brief
+ The following functions works like index_read, but it find the last
+ row with the current key value or prefix.
+ */
+ virtual int index_read_last_map(uchar * buf, const uchar * key,
+ key_part_map keypart_map)
+ {
+ uint key_len= calculate_key_len(table, active_index, key, keypart_map);
+ return index_read_last(buf, key, key_len);
+ }
virtual int read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
KEY_MULTI_RANGE *ranges, uint range_count,
bool sorted, HANDLER_BUFFER *buffer);
@@ -1835,7 +1840,7 @@ int ha_find_files(THD *thd,const char *db,const char *path,
int ha_table_exists_in_engine(THD* thd, const char* db, const char* name);
/* key cache */
-int ha_init_key_cache(const char *name, KEY_CACHE *key_cache);
+extern "C" int ha_init_key_cache(const char *name, KEY_CACHE *key_cache);
int ha_resize_key_cache(KEY_CACHE *key_cache);
int ha_change_key_cache_param(KEY_CACHE *key_cache);
int ha_change_key_cache(KEY_CACHE *old_key_cache, KEY_CACHE *new_key_cache);
diff --git a/sql/item.cc b/sql/item.cc
index 711a21ecbec..79f43da47bf 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -3830,15 +3830,15 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
if ((*res)->type() == Item::FIELD_ITEM)
{
/*
- It's an Item_field referencing another Item_field in the select
- list.
- use the field from the Item_field in the select list and leave
- the Item_field instance in place.
+ It's an Item_field referencing another Item_field in the select
+ list.
+ Use the field from the Item_field in the select list and leave
+ the Item_field instance in place.
*/
- Field *field= (*((Item_field**)res))->field;
+ Field *new_field= (*((Item_field**)res))->field;
- if (field == NULL)
+ if (new_field == NULL)
{
/* The column to which we link isn't valid. */
my_error(ER_BAD_FIELD_ERROR, MYF(0), (*res)->name,
@@ -3846,7 +3846,7 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
return(1);
}
- set_field(field);
+ set_field(new_field);
return 0;
}
else
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 755e711e383..8f5ff050dd6 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -3017,11 +3017,11 @@ uchar *in_longlong::get_value(Item *item)
void in_datetime::set(uint pos,Item *item)
{
- Item **tmp= &item;
+ Item **tmp_item= &item;
bool is_null;
struct packed_longlong *buff= &((packed_longlong*) base)[pos];
- buff->val= get_datetime_value(thd, &tmp, 0, warn_item, &is_null);
+ buff->val= get_datetime_value(thd, &tmp_item, 0, warn_item, &is_null);
buff->unsigned_flag= 1L;
}
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 47914c59b4c..35ecfdb0f2c 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -1158,7 +1158,6 @@ public:
class Item_func_in :public Item_func_opt_neg
{
public:
- Item_result cmp_type;
/*
an array of values when the right hand arguments of IN
are all SQL constant and there are no nulls
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 4012371bedb..6f908eb715e 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -4383,11 +4383,11 @@ int Item_func_set_user_var::save_in_field(Field *field, bool no_conversions,
else if (result_type() == DECIMAL_RESULT)
{
my_decimal decimal_value;
- my_decimal *value= entry->val_decimal(&null_value, &decimal_value);
+ my_decimal *val= entry->val_decimal(&null_value, &decimal_value);
if (null_value)
return set_field_to_null(field);
field->set_notnull();
- error=field->store_decimal(value);
+ error=field->store_decimal(val);
}
else
{
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index d54b9961562..186ec83a4a6 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1049,6 +1049,23 @@ String *Item_str_conv::val_str(String *str)
}
+void Item_func_lcase::fix_length_and_dec()
+{
+ collation.set(args[0]->collation);
+ multiply= collation.collation->casedn_multiply;
+ converter= collation.collation->cset->casedn;
+ max_length= args[0]->max_length * multiply;
+}
+
+void Item_func_ucase::fix_length_and_dec()
+{
+ collation.set(args[0]->collation);
+ multiply= collation.collation->caseup_multiply;
+ converter= collation.collation->cset->caseup;
+ max_length= args[0]->max_length * multiply;
+}
+
+
String *Item_func_left::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 6d2d9c199c9..385a12d372a 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -145,8 +145,7 @@ class Item_str_conv :public Item_str_func
{
protected:
uint multiply;
- size_t (*converter)(CHARSET_INFO *cs, char *src, size_t srclen,
- char *dst, size_t dstlen);
+ my_charset_conv_case converter;
String tmp_value;
public:
Item_str_conv(Item *item) :Item_str_func(item) {}
@@ -159,13 +158,7 @@ class Item_func_lcase :public Item_str_conv
public:
Item_func_lcase(Item *item) :Item_str_conv(item) {}
const char *func_name() const { return "lcase"; }
- void fix_length_and_dec()
- {
- collation.set(args[0]->collation);
- multiply= collation.collation->casedn_multiply;
- converter= collation.collation->cset->casedn;
- max_length= args[0]->max_length * multiply;
- }
+ void fix_length_and_dec();
};
class Item_func_ucase :public Item_str_conv
@@ -173,13 +166,7 @@ class Item_func_ucase :public Item_str_conv
public:
Item_func_ucase(Item *item) :Item_str_conv(item) {}
const char *func_name() const { return "ucase"; }
- void fix_length_and_dec()
- {
- collation.set(args[0]->collation);
- multiply= collation.collation->caseup_multiply;
- converter= collation.collation->cset->caseup;
- max_length= args[0]->max_length * multiply;
- }
+ void fix_length_and_dec();
};
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 1d042860d73..a253397e52c 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -2129,10 +2129,10 @@ int subselect_uniquesubquery_engine::exec()
if (!table->file->inited)
table->file->ha_index_init(tab->ref.key, 0);
- error= table->file->index_read(table->record[0],
- tab->ref.key_buff,
- make_prev_keypart_map(tab->ref.key_parts),
- HA_READ_KEY_EXACT);
+ error= table->file->index_read_map(table->record[0],
+ tab->ref.key_buff,
+ make_prev_keypart_map(tab->ref.key_parts),
+ HA_READ_KEY_EXACT);
if (error &&
error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
error= report_error(table, error);
@@ -2239,10 +2239,10 @@ int subselect_indexsubquery_engine::exec()
if (!table->file->inited)
table->file->ha_index_init(tab->ref.key, 1);
- error= table->file->index_read(table->record[0],
- tab->ref.key_buff,
- make_prev_keypart_map(tab->ref.key_parts),
- HA_READ_KEY_EXACT);
+ error= table->file->index_read_map(table->record[0],
+ tab->ref.key_buff,
+ make_prev_keypart_map(tab->ref.key_parts),
+ HA_READ_KEY_EXACT);
if (error &&
error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
error= report_error(table, error);
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index 067af930d6f..15be9c97b6e 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -570,13 +570,13 @@ String *Item_nodeset_func_rootelement::val_nodeset(String *nodeset)
String * Item_nodeset_func_union::val_nodeset(String *nodeset)
{
- uint numnodes= pxml->length() / sizeof(MY_XML_NODE);
+ uint num_nodes= pxml->length() / sizeof(MY_XML_NODE);
String set0, *s0= args[0]->val_nodeset(&set0);
String set1, *s1= args[1]->val_nodeset(&set1);
String both_str;
- both_str.alloc(numnodes);
+ both_str.alloc(num_nodes);
char *both= (char*) both_str.ptr();
- bzero((void*)both, numnodes);
+ bzero((void*)both, num_nodes);
MY_XPATH_FLT *flt;
fltbeg= (MY_XPATH_FLT*) s0->ptr();
@@ -590,7 +590,7 @@ String * Item_nodeset_func_union::val_nodeset(String *nodeset)
both[flt->num]= 1;
nodeset->length(0);
- for (uint i= 0, pos= 0; i < numnodes; i++)
+ for (uint i= 0, pos= 0; i < num_nodes; i++)
{
if (both[i])
((XPathFilter*)nodeset)->append_element(i, pos++);
@@ -2656,7 +2656,9 @@ static uint xml_parent_tag(MY_XML_NODE *items, uint nitems, uint level)
RETURN
Currently only MY_XML_OK
*/
-static int xml_enter(MY_XML_PARSER *st,const char *attr, size_t len)
+extern "C" int xml_enter(MY_XML_PARSER *st,const char *attr, size_t len);
+
+int xml_enter(MY_XML_PARSER *st,const char *attr, size_t len)
{
MY_XML_USER_DATA *data= (MY_XML_USER_DATA*)st->user_data;
MY_XML_NODE *nodes= (MY_XML_NODE*) data->pxml->ptr();
@@ -2687,7 +2689,9 @@ static int xml_enter(MY_XML_PARSER *st,const char *attr, size_t len)
RETURN
Currently only MY_XML_OK
*/
-static int xml_value(MY_XML_PARSER *st,const char *attr, size_t len)
+extern "C" int xml_value(MY_XML_PARSER *st,const char *attr, size_t len);
+
+int xml_value(MY_XML_PARSER *st,const char *attr, size_t len)
{
MY_XML_USER_DATA *data= (MY_XML_USER_DATA*)st->user_data;
MY_XML_NODE *nodes= (MY_XML_NODE*) data->pxml->ptr();
@@ -2717,7 +2721,9 @@ static int xml_value(MY_XML_PARSER *st,const char *attr, size_t len)
RETURN
Currently only MY_XML_OK
*/
-static int xml_leave(MY_XML_PARSER *st,const char *attr, size_t len)
+extern "C" int xml_leave(MY_XML_PARSER *st,const char *attr, size_t len);
+
+int xml_leave(MY_XML_PARSER *st,const char *attr, size_t len)
{
MY_XML_USER_DATA *data= (MY_XML_USER_DATA*)st->user_data;
DBUG_ASSERT(data->level > 0);
diff --git a/sql/key.cc b/sql/key.cc
index fee06ec058f..e8354ed2635 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -480,6 +480,7 @@ int key_cmp(KEY_PART_INFO *key_part, const uchar *key, uint key_length)
rec0 Pointer to table->record[0]
first_rec Pointer to record compare with
second_rec Pointer to record compare against first_rec
+
DESCRIPTION
This method is set-up such that it can be called directly from the
priority queue and it is attempted to be optimised as much as possible
diff --git a/sql/log.cc b/sql/log.cc
index 588a06fa7a4..93d35de4c69 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1932,7 +1932,7 @@ bool MYSQL_QUERY_LOG::write(time_t event_time, const char *user_host,
{
char buff[32];
uint length= 0;
- char time_buff[MAX_TIME_SIZE];
+ char local_time_buff[MAX_TIME_SIZE];
struct tm start;
uint time_buff_len= 0;
@@ -1948,13 +1948,13 @@ bool MYSQL_QUERY_LOG::write(time_t event_time, const char *user_host,
localtime_r(&event_time, &start);
- time_buff_len= my_snprintf(time_buff, MAX_TIME_SIZE,
+ time_buff_len= my_snprintf(local_time_buff, MAX_TIME_SIZE,
"%02d%02d%02d %2d:%02d:%02d",
start.tm_year % 100, start.tm_mon + 1,
start.tm_mday, start.tm_hour,
start.tm_min, start.tm_sec);
- if (my_b_write(&log_file, (uchar*) &time_buff, time_buff_len))
+ if (my_b_write(&log_file, (uchar*) local_time_buff, time_buff_len))
goto err;
}
else
diff --git a/sql/log_event.cc b/sql/log_event.cc
index db8729c8318..3b0e73e650c 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -456,7 +456,11 @@ Log_event::Log_event()
thd(0)
{
server_id= ::server_id;
- when= my_time(0);
+ /*
+ We can't call my_time() here as this would cause a call before
+ my_init() is called
+ */
+ when= 0;
log_pos= 0;
}
#endif /* !MYSQL_CLIENT */
@@ -637,6 +641,7 @@ void Log_event::init_show_field_list(List<Item>* field_list)
bool Log_event::write_header(IO_CACHE* file, ulong event_data_length)
{
uchar header[LOG_EVENT_HEADER_LEN];
+ ulong now;
DBUG_ENTER("Log_event::write_header");
/* Store number of bytes that will be written by this event */
@@ -687,6 +692,14 @@ bool Log_event::write_header(IO_CACHE* file, ulong event_data_length)
log_pos= my_b_safe_tell(file)+data_written;
}
+ /* Set time of we this isn't a query */
+ if (!(now= (ulong) when))
+ {
+ THD *thd= current_thd;
+ /* thd will only be 0 here at time of log creation */
+ now= thd ? thd->start_time : my_time(0);
+ }
+
/*
Header will be of size LOG_EVENT_HEADER_LEN for all events, except for
FORMAT_DESCRIPTION_EVENT and ROTATE_EVENT, where it will be
@@ -694,7 +707,7 @@ bool Log_event::write_header(IO_CACHE* file, ulong event_data_length)
because we read them before knowing the format).
*/
- int4store(header, (ulong) when); // timestamp
+ int4store(header, now); // timestamp
header[EVENT_TYPE_OFFSET]= get_type_code();
int4store(header+ SERVER_ID_OFFSET, server_id);
int4store(header+ EVENT_LEN_OFFSET, data_written);
@@ -6867,7 +6880,7 @@ int Write_rows_log_event::do_after_row_operations(TABLE *table, int error)
return error? error : local_error;
}
-int Write_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli,
+int Write_rows_log_event::do_prepare_row(THD *thd_arg, RELAY_LOG_INFO const *rli,
TABLE *table,
uchar const *const row_start,
uchar const **const row_end)
@@ -6878,7 +6891,7 @@ int Write_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli,
if (int error= unpack_row(rli, table, m_width, row_start, &m_cols, row_end,
&m_master_reclength, table->write_set, WRITE_ROWS_EVENT))
{
- thd->net.last_errno= error;
+ thd_arg->net.last_errno= error;
return error;
}
bitmap_copy(table->read_set, table->write_set);
@@ -7137,10 +7150,10 @@ replace_record(THD *thd, TABLE *table,
}
key_copy((uchar*)key.get(), table->record[0], table->key_info + keynum, 0);
- error= table->file->index_read_idx(table->record[1], keynum,
- (const uchar*)key.get(),
- HA_WHOLE_KEY,
- HA_READ_KEY_EXACT);
+ error= table->file->index_read_idx_map(table->record[1], keynum,
+ (const uchar*)key.get(),
+ HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT);
if (error)
{
table->file->print_error(error, MYF(0));
@@ -7391,8 +7404,8 @@ static int find_and_fetch_row(TABLE *table, uchar *key)
my_ptrdiff_t const pos=
table->s->null_bytes > 0 ? table->s->null_bytes - 1 : 0;
table->record[1][pos]= 0xFF;
- if ((error= table->file->index_read(table->record[1], key, HA_WHOLE_KEY,
- HA_READ_KEY_EXACT)))
+ if ((error= table->file->index_read_map(table->record[1], key, HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT)))
{
table->file->print_error(error, MYF(0));
table->file->ha_index_end();
@@ -7592,7 +7605,7 @@ int Delete_rows_log_event::do_after_row_operations(TABLE *table, int error)
return error;
}
-int Delete_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli,
+int Delete_rows_log_event::do_prepare_row(THD *thd_arg, RELAY_LOG_INFO const *rli,
TABLE *table,
uchar const *const row_start,
uchar const **const row_end)
@@ -7607,7 +7620,7 @@ int Delete_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli,
if (int error= unpack_row(rli, table, m_width, row_start, &m_cols, row_end,
&m_master_reclength, table->read_set, DELETE_ROWS_EVENT))
{
- thd->net.last_errno= error;
+ thd_arg->net.last_errno= error;
return error;
}
@@ -7771,7 +7784,7 @@ int Update_rows_log_event::do_after_row_operations(TABLE *table, int error)
return error;
}
-int Update_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli,
+int Update_rows_log_event::do_prepare_row(THD *thd_arg, RELAY_LOG_INFO const *rli,
TABLE *table,
uchar const *const row_start,
uchar const **const row_end)
@@ -7794,7 +7807,7 @@ int Update_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli,
if ((error= unpack_row(rli, table, m_width, row_start, &m_cols, row_end,
&m_master_reclength, table->read_set, UPDATE_ROWS_EVENT)))
{
- thd->net.last_errno= error;
+ thd_arg->net.last_errno= error;
return error;
}
@@ -7804,7 +7817,7 @@ int Update_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli,
if ((error= unpack_row(rli, table, m_width, next_start, &m_cols_ai, row_end,
&m_master_reclength, table->write_set, UPDATE_ROWS_EVENT)))
{
- thd->net.last_errno= error;
+ thd_arg->net.last_errno= error;
return error;
}
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index e6a9dd50c08..d44f9621a42 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -5,7 +5,7 @@
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
int
-Write_rows_log_event_old::do_prepare_row(THD *thd,
+Write_rows_log_event_old::do_prepare_row(THD *thd_arg,
RELAY_LOG_INFO const *rli,
TABLE *table,
uchar const *row_start,
@@ -25,7 +25,7 @@ Write_rows_log_event_old::do_prepare_row(THD *thd,
int
-Delete_rows_log_event_old::do_prepare_row(THD *thd,
+Delete_rows_log_event_old::do_prepare_row(THD *thd_arg,
RELAY_LOG_INFO const *rli,
TABLE *table,
uchar const *row_start,
@@ -58,7 +58,7 @@ Delete_rows_log_event_old::do_prepare_row(THD *thd,
}
-int Update_rows_log_event_old::do_prepare_row(THD *thd,
+int Update_rows_log_event_old::do_prepare_row(THD *thd_arg,
RELAY_LOG_INFO const *rli,
TABLE *table,
uchar const *row_start,
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 34d92a13945..805cf23118f 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -168,7 +168,7 @@ public:
protected:
Object_creation_ctx() {}
- virtual Object_creation_ctx *create_backup_ctx(THD *thd) = 0;
+ virtual Object_creation_ctx *create_backup_ctx(THD *thd) const = 0;
virtual void change_env(THD *thd) const = 0;
@@ -204,7 +204,7 @@ protected:
CHARSET_INFO *connection_cl);
protected:
- virtual Object_creation_ctx *create_backup_ctx(THD *thd);
+ virtual Object_creation_ctx *create_backup_ctx(THD *thd) const;
virtual void change_env(THD *thd) const;
@@ -1643,7 +1643,7 @@ bool key_cmp_if_same(TABLE *form,const uchar *key,uint index,uint key_length);
void key_unpack(String *to,TABLE *form,uint index);
bool is_key_used(TABLE *table, uint idx, const MY_BITMAP *fields);
int key_cmp(KEY_PART_INFO *key_part, const uchar *key, uint key_length);
-int key_rec_cmp(void *key_info, uchar *a, uchar *b);
+extern "C" int key_rec_cmp(void *key_info, uchar *a, uchar *b);
bool init_errmessage(void);
#endif /* MYSQL_SERVER */
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 33cd55170ea..d9f0648b9b3 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -693,7 +693,7 @@ struct st_VioSSLFd *ssl_acceptor_fd;
pthread_handler_t signal_hand(void *arg);
static void mysql_init_variables(void);
static void get_options(int *argc,char **argv);
-static my_bool get_one_option(int, const struct my_option *, char *);
+extern "C" my_bool mysqld_get_one_option(int, const struct my_option *, char *);
static void set_server_version(void);
static int init_thread_environment();
static char *get_relative_path(const char *path);
@@ -1141,6 +1141,7 @@ void unireg_end(void)
extern "C" void unireg_abort(int exit_code)
{
DBUG_ENTER("unireg_abort");
+
if (exit_code)
sql_print_error("Aborting\n");
else if (opt_help)
@@ -2353,7 +2354,7 @@ static void init_signals(void)
sigaddset(&set,SIGTSTP);
#endif
if (thd_lib_detected != THD_LIB_LT)
- sigaddset(&set,THR_SERVER_ALARM);
+ sigaddset(&set,THR_SERVER_ALARM);
if (test_flags & TEST_SIGINT)
{
// May be SIGINT
@@ -2549,7 +2550,9 @@ static void check_data_home(const char *path)
/* ARGSUSED */
-static int my_message_sql(uint error, const char *str, myf MyFlags)
+extern "C" int my_message_sql(uint error, const char *str, myf MyFlags);
+
+int my_message_sql(uint error, const char *str, myf MyFlags)
{
THD *thd;
DBUG_ENTER("my_message_sql");
@@ -2612,13 +2615,16 @@ static int my_message_sql(uint error, const char *str, myf MyFlags)
#ifndef EMBEDDED_LIBRARY
-static void *my_str_malloc_mysqld(size_t size)
+extern "C" void *my_str_malloc_mysqld(size_t size);
+extern "C" void my_str_free_mysqld(void *ptr);
+
+void *my_str_malloc_mysqld(size_t size)
{
return my_malloc(size, MYF(MY_FAE));
}
-static void my_str_free_mysqld(void *ptr)
+void my_str_free_mysqld(void *ptr)
{
my_free((uchar*)ptr, MYF(MY_FAE));
}
@@ -3418,7 +3424,7 @@ server.");
my_getopt_skip_unknown= 0;
if ((ho_error= handle_options(&defaults_argc, &tmp_argv, no_opts,
- get_one_option)))
+ mysqld_get_one_option)))
unireg_abort(ho_error);
if (defaults_argc)
@@ -3902,7 +3908,6 @@ we force server id to 2, but this MySQL server will not act as a slave.");
*/
if (init_slave() && !active_mi)
{
- end_thr_alarm(1); // Don't allow alarms
unireg_abort(1);
}
@@ -3910,16 +3915,12 @@ we force server id to 2, but this MySQL server will not act as a slave.");
{
select_thread_in_use= 0; // Allow 'kill' to work
bootstrap(stdin);
- end_thr_alarm(1); // Don't allow alarms
unireg_abort(bootstrap_error ? 1 : 0);
}
if (opt_init_file)
{
if (read_init_file(opt_init_file))
- {
- end_thr_alarm(1); // Don't allow alarms
unireg_abort(1);
- }
}
execute_ddl_log_recovery();
@@ -6872,6 +6873,7 @@ SHOW_VAR status_vars[]= {
{"Open_streams", (char*) &my_stream_opened, SHOW_LONG_NOFLUSH},
{"Open_table_definitions", (char*) &show_table_definitions, SHOW_FUNC},
{"Open_tables", (char*) &show_open_tables, SHOW_FUNC},
+ {"Opened_files", (char*) &my_file_total_opened, SHOW_LONG_NOFLUSH},
{"Opened_tables", (char*) offsetof(STATUS_VAR, opened_tables), SHOW_LONG_STATUS},
{"Prepared_stmt_count", (char*) &show_prepared_stmt_count, SHOW_FUNC},
#ifdef HAVE_QUERY_CACHE
@@ -7239,9 +7241,10 @@ static void mysql_init_variables(void)
}
-static my_bool
-get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
- char *argument)
+my_bool
+mysqld_get_one_option(int optid,
+ const struct my_option *opt __attribute__((unused)),
+ char *argument)
{
switch(optid) {
case '#':
@@ -7732,7 +7735,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
/* Handle arguments for multiple key caches */
-static uchar* *
+extern "C" uchar **mysql_getopt_value(const char *keyname, uint key_length,
+ const struct my_option *option);
+
+uchar* *
mysql_getopt_value(const char *keyname, uint key_length,
const struct my_option *option)
{
@@ -7761,11 +7767,19 @@ mysql_getopt_value(const char *keyname, uint key_length,
}
-static void option_error_reporter(enum loglevel level, const char *format, ...)
+extern "C" void option_error_reporter(enum loglevel level, const char *format, ...);
+
+void option_error_reporter(enum loglevel level, const char *format, ...)
{
va_list args;
va_start(args, format);
- vprint_msg_to_log(level, format, args);
+
+ /* Don't print warnings for --loose options during bootstrap */
+ if (level == ERROR_LEVEL || !opt_bootstrap ||
+ global_system_variables.log_warnings)
+ {
+ vprint_msg_to_log(level, format, args);
+ }
va_end(args);
}
@@ -7783,7 +7797,7 @@ static void get_options(int *argc,char **argv)
my_getopt_skip_unknown= TRUE;
if ((ho_error= handle_options(argc, &argv, my_long_options,
- get_one_option)))
+ mysqld_get_one_option)))
exit(ho_error);
(*argc)++; /* add back one for the progname handle_options removes */
/* no need to do this for argv as we are discarding it. */
@@ -8144,7 +8158,7 @@ void refresh_status(THD *thd)
add_to_status(&global_status_var, &thd->status_var);
/* Reset thread's status variables */
- bzero((char*) &thd->status_var, sizeof(thd->status_var));
+ bzero((uchar*) &thd->status_var, sizeof(thd->status_var));
/* Reset some global variables */
reset_status_vars();
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 948b268d9a3..516da13d857 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -8375,7 +8375,8 @@ int QUICK_RANGE_SELECT::get_next_prefix(uint prefix_length,
{
/* Read the next record in the same range with prefix after cur_prefix. */
DBUG_ASSERT(cur_prefix != 0);
- result= file->index_read(record, cur_prefix, keypart_map, HA_READ_AFTER_KEY);
+ result= file->index_read_map(record, cur_prefix, keypart_map,
+ HA_READ_AFTER_KEY);
if (result || (file->compare_key(file->end_range) <= 0))
DBUG_RETURN(result);
}
@@ -8446,9 +8447,10 @@ int QUICK_RANGE_SELECT_GEOM::get_next()
}
last_range= *(cur_range++);
- result= file->index_read(record, last_range->min_key,
- last_range->min_keypart_map,
- (ha_rkey_function)(last_range->flag ^ GEOM_FLAG));
+ result= file->index_read_map(record, last_range->min_key,
+ last_range->min_keypart_map,
+ (ha_rkey_function)(last_range->flag ^
+ GEOM_FLAG));
if (result != HA_ERR_KEY_NOT_FOUND && result != HA_ERR_END_OF_FILE)
DBUG_RETURN(result);
last_range= 0; // Not found, to next range
@@ -8579,18 +8581,19 @@ int QUICK_SELECT_DESC::get_next()
if (last_range->flag & EQ_RANGE)
{
- result = file->index_read(record, last_range->max_key,
- last_range->max_keypart_map, HA_READ_KEY_EXACT);
+ result = file->index_read_map(record, last_range->max_key,
+ last_range->max_keypart_map,
+ HA_READ_KEY_EXACT);
}
else
{
DBUG_ASSERT(last_range->flag & NEAR_MAX ||
range_reads_after_key(last_range));
- result=file->index_read(record, last_range->max_key,
- last_range->max_keypart_map,
- ((last_range->flag & NEAR_MAX) ?
- HA_READ_BEFORE_KEY :
- HA_READ_PREFIX_LAST_OR_PREV));
+ result=file->index_read_map(record, last_range->max_key,
+ last_range->max_keypart_map,
+ ((last_range->flag & NEAR_MAX) ?
+ HA_READ_BEFORE_KEY :
+ HA_READ_PREFIX_LAST_OR_PREV));
}
if (result)
{
@@ -10446,9 +10449,9 @@ int QUICK_GROUP_MIN_MAX_SELECT::get_next()
first sub-group with the extended prefix.
*/
if (!have_min && !have_max && key_infix_len > 0)
- result= file->index_read(record, group_prefix,
- make_prev_keypart_map(real_key_parts),
- HA_READ_KEY_EXACT);
+ result= file->index_read_map(record, group_prefix,
+ make_prev_keypart_map(real_key_parts),
+ HA_READ_KEY_EXACT);
result= have_min ? min_res : have_max ? max_res : result;
} while ((result == HA_ERR_KEY_NOT_FOUND || result == HA_ERR_END_OF_FILE) &&
@@ -10510,9 +10513,9 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min()
/* Apply the constant equality conditions to the non-group select fields */
if (key_infix_len > 0)
{
- if ((result= file->index_read(record, group_prefix,
- make_prev_keypart_map(real_key_parts),
- HA_READ_KEY_EXACT)))
+ if ((result= file->index_read_map(record, group_prefix,
+ make_prev_keypart_map(real_key_parts),
+ HA_READ_KEY_EXACT)))
DBUG_RETURN(result);
}
@@ -10527,9 +10530,9 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min()
{
/* Find the first subsequent record without NULL in the MIN/MAX field. */
key_copy(tmp_record, record, index_info, 0);
- result= file->index_read(record, tmp_record,
- make_keypart_map(real_key_parts),
- HA_READ_AFTER_KEY);
+ result= file->index_read_map(record, tmp_record,
+ make_keypart_map(real_key_parts),
+ HA_READ_AFTER_KEY);
/*
Check if the new record belongs to the current group by comparing its
prefix with the group's prefix. If it is from the next group, then the
@@ -10584,9 +10587,9 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_max()
if (min_max_ranges.elements > 0)
result= next_max_in_range();
else
- result= file->index_read(record, group_prefix,
- make_prev_keypart_map(real_key_parts),
- HA_READ_PREFIX_LAST);
+ result= file->index_read_map(record, group_prefix,
+ make_prev_keypart_map(real_key_parts),
+ HA_READ_PREFIX_LAST);
DBUG_RETURN(result);
}
@@ -10637,9 +10640,9 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_prefix()
else
{
/* Load the first key in this group into record. */
- result= file->index_read(record, group_prefix,
- make_prev_keypart_map(group_key_parts),
- HA_READ_AFTER_KEY);
+ result= file->index_read_map(record, group_prefix,
+ make_prev_keypart_map(group_key_parts),
+ HA_READ_AFTER_KEY);
if (result)
DBUG_RETURN(result);
}
@@ -10716,7 +10719,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min_in_range()
HA_READ_AFTER_KEY : HA_READ_KEY_OR_NEXT;
}
- result= file->index_read(record, group_prefix, keypart_map, find_flag);
+ result= file->index_read_map(record, group_prefix, keypart_map, find_flag);
if (result)
{
if ((result == HA_ERR_KEY_NOT_FOUND || result == HA_ERR_END_OF_FILE) &&
@@ -10849,7 +10852,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_max_in_range()
HA_READ_BEFORE_KEY : HA_READ_PREFIX_LAST_OR_PREV;
}
- result= file->index_read(record, group_prefix, keypart_map, find_flag);
+ result= file->index_read_map(record, group_prefix, keypart_map, find_flag);
if (result)
{
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 8851401d21f..6836c53db4e 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -270,9 +270,10 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
Closed interval: Either The MIN argument is non-nullable, or
we have a >= predicate for the MIN argument.
*/
- error= table->file->index_read(table->record[0], ref.key_buff,
- make_prev_keypart_map(ref.key_parts),
- HA_READ_KEY_OR_NEXT);
+ error= table->file->index_read_map(table->record[0],
+ ref.key_buff,
+ make_prev_keypart_map(ref.key_parts),
+ HA_READ_KEY_OR_NEXT);
else
{
/*
@@ -281,9 +282,10 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
2) there is a > predicate on it, nullability is irrelevant.
We need to scan the next bigger record first.
*/
- error= table->file->index_read(table->record[0], ref.key_buff,
- make_prev_keypart_map(ref.key_parts),
- HA_READ_AFTER_KEY);
+ error= table->file->index_read_map(table->record[0],
+ ref.key_buff,
+ make_prev_keypart_map(ref.key_parts),
+ HA_READ_AFTER_KEY);
/*
If the found record is outside the group formed by the search
prefix, or there is no such record at all, check if all
@@ -305,9 +307,10 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
key_cmp_if_same(table, ref.key_buff, ref.key, prefix_len)))
{
DBUG_ASSERT(item_field->field->real_maybe_null());
- error= table->file->index_read(table->record[0], ref.key_buff,
- make_prev_keypart_map(ref.key_parts),
- HA_READ_KEY_EXACT);
+ error= table->file->index_read_map(table->record[0],
+ ref.key_buff,
+ make_prev_keypart_map(ref.key_parts),
+ HA_READ_KEY_EXACT);
}
}
}
@@ -394,11 +397,11 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
if (!ref.key_length)
error= table->file->index_last(table->record[0]);
else
- error= table->file->index_read(table->record[0], key_buff,
- make_prev_keypart_map(ref.key_parts),
- range_fl & NEAR_MAX ?
- HA_READ_BEFORE_KEY :
- HA_READ_PREFIX_LAST_OR_PREV);
+ error= table->file->index_read_map(table->record[0], key_buff,
+ make_prev_keypart_map(ref.key_parts),
+ range_fl & NEAR_MAX ?
+ HA_READ_BEFORE_KEY :
+ HA_READ_PREFIX_LAST_OR_PREV);
if (!error && reckey_in_range(1, &ref, item_field->field,
conds, range_fl, prefix_len))
error= HA_ERR_KEY_NOT_FOUND;
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 308b96d84f8..ab887d5dda0 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -91,10 +91,10 @@ partition_info *partition_info::get_clone()
#define MAX_PART_NAME_SIZE 8
char *partition_info::create_default_partition_names(uint part_no,
- uint no_parts,
+ uint no_parts_arg,
uint start_no)
{
- char *ptr= (char*) sql_calloc(no_parts*MAX_PART_NAME_SIZE);
+ char *ptr= (char*) sql_calloc(no_parts_arg*MAX_PART_NAME_SIZE);
char *move_ptr= ptr;
uint i= 0;
DBUG_ENTER("create_default_partition_names");
@@ -105,11 +105,11 @@ char *partition_info::create_default_partition_names(uint part_no,
{
my_sprintf(move_ptr, (move_ptr,"p%u", (start_no + i)));
move_ptr+=MAX_PART_NAME_SIZE;
- } while (++i < no_parts);
+ } while (++i < no_parts_arg);
}
else
{
- mem_alloc_error(no_parts*MAX_PART_NAME_SIZE);
+ mem_alloc_error(no_parts_arg*MAX_PART_NAME_SIZE);
}
DBUG_RETURN(ptr);
}
diff --git a/sql/rpl_filter.cc b/sql/rpl_filter.cc
index bb5db0106eb..fb609e12dcb 100644
--- a/sql/rpl_filter.cc
+++ b/sql/rpl_filter.cc
@@ -362,9 +362,11 @@ Rpl_filter::add_ignore_db(const char* table_spec)
ignore_db.push_back(db);
}
+extern "C" uchar *get_table_key(const uchar *, size_t *, my_bool);
+extern "C" void free_table_ent(void* a);
-static uchar* get_table_key(const uchar* a, size_t *len,
- my_bool __attribute__((unused)))
+uchar *get_table_key(const uchar* a, size_t *len,
+ my_bool __attribute__((unused)))
{
TABLE_RULE_ENT *e= (TABLE_RULE_ENT *) a;
@@ -373,7 +375,7 @@ static uchar* get_table_key(const uchar* a, size_t *len,
}
-static void free_table_ent(void* a)
+void free_table_ent(void* a)
{
TABLE_RULE_ENT *e= (TABLE_RULE_ENT *) a;
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 97d38cd84ca..7528e3c82f5 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -3266,11 +3266,12 @@ bool sys_var_thd_storage_engine::check(THD *thd, set_var *var)
var->save_result.plugin= NULL;
if (var->value->result_type() == STRING_RESULT)
{
- LEX_STRING name;
+ LEX_STRING engine_name;
handlerton *hton;
if (!(res=var->value->val_str(&str)) ||
- !(name.str= (char *)res->ptr()) || !(name.length= res->length()) ||
- !(var->save_result.plugin= ha_resolve_by_name(thd, &name)) ||
+ !(engine_name.str= (char *)res->ptr()) ||
+ !(engine_name.length= res->length()) ||
+ !(var->save_result.plugin= ha_resolve_by_name(thd, &engine_name)) ||
!(hton= plugin_data(var->save_result.plugin, handlerton *)) ||
ha_checktype(thd, ha_legacy_type(hton), 1, 0) != hton)
{
@@ -3292,13 +3293,13 @@ uchar *sys_var_thd_storage_engine::value_ptr(THD *thd, enum_var_type type,
{
uchar* result;
handlerton *hton;
- LEX_STRING *name;
+ LEX_STRING *engine_name;
plugin_ref plugin= thd->variables.*offset;
if (type == OPT_GLOBAL)
plugin= my_plugin_lock(thd, &(global_system_variables.*offset));
hton= plugin_data(plugin, handlerton*);
- name= &hton2plugin[hton->slot]->name;
- result= (uchar *) thd->strmake(name->str, name->length);
+ engine_name= &hton2plugin[hton->slot]->name;
+ result= (uchar *) thd->strmake(engine_name->str, engine_name->length);
if (type == OPT_GLOBAL)
plugin_unlock(thd, plugin);
return result;
@@ -3585,7 +3586,7 @@ void free_key_cache(const char *name, KEY_CACHE *key_cache)
}
-bool process_key_caches(int (* func) (const char *name, KEY_CACHE *))
+bool process_key_caches(process_key_cache_t func)
{
I_List_iterator<NAMED_LIST> it(key_caches);
NAMED_LIST *element;
diff --git a/sql/set_var.h b/sql/set_var.h
index 67ec449a02f..eb2c893c89e 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -1128,6 +1128,11 @@ public:
};
+extern "C"
+{
+ typedef int (*process_key_cache_t) (const char *, KEY_CACHE *);
+}
+
/* Named lists (used for keycaches) */
class NAMED_LIST :public ilink
@@ -1152,8 +1157,7 @@ public:
{
my_free((uchar*) name, MYF(0));
}
- friend bool process_key_caches(int (* func) (const char *name,
- KEY_CACHE *));
+ friend bool process_key_caches(process_key_cache_t func);
friend void delete_elements(I_List<NAMED_LIST> *list,
void (*free_element)(const char*, uchar*));
};
@@ -1201,6 +1205,6 @@ extern sys_var_str sys_var_general_log_path, sys_var_slow_log_path;
KEY_CACHE *get_key_cache(LEX_STRING *cache_name);
KEY_CACHE *get_or_create_key_cache(const char *name, uint length);
void free_key_cache(const char *name, KEY_CACHE *key_cache);
-bool process_key_caches(int (* func) (const char *name, KEY_CACHE *));
+bool process_key_caches(process_key_cache_t func);
void delete_elements(I_List<NAMED_LIST> *list,
void (*free_element)(const char*, uchar*));
diff --git a/sql/sp.cc b/sql/sp.cc
index 372aa9c6780..0956561719b 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -97,7 +97,8 @@ public:
protected:
virtual Object_creation_ctx *create_backup_ctx(THD *thd) const
{
- return new Stored_routine_creation_ctx(thd);
+ DBUG_ENTER("Stored_routine_creation_ctx::create_backup_ctx");
+ DBUG_RETURN(new Stored_routine_creation_ctx(thd));
}
private:
@@ -348,8 +349,8 @@ db_find_routine_aux(THD *thd, int type, sp_name *name, TABLE *table)
key_copy(key, table->record[0], table->key_info,
table->key_info->key_length);
- if (table->file->index_read_idx(table->record[0], 0, key, HA_WHOLE_KEY,
- HA_READ_KEY_EXACT))
+ if (table->file->index_read_idx_map(table->record[0], 0, key, HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT))
DBUG_RETURN(SP_KEY_NOT_FOUND);
DBUG_RETURN(SP_OK);
@@ -1182,9 +1183,9 @@ sp_drop_db_routines(THD *thd, char *db)
ret= SP_OK;
table->file->ha_index_init(0, 1);
- if (! table->file->index_read(table->record[0],
- (uchar *)table->field[MYSQL_PROC_FIELD_DB]->ptr,
- (key_part_map)1, HA_READ_KEY_EXACT))
+ if (! table->file->index_read_map(table->record[0],
+ (uchar *)table->field[MYSQL_PROC_FIELD_DB]->ptr,
+ (key_part_map)1, HA_READ_KEY_EXACT))
{
int nxtres;
bool deleted= FALSE;
diff --git a/sql/sp_cache.cc b/sql/sp_cache.cc
index 84b15ee15c4..cc6ba9ef1d0 100644
--- a/sql/sp_cache.cc
+++ b/sql/sp_cache.cc
@@ -214,8 +214,12 @@ void sp_cache_flush_obsolete(sp_cache **cp)
Internal functions
*************************************************************************/
-static uchar *hash_get_key_for_sp_head(const uchar *ptr, size_t *plen,
- my_bool first)
+extern "C" uchar *hash_get_key_for_sp_head(const uchar *ptr, size_t *plen,
+ my_bool first);
+extern "C" void hash_free_sp_head(void *p);
+
+uchar *hash_get_key_for_sp_head(const uchar *ptr, size_t *plen,
+ my_bool first)
{
sp_head *sp= (sp_head *)ptr;
*plen= sp->m_qname.length;
@@ -223,8 +227,7 @@ static uchar *hash_get_key_for_sp_head(const uchar *ptr, size_t *plen,
}
-static void
-hash_free_sp_head(void *p)
+void hash_free_sp_head(void *p)
{
sp_head *sp= (sp_head *)p;
delete sp;
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 9b67a89bed2..cfc21a112db 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -32,6 +32,8 @@
#include <my_user.h>
+extern "C" uchar *sp_table_key(const uchar *ptr, size_t *plen, my_bool first);
+
Item_result
sp_map_result_type(enum enum_field_types type)
{
@@ -483,7 +485,6 @@ sp_head::sp_head()
*/
m_db= m_name= m_qname= str_reset;
- extern uchar *sp_table_key(const uchar *ptr, size_t *plen, my_bool first);
DBUG_ENTER("sp_head::sp_head");
m_backpatch.empty();
@@ -1066,6 +1067,12 @@ sp_head::execute(THD *thd)
old_arena= thd->stmt_arena;
/*
+ Switch query context. This has to be done early as this is sometimes
+ allocated trough sql_alloc
+ */
+ saved_creation_ctx= m_creation_ctx->set_n_backup(thd);
+
+ /*
We have to save/restore this info when we are changing call level to
be able properly do close_thread_tables() in instructions.
*/
@@ -1110,10 +1117,6 @@ sp_head::execute(THD *thd)
*/
thd->spcont->callers_arena= &backup_arena;
- /* Switch query context. */
-
- saved_creation_ctx= m_creation_ctx->set_n_backup(thd);
-
do
{
sp_instr *i;
@@ -3579,8 +3582,8 @@ typedef struct st_sp_table
uint8 trg_event_map;
} SP_TABLE;
-uchar *
-sp_table_key(const uchar *ptr, size_t *plen, my_bool first)
+
+uchar *sp_table_key(const uchar *ptr, size_t *plen, my_bool first)
{
SP_TABLE *tab= (SP_TABLE *)ptr;
*plen= tab->qname.length;
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 91f1570f653..7e017d7d028 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1815,9 +1815,9 @@ static bool update_user_table(THD *thd, TABLE *table,
key_copy((uchar *) user_key, table->record[0], table->key_info,
table->key_info->key_length);
- if (table->file->index_read_idx(table->record[0], 0,
- (uchar *) user_key, HA_WHOLE_KEY,
- HA_READ_KEY_EXACT))
+ if (table->file->index_read_idx_map(table->record[0], 0,
+ (uchar *) user_key, HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT))
{
my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH),
MYF(0)); /* purecov: deadcode */
@@ -1908,8 +1908,9 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
key_copy(user_key, table->record[0], table->key_info,
table->key_info->key_length);
- if (table->file->index_read_idx(table->record[0], 0, user_key, HA_WHOLE_KEY,
- HA_READ_KEY_EXACT))
+ if (table->file->index_read_idx_map(table->record[0], 0, user_key,
+ HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT))
{
/* what == 'N' means revoke */
if (what == 'N')
@@ -2131,8 +2132,9 @@ static int replace_db_table(TABLE *table, const char *db,
key_copy(user_key, table->record[0], table->key_info,
table->key_info->key_length);
- if (table->file->index_read_idx(table->record[0],0, user_key, HA_WHOLE_KEY,
- HA_READ_KEY_EXACT))
+ if (table->file->index_read_idx_map(table->record[0],0, user_key,
+ HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT))
{
if (what == 'N')
{ // no row, no revoke
@@ -2348,8 +2350,8 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
col_privs->field[4]->store("",0, &my_charset_latin1);
col_privs->file->ha_index_init(0, 1);
- if (col_privs->file->index_read(col_privs->record[0], (uchar*) key,
- (key_part_map)15, HA_READ_KEY_EXACT))
+ if (col_privs->file->index_read_map(col_privs->record[0], (uchar*) key,
+ (key_part_map)15, HA_READ_KEY_EXACT))
{
cols = 0; /* purecov: deadcode */
col_privs->file->ha_index_end();
@@ -2511,8 +2513,8 @@ static int replace_column_table(GRANT_TABLE *g_t,
key_copy(user_key, table->record[0], table->key_info,
table->key_info->key_length);
- if (table->file->index_read(table->record[0], user_key, HA_WHOLE_KEY,
- HA_READ_KEY_EXACT))
+ if (table->file->index_read_map(table->record[0], user_key, HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT))
{
if (revoke_grant)
{
@@ -2589,8 +2591,9 @@ static int replace_column_table(GRANT_TABLE *g_t,
key_copy(user_key, table->record[0], table->key_info,
key_prefix_length);
- if (table->file->index_read(table->record[0], user_key, (key_part_map)15,
- HA_READ_KEY_EXACT))
+ if (table->file->index_read_map(table->record[0], user_key,
+ (key_part_map)15,
+ HA_READ_KEY_EXACT))
goto end;
/* Scan through all rows with the same host,db,user and table */
@@ -2691,8 +2694,9 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
key_copy(user_key, table->record[0], table->key_info,
table->key_info->key_length);
- if (table->file->index_read_idx(table->record[0], 0, user_key, HA_WHOLE_KEY,
- HA_READ_KEY_EXACT))
+ if (table->file->index_read_idx_map(table->record[0], 0, user_key,
+ HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT))
{
/*
The following should never happen as we first check the in memory
@@ -2816,9 +2820,10 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name,
TRUE);
store_record(table,record[1]); // store at pos 1
- if (table->file->index_read_idx(table->record[0], 0,
- (uchar*) table->field[0]->ptr, HA_WHOLE_KEY,
- HA_READ_KEY_EXACT))
+ if (table->file->index_read_idx_map(table->record[0], 0,
+ (uchar*) table->field[0]->ptr,
+ HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT))
{
/*
The following should never happen as we first check the in memory
@@ -5015,9 +5020,9 @@ static int handle_grant_table(TABLE_LIST *tables, uint table_no, bool drop,
table->key_info->key_part[1].store_length);
key_copy(user_key, table->record[0], table->key_info, key_prefix_length);
- if ((error= table->file->index_read_idx(table->record[0], 0,
- user_key, (key_part_map)3,
- HA_READ_KEY_EXACT)))
+ if ((error= table->file->index_read_idx_map(table->record[0], 0,
+ user_key, (key_part_map)3,
+ HA_READ_KEY_EXACT)))
{
if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
{
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 6a082ae3c8b..729a41013c0 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -2704,14 +2704,17 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup)
pthread_mutex_t LOCK_xid_cache;
HASH xid_cache;
-static uchar *xid_get_hash_key(const uchar *ptr, size_t *length,
+extern "C" uchar *xid_get_hash_key(const uchar *, size_t *, my_bool);
+extern "C" void xid_free_hash(void *);
+
+uchar *xid_get_hash_key(const uchar *ptr, size_t *length,
my_bool not_used __attribute__((unused)))
{
*length=((XID_STATE*)ptr)->xid.key_length();
return ((XID_STATE*)ptr)->xid.key();
}
-static void xid_free_hash (void *ptr)
+void xid_free_hash(void *ptr)
{
if (!((XID_STATE*)ptr)->in_thd)
my_free((uchar*)ptr, MYF(0));
@@ -3245,13 +3248,13 @@ int THD::binlog_flush_pending_rows_event(bool stmt_end)
RETURN VALUE
Error code, or 0 if no error.
*/
-int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query,
+int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
ulong query_len, bool is_trans, bool suppress_use,
THD::killed_state killed_status_arg)
{
DBUG_ENTER("THD::binlog_query");
- DBUG_PRINT("enter", ("qtype=%d, query='%s'", qtype, query));
- DBUG_ASSERT(query && mysql_bin_log.is_open());
+ DBUG_PRINT("enter", ("qtype: %d query: '%s'", qtype, query_arg));
+ DBUG_ASSERT(query_arg && mysql_bin_log.is_open());
/*
If we are not in prelocked mode, mysql_unlock_tables() will be
@@ -3307,7 +3310,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query,
flush the pending rows event if necessary.
*/
{
- Query_log_event qinfo(this, query, query_len, is_trans, suppress_use,
+ Query_log_event qinfo(this, query_arg, query_len, is_trans, suppress_use,
killed_status_arg);
qinfo.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
/*
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 368d9758b29..b4135511763 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1316,10 +1316,10 @@ public:
mode, row-based binlogging is used for such cases where two
auto_increment columns are inserted.
*/
- inline void record_first_successful_insert_id_in_cur_stmt(ulonglong id)
+ inline void record_first_successful_insert_id_in_cur_stmt(ulonglong id_arg)
{
if (first_successful_insert_id_in_cur_stmt == 0)
- first_successful_insert_id_in_cur_stmt= id;
+ first_successful_insert_id_in_cur_stmt= id_arg;
}
inline ulonglong read_first_successful_insert_id_in_prev_stmt(void)
{
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 575db5b80f7..910f4216452 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -59,8 +59,10 @@ typedef struct my_dblock_st
lock_db key.
*/
-static uchar* lock_db_get_key(my_dblock_t *ptr, size_t *length,
- my_bool not_used __attribute__((unused)))
+extern "C" uchar* lock_db_get_key(my_dblock_t *, size_t *, my_bool not_used);
+
+uchar* lock_db_get_key(my_dblock_t *ptr, size_t *length,
+ my_bool not_used __attribute__((unused)))
{
*length= ptr->name_length;
return (uchar*) ptr->name;
@@ -71,7 +73,9 @@ static uchar* lock_db_get_key(my_dblock_t *ptr, size_t *length,
Free lock_db hash element.
*/
-static void lock_db_free_element(void *ptr)
+extern "C" void lock_db_free_element(void *ptr);
+
+void lock_db_free_element(void *ptr)
{
my_free(ptr, MYF(0));
}
@@ -155,8 +159,11 @@ typedef struct my_dbopt_st
Function we use in the creation of our hash to get key.
*/
-static uchar* dboptions_get_key(my_dbopt_t *opt, size_t *length,
- my_bool not_used __attribute__((unused)))
+extern "C" uchar* dboptions_get_key(my_dbopt_t *opt, size_t *length,
+ my_bool not_used);
+
+uchar* dboptions_get_key(my_dbopt_t *opt, size_t *length,
+ my_bool not_used __attribute__((unused)))
{
*length= opt->name_length;
return (uchar*) opt->name;
@@ -182,7 +189,9 @@ static inline void write_to_binlog(THD *thd, char *query, uint q_len,
Function to free dboptions hash element
*/
-static void free_dbopt(void *dbopt)
+extern "C" void free_dbopt(void *dbopt);
+
+void free_dbopt(void *dbopt)
{
my_free((uchar*) dbopt, MYF(0));
}
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 7d8fc119cf9..e3ee978b964 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -753,7 +753,7 @@ void multi_delete::send_error(uint errcode,const char *err)
int multi_delete::do_deletes()
{
- int local_error= 0, counter= 0, error;
+ int local_error= 0, counter= 0, tmp_error;
bool will_batch;
DBUG_ENTER("do_deletes");
DBUG_ASSERT(do_delete);
@@ -806,11 +806,11 @@ int multi_delete::do_deletes()
break;
}
}
- if (will_batch && (error= table->file->end_bulk_delete()))
+ if (will_batch && (tmp_error= table->file->end_bulk_delete()))
{
if (!local_error)
{
- local_error= error;
+ local_error= tmp_error;
table->file->print_error(local_error,MYF(0));
}
}
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index 300ec7f3c62..0e556f4c551 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -541,8 +541,8 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
table->file->ha_index_or_rnd_end();
table->file->ha_index_init(keyno, 1);
key_copy(key, table->record[0], table->key_info + keyno, key_len);
- error= table->file->index_read(table->record[0],
- key, keypart_map, ha_rkey_mode);
+ error= table->file->index_read_map(table->record[0],
+ key, keypart_map, ha_rkey_mode);
mode=rkey_to_rnext[(int)ha_rkey_mode];
break;
}
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index 023bd1fec94..c1962c8c650 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -294,9 +294,9 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations,
rkey_id->store((longlong) key_id, TRUE);
rkey_id->get_key_image(buff, rkey_id->pack_length(), Field::itRAW);
- int key_res= relations->file->index_read(relations->record[0],
- buff, (key_part_map) 1,
- HA_READ_KEY_EXACT);
+ int key_res= relations->file->index_read_map(relations->record[0],
+ buff, (key_part_map) 1,
+ HA_READ_KEY_EXACT);
for ( ;
!key_res && key_id == (int16) rkey_id->val_int() ;
@@ -308,8 +308,8 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations,
field->store((longlong) topic_id, TRUE);
field->get_key_image(topic_id_buff, field->pack_length(), Field::itRAW);
- if (!topics->file->index_read(topics->record[0], topic_id_buff,
- (key_part_map)1, HA_READ_KEY_EXACT))
+ if (!topics->file->index_read_map(topics->record[0], topic_id_buff,
+ (key_part_map)1, HA_READ_KEY_EXACT))
{
memorize_variant_topic(thd,topics,count,find_fields,
names,name,description,example);
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 7272d09b575..86a1d15bab4 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1387,9 +1387,9 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
}
}
key_copy((uchar*) key,table->record[0],table->key_info+key_nr,0);
- if ((error=(table->file->index_read_idx(table->record[1],key_nr,
- (uchar*) key, HA_WHOLE_KEY,
- HA_READ_KEY_EXACT))))
+ if ((error=(table->file->index_read_idx_map(table->record[1],key_nr,
+ (uchar*) key, HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT))))
goto err;
}
if (info->handle_duplicates == DUP_UPDATE)
@@ -3552,13 +3552,13 @@ select_create::binlog_show_create_table(TABLE **tables, uint count)
char buf[2048];
String query(buf, sizeof(buf), system_charset_info);
int result;
- TABLE_LIST table_list;
+ TABLE_LIST tmp_table_list;
- memset(&table_list, 0, sizeof(table_list));
- table_list.table = *tables;
+ memset(&tmp_table_list, 0, sizeof(tmp_table_list));
+ tmp_table_list.table = *tables;
query.length(0); // Have to zero it since constructor doesn't
- result= store_create_info(thd, &table_list, &query, create_info);
+ result= store_create_info(thd, &tmp_table_list, &query, create_info);
DBUG_ASSERT(result == 0); /* store_create_info() always return 0 */
thd->binlog_query(THD::STMT_QUERY_TYPE,
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 055dc1e8424..7c4a3bc3a2f 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -2822,8 +2822,8 @@ void st_select_lex::fix_prepare_information(THD *thd, Item **conds,
SYNOPSIS
set_index_hint_type()
- type the kind of hints to be added from now on.
- clause the clause to use for hints to be added from now on.
+ type_arg The kind of hints to be added from now on.
+ clause The clause to use for hints to be added from now on.
DESCRIPTION
Used in filling up the tagged hints list.
@@ -2832,10 +2832,10 @@ void st_select_lex::fix_prepare_information(THD *thd, Item **conds,
Then the context variable index_hint_type can be reset to the
next hint type.
*/
-void st_select_lex::set_index_hint_type(enum index_hint_type type,
+void st_select_lex::set_index_hint_type(enum index_hint_type type_arg,
index_clause_map clause)
{
- current_index_hint_type= type;
+ current_index_hint_type= type_arg;
current_index_hint_clause= clause;
}
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 0d088063462..6da6517b0f5 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -1058,8 +1058,12 @@ err:
}
-static uchar *get_hash_key(const uchar *buff, size_t *length,
- my_bool not_used __attribute__((unused)))
+extern "C" uchar *get_plugin_hash_key(const uchar *, size_t *, my_bool);
+extern "C" uchar *get_bookmark_hash_key(const uchar *, size_t *, my_bool);
+
+
+uchar *get_plugin_hash_key(const uchar *buff, size_t *length,
+ my_bool not_used __attribute__((unused)))
{
struct st_plugin_int *plugin= (st_plugin_int *)buff;
*length= (uint)plugin->name.length;
@@ -1067,8 +1071,8 @@ static uchar *get_hash_key(const uchar *buff, size_t *length,
}
-static uchar *get_bookmark_hash_key(const uchar *buff, size_t *length,
- my_bool not_used __attribute__((unused)))
+uchar *get_bookmark_hash_key(const uchar *buff, size_t *length,
+ my_bool not_used __attribute__((unused)))
{
struct st_bookmark *var= (st_bookmark *)buff;
*length= var->name_len + 1;
@@ -1115,7 +1119,7 @@ int plugin_init(int *argc, char **argv, int flags)
for (i= 0; i < MYSQL_MAX_PLUGIN_TYPE_NUM; i++)
{
if (hash_init(&plugin_hash[i], system_charset_info, 16, 0, 0,
- get_hash_key, NULL, HASH_UNIQUE))
+ get_plugin_hash_key, NULL, HASH_UNIQUE))
goto err;
}
@@ -1702,9 +1706,10 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name)
table->use_all_columns();
table->field[0]->store(name->str, name->length, system_charset_info);
- if (! table->file->index_read_idx(table->record[0], 0,
- (uchar *)table->field[0]->ptr, HA_WHOLE_KEY,
- HA_READ_KEY_EXACT))
+ if (! table->file->index_read_idx_map(table->record[0], 0,
+ (uchar *)table->field[0]->ptr,
+ HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT))
{
int error;
if ((error= table->file->ha_delete_row(table->record[0])))
@@ -2769,8 +2774,10 @@ static void plugin_opt_set_limits(struct my_option *options,
options->arg_type= OPT_ARG;
}
+extern "C" my_bool get_one_plugin_option(int optid, const struct my_option *,
+ char *);
-static my_bool get_one_option(int optid __attribute__((unused)),
+my_bool get_one_plugin_option(int optid __attribute__((unused)),
const struct my_option *opt,
char *argument)
{
@@ -3078,7 +3085,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
DBUG_RETURN(-1);
}
- error= handle_options(argc, &argv, opts, get_one_option);
+ error= handle_options(argc, &argv, opts, get_one_plugin_option);
(*argc)++; /* add back one for the program name */
if (error)
@@ -3140,7 +3147,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
DBUG_RETURN(0);
}
- if (enabled_saved)
+ if (enabled_saved && global_system_variables.log_warnings)
sql_print_information("Plugin '%s' disabled by command line option",
tmp->name.str);
DBUG_RETURN(1);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index c1c3999bc8e..7cd5d1be8bf 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -11153,10 +11153,10 @@ int safe_index_read(JOIN_TAB *tab)
{
int error;
TABLE *table= tab->table;
- if ((error=table->file->index_read(table->record[0],
- tab->ref.key_buff,
- make_prev_keypart_map(tab->ref.key_parts),
- HA_READ_KEY_EXACT)))
+ if ((error=table->file->index_read_map(table->record[0],
+ tab->ref.key_buff,
+ make_prev_keypart_map(tab->ref.key_parts),
+ HA_READ_KEY_EXACT)))
return report_error(table, error);
return 0;
}
@@ -11292,10 +11292,10 @@ join_read_const(JOIN_TAB *tab)
error=HA_ERR_KEY_NOT_FOUND;
else
{
- error=table->file->index_read_idx(table->record[0],tab->ref.key,
- (uchar*) tab->ref.key_buff,
- make_prev_keypart_map(tab->ref.key_parts),
- HA_READ_KEY_EXACT);
+ error=table->file->index_read_idx_map(table->record[0],tab->ref.key,
+ (uchar*) tab->ref.key_buff,
+ make_prev_keypart_map(tab->ref.key_parts),
+ HA_READ_KEY_EXACT);
}
if (error)
{
@@ -11336,10 +11336,10 @@ join_read_key(JOIN_TAB *tab)
table->status=STATUS_NOT_FOUND;
return -1;
}
- error=table->file->index_read(table->record[0],
- tab->ref.key_buff,
- make_prev_keypart_map(tab->ref.key_parts),
- HA_READ_KEY_EXACT);
+ error=table->file->index_read_map(table->record[0],
+ tab->ref.key_buff,
+ make_prev_keypart_map(tab->ref.key_parts),
+ HA_READ_KEY_EXACT);
if (error && error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
return report_error(table, error);
}
@@ -11365,10 +11365,10 @@ join_read_always_key(JOIN_TAB *tab)
}
if (cp_buffer_from_ref(tab->join->thd, table, &tab->ref))
return -1;
- if ((error=table->file->index_read(table->record[0],
- tab->ref.key_buff,
- make_prev_keypart_map(tab->ref.key_parts),
- HA_READ_KEY_EXACT)))
+ if ((error=table->file->index_read_map(table->record[0],
+ tab->ref.key_buff,
+ make_prev_keypart_map(tab->ref.key_parts),
+ HA_READ_KEY_EXACT)))
{
if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
return report_error(table, error);
@@ -11393,8 +11393,9 @@ join_read_last_key(JOIN_TAB *tab)
table->file->ha_index_init(tab->ref.key, tab->sorted);
if (cp_buffer_from_ref(tab->join->thd, table, &tab->ref))
return -1;
- if ((error=table->file->index_read_last(table->record[0],
- tab->ref.key_buff, make_prev_keypart_map(tab->ref.key_parts))))
+ if ((error=table->file->index_read_last_map(table->record[0],
+ tab->ref.key_buff,
+ make_prev_keypart_map(tab->ref.key_parts))))
{
if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
return report_error(table, error);
@@ -11934,9 +11935,10 @@ end_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
if (item->maybe_null)
group->buff[-1]= (char) group->field->is_null();
}
- if (!table->file->index_read(table->record[1],
- join->tmp_table_param.group_buff, HA_WHOLE_KEY,
- HA_READ_KEY_EXACT))
+ if (!table->file->index_read_map(table->record[1],
+ join->tmp_table_param.group_buff,
+ HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT))
{ /* Update old record */
restore_record(table,record[1]);
update_tmptable_sum_func(join->sum_funcs,table);
diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc
index 911372d5f4e..a780c561ffe 100644
--- a/sql/sql_servers.cc
+++ b/sql/sql_servers.cc
@@ -516,9 +516,10 @@ int insert_server_record(TABLE *table, FOREIGN_SERVER *server)
system_charset_info);
/* read index until record is that specified in server_name */
- if ((error= table->file->index_read_idx(table->record[0], 0,
- (uchar *)table->field[0]->ptr, HA_WHOLE_KEY,
- HA_READ_KEY_EXACT)))
+ if ((error= table->file->index_read_idx_map(table->record[0], 0,
+ (uchar *)table->field[0]->ptr,
+ HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT)))
{
/* if not found, err */
if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
@@ -858,9 +859,10 @@ update_server_record(TABLE *table, FOREIGN_SERVER *server)
server->server_name_length,
system_charset_info);
- if ((error= table->file->index_read_idx(table->record[0], 0,
- (uchar *)table->field[0]->ptr, ~(longlong)0,
- HA_READ_KEY_EXACT)))
+ if ((error= table->file->index_read_idx_map(table->record[0], 0,
+ (uchar *)table->field[0]->ptr,
+ ~(longlong)0,
+ HA_READ_KEY_EXACT)))
{
if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
table->file->print_error(error, MYF(0));
@@ -914,9 +916,10 @@ delete_server_record(TABLE *table,
/* set the field that's the PK to the value we're looking for */
table->field[0]->store(server_name, server_name_length, system_charset_info);
- if ((error= table->file->index_read_idx(table->record[0], 0,
- (uchar *)table->field[0]->ptr, HA_WHOLE_KEY,
- HA_READ_KEY_EXACT)))
+ if ((error= table->file->index_read_idx_map(table->record[0], 0,
+ (uchar *)table->field[0]->ptr,
+ HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT)))
{
if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
table->file->print_error(error, MYF(0));
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 4a863df64d1..a9465a3f0d5 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1347,6 +1347,11 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
packet->append(STRING_WITH_LEN(" ROW_FORMAT="));
packet->append(ha_row_type[(uint) share->row_type]);
}
+ if (share->transactional != HA_CHOICE_UNDEF)
+ {
+ packet->append(STRING_WITH_LEN(" TRANSACTIONAL="));
+ packet->append(share->transactional == HA_CHOICE_YES ? "1" : "0", 1);
+ }
if (table->s->key_block_size)
{
char *end;
@@ -2899,7 +2904,7 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
case ROW_TYPE_COMPACT:
tmp_buff= "Compact";
break;
- case ROW_TYPE_PAGES:
+ case ROW_TYPE_PAGE:
tmp_buff= "Paged";
break;
}
@@ -2983,6 +2988,12 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
ptr=strxmov(ptr, " row_format=",
ha_row_type[(uint) share->row_type],
NullS);
+ if (share->transactional != HA_CHOICE_UNDEF)
+ {
+ ptr= strxmov(ptr, " TRANSACTIONAL=",
+ (share->transactional == HA_CHOICE_YES ? "1" : "0"),
+ NullS);
+ }
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (show_table->s->db_type() == partition_hton &&
show_table->part_info != NULL &&
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 6c7dea6bf22..a8eb7360339 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -795,10 +795,8 @@ copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
const uchar *from_end= (const uchar*) from+from_length;
char *to_start= to;
uchar *to_end= (uchar*) to+to_length;
- int (*mb_wc)(struct charset_info_st *, my_wc_t *, const uchar *,
- const uchar *) = from_cs->cset->mb_wc;
- int (*wc_mb)(struct charset_info_st *, my_wc_t, uchar *s, uchar *e)=
- to_cs->cset->wc_mb;
+ my_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc;
+ my_charset_conv_wc_mb wc_mb= to_cs->cset->wc_mb;
uint error_count= 0;
while (1)
@@ -940,10 +938,8 @@ well_formed_copy_nchars(CHARSET_INFO *to_cs,
{
int cnvres;
my_wc_t wc;
- int (*mb_wc)(struct charset_info_st *, my_wc_t *,
- const uchar *, const uchar *)= from_cs->cset->mb_wc;
- int (*wc_mb)(struct charset_info_st *, my_wc_t,
- uchar *s, uchar *e)= to_cs->cset->wc_mb;
+ my_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc;
+ my_charset_conv_wc_mb wc_mb= to_cs->cset->wc_mb;
const uchar *from_end= (const uchar*) from + from_length;
uchar *to_end= (uchar*) to + to_length;
char *to_start= to;
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 9746080e9cd..345607810a9 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -5279,6 +5279,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
}
if (!(used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE))
create_info->key_block_size= table->s->key_block_size;
+ if (!(used_fields & HA_CREATE_USED_TRANSACTIONAL))
+ create_info->transactional= table->s->transactional;
if (!create_info->tablespace && create_info->storage_media != HA_SM_MEMORY)
{
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 10bb7844d88..19582af38f4 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -551,9 +551,10 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
goto err;
table->use_all_columns();
table->field[0]->store(exact_name_str, exact_name_len, &my_charset_bin);
- if (!table->file->index_read_idx(table->record[0], 0,
- (uchar*) table->field[0]->ptr, HA_WHOLE_KEY,
- HA_READ_KEY_EXACT))
+ if (!table->file->index_read_idx_map(table->record[0], 0,
+ (uchar*) table->field[0]->ptr,
+ HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT))
{
int error;
if ((error = table->file->ha_delete_row(table->record[0])))
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 81bb1c2dae9..5453f783398 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -857,6 +857,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token OUT_SYM /* SQL-2003-R */
%token OWNER_SYM
%token PACK_KEYS_SYM
+%token PAGE_SYM
%token PARAM_MARKER
%token PARSER_SYM
%token PARTIAL /* SQL-2003-N */
@@ -1009,6 +1010,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token TO_SYM /* SQL-2003-R */
%token TRAILING /* SQL-2003-R */
%token TRANSACTION_SYM
+%token TRANSACTIONAL_SYM
%token TRIGGERS_SYM
%token TRIGGER_SYM /* SQL-2003-R */
%token TRIM /* SQL-2003-N */
@@ -4364,6 +4366,12 @@ create_table_option:
Lex->create_info.used_fields|= HA_CREATE_USED_KEY_BLOCK_SIZE;
Lex->create_info.key_block_size= $3;
}
+ | TRANSACTIONAL_SYM opt_equal ulong_num
+ {
+ Lex->create_info.used_fields|= HA_CREATE_USED_TRANSACTIONAL;
+ Lex->create_info.transactional= ($3 != 0 ? HA_CHOICE_YES :
+ HA_CHOICE_NO);
+ }
;
default_charset:
@@ -4442,7 +4450,8 @@ row_types:
| DYNAMIC_SYM { $$= ROW_TYPE_DYNAMIC; }
| COMPRESSED_SYM { $$= ROW_TYPE_COMPRESSED; }
| REDUNDANT_SYM { $$= ROW_TYPE_REDUNDANT; }
- | COMPACT_SYM { $$= ROW_TYPE_COMPACT; };
+ | COMPACT_SYM { $$= ROW_TYPE_COMPACT; }
+ | PAGE_SYM { $$= ROW_TYPE_PAGE; };
merge_insert_types:
NO_SYM { $$= MERGE_INSERT_DISABLED; }
@@ -10034,6 +10043,7 @@ keyword_sp:
| ONE_SHOT_SYM {}
| ONE_SYM {}
| PACK_KEYS_SYM {}
+ | PAGE_SYM {}
| PARTIAL {}
| PARTITIONING_SYM {}
| PARTITIONS_SYM {}
@@ -10103,6 +10113,7 @@ keyword_sp:
| TEXT_SYM {}
| THAN_SYM {}
| TRANSACTION_SYM {}
+ | TRANSACTIONAL_SYM {}
| TRIGGERS_SYM {}
| TIMESTAMP {}
| TIMESTAMP_ADD {}
diff --git a/sql/strfunc.cc b/sql/strfunc.cc
index 9ffc5fd127f..c03365cfc2b 100644
--- a/sql/strfunc.cc
+++ b/sql/strfunc.cc
@@ -265,10 +265,8 @@ uint strconvert(CHARSET_INFO *from_cs, const char *from,
my_wc_t wc;
char *to_start= to;
uchar *to_end= (uchar*) to + to_length - 1;
- int (*mb_wc)(struct charset_info_st *, my_wc_t *, const uchar *,
- const uchar *)= from_cs->cset->mb_wc;
- int (*wc_mb)(struct charset_info_st *, my_wc_t, uchar *s, uchar *e)=
- to_cs->cset->wc_mb;
+ my_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc;
+ my_charset_conv_wc_mb wc_mb= to_cs->cset->wc_mb;
uint error_count= 0;
while (1)
diff --git a/sql/table.cc b/sql/table.cc
index 7be78e0be98..e6c47a89d21 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -51,11 +51,13 @@ inline bool is_system_table_name(const char *name, uint length);
Object_creation_ctx *Object_creation_ctx::set_n_backup(THD *thd)
{
- Object_creation_ctx *backup_ctx= create_backup_ctx(thd);
+ Object_creation_ctx *backup_ctx;
+ DBUG_ENTER("Object_creation_ctx::set_n_backup");
+ backup_ctx= create_backup_ctx(thd);
change_env(thd);
- return backup_ctx;
+ DBUG_RETURN(backup_ctx);
}
void Object_creation_ctx::restore_env(THD *thd, Object_creation_ctx *backup_ctx)
@@ -84,7 +86,7 @@ Default_object_creation_ctx::Default_object_creation_ctx(
{ }
Object_creation_ctx *
-Default_object_creation_ctx::create_backup_ctx(THD *thd)
+Default_object_creation_ctx::create_backup_ctx(THD *thd) const
{
return new Default_object_creation_ctx(thd);
}
@@ -695,7 +697,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if (!head[32]) // New frm file in 3.23
{
share->avg_row_length= uint4korr(head+34);
- share-> row_type= (row_type) head[40];
+ share->transactional= (ha_choice) head[39];
+ share->row_type= (row_type) head[40];
share->table_charset= get_charset((uint) head[38],MYF(0));
share->null_field_first= 1;
}
@@ -2417,6 +2420,7 @@ File create_frm(THD *thd, const char *name, const char *db,
int4store(fileinfo+34,create_info->avg_row_length);
fileinfo[38]= (create_info->default_table_charset ?
create_info->default_table_charset->number : 0);
+ fileinfo[39]= (uchar) create_info->transactional;
fileinfo[40]= (uchar) create_info->row_type;
/* Next few bytes were for RAID support */
fileinfo[41]= 0;
@@ -4548,11 +4552,11 @@ Item_subselect *TABLE_LIST::containing_subselect()
FALSE no errors found
TRUE found and reported an error.
*/
-bool TABLE_LIST::process_index_hints(TABLE *table)
+bool TABLE_LIST::process_index_hints(TABLE *tbl)
{
/* initialize the result variables */
- table->keys_in_use_for_query= table->keys_in_use_for_group_by=
- table->keys_in_use_for_order_by= table->s->keys_in_use;
+ tbl->keys_in_use_for_query= tbl->keys_in_use_for_group_by=
+ tbl->keys_in_use_for_order_by= tbl->s->keys_in_use;
/* index hint list processing */
if (index_hints)
@@ -4604,8 +4608,8 @@ bool TABLE_LIST::process_index_hints(TABLE *table)
Check if an index with the given name exists and get his offset in
the keys bitmask for the table
*/
- if (table->s->keynames.type_names == 0 ||
- (pos= find_type(&table->s->keynames, hint->key_name.str,
+ if (tbl->s->keynames.type_names == 0 ||
+ (pos= find_type(&tbl->s->keynames, hint->key_name.str,
hint->key_name.length, 1)) <= 0)
{
my_error(ER_KEY_DOES_NOT_EXITS, MYF(0), hint->key_name.str, alias);
@@ -4641,7 +4645,7 @@ bool TABLE_LIST::process_index_hints(TABLE *table)
!index_order[INDEX_HINT_FORCE].is_clear_all() ||
!index_group[INDEX_HINT_FORCE].is_clear_all())
{
- table->force_index= TRUE;
+ tbl->force_index= TRUE;
index_join[INDEX_HINT_USE].merge(index_join[INDEX_HINT_FORCE]);
index_order[INDEX_HINT_USE].merge(index_order[INDEX_HINT_FORCE]);
index_group[INDEX_HINT_USE].merge(index_group[INDEX_HINT_FORCE]);
@@ -4649,20 +4653,20 @@ bool TABLE_LIST::process_index_hints(TABLE *table)
/* apply USE INDEX */
if (!index_join[INDEX_HINT_USE].is_clear_all() || have_empty_use_join)
- table->keys_in_use_for_query.intersect(index_join[INDEX_HINT_USE]);
+ tbl->keys_in_use_for_query.intersect(index_join[INDEX_HINT_USE]);
if (!index_order[INDEX_HINT_USE].is_clear_all() || have_empty_use_order)
- table->keys_in_use_for_order_by.intersect (index_order[INDEX_HINT_USE]);
+ tbl->keys_in_use_for_order_by.intersect (index_order[INDEX_HINT_USE]);
if (!index_group[INDEX_HINT_USE].is_clear_all() || have_empty_use_group)
- table->keys_in_use_for_group_by.intersect (index_group[INDEX_HINT_USE]);
+ tbl->keys_in_use_for_group_by.intersect (index_group[INDEX_HINT_USE]);
/* apply IGNORE INDEX */
- table->keys_in_use_for_query.subtract (index_join[INDEX_HINT_IGNORE]);
- table->keys_in_use_for_order_by.subtract (index_order[INDEX_HINT_IGNORE]);
- table->keys_in_use_for_group_by.subtract (index_group[INDEX_HINT_IGNORE]);
+ tbl->keys_in_use_for_query.subtract (index_join[INDEX_HINT_IGNORE]);
+ tbl->keys_in_use_for_order_by.subtract (index_order[INDEX_HINT_IGNORE]);
+ tbl->keys_in_use_for_group_by.subtract (index_group[INDEX_HINT_IGNORE]);
}
/* make sure covering_keys don't include indexes disabled with a hint */
- table->covering_keys.intersect(table->keys_in_use_for_query);
+ tbl->covering_keys.intersect(tbl->keys_in_use_for_query);
return 0;
}
diff --git a/sql/table.h b/sql/table.h
index e46036f3ee9..ee2b78bde1a 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -310,6 +310,7 @@ typedef struct st_table_share
}
enum row_type row_type; /* How rows are stored */
enum tmp_table_type tmp_table;
+ enum ha_choice transactional;
uint ref_count; /* How many TABLE objects uses this */
uint open_count; /* Number of tables in open list */
diff --git a/sql/tztime.cc b/sql/tztime.cc
index 14192d06978..9eb38e97827 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -1854,8 +1854,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
*/
(void)table->file->ha_index_init(0, 1);
- if (table->file->index_read(table->record[0], table->field[0]->ptr,
- HA_WHOLE_KEY, HA_READ_KEY_EXACT))
+ if (table->file->index_read_map(table->record[0], table->field[0]->ptr,
+ HA_WHOLE_KEY, HA_READ_KEY_EXACT))
{
#ifdef EXTRA_DEBUG
/*
@@ -1881,8 +1881,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
table->field[0]->store((longlong) tzid, TRUE);
(void)table->file->ha_index_init(0, 1);
- if (table->file->index_read(table->record[0], table->field[0]->ptr,
- HA_WHOLE_KEY, HA_READ_KEY_EXACT))
+ if (table->file->index_read_map(table->record[0], table->field[0]->ptr,
+ HA_WHOLE_KEY, HA_READ_KEY_EXACT))
{
sql_print_error("Can't find description of time zone '%u'", tzid);
goto end;
@@ -1908,8 +1908,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
table->field[0]->store((longlong) tzid, TRUE);
(void)table->file->ha_index_init(0, 1);
- res= table->file->index_read(table->record[0], table->field[0]->ptr,
- (key_part_map)1, HA_READ_KEY_EXACT);
+ res= table->file->index_read_map(table->record[0], table->field[0]->ptr,
+ (key_part_map)1, HA_READ_KEY_EXACT);
while (!res)
{
ttid= (uint)table->field[1]->val_int();
@@ -1979,8 +1979,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
table->field[0]->store((longlong) tzid, TRUE);
(void)table->file->ha_index_init(0, 1);
- res= table->file->index_read(table->record[0], table->field[0]->ptr,
- (key_part_map)1, HA_READ_KEY_EXACT);
+ res= table->file->index_read_map(table->record[0], table->field[0]->ptr,
+ (key_part_map)1, HA_READ_KEY_EXACT);
while (!res)
{
ttime= (my_time_t)table->field[1]->val_int();
diff --git a/storage/archive/archive_reader.c b/storage/archive/archive_reader.c
index d3c11f1dce2..bfc01073161 100644
--- a/storage/archive/archive_reader.c
+++ b/storage/archive/archive_reader.c
@@ -263,7 +263,7 @@ int main(int argc, char *argv[])
frm_file= my_open(argv[1], O_CREAT|O_RDWR|O_BINARY, MYF(0));
ptr= (char *)my_malloc(sizeof(char) * reader_handle.frm_length, MYF(0));
azread_frm(&reader_handle, ptr);
- my_write(frm_file, ptr, reader_handle.frm_length, MYF(0));
+ my_write(frm_file, (uchar*) ptr, reader_handle.frm_length, MYF(0));
my_close(frm_file, MYF(0));
my_free(ptr, MYF(0));
}
diff --git a/storage/archive/azio.c b/storage/archive/azio.c
index ee2fee34953..f6b1a6e733f 100644
--- a/storage/archive/azio.c
+++ b/storage/archive/azio.c
@@ -190,7 +190,8 @@ void write_header(azio_stream *s)
*(ptr + AZ_DIRTY_POS)= (unsigned char)s->dirty; /* Start of Data Block Index Block */
/* Always begin at the begining, and end there as well */
- my_pwrite(s->file, buffer, AZHEADER_SIZE + AZMETA_BUFFER_SIZE, 0, MYF(0));
+ my_pwrite(s->file, (uchar*) buffer, AZHEADER_SIZE + AZMETA_BUFFER_SIZE, 0,
+ MYF(0));
}
/* ===========================================================================
@@ -821,7 +822,7 @@ int azwrite_frm(azio_stream *s, char *blob, unsigned int length)
s->frm_length= length;
s->start+= length;
- my_pwrite(s->file, blob, s->frm_length, s->frm_start_pos, MYF(0));
+ my_pwrite(s->file, (uchar*) blob, s->frm_length, s->frm_start_pos, MYF(0));
write_header(s);
my_seek(s->file, 0, MY_SEEK_END, MYF(0));
@@ -831,7 +832,7 @@ int azwrite_frm(azio_stream *s, char *blob, unsigned int length)
int azread_frm(azio_stream *s, char *blob)
{
- my_pread(s->file, blob, s->frm_length, s->frm_start_pos, MYF(0));
+ my_pread(s->file, (uchar*) blob, s->frm_length, s->frm_start_pos, MYF(0));
return 0;
}
@@ -852,7 +853,8 @@ int azwrite_comment(azio_stream *s, char *blob, unsigned int length)
s->comment_length= length;
s->start+= length;
- my_pwrite(s->file, blob, s->comment_length, s->comment_start_pos, MYF(0));
+ my_pwrite(s->file, (uchar*) blob, s->comment_length, s->comment_start_pos,
+ MYF(0));
write_header(s);
my_seek(s->file, 0, MY_SEEK_END, MYF(0));
@@ -862,7 +864,8 @@ int azwrite_comment(azio_stream *s, char *blob, unsigned int length)
int azread_comment(azio_stream *s, char *blob)
{
- my_pread(s->file, blob, s->comment_length, s->comment_start_pos, MYF(0));
+ my_pread(s->file, (uchar*) blob, s->comment_length, s->comment_start_pos,
+ MYF(0));
return 0;
}
diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc
index 03da7808948..4e12e9f0ee7 100644
--- a/storage/blackhole/ha_blackhole.cc
+++ b/storage/blackhole/ha_blackhole.cc
@@ -184,8 +184,8 @@ THR_LOCK_DATA **ha_blackhole::store_lock(THD *thd,
}
-int ha_blackhole::index_read(uchar * buf, const uchar * key,
- key_part_map keypart_map,
+int ha_blackhole::index_read_map(uchar * buf, const uchar * key,
+ key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
DBUG_ENTER("ha_blackhole::index_read");
@@ -193,7 +193,7 @@ int ha_blackhole::index_read(uchar * buf, const uchar * key,
}
-int ha_blackhole::index_read_idx(uchar * buf, uint idx, const uchar * key,
+int ha_blackhole::index_read_idx_map(uchar * buf, uint idx, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
@@ -202,8 +202,8 @@ int ha_blackhole::index_read_idx(uchar * buf, uint idx, const uchar * key,
}
-int ha_blackhole::index_read_last(uchar * buf, const uchar * key,
- key_part_map keypart_map)
+int ha_blackhole::index_read_last_map(uchar * buf, const uchar * key,
+ key_part_map keypart_map)
{
DBUG_ENTER("ha_blackhole::index_read_last");
DBUG_RETURN(HA_ERR_END_OF_FILE);
diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h
index f51159b768e..d5a0d08926c 100644
--- a/storage/blackhole/ha_blackhole.h
+++ b/storage/blackhole/ha_blackhole.h
@@ -76,11 +76,12 @@ public:
int rnd_init(bool scan);
int rnd_next(uchar *buf);
int rnd_pos(uchar * buf, uchar *pos);
- int index_read(uchar * buf, const uchar * key, key_part_map keypart_map,
- enum ha_rkey_function find_flag);
- int index_read_idx(uchar * buf, uint idx, const uchar * key,
- key_part_map keypart_map, enum ha_rkey_function find_flag);
- int index_read_last(uchar * buf, const uchar * key, key_part_map keypart_map);
+ int index_read_map(uchar * buf, const uchar * key, key_part_map keypart_map,
+ enum ha_rkey_function find_flag);
+ int index_read_idx_map(uchar * buf, uint idx, const uchar * key,
+ key_part_map keypart_map,
+ enum ha_rkey_function find_flag);
+ int index_read_last_map(uchar * buf, const uchar * key, key_part_map keypart_map);
int index_next(uchar * buf);
int index_prev(uchar * buf);
int index_first(uchar * buf);
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index 00ca2a6c07f..9a7781e017d 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -68,6 +68,10 @@ static int free_share(TINA_SHARE *share);
static int read_meta_file(File meta_file, ha_rows *rows);
static int write_meta_file(File meta_file, ha_rows rows, bool dirty);
+extern "C" void tina_get_status(void* param, int concurrent_insert);
+extern "C" void tina_update_status(void* param);
+extern "C" my_bool tina_check_status(void* param);
+
/* Stuff for shares */
pthread_mutex_t tina_mutex;
static HASH tina_open_tables;
diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc
index 06efc727837..65e28da1fe3 100644
--- a/storage/example/ha_example.cc
+++ b/storage/example/ha_example.cc
@@ -420,10 +420,10 @@ int ha_example::delete_row(const uchar *buf)
index.
*/
-int ha_example::index_read(uchar *buf, const uchar *key,
- key_part_map keypart_map __attribute__((unused)),
- enum ha_rkey_function find_flag
- __attribute__((unused)))
+int ha_example::index_read_map(uchar *buf, const uchar *key,
+ key_part_map keypart_map __attribute__((unused)),
+ enum ha_rkey_function find_flag
+ __attribute__((unused)))
{
DBUG_ENTER("ha_example::index_read");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
diff --git a/storage/example/ha_example.h b/storage/example/ha_example.h
index 25a22cc94c5..ec3987ced5d 100644
--- a/storage/example/ha_example.h
+++ b/storage/example/ha_example.h
@@ -195,8 +195,8 @@ public:
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
- int index_read(uchar *buf, const uchar *key,
- key_part_map keypart_map, enum ha_rkey_function find_flag);
+ int index_read_map(uchar *buf, const uchar *key,
+ key_part_map keypart_map, enum ha_rkey_function find_flag);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc
index 2e7c47e17b4..4934792de80 100644
--- a/storage/heap/ha_heap.cc
+++ b/storage/heap/ha_heap.cc
@@ -270,8 +270,9 @@ int ha_heap::delete_row(const uchar * buf)
return res;
}
-int ha_heap::index_read(uchar * buf, const uchar * key, key_part_map keypart_map,
- enum ha_rkey_function find_flag)
+int ha_heap::index_read_map(uchar *buf, const uchar *key,
+ key_part_map keypart_map,
+ enum ha_rkey_function find_flag)
{
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_key_count);
@@ -280,7 +281,8 @@ int ha_heap::index_read(uchar * buf, const uchar * key, key_part_map keypart_map
return error;
}
-int ha_heap::index_read_last(uchar *buf, const uchar *key, key_part_map keypart_map)
+int ha_heap::index_read_last_map(uchar *buf, const uchar *key,
+ key_part_map keypart_map)
{
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_key_count);
@@ -290,9 +292,9 @@ int ha_heap::index_read_last(uchar *buf, const uchar *key, key_part_map keypart_
return error;
}
-int ha_heap::index_read_idx(uchar * buf, uint index, const uchar * key,
- key_part_map keypart_map,
- enum ha_rkey_function find_flag)
+int ha_heap::index_read_idx_map(uchar *buf, uint index, const uchar *key,
+ key_part_map keypart_map,
+ enum ha_rkey_function find_flag)
{
ha_statistic_increment(&SSV::ha_read_key_count);
int error = heap_rkey(file, buf, index, key, keypart_map, find_flag);
diff --git a/storage/heap/ha_heap.h b/storage/heap/ha_heap.h
index 7db775ca15a..5c5ad43658e 100644
--- a/storage/heap/ha_heap.h
+++ b/storage/heap/ha_heap.h
@@ -79,11 +79,12 @@ public:
ulonglong nb_desired_values,
ulonglong *first_value,
ulonglong *nb_reserved_values);
- int index_read(uchar * buf, const uchar * key, key_part_map keypart_map,
- enum ha_rkey_function find_flag);
- int index_read_last(uchar *buf, const uchar *key, key_part_map keypart_map);
- int index_read_idx(uchar * buf, uint index, const uchar * key,
- key_part_map keypart_map, enum ha_rkey_function find_flag);
+ int index_read_map(uchar * buf, const uchar * key, key_part_map keypart_map,
+ enum ha_rkey_function find_flag);
+ int index_read_last_map(uchar *buf, const uchar *key, key_part_map keypart_map);
+ int index_read_idx_map(uchar * buf, uint index, const uchar * key,
+ key_part_map keypart_map,
+ enum ha_rkey_function find_flag);
int index_next(uchar * buf);
int index_prev(uchar * buf);
int index_first(uchar * buf);
diff --git a/storage/heap/hp_test1.c b/storage/heap/hp_test1.c
index 24eea141ad9..b1b55098a78 100644
--- a/storage/heap/hp_test1.c
+++ b/storage/heap/hp_test1.c
@@ -32,7 +32,7 @@ int main(int argc, char **argv)
{
int i,j,error,deleted;
HP_INFO *file;
- char record[128],key[32];
+ uchar record[128],key[32];
const char *filename;
HP_KEYDEF keyinfo[10];
HA_KEYSEG keyseg[4];
@@ -65,12 +65,12 @@ int main(int argc, char **argv)
!(file= heap_open(filename, 2)))
goto err;
printf("- Writing records:s\n");
- strmov(record," ..... key ");
+ strmov((char*) record," ..... key ");
for (i=49 ; i>=1 ; i-=2 )
{
j=i%25 +1;
- sprintf(key,"%6d",j);
+ sprintf((char*) key,"%6d",j);
bmove(record+1,key,6);
error=heap_write(file,record);
if (heap_check_heap(file,0))
@@ -92,18 +92,18 @@ int main(int argc, char **argv)
for (i=1 ; i<=10 ; i++)
{
if (i == remove_ant) { VOID(heap_close(file)) ; return (0) ; }
- sprintf(key,"%6d",(j=(int) ((rand() & 32767)/32767.*25)));
+ sprintf((char*) key,"%6d",(j=(int) ((rand() & 32767)/32767.*25)));
if ((error = heap_rkey(file,record,0,key,6,HA_READ_KEY_EXACT)))
{
if (verbose || (flags[j] == 1 ||
(error && my_errno != HA_ERR_KEY_NOT_FOUND)))
- printf("key: %s rkey: %3d my_errno: %3d\n",key,error,my_errno);
+ printf("key: %s rkey: %3d my_errno: %3d\n",(char*) key,error,my_errno);
}
else
{
error=heap_delete(file,record);
if (error || verbose)
- printf("key: %s delete: %d my_errno: %d\n",key,error,my_errno);
+ printf("key: %s delete: %d my_errno: %d\n",(char*) key,error,my_errno);
flags[j]=0;
if (! error)
deleted++;
@@ -118,7 +118,7 @@ int main(int argc, char **argv)
printf("- Reading records with key\n");
for (i=1 ; i<=25 ; i++)
{
- sprintf(key,"%6d",i);
+ sprintf((char*) key,"%6d",i);
bmove(record+1,key,6);
my_errno=0;
error=heap_rkey(file,record,0,key,6,HA_READ_KEY_EXACT);
@@ -127,7 +127,7 @@ int main(int argc, char **argv)
(error && (flags[i] != 0 || my_errno != HA_ERR_KEY_NOT_FOUND)))
{
printf("key: %s rkey: %3d my_errno: %3d record: %s\n",
- key,error,my_errno,record+1);
+ (char*) key,error,my_errno,record+1);
}
}
@@ -150,7 +150,7 @@ int main(int argc, char **argv)
if (verbose || (error != 0 && error != HA_ERR_RECORD_DELETED))
{
printf("pos: %2d ni_rrnd: %3d my_errno: %3d record: %s\n",
- i-1,error,my_errno,record+1);
+ i-1,error,my_errno,(char*) record+1);
}
}
}
diff --git a/storage/heap/hp_test2.c b/storage/heap/hp_test2.c
index e2a8e2f6926..e57a554e5d9 100644
--- a/storage/heap/hp_test2.c
+++ b/storage/heap/hp_test2.c
@@ -43,7 +43,7 @@ static int reclength=39;
static int calc_check(uchar *buf,uint length);
-static void make_record(char *record, uint n1, uint n2, uint n3,
+static void make_record(uchar *record, uint n1, uint n2, uint n3,
const char *mark, uint count);
/* Main program */
@@ -56,7 +56,7 @@ int main(int argc, char *argv[])
int error;
ulong pos;
unsigned long key_check;
- char record[128],record2[128],record3[128],key[10];
+ uchar record[128],record2[128],record3[128],key[10];
const char *filename,*filename2;
HP_INFO *file,*file2;
HP_SHARE *tmp_share;
@@ -133,7 +133,7 @@ int main(int argc, char *argv[])
signal(SIGINT,endprog);
printf("- Writing records:s\n");
- strmov(record," ..... key");
+ strmov((char*) record," ..... key");
for (i=0 ; i < recant ; i++)
{
@@ -179,10 +179,10 @@ int main(int argc, char *argv[])
for (j=rnd(1000)+1 ; j>0 && key1[j] == 0 ; j--) ;
if (j != 0)
{
- sprintf(key,"%6d",j);
+ sprintf((char*) key,"%6d",j);
if (heap_rkey(file,record,0,key,6, HA_READ_KEY_EXACT))
{
- printf("can't find key1: \"%s\"\n",key);
+ printf("can't find key1: \"%s\"\n",(char*) key);
goto err;
}
#ifdef NOT_USED
@@ -192,13 +192,13 @@ int main(int argc, char *argv[])
#endif
if (heap_delete(file,record))
{
- printf("error: %d; can't delete record: \"%s\"\n", my_errno,record);
+ printf("error: %d; can't delete record: \"%s\"\n", my_errno,(char*) record);
goto err;
}
opt_delete++;
- key1[atoi(record+keyinfo[0].seg[0].start)]--;
- key3[atoi(record+keyinfo[2].seg[0].start)]=0;
- key_check-=atoi(record);
+ key1[atoi((char*) record+keyinfo[0].seg[0].start)]--;
+ key3[atoi((char*) record+keyinfo[2].seg[0].start)]=0;
+ key_check-=atoi((char*) record);
if (testflag == 2 && heap_check_heap(file,0))
{
puts("Heap keys crashed");
@@ -239,10 +239,10 @@ int main(int argc, char *argv[])
for (j=rnd(1000)+1 ; j>0 && key1[j] == 0 ; j--) ;
if (!key1[j])
continue;
- sprintf(key,"%6d",j);
+ sprintf((char*) key,"%6d",j);
if (heap_rkey(file,record,0,key,6, HA_READ_KEY_EXACT))
{
- printf("can't find key1: \"%s\"\n",key);
+ printf("can't find key1: \"%s\"\n",(char*) key);
goto err;
}
}
@@ -251,19 +251,20 @@ int main(int argc, char *argv[])
if (my_errno != HA_ERR_FOUND_DUPP_KEY || key3[n3] == 0)
{
printf("error: %d; can't update:\nFrom: \"%s\"\nTo: \"%s\"\n",
- my_errno,record,record2);
+ my_errno,(char*) record, (char*) record2);
goto err;
}
if (verbose)
- printf("Double key when tried to update:\nFrom: \"%s\"\nTo: \"%s\"\n",record,record2);
+ printf("Double key when tried to update:\nFrom: \"%s\"\nTo: \"%s\"\n",
+ (char*) record, (char*) record2);
}
else
{
- key1[atoi(record+keyinfo[0].seg[0].start)]--;
- key3[atoi(record+keyinfo[2].seg[0].start)]=0;
+ key1[atoi((char*) record+keyinfo[0].seg[0].start)]--;
+ key3[atoi((char*) record+keyinfo[2].seg[0].start)]=0;
key1[n1]++; key3[n3]=1;
update++;
- key_check=key_check-atoi(record)+n1;
+ key_check=key_check-atoi((char*) record)+n1;
}
if (testflag == 3 && heap_check_heap(file,0))
{
@@ -281,7 +282,7 @@ int main(int argc, char *argv[])
for (i=999, dupp_keys=found_key=0 ; i>0 ; i--)
{
if (key1[i] > dupp_keys) { dupp_keys=key1[i]; found_key=i; }
- sprintf(key,"%6d",found_key);
+ sprintf((char*) key,"%6d",found_key);
}
if (dupp_keys > 3)
@@ -294,9 +295,9 @@ int main(int argc, char *argv[])
goto err;
if (heap_rnext(file,record3)) goto err;
if (heap_delete(file,record3)) goto err;
- key_check-=atoi(record3);
- key1[atoi(record+keyinfo[0].seg[0].start)]--;
- key3[atoi(record+keyinfo[2].seg[0].start)]=0;
+ key_check-=atoi((char*) record3);
+ key1[atoi((char*) record+keyinfo[0].seg[0].start)]--;
+ key3[atoi((char*) record+keyinfo[2].seg[0].start)]=0;
opt_delete++;
ant=2;
while ((error=heap_rnext(file,record3)) == 0 ||
@@ -321,16 +322,16 @@ int main(int argc, char *argv[])
if (heap_rlast(file,record3,0)) goto err;
if (heap_delete(file,record3)) goto err;
- key_check-=atoi(record3);
- key1[atoi(record+keyinfo[0].seg[0].start)]--;
- key3[atoi(record+keyinfo[2].seg[0].start)]=0;
+ key_check-=atoi((char*) record3);
+ key1[atoi((char*) record+keyinfo[0].seg[0].start)]--;
+ key3[atoi((char*) record+keyinfo[2].seg[0].start)]=0;
opt_delete++;
if (heap_rprev(file,record3) || heap_rprev(file,record3))
goto err;
if (heap_delete(file,record3)) goto err;
- key_check-=atoi(record3);
- key1[atoi(record+keyinfo[0].seg[0].start)]--;
- key3[atoi(record+keyinfo[2].seg[0].start)]=0;
+ key_check-=atoi((char*) record3);
+ key1[atoi((char*) record+keyinfo[0].seg[0].start)]--;
+ key3[atoi((char*) record+keyinfo[2].seg[0].start)]=0;
opt_delete++;
ant=3;
while ((error=heap_rprev(file,record3)) == 0 ||
@@ -365,10 +366,10 @@ int main(int argc, char *argv[])
if (error)
goto err;
if (heap_delete(file,record3)) goto err;
- key_check-=atoi(record3);
+ key_check-=atoi((char*) record3);
opt_delete++;
- key1[atoi(record+keyinfo[0].seg[0].start)]--;
- key3[atoi(record+keyinfo[2].seg[0].start)]=0;
+ key1[atoi((char*) record+keyinfo[0].seg[0].start)]--;
+ key3[atoi((char*) record+keyinfo[2].seg[0].start)]=0;
ant=0;
while ((error=heap_scan(file,record3)) == 0 ||
error == HA_ERR_RECORD_DELETED)
@@ -510,7 +511,7 @@ int main(int argc, char *argv[])
for (i=999, dupp_keys=found_key=0 ; i>0 ; i--)
{
if (key1[i] > dupp_keys) { dupp_keys=key1[i]; found_key=i; }
- sprintf(key,"%6d",found_key);
+ sprintf((char*) key,"%6d",found_key);
}
printf("- Read through all keys with first-next-last-prev\n");
ant=0;
@@ -577,7 +578,7 @@ int main(int argc, char *argv[])
{
if (heap_write(file2,record))
goto err;
- key_check-=atoi(record);
+ key_check-=atoi((char*) record);
write_count++;
if (heap_delete(file,record))
goto err;
@@ -684,11 +685,11 @@ static int calc_check(uchar *buf, uint length)
return check;
}
-static void make_record(char *record, uint n1, uint n2, uint n3,
+static void make_record(uchar *record, uint n1, uint n2, uint n3,
const char *mark, uint count)
{
bfill(record,reclength,' ');
- sprintf(record,"%6d:%4d:%8d:%3.3s: %4d",
+ sprintf((char*) record,"%6d:%4d:%8d:%3.3s: %4d",
n1,n2,n3,mark,count);
record[37]='A'; /* Store A in null key */
record[38]=1; /* set as null */
diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c
index c881f7a7480..15f4e1e1d34 100644
--- a/storage/myisam/ft_boolean_search.c
+++ b/storage/myisam/ft_boolean_search.c
@@ -227,7 +227,7 @@ static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
if (! ftb_param->up_quot) break;
phrase_word= (FT_WORD *)alloc_root(&ftb_param->ftb->mem_root, sizeof(FT_WORD));
tmp_element= (LIST *)alloc_root(&ftb_param->ftb->mem_root, sizeof(LIST));
- phrase_word->pos= word;
+ phrase_word->pos= (uchar*) word;
phrase_word->len= word_len;
tmp_element->data= (void *)phrase_word;
ftb_param->ftbe->phrase= list_add(ftb_param->ftbe->phrase, tmp_element);
@@ -253,7 +253,7 @@ static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
if (info->yesno > 0) ftbe->up->ythresh++;
ftb_param->ftbe= ftbe;
ftb_param->depth++;
- ftb_param->up_quot= info->quot;
+ ftb_param->up_quot= (uchar*) info->quot;
break;
case FT_TOKEN_RIGHT_PAREN:
if (ftb_param->ftbe->document)
@@ -288,13 +288,13 @@ static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
MYSQL_FTPARSER_BOOLEAN_INFO info;
CHARSET_INFO *cs= ftb_param->ftb->charset;
uchar **start= (uchar**) &query;
- char *end= query + len;
+ uchar *end= (uchar*) query + len;
FT_WORD w;
info.prev= ' ';
info.quot= 0;
while (ft_get_word(cs, start, end, &w, &info))
- param->mysql_add_word(param, w.pos, w.len, &info);
+ param->mysql_add_word(param, (char*) w.pos, w.len, &info);
return(0);
}
@@ -321,7 +321,7 @@ static int _ftb_parse_query(FTB *ftb, uchar *query, uint len,
param->mysql_add_word= ftb_query_add_word;
param->mysql_ftparam= (void *)&ftb_param;
param->cs= ftb->charset;
- param->doc= query;
+ param->doc= (char*) query;
param->length= len;
param->flags= 0;
param->mode= MYSQL_FTPARSER_FULL_BOOLEAN_INFO;
@@ -606,7 +606,7 @@ static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
FT_WORD *w= (FT_WORD *)phrase_param->document->data;
LIST *phrase, *document;
- w->pos= word;
+ w->pos= (uchar*) word;
w->len= word_len;
phrase_param->document= phrase_param->document->prev;
if (phrase_param->phrase_length > phrase_param->document_length)
@@ -636,11 +636,11 @@ static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
{
FT_WORD word;
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
- const char *docend= document + len;
+ const uchar *docend= (uchar*) document + len;
while (ft_simple_get_word(phrase_param->cs, (uchar**) &document, docend,
&word, FALSE))
{
- param->mysql_add_word(param, word.pos, word.len, 0);
+ param->mysql_add_word(param, (char*) word.pos, word.len, 0);
if (phrase_param->match)
break;
}
@@ -685,7 +685,7 @@ static int _ftb_check_phrase(FTB *ftb, const uchar *document, uint len,
param->mysql_add_word= ftb_phrase_add_word;
param->mysql_ftparam= (void *)&ftb_param;
param->cs= ftb->charset;
- param->doc= (uchar *)document;
+ param->doc= (char *) document;
param->length= len;
param->flags= 0;
param->mode= MYSQL_FTPARSER_WITH_STOPWORDS;
@@ -830,10 +830,11 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record)
/* Clear all states, except that the table was updated */
info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
- if (!(*info->read_record)(info,curdoc,record))
+ if (!(*info->read_record)(info,curdoc, (uchar*) record))
{
info->update|= HA_STATE_AKTIV; /* Record is read */
- if (ftb->with_scan && ft_boolean_find_relevance(ftb,record,0)==0)
+ if (ftb->with_scan &&
+ ft_boolean_find_relevance(ftb,(uchar*) record,0)==0)
continue; /* no match */
my_errno=0;
goto err;
@@ -896,10 +897,10 @@ static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
- char *end= doc + len;
+ uchar *end= (uchar*) doc + len;
FT_WORD w;
while (ft_simple_get_word(ftb->charset, (uchar**) &doc, end, &w, TRUE))
- param->mysql_add_word(param, w.pos, w.len, 0);
+ param->mysql_add_word(param, (char*) w.pos, w.len, 0);
return(0);
}
@@ -955,7 +956,7 @@ float ft_boolean_find_relevance(FT_INFO *ftb, uchar *record, uint length)
{
if (!ftsi.pos)
continue;
- param->doc= (uchar *)ftsi.pos;
+ param->doc= (char *)ftsi.pos;
param->length= ftsi.len;
if (unlikely(parser->parse(param)))
return 0;
diff --git a/storage/myisam/ft_nlq_search.c b/storage/myisam/ft_nlq_search.c
index 4774b819aa2..282fa6751d8 100644
--- a/storage/myisam/ft_nlq_search.c
+++ b/storage/myisam/ft_nlq_search.c
@@ -83,7 +83,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
word->weight=LWS_FOR_QUERY;
- keylen=_ft_make_key(info,aio->keynr,(char*) keybuff,word,0);
+ keylen=_ft_make_key(info,aio->keynr,keybuff,word,0);
keylen-=HA_FT_WLEN;
doc_cnt=0;
@@ -317,7 +317,7 @@ int ft_nlq_read_next(FT_INFO *handler, char *record)
info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
info->lastpos=handler->doc[handler->curdoc].dpos;
- if (!(*info->read_record)(info,info->lastpos,record))
+ if (!(*info->read_record)(info,info->lastpos,(uchar*) record))
{
info->update|= HA_STATE_AKTIV; /* Record is read */
return 0;
diff --git a/storage/myisam/ft_parser.c b/storage/myisam/ft_parser.c
index befe2bab066..df2423aa50f 100644
--- a/storage/myisam/ft_parser.c
+++ b/storage/myisam/ft_parser.c
@@ -83,7 +83,7 @@ my_bool ft_boolean_check_syntax_string(const uchar *str)
uint i, j;
if (!str ||
- (strlen(str)+1 != sizeof(ft_boolean_syntax)) ||
+ (strlen((char*) str)+1 != sizeof(ft_boolean_syntax)) ||
(str[0] != ' ' && str[1] != ' '))
return 1;
for (i=0; i<sizeof(ft_boolean_syntax); i++)
@@ -127,7 +127,7 @@ uchar ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
break;
if (*doc == FTB_RQUOT && param->quot)
{
- param->quot=doc;
+ param->quot= (char*) doc;
*start=doc+1;
param->type= FT_TOKEN_RIGHT_PAREN;
goto ret;
@@ -138,7 +138,8 @@ uchar ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
{
/* param->prev=' '; */
*start=doc+1;
- if (*doc == FTB_LQUOT) param->quot=*start;
+ if (*doc == FTB_LQUOT)
+ param->quot= (char*) *start;
param->type= (*doc == FTB_RBR ? FT_TOKEN_RIGHT_PAREN : FT_TOKEN_LEFT_PAREN);
goto ret;
}
@@ -174,7 +175,8 @@ uchar ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
if ((param->trunc=(doc<end && *doc == FTB_TRUNC)))
doc++;
- if (((length >= ft_min_word_len && !is_stopword(word->pos, word->len))
+ if (((length >= ft_min_word_len && !is_stopword((char*) word->pos,
+ word->len))
|| param->trunc) && length < ft_max_word_len)
{
*start=doc;
@@ -190,7 +192,8 @@ uchar ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
}
if (param->quot)
{
- param->quot=*start=doc;
+ *start= doc;
+ param->quot= (char*) doc;
param->type= 3; /* FT_RBR */
goto ret;
}
@@ -235,7 +238,7 @@ uchar ft_simple_get_word(CHARSET_INFO *cs, uchar **start, const uchar *end,
if (skip_stopwords == FALSE ||
(length >= ft_min_word_len && length < ft_max_word_len &&
- !is_stopword(word->pos, word->len)))
+ !is_stopword((char*) word->pos, word->len)))
{
*start= doc;
DBUG_RETURN(1);
@@ -271,7 +274,7 @@ static int ft_add_word(MYSQL_FTPARSER_PARAM *param,
w.pos= ptr;
}
else
- w.pos= word;
+ w.pos= (uchar*) word;
w.len= word_len;
if (!tree_insert(wtree, &w, 0, wtree->custom_arg))
{
@@ -293,7 +296,7 @@ static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
DBUG_ENTER("ft_parse_internal");
while (ft_simple_get_word(wtree->custom_arg, &doc, end, &w, TRUE))
- if (param->mysql_add_word(param, w.pos, w.len, 0))
+ if (param->mysql_add_word(param, (char*) w.pos, w.len, 0))
DBUG_RETURN(1);
DBUG_RETURN(0);
}
@@ -314,7 +317,7 @@ int ft_parse(TREE *wtree, uchar *doc, int doclen,
param->mysql_add_word= ft_add_word;
param->mysql_ftparam= &my_param;
param->cs= wtree->custom_arg;
- param->doc= doc;
+ param->doc= (char*) doc;
param->length= doclen;
param->mode= MYSQL_FTPARSER_SIMPLE_MODE;
DBUG_RETURN(parser->parse(param));
@@ -392,7 +395,9 @@ MYSQL_FTPARSER_PARAM *ftparser_call_initializer(MI_INFO *info,
mysql_add_word == 0 - parser is not initialized
mysql_add_word != 0 - parser is initialized, or no
initialization needed. */
- info->ftparser_param[ftparser_nr].mysql_add_word= (void *)1;
+ info->ftparser_param[ftparser_nr].mysql_add_word=
+ (int (*)(struct st_mysql_ftparser_param *, char *, int,
+ MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
return 0;
}
diff --git a/storage/myisam/ft_stopwords.c b/storage/myisam/ft_stopwords.c
index e6a90bc927a..59866d9a351 100644
--- a/storage/myisam/ft_stopwords.c
+++ b/storage/myisam/ft_stopwords.c
@@ -82,7 +82,7 @@ int ft_init_stopwords()
end=start+len;
while (ft_simple_get_word(default_charset_info, &start, end, &w, TRUE))
{
- if (ft_add_stopword(my_strndup(w.pos, w.len, MYF(0))))
+ if (ft_add_stopword(my_strndup((char*) w.pos, w.len, MYF(0))))
goto err1;
}
error=0;
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 77334b2cfba..bc6e5706c21 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -1576,8 +1576,9 @@ int ha_myisam::delete_row(const uchar *buf)
return mi_delete(file,buf);
}
-int ha_myisam::index_read(uchar *buf, const uchar *key, key_part_map keypart_map,
- enum ha_rkey_function find_flag)
+int ha_myisam::index_read_map(uchar *buf, const uchar *key,
+ key_part_map keypart_map,
+ enum ha_rkey_function find_flag)
{
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_key_count);
@@ -1586,9 +1587,9 @@ int ha_myisam::index_read(uchar *buf, const uchar *key, key_part_map keypart_map
return error;
}
-int ha_myisam::index_read_idx(uchar *buf, uint index, const uchar *key,
- key_part_map keypart_map,
- enum ha_rkey_function find_flag)
+int ha_myisam::index_read_idx_map(uchar *buf, uint index, const uchar *key,
+ key_part_map keypart_map,
+ enum ha_rkey_function find_flag)
{
ha_statistic_increment(&SSV::ha_read_key_count);
int error=mi_rkey(file, buf, index, key, keypart_map, find_flag);
@@ -1596,8 +1597,8 @@ int ha_myisam::index_read_idx(uchar *buf, uint index, const uchar *key,
return error;
}
-int ha_myisam::index_read_last(uchar *buf, const uchar *key,
- key_part_map keypart_map)
+int ha_myisam::index_read_last_map(uchar *buf, const uchar *key,
+ key_part_map keypart_map)
{
DBUG_ENTER("ha_myisam::index_read_last");
DBUG_ASSERT(inited==INDEX);
diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h
index 635f314b3da..e8594fc9039 100644
--- a/storage/myisam/ha_myisam.h
+++ b/storage/myisam/ha_myisam.h
@@ -65,11 +65,12 @@ class ha_myisam: public handler
int write_row(uchar * buf);
int update_row(const uchar * old_data, uchar * new_data);
int delete_row(const uchar * buf);
- int index_read(uchar *buf, const uchar *key, key_part_map keypart_map,
- enum ha_rkey_function find_flag);
- int index_read_idx(uchar *buf, uint index, const uchar *key,
- key_part_map keypart_map, enum ha_rkey_function find_flag);
- int index_read_last(uchar *buf, const uchar *key, key_part_map keypart_map);
+ int index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map,
+ enum ha_rkey_function find_flag);
+ int index_read_idx_map(uchar *buf, uint index, const uchar *key,
+ key_part_map keypart_map,
+ enum ha_rkey_function find_flag);
+ int index_read_last_map(uchar *buf, const uchar *key, key_part_map keypart_map);
int index_next(uchar * buf);
int index_prev(uchar * buf);
int index_first(uchar * buf);
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index 255f17eada7..fe6b716877c 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -173,7 +173,7 @@ int chk_del(MI_CHECK *param, register MI_INFO *info, uint test_flag)
printf(" %9s",llstr(next_link,buff));
if (next_link >= info->state->data_file_length)
goto wrong;
- if (my_pread(info->dfile,(char*) buff,delete_link_length,
+ if (my_pread(info->dfile, (uchar*) buff,delete_link_length,
next_link,MYF(MY_NABP)))
{
if (test_flag & T_VERBOSE) puts("");
@@ -250,7 +250,8 @@ static int check_k_link(MI_CHECK *param, register MI_INFO *info, uint nr)
my_off_t next_link;
uint block_size=(nr+1)*MI_MIN_KEY_BLOCK_LENGTH;
ha_rows records;
- char llbuff[21], llbuff2[21], *buff;
+ char llbuff[21], llbuff2[21];
+ uchar *buff;
DBUG_ENTER("check_k_link");
DBUG_PRINT("enter", ("block_size: %u", block_size));
@@ -1672,7 +1673,7 @@ static int writekeys(MI_SORT_PARAM *sort_param)
{
if (info->s->keyinfo[i].flag & HA_FULLTEXT )
{
- if (_mi_ft_add(info,i,(char*) key,buff,filepos))
+ if (_mi_ft_add(info, i, key, buff, filepos))
goto err;
}
#ifdef HAVE_SPATIAL
@@ -1703,7 +1704,7 @@ static int writekeys(MI_SORT_PARAM *sort_param)
{
if (info->s->keyinfo[i].flag & HA_FULLTEXT)
{
- if (_mi_ft_del(info,i,(char*) key,buff,filepos))
+ if (_mi_ft_del(info,i, key,buff,filepos))
break;
}
else
@@ -2742,7 +2743,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
sort_param[i].filepos=new_header_length;
sort_param[i].max_pos=sort_param[i].pos=share->pack.header_length;
- sort_param[i].record= (((char *)(sort_param+share->base.keys))+
+ sort_param[i].record= (((uchar *)(sort_param+share->base.keys))+
(share->base.pack_reclength * i));
if (!mi_alloc_rec_buff(info, -1, &sort_param[i].rec_buff))
{
@@ -3586,7 +3587,7 @@ int sort_write_record(MI_SORT_PARAM *sort_param)
DBUG_RETURN(1);
sort_info->buff_length=reclength;
}
- from=sort_info->buff+ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER);
+ from= sort_info->buff+ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER);
}
/* We can use info->checksum here as only one thread calls this. */
info->checksum=mi_checksum(info,sort_param->record);
@@ -4268,7 +4269,7 @@ int write_data_suffix(SORT_INFO *sort_info, my_bool fix_datafile)
if (info->s->options & HA_OPTION_COMPRESS_RECORD && fix_datafile)
{
- char buff[MEMMAP_EXTRA_MARGIN];
+ uchar buff[MEMMAP_EXTRA_MARGIN];
bzero(buff,sizeof(buff));
if (my_b_write(&info->rec_cache,buff,sizeof(buff)))
{
diff --git a/storage/myisam/mi_delete.c b/storage/myisam/mi_delete.c
index 29a84570f1e..6fe31f30c19 100644
--- a/storage/myisam/mi_delete.c
+++ b/storage/myisam/mi_delete.c
@@ -78,7 +78,7 @@ int mi_delete(MI_INFO *info,const uchar *record)
info->s->keyinfo[i].version++;
if (info->s->keyinfo[i].flag & HA_FULLTEXT )
{
- if (_mi_ft_del(info,i,(char*) old_key,record,info->lastpos))
+ if (_mi_ft_del(info,i, old_key,record,info->lastpos))
goto err;
}
else
@@ -250,7 +250,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (info->ft1_to_ft2)
{
/* we're in ft1->ft2 conversion mode. Saving key data */
- insert_dynamic(info->ft1_to_ft2, (char*) (lastkey+off));
+ insert_dynamic(info->ft1_to_ft2, (lastkey+off));
}
else
{
@@ -806,7 +806,7 @@ static uint remove_key(MI_KEYDEF *keyinfo, uint nod_flag,
if (next_length > prev_length)
{
/* We have to copy data from the current key to the next key */
- bmove_upp((char*) keypos,(char*) (lastkey+next_length),
+ bmove_upp(keypos, (lastkey+next_length),
(next_length-prev_length));
keypos-=(next_length-prev_length)+prev_pack_length;
store_key_length(keypos,prev_length);
@@ -853,7 +853,7 @@ static uint remove_key(MI_KEYDEF *keyinfo, uint nod_flag,
if (next_length >= prev_length)
{ /* Key after is based on deleted key */
uint pack_length,tmp;
- bmove_upp((char*) keypos,(char*) (lastkey+next_length),
+ bmove_upp(keypos, (lastkey+next_length),
tmp=(next_length-prev_length));
rest_length+=tmp;
pack_length= prev_length ? get_pack_length(rest_length): 0;
diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c
index eba868bfb82..cdd70abe9ad 100644
--- a/storage/myisam/mi_dynrec.c
+++ b/storage/myisam/mi_dynrec.c
@@ -91,7 +91,7 @@ my_bool mi_dynmap_file(MI_INFO *info, my_off_t size)
DBUG_RETURN(1);
}
#if defined(HAVE_MADVISE)
- madvise(info->s->file_map, size, MADV_RANDOM);
+ madvise((char*) info->s->file_map, size, MADV_RANDOM);
#endif
info->s->mmaped_length= size;
DBUG_RETURN(0);
@@ -112,7 +112,7 @@ void mi_remap_file(MI_INFO *info, my_off_t size)
{
if (info->s->file_map)
{
- VOID(my_munmap(info->s->file_map,
+ VOID(my_munmap((char*) info->s->file_map,
(size_t) info->s->mmaped_length + MEMMAP_EXTRA_MARGIN));
mi_dynmap_file(info, size);
}
@@ -135,8 +135,8 @@ void mi_remap_file(MI_INFO *info, my_off_t size)
0 ok
*/
-uint mi_mmap_pread(MI_INFO *info, uchar *Buffer,
- uint Count, my_off_t offset, myf MyFlags)
+size_t mi_mmap_pread(MI_INFO *info, uchar *Buffer,
+ size_t Count, my_off_t offset, myf MyFlags)
{
DBUG_PRINT("info", ("mi_read with mmap %d\n", info->dfile));
if (info->s->concurrent_insert)
@@ -167,8 +167,8 @@ uint mi_mmap_pread(MI_INFO *info, uchar *Buffer,
/* wrapper for my_pread in case if mmap isn't used */
-uint mi_nommap_pread(MI_INFO *info, uchar *Buffer,
- uint Count, my_off_t offset, myf MyFlags)
+size_t mi_nommap_pread(MI_INFO *info, uchar *Buffer,
+ size_t Count, my_off_t offset, myf MyFlags)
{
return my_pread(info->dfile, Buffer, Count, offset, MyFlags);
}
@@ -190,8 +190,8 @@ uint mi_nommap_pread(MI_INFO *info, uchar *Buffer,
!=0 error. In this case return error from pwrite
*/
-uint mi_mmap_pwrite(MI_INFO *info, uchar *Buffer,
- uint Count, my_off_t offset, myf MyFlags)
+size_t mi_mmap_pwrite(MI_INFO *info, const uchar *Buffer,
+ size_t Count, my_off_t offset, myf MyFlags)
{
DBUG_PRINT("info", ("mi_write with mmap %d\n", info->dfile));
if (info->s->concurrent_insert)
@@ -224,8 +224,8 @@ uint mi_mmap_pwrite(MI_INFO *info, uchar *Buffer,
/* wrapper for my_pwrite in case if mmap isn't used */
-uint mi_nommap_pwrite(MI_INFO *info, uchar *Buffer,
- uint Count, my_off_t offset, myf MyFlags)
+size_t mi_nommap_pwrite(MI_INFO *info, const uchar *Buffer,
+ size_t Count, my_off_t offset, myf MyFlags)
{
return my_pwrite(info->dfile, Buffer, Count, offset, MyFlags);
}
@@ -424,7 +424,7 @@ static bool unlink_deleted_block(MI_INFO *info, MI_BLOCK_INFO *block_info)
& BLOCK_DELETED))
DBUG_RETURN(1); /* Something is wrong */
mi_sizestore(tmp.header+4,block_info->next_filepos);
- if (info->s->file_write(info,(char*) tmp.header+4,8,
+ if (info->s->file_write(info, tmp.header+4,8,
block_info->prev_filepos+4, MYF(MY_NABP)))
DBUG_RETURN(1);
/* Unlink block from next block */
@@ -434,7 +434,7 @@ static bool unlink_deleted_block(MI_INFO *info, MI_BLOCK_INFO *block_info)
& BLOCK_DELETED))
DBUG_RETURN(1); /* Something is wrong */
mi_sizestore(tmp.header+12,block_info->prev_filepos);
- if (info->s->file_write(info,(char*) tmp.header+12,8,
+ if (info->s->file_write(info, tmp.header+12,8,
block_info->next_filepos+12,
MYF(MY_NABP)))
DBUG_RETURN(1);
@@ -483,7 +483,7 @@ static int update_backward_delete_link(MI_INFO *info, my_off_t delete_block,
if (_mi_get_block_info(&block_info,info->dfile,delete_block)
& BLOCK_DELETED)
{
- char buff[8];
+ uchar buff[8];
mi_sizestore(buff,filepos);
if (info->s->file_write(info,buff, 8, delete_block+12, MYF(MY_NABP)))
DBUG_RETURN(1); /* Error on write */
@@ -1564,7 +1564,7 @@ static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos,
uint length)
{
uint next_length;
- char temp_buff[IO_SIZE*2];
+ uchar temp_buff[IO_SIZE*2];
DBUG_ENTER("_mi_cmp_buffer");
next_length= IO_SIZE*2 - (uint) (filepos & (IO_SIZE-1));
@@ -1572,7 +1572,7 @@ static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos,
while (length > IO_SIZE*2)
{
if (my_pread(file,temp_buff,next_length,filepos, MYF(MY_NABP)) ||
- memcmp((uchar*) buff,temp_buff,next_length))
+ memcmp(buff, temp_buff, next_length))
goto err;
filepos+=next_length;
buff+=next_length;
@@ -1581,7 +1581,7 @@ static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos,
}
if (my_pread(file,temp_buff,length,filepos,MYF(MY_NABP)))
goto err;
- DBUG_RETURN(memcmp((uchar*) buff,temp_buff,length));
+ DBUG_RETURN(memcmp(buff,temp_buff,length));
err:
DBUG_RETURN(1);
}
@@ -1815,11 +1815,11 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
my_pread() may leave the file pointer untouched.
*/
VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
- if (my_read(file,(char*) header,sizeof(info->header),MYF(0)) !=
+ if (my_read(file, header, sizeof(info->header),MYF(0)) !=
sizeof(info->header))
goto err;
}
- DBUG_DUMP("header",(uchar*) header,MI_BLOCK_INFO_HEADER_LENGTH);
+ DBUG_DUMP("header",header,MI_BLOCK_INFO_HEADER_LENGTH);
if (info->second_read)
{
if (info->header[0] <= 6 || info->header[0] == 13)
diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c
index 30802a50513..1b4c79d13de 100644
--- a/storage/myisam/mi_extra.c
+++ b/storage/myisam/mi_extra.c
@@ -78,7 +78,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
if (_mi_memmap_file(info))
{
/* We don't nead MADV_SEQUENTIAL if small file */
- madvise(share->file_map,share->state.state.data_file_length,
+ madvise((char*) share->file_map, share->state.state.data_file_length,
share->state.state.data_file_length <= RECORD_CACHE_SIZE*16 ?
MADV_RANDOM : MADV_SEQUENTIAL);
pthread_mutex_unlock(&share->intern_lock);
@@ -158,7 +158,8 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
}
#if defined(HAVE_MMAP) && defined(HAVE_MADVISE)
if (info->opt_flag & MEMMAP_USED)
- madvise(share->file_map,share->state.state.data_file_length,MADV_RANDOM);
+ madvise((char*) share->file_map, share->state.state.data_file_length,
+ MADV_RANDOM);
#endif
break;
case HA_EXTRA_FLUSH_CACHE:
@@ -435,7 +436,8 @@ int mi_reset(MI_INFO *info)
mi_alloc_rec_buff(info, -1, &info->rec_buff);
#if defined(HAVE_MMAP) && defined(HAVE_MADVISE)
if (info->opt_flag & MEMMAP_USED)
- madvise(share->file_map,share->state.state.data_file_length,MADV_RANDOM);
+ madvise((char*) share->file_map, share->state.state.data_file_length,
+ MADV_RANDOM);
#endif
info->opt_flag&= ~(KEY_READ_USED | REMEMBER_OLD_POS);
info->quick_mode=0;
diff --git a/storage/myisam/mi_key.c b/storage/myisam/mi_key.c
index 5b3662c4f28..3f445ebf44d 100644
--- a/storage/myisam/mi_key.c
+++ b/storage/myisam/mi_key.c
@@ -108,7 +108,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
{
if (type != HA_KEYTYPE_NUM)
{
- length= cs->cset->lengthsp(cs, pos, length);
+ length= cs->cset->lengthsp(cs, (char*) pos, length);
}
else
{
@@ -380,7 +380,8 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
{
memcpy(pos,key,(size_t) length);
keyseg->charset->cset->fill(keyseg->charset,
- pos + length, keyseg->length - length,
+ (char*) pos + length,
+ keyseg->length - length,
' ');
}
else
diff --git a/storage/myisam/mi_keycache.c b/storage/myisam/mi_keycache.c
index 6694893e9c3..5cf3fede1ae 100644
--- a/storage/myisam/mi_keycache.c
+++ b/storage/myisam/mi_keycache.c
@@ -104,7 +104,8 @@ int mi_assign_to_key_cache(MI_INFO *info,
share->key_cache= key_cache;
/* store the key cache in the global hash structure for future opens */
- if (multi_key_cache_set(share->unique_file_name, share->unique_name_length,
+ if (multi_key_cache_set((uchar*) share->unique_file_name,
+ share->unique_name_length,
share->key_cache))
error= my_errno;
pthread_mutex_unlock(&share->intern_lock);
diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c
index 6aa62b70ae3..ec359d13a14 100644
--- a/storage/myisam/mi_locking.c
+++ b/storage/myisam/mi_locking.c
@@ -520,7 +520,7 @@ int _mi_test_if_changed(register MI_INFO *info)
int _mi_mark_file_changed(MI_INFO *info)
{
- char buff[3];
+ uchar buff[3];
register MYISAM_SHARE *share=info->s;
DBUG_ENTER("_mi_mark_file_changed");
@@ -553,7 +553,7 @@ int _mi_mark_file_changed(MI_INFO *info)
int _mi_decrement_open_count(MI_INFO *info)
{
- char buff[2];
+ uchar buff[2];
register MYISAM_SHARE *share=info->s;
int lock_error=0,write_error=0;
if (share->global_changed)
diff --git a/storage/myisam/mi_log.c b/storage/myisam/mi_log.c
index 91d3bb6f702..8b9ca038fec 100644
--- a/storage/myisam/mi_log.c
+++ b/storage/myisam/mi_log.c
@@ -76,7 +76,7 @@ int mi_log(int activate_log)
void _myisam_log(enum myisam_log_commands command, MI_INFO *info,
const uchar *buffert, uint length)
{
- char buff[11];
+ uchar buff[11];
int error,old_errno;
ulong pid=(ulong) GETPID();
old_errno=my_errno;
@@ -100,7 +100,7 @@ void _myisam_log(enum myisam_log_commands command, MI_INFO *info,
void _myisam_log_command(enum myisam_log_commands command, MI_INFO *info,
const uchar *buffert, uint length, int result)
{
- char buff[9];
+ uchar buff[9];
int error,old_errno;
ulong pid=(ulong) GETPID();
@@ -124,7 +124,7 @@ void _myisam_log_command(enum myisam_log_commands command, MI_INFO *info,
void _myisam_log_record(enum myisam_log_commands command, MI_INFO *info,
const uchar *record, my_off_t filepos, int result)
{
- char buff[21],*pos;
+ uchar buff[21],*pos;
int error,old_errno;
uint length;
ulong pid=(ulong) GETPID();
@@ -134,7 +134,7 @@ void _myisam_log_record(enum myisam_log_commands command, MI_INFO *info,
length=info->s->base.reclength;
else
length=info->s->base.reclength+ _my_calc_total_blob_length(info,record);
- buff[0]=(char) command;
+ buff[0]=(uchar) command;
mi_int2store(buff+1,info->dfile);
mi_int4store(buff+3,pid);
mi_int2store(buff+7,result);
@@ -142,8 +142,8 @@ void _myisam_log_record(enum myisam_log_commands command, MI_INFO *info,
mi_int4store(buff+17,length);
pthread_mutex_lock(&THR_LOCK_myisam);
error=my_lock(myisam_log_file,F_WRLCK,0L,F_TO_EOF,MYF(MY_SEEK_NOT_DONE));
- VOID(my_write(myisam_log_file,buff,sizeof(buff),MYF(0)));
- VOID(my_write(myisam_log_file,(uchar*) record,info->s->base.reclength,MYF(0)));
+ VOID(my_write(myisam_log_file, buff,sizeof(buff),MYF(0)));
+ VOID(my_write(myisam_log_file, record,info->s->base.reclength,MYF(0)));
if (info->s->base.blobs)
{
MI_BLOB *blob,*end;
@@ -152,7 +152,8 @@ void _myisam_log_record(enum myisam_log_commands command, MI_INFO *info,
blob != end ;
blob++)
{
- memcpy_fixed(&pos,record+blob->offset+blob->pack_length,sizeof(char*));
+ memcpy_fixed((uchar*) &pos, record+blob->offset+blob->pack_length,
+ sizeof(char*));
VOID(my_write(myisam_log_file,pos,blob->length,MYF(0)));
}
}
diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c
index 405dca641d1..b848c822f75 100644
--- a/storage/myisam/mi_open.c
+++ b/storage/myisam/mi_open.c
@@ -79,7 +79,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
key_parts,unique_key_parts,fulltext_keys,uniques;
char name_buff[FN_REFLEN], org_name[FN_REFLEN], index_name[FN_REFLEN],
data_name[FN_REFLEN];
- char *disk_cache, *disk_pos, *end_pos;
+ uchar *disk_cache, *disk_pos, *end_pos;
MI_INFO info,*m_info,*old_info;
MYISAM_SHARE share_buff,*share;
ulong rec_per_key_part[MI_MAX_POSSIBLE_KEY*MI_MAX_KEY_SEG];
@@ -104,7 +104,8 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
share_buff.state.rec_per_key_part=rec_per_key_part;
share_buff.state.key_root=key_root;
share_buff.state.key_del=key_del;
- share_buff.key_cache= multi_key_cache_search(name_buff, strlen(name_buff));
+ share_buff.key_cache= multi_key_cache_search((uchar*) name_buff,
+ strlen(name_buff));
DBUG_EXECUTE_IF("myisam_pretend_crashed_table_on_open",
if (strstr(name, "/t1"))
@@ -121,7 +122,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
}
share->mode=open_mode;
errpos=1;
- if (my_read(kfile,(char*) share->state.header.file_version,head_length,
+ if (my_read(kfile, share->state.header.file_version, head_length,
MYF(MY_NABP)))
{
my_errno= HA_ERR_NOT_A_TABLE;
@@ -165,7 +166,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
info_length=mi_uint2korr(share->state.header.header_length);
base_pos=mi_uint2korr(share->state.header.base_pos);
- if (!(disk_cache=(char*) my_alloca(info_length+128)))
+ if (!(disk_cache= (uchar*) my_alloca(info_length+128)))
{
my_errno=ENOMEM;
goto err;
@@ -202,15 +203,14 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
}
share->state_diff_length=len-MI_STATE_INFO_SIZE;
- mi_state_info_read((uchar*) disk_cache, &share->state);
+ mi_state_info_read(disk_cache, &share->state);
len= mi_uint2korr(share->state.header.base_info_length);
if (len != MI_BASE_INFO_SIZE)
{
DBUG_PRINT("warning",("saved_base_info_length: %d base_info_length: %d",
len,MI_BASE_INFO_SIZE));
}
- disk_pos= (char*)
- my_n_base_info_read((uchar*) disk_cache + base_pos, &share->base);
+ disk_pos= my_n_base_info_read(disk_cache + base_pos, &share->base);
share->state.state_length=base_pos;
if (!(open_flags & HA_OPEN_FOR_REPAIR) &&
@@ -504,7 +504,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
}
else if (share->options & HA_OPTION_PACK_RECORD)
share->data_file_type = DYNAMIC_RECORD;
- my_afree((uchar*) disk_cache);
+ my_afree(disk_cache);
mi_setup_functions(share);
share->is_log_table= FALSE;
#ifdef THREAD
@@ -642,7 +642,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
if (myisam_log_file >= 0)
{
intern_filename(name_buff,share->index_file_name);
- _myisam_log(MI_LOG_OPEN, m_info,name_buff, strlen(name_buff));
+ _myisam_log(MI_LOG_OPEN, m_info, (uchar*) name_buff, strlen(name_buff));
}
DBUG_RETURN(m_info);
@@ -669,7 +669,7 @@ err:
VOID(my_lock(kfile, F_UNLCK, 0L, F_TO_EOF, MYF(MY_SEEK_NOT_DONE)));
/* fall through */
case 2:
- my_afree((uchar*) disk_cache);
+ my_afree(disk_cache);
/* fall through */
case 1:
VOID(my_close(kfile,MYF(0)));
@@ -961,7 +961,7 @@ uchar *mi_state_info_read(uchar *ptr, MI_STATE_INFO *state)
uint mi_state_info_read_dsk(File file, MI_STATE_INFO *state, my_bool pRead)
{
- char buff[MI_STATE_INFO_SIZE + MI_STATE_EXTRA_SIZE];
+ uchar buff[MI_STATE_INFO_SIZE + MI_STATE_EXTRA_SIZE];
if (!myisam_single_user)
{
@@ -972,7 +972,7 @@ uint mi_state_info_read_dsk(File file, MI_STATE_INFO *state, my_bool pRead)
}
else if (my_read(file, buff, state->state_length,MYF(MY_NABP)))
return 1;
- mi_state_info_read((uchar*) buff, state);
+ mi_state_info_read(buff, state);
}
return 0;
}
@@ -1076,7 +1076,7 @@ uint mi_keydef_write(File file, MI_KEYDEF *keydef)
return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0;
}
-char *mi_keydef_read(char *ptr, MI_KEYDEF *keydef)
+uchar *mi_keydef_read(uchar *ptr, MI_KEYDEF *keydef)
{
keydef->keysegs = (uint) *ptr++;
keydef->key_alg = *ptr++; /* Rtree or Btree */
@@ -1121,7 +1121,7 @@ int mi_keyseg_write(File file, const HA_KEYSEG *keyseg)
}
-char *mi_keyseg_read(char *ptr, HA_KEYSEG *keyseg)
+uchar *mi_keyseg_read(uchar *ptr, HA_KEYSEG *keyseg)
{
keyseg->type = *ptr++;
keyseg->language = *ptr++;
@@ -1160,7 +1160,7 @@ uint mi_uniquedef_write(File file, MI_UNIQUEDEF *def)
return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0;
}
-char *mi_uniquedef_read(char *ptr, MI_UNIQUEDEF *def)
+uchar *mi_uniquedef_read(uchar *ptr, MI_UNIQUEDEF *def)
{
def->keysegs = mi_uint2korr(ptr);
def->key = ptr[2];
@@ -1184,7 +1184,7 @@ uint mi_recinfo_write(File file, MI_COLUMNDEF *recinfo)
return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0;
}
-char *mi_recinfo_read(char *ptr, MI_COLUMNDEF *recinfo)
+uchar *mi_recinfo_read(uchar *ptr, MI_COLUMNDEF *recinfo)
{
recinfo->type= mi_sint2korr(ptr); ptr +=2;
recinfo->length=mi_uint2korr(ptr); ptr +=2;
diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c
index 1231ef026f7..305b7e5532c 100644
--- a/storage/myisam/mi_packrec.c
+++ b/storage/myisam/mi_packrec.c
@@ -136,7 +136,7 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
uint i,trees,huff_tree_bits,rec_reflength,length;
uint16 *decode_table,*tmp_buff;
ulong elements,intervall_length;
- char *disk_cache;
+ uchar *disk_cache;
uchar *intervall_buff;
uchar header[HEAD_LENGTH];
MYISAM_SHARE *share=info->s;
@@ -216,7 +216,7 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
MYF(MY_WME | MY_ZEROFILL))))
goto err1;
tmp_buff=share->decode_tables+length;
- disk_cache=(uchar*) (tmp_buff+OFFSET_TABLE_SIZE);
+ disk_cache= (uchar*) (tmp_buff+OFFSET_TABLE_SIZE);
if (my_read(file,disk_cache,
(uint) (share->pack.header_length-sizeof(header)),
@@ -224,7 +224,7 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
goto err2;
huff_tree_bits=max_bit(trees ? trees-1 : 0);
- init_bit_buffer(&bit_buff, (uchar*) disk_cache,
+ init_bit_buffer(&bit_buff, disk_cache,
(uint) (share->pack.header_length-sizeof(header)));
/* Read new info for each field */
for (i=0 ; i < share->base.fields ; i++)
@@ -1368,7 +1368,7 @@ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff,
position is ok
*/
VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
- if (my_read(file,(char*) header,ref_length,MYF(MY_NABP)))
+ if (my_read(file, header,ref_length,MYF(MY_NABP)))
return BLOCK_FATAL_ERROR;
DBUG_DUMP("header",(uchar*) header,ref_length);
}
@@ -1507,7 +1507,7 @@ my_bool _mi_memmap_file(MI_INFO *info)
void _mi_unmap_file(MI_INFO *info)
{
- VOID(my_munmap(info->s->file_map,
+ VOID(my_munmap((char*) info->s->file_map,
(size_t) info->s->mmaped_length + MEMMAP_EXTRA_MARGIN));
}
diff --git a/storage/myisam/mi_page.c b/storage/myisam/mi_page.c
index ede379feea6..23a2526f756 100644
--- a/storage/myisam/mi_page.c
+++ b/storage/myisam/mi_page.c
@@ -107,7 +107,7 @@ int _mi_dispose(register MI_INFO *info, MI_KEYDEF *keyinfo, my_off_t pos,
int level)
{
my_off_t old_link;
- char buff[8];
+ uchar buff[8];
DBUG_ENTER("_mi_dispose");
DBUG_PRINT("enter",("pos: %ld", (long) pos));
@@ -128,7 +128,7 @@ int _mi_dispose(register MI_INFO *info, MI_KEYDEF *keyinfo, my_off_t pos,
my_off_t _mi_new(register MI_INFO *info, MI_KEYDEF *keyinfo, int level)
{
my_off_t pos;
- char buff[8];
+ uchar buff[8];
DBUG_ENTER("_mi_new");
if ((pos= info->s->state.key_del[keyinfo->block_size_index]) ==
diff --git a/storage/myisam/mi_rkey.c b/storage/myisam/mi_rkey.c
index 3dcaa27d3ca..c9bf04d665a 100644
--- a/storage/myisam/mi_rkey.c
+++ b/storage/myisam/mi_rkey.c
@@ -45,6 +45,7 @@ int mi_rkey(MI_INFO *info, uchar *buf, int inx, const uchar *key,
info->once_flags&= ~USE_PACKED_KEYS; /* Reset flag */
/*
key is already packed!; This happens when we are using a MERGE TABLE
+ In this key 'key_part_map' is the length of the key !
*/
key_buff=info->lastkey+info->s->base.max_key_length;
pack_key_length= keypart_map;
diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c
index acc8c073297..2195ac178dd 100644
--- a/storage/myisam/mi_search.c
+++ b/storage/myisam/mi_search.c
@@ -836,7 +836,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
if (tot_length >= 255 && *start != 255)
{
/* length prefix changed from a length of one to a length of 3 */
- bmove_upp((char*) key+length+3,(char*) key+length+1,length);
+ bmove_upp(key+length+3, key+length+1, length);
*key=255;
mi_int2store(key+1,tot_length);
key+=3+length;
diff --git a/storage/myisam/mi_statrec.c b/storage/myisam/mi_statrec.c
index 93e91fb9e32..e3771560c01 100644
--- a/storage/myisam/mi_statrec.c
+++ b/storage/myisam/mi_statrec.c
@@ -26,14 +26,14 @@ int _mi_write_static_record(MI_INFO *info, const uchar *record)
{
my_off_t filepos=info->s->state.dellink;
info->rec_cache.seek_not_done=1; /* We have done a seek */
- if (info->s->file_read(info,(char*) &temp[0],info->s->base.rec_reflength,
+ if (info->s->file_read(info, &temp[0],info->s->base.rec_reflength,
info->s->state.dellink+1,
MYF(MY_NABP)))
goto err;
info->s->state.dellink= _mi_rec_pos(info->s,temp);
info->state->del--;
info->state->empty-=info->s->base.pack_reclength;
- if (info->s->file_write(info, (char*) record, info->s->base.reclength,
+ if (info->s->file_write(info, record, info->s->base.reclength,
filepos,
MYF(MY_NABP)))
goto err;
@@ -48,29 +48,29 @@ int _mi_write_static_record(MI_INFO *info, const uchar *record)
}
if (info->opt_flag & WRITE_CACHE_USED)
{ /* Cash in use */
- if (my_b_write(&info->rec_cache, (uchar*) record,
+ if (my_b_write(&info->rec_cache, record,
info->s->base.reclength))
goto err;
if (info->s->base.pack_reclength != info->s->base.reclength)
{
uint length=info->s->base.pack_reclength - info->s->base.reclength;
- bzero((char*) temp,length);
- if (my_b_write(&info->rec_cache, (uchar*) temp,length))
+ bzero(temp,length);
+ if (my_b_write(&info->rec_cache, temp,length))
goto err;
}
}
else
{
info->rec_cache.seek_not_done=1; /* We have done a seek */
- if (info->s->file_write(info,(char*) record,info->s->base.reclength,
+ if (info->s->file_write(info, record, info->s->base.reclength,
info->state->data_file_length,
info->s->write_flag))
goto err;
if (info->s->base.pack_reclength != info->s->base.reclength)
{
uint length=info->s->base.pack_reclength - info->s->base.reclength;
- bzero((char*) temp,length);
- if (info->s->file_write(info, (uchar*) temp,length,
+ bzero(temp,length);
+ if (info->s->file_write(info, temp,length,
info->state->data_file_length+
info->s->base.reclength,
info->s->write_flag))
@@ -89,9 +89,9 @@ int _mi_update_static_record(MI_INFO *info, my_off_t pos, const uchar *record)
{
info->rec_cache.seek_not_done=1; /* We have done a seek */
return (info->s->file_write(info,
- (char*) record,info->s->base.reclength,
- pos,
- MYF(MY_NABP)) != 0);
+ record, info->s->base.reclength,
+ pos,
+ MYF(MY_NABP)) != 0);
}
@@ -129,11 +129,11 @@ int _mi_cmp_static_record(register MI_INFO *info, register const uchar *old)
if ((info->opt_flag & READ_CHECK_USED))
{ /* If check isn't disabled */
info->rec_cache.seek_not_done=1; /* We have done a seek */
- if (info->s->file_read(info, (char*) info->rec_buff, info->s->base.reclength,
+ if (info->s->file_read(info, info->rec_buff, info->s->base.reclength,
info->lastpos,
MYF(MY_NABP)))
DBUG_RETURN(-1);
- if (memcmp((uchar*) info->rec_buff, (uchar*) old,
+ if (memcmp(info->rec_buff, old,
(uint) info->s->base.reclength))
{
DBUG_DUMP("read",old,info->s->base.reclength);
@@ -152,7 +152,7 @@ int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def,
DBUG_ENTER("_mi_cmp_static_unique");
info->rec_cache.seek_not_done=1; /* We have done a seek */
- if (info->s->file_read(info, (char*) info->rec_buff, info->s->base.reclength,
+ if (info->s->file_read(info, info->rec_buff, info->s->base.reclength,
pos, MYF(MY_NABP)))
DBUG_RETURN(-1);
DBUG_RETURN(mi_unique_comp(def, record, info->rec_buff,
@@ -178,7 +178,7 @@ int _mi_read_static_record(register MI_INFO *info, register my_off_t pos,
return(-1);
info->rec_cache.seek_not_done=1; /* We have done a seek */
- error=info->s->file_read(info,(char*) record,info->s->base.reclength,
+ error=info->s->file_read(info, record, info->s->base.reclength,
pos,MYF(MY_NABP)) != 0;
fast_mi_writeinfo(info);
if (! error)
diff --git a/storage/myisam/mi_test1.c b/storage/myisam/mi_test1.c
index 08627ba7e92..a68bcbed56c 100644
--- a/storage/myisam/mi_test1.c
+++ b/storage/myisam/mi_test1.c
@@ -40,9 +40,9 @@ static HA_KEYSEG uniqueseg[10];
static int run_test(const char *filename);
static void get_options(int argc, char *argv[]);
-static void create_key(char *key,uint rownr);
-static void create_record(char *record,uint rownr);
-static void update_record(char *record);
+static void create_key(uchar *key,uint rownr);
+static void create_record(uchar *record,uint rownr);
+static void update_record(uchar *record);
int main(int argc,char *argv[])
{
@@ -62,7 +62,7 @@ static int run_test(const char *filename)
int i,j,error,deleted,rec_length,uniques=0;
ha_rows found,row_count;
my_off_t pos;
- char record[MAX_REC_LENGTH],key[MAX_REC_LENGTH],read_record[MAX_REC_LENGTH];
+ uchar record[MAX_REC_LENGTH],key[MAX_REC_LENGTH],read_record[MAX_REC_LENGTH];
MI_UNIQUEDEF uniquedef;
MI_CREATE_INFO create_info;
@@ -327,20 +327,20 @@ err:
}
-static void create_key_part(char *key,uint rownr)
+static void create_key_part(uchar *key,uint rownr)
{
if (!unique_key)
rownr&=7; /* Some identical keys */
if (keyinfo[0].seg[0].type == HA_KEYTYPE_NUM)
{
- sprintf(key,"%*d",keyinfo[0].seg[0].length,rownr);
+ sprintf((char*) key,"%*d",keyinfo[0].seg[0].length,rownr);
}
else if (keyinfo[0].seg[0].type == HA_KEYTYPE_VARTEXT1 ||
keyinfo[0].seg[0].type == HA_KEYTYPE_VARTEXT2)
{ /* Alpha record */
/* Create a key that may be easily packed */
bfill(key,keyinfo[0].seg[0].length,rownr < 10 ? 'A' : 'B');
- sprintf(key+keyinfo[0].seg[0].length-2,"%-2d",rownr);
+ sprintf((char*) key+keyinfo[0].seg[0].length-2,"%-2d",rownr);
if ((rownr & 7) == 0)
{
/* Change the key to force a unpack of the next key */
@@ -350,12 +350,12 @@ static void create_key_part(char *key,uint rownr)
else
{ /* Alpha record */
if (keyinfo[0].seg[0].flag & HA_SPACE_PACK)
- sprintf(key,"%-*d",keyinfo[0].seg[0].length,rownr);
+ sprintf((char*) key,"%-*d",keyinfo[0].seg[0].length,rownr);
else
{
/* Create a key that may be easily packed */
bfill(key,keyinfo[0].seg[0].length,rownr < 10 ? 'A' : 'B');
- sprintf(key+keyinfo[0].seg[0].length-2,"%-2d",rownr);
+ sprintf((char*) key+keyinfo[0].seg[0].length-2,"%-2d",rownr);
if ((rownr & 7) == 0)
{
/* Change the key to force a unpack of the next key */
@@ -366,7 +366,7 @@ static void create_key_part(char *key,uint rownr)
}
-static void create_key(char *key,uint rownr)
+static void create_key(uchar *key,uint rownr)
{
if (keyinfo[0].seg[0].null_bit)
{
@@ -382,7 +382,7 @@ static void create_key(char *key,uint rownr)
{
uint tmp;
create_key_part(key+2,rownr);
- tmp=strlen(key+2);
+ tmp=strlen((char*) key+2);
int2store(key,tmp);
}
else
@@ -390,13 +390,13 @@ static void create_key(char *key,uint rownr)
}
-static char blob_key[MAX_REC_LENGTH];
-static char blob_record[MAX_REC_LENGTH+20*20];
+static uchar blob_key[MAX_REC_LENGTH];
+static uchar blob_record[MAX_REC_LENGTH+20*20];
-static void create_record(char *record,uint rownr)
+static void create_record(uchar *record,uint rownr)
{
- char *pos;
+ uchar *pos;
bzero((char*) record,MAX_REC_LENGTH);
record[0]=1; /* delete marker */
if (rownr == 0 && keyinfo[0].seg[0].null_bit)
@@ -406,9 +406,9 @@ static void create_record(char *record,uint rownr)
if (recinfo[1].type == FIELD_BLOB)
{
uint tmp;
- char *ptr;
+ uchar *ptr;
create_key_part(blob_key,rownr);
- tmp=strlen(blob_key);
+ tmp=strlen((char*) blob_key);
int4store(pos,tmp);
ptr=blob_key;
memcpy_fixed(pos+4,&ptr,sizeof(char*));
@@ -418,7 +418,7 @@ static void create_record(char *record,uint rownr)
{
uint tmp, pack_length= HA_VARCHAR_PACKLENGTH(recinfo[1].length-1);
create_key_part(pos+pack_length,rownr);
- tmp= strlen(pos+pack_length);
+ tmp= strlen((char*) pos+pack_length);
if (pack_length == 1)
*(uchar*) pos= (uchar) tmp;
else
@@ -433,10 +433,10 @@ static void create_record(char *record,uint rownr)
if (recinfo[2].type == FIELD_BLOB)
{
uint tmp;
- char *ptr;;
- sprintf(blob_record,"... row: %d", rownr);
- strappend(blob_record,max(MAX_REC_LENGTH-rownr,10),' ');
- tmp=strlen(blob_record);
+ uchar *ptr;;
+ sprintf((char*) blob_record,"... row: %d", rownr);
+ strappend((char*) blob_record,max(MAX_REC_LENGTH-rownr,10),' ');
+ tmp=strlen((char*) blob_record);
int4store(pos,tmp);
ptr=blob_record;
memcpy_fixed(pos+4,&ptr,sizeof(char*));
@@ -444,28 +444,28 @@ static void create_record(char *record,uint rownr)
else if (recinfo[2].type == FIELD_VARCHAR)
{
uint tmp, pack_length= HA_VARCHAR_PACKLENGTH(recinfo[1].length-1);
- sprintf(pos+pack_length, "... row: %d", rownr);
- tmp= strlen(pos+pack_length);
+ sprintf((char*) pos+pack_length, "... row: %d", rownr);
+ tmp= strlen((char*) pos+pack_length);
if (pack_length == 1)
- *(uchar*) pos= (uchar) tmp;
+ *pos= (uchar) tmp;
else
int2store(pos,tmp);
}
else
{
- sprintf(pos,"... row: %d", rownr);
- strappend(pos,recinfo[2].length,' ');
+ sprintf((char*) pos,"... row: %d", rownr);
+ strappend((char*) pos,recinfo[2].length,' ');
}
}
/* change row to test re-packing of rows and reallocation of keys */
-static void update_record(char *record)
+static void update_record(uchar *record)
{
- char *pos=record+1;
+ uchar *pos=record+1;
if (recinfo[1].type == FIELD_BLOB)
{
- char *column,*ptr;
+ uchar *column,*ptr;
int length;
length=uint4korr(pos); /* Long blob */
memcpy_fixed(&column,pos+4,sizeof(char*));
@@ -474,7 +474,8 @@ static void update_record(char *record)
memcpy_fixed(pos+4,&ptr,sizeof(char*)); /* Store pointer to new key */
if (keyinfo[0].seg[0].type != HA_KEYTYPE_NUM)
default_charset_info->cset->casedn(default_charset_info,
- blob_key, length, blob_key, length);
+ (char*) blob_key, length,
+ (char*) blob_key, length);
pos+=recinfo[1].length;
}
else if (recinfo[1].type == FIELD_VARCHAR)
@@ -482,22 +483,22 @@ static void update_record(char *record)
uint pack_length= HA_VARCHAR_PACKLENGTH(recinfo[1].length-1);
uint length= pack_length == 1 ? (uint) *(uchar*) pos : uint2korr(pos);
default_charset_info->cset->casedn(default_charset_info,
- pos + pack_length, length,
- pos + pack_length, length);
+ (char*) pos + pack_length, length,
+ (char*) pos + pack_length, length);
pos+=recinfo[1].length;
}
else
{
if (keyinfo[0].seg[0].type != HA_KEYTYPE_NUM)
default_charset_info->cset->casedn(default_charset_info,
- pos, keyinfo[0].seg[0].length,
- pos, keyinfo[0].seg[0].length);
+ (char*) pos, keyinfo[0].seg[0].length,
+ (char*) pos, keyinfo[0].seg[0].length);
pos+=recinfo[1].length;
}
if (recinfo[2].type == FIELD_BLOB)
{
- char *column;
+ uchar *column;
int length;
length=uint4korr(pos);
memcpy_fixed(&column,pos+4,sizeof(char*));
@@ -505,7 +506,7 @@ static void update_record(char *record)
bfill(blob_record+length,20,'.'); /* Make it larger */
length+=20;
int4store(pos,length);
- column=blob_record;
+ column= blob_record;
memcpy_fixed(pos+4,&column,sizeof(char*));
}
else if (recinfo[2].type == FIELD_VARCHAR)
diff --git a/storage/myisam/mi_test2.c b/storage/myisam/mi_test2.c
index 99d0c23d2a4..902801b5e6e 100644
--- a/storage/myisam/mi_test2.c
+++ b/storage/myisam/mi_test2.c
@@ -37,7 +37,7 @@
static void get_options(int argc, char *argv[]);
static uint rnd(uint max_value);
static void fix_length(uchar *record,uint length);
-static void put_blob_in_record(char *blob_pos,char **blob_buffer);
+static void put_blob_in_record(uchar *blob_pos,char **blob_buffer);
static void copy_key(struct st_myisam_info *info,uint inx,
uchar *record,uchar *key);
@@ -53,8 +53,8 @@ static uint key_cache_block_size= KEY_CACHE_BLOCK_SIZE;
static uint keys=MYISAM_KEYS,recant=1000;
static uint use_blob=0;
static uint16 key1[1001],key3[5000];
-static char record[300],record2[300],key[100],key2[100],
- read_record[300],read_record2[300],read_record3[300];
+static uchar record[300],record2[300],key[100],key2[100];
+static uchar read_record[300],read_record2[300],read_record3[300];
static HA_KEYSEG glob_keyseg[MYISAM_KEYS][MAX_PARTS];
/* Test program */
@@ -231,7 +231,7 @@ int main(int argc, char *argv[])
for (i=0 ; i < recant ; i++)
{
n1=rnd(1000); n2=rnd(100); n3=rnd(5000);
- sprintf(record,"%6d:%4d:%8d:Pos: %4d ",n1,n2,n3,write_count);
+ sprintf((char*) record,"%6d:%4d:%8d:Pos: %4d ",n1,n2,n3,write_count);
int4store(record+STANDARD_LENGTH-4,(long) i);
fix_length(record,(uint) STANDARD_LENGTH+rnd(60));
put_blob_in_record(record+blob_pos,&blob_buffer);
@@ -262,7 +262,7 @@ int main(int argc, char *argv[])
for (j=rnd(1000)+1 ; j>0 && key1[j] == 0 ; j--) ;
if (!j)
for (j=999 ; j>0 && key1[j] == 0 ; j--) ;
- sprintf(key,"%6d",j);
+ sprintf((char*) key,"%6d",j);
if (mi_rkey(file,read_record,0,key,HA_WHOLE_KEY,HA_READ_KEY_EXACT))
{
printf("Test in loop: Can't find key: \"%s\"\n",key);
@@ -290,7 +290,7 @@ int main(int argc, char *argv[])
for (j=rnd(1000)+1 ; j>0 && key1[j] == 0 ; j--) ;
if (j != 0)
{
- sprintf(key,"%6d",j);
+ sprintf((char*) key,"%6d",j);
if (mi_rkey(file,read_record,0,key,HA_WHOLE_KEY,HA_READ_KEY_EXACT))
{
printf("can't find key1: \"%s\"\n",key);
@@ -304,8 +304,8 @@ int main(int argc, char *argv[])
goto err;
}
opt_delete++;
- key1[atoi(read_record+keyinfo[0].seg[0].start)]--;
- key3[atoi(read_record+keyinfo[2].seg[0].start)]=0;
+ key1[atoi((char*) read_record+keyinfo[0].seg[0].start)]--;
+ key3[atoi((char*) read_record+keyinfo[2].seg[0].start)]=0;
}
else
puts("Warning: Skipping delete test because no dupplicate keys");
@@ -317,17 +317,17 @@ int main(int argc, char *argv[])
for (i=0 ; i<recant/10 ; i++)
{
n1=rnd(1000); n2=rnd(100); n3=rnd(5000);
- sprintf(record2,"%6d:%4d:%8d:XXX: %4d ",n1,n2,n3,update);
+ sprintf((char*) record2,"%6d:%4d:%8d:XXX: %4d ",n1,n2,n3,update);
int4store(record2+STANDARD_LENGTH-4,(long) i);
fix_length(record2,(uint) STANDARD_LENGTH+rnd(60));
for (j=rnd(1000)+1 ; j>0 && key1[j] == 0 ; j--) ;
if (j != 0)
{
- sprintf(key,"%6d",j);
+ sprintf((char*) key,"%6d",j);
if (mi_rkey(file,read_record,0,key,HA_WHOLE_KEY,HA_READ_KEY_EXACT))
{
- printf("can't find key1: \"%s\"\n",key);
+ printf("can't find key1: \"%s\"\n",(char*) key);
goto err;
}
if (use_blob)
@@ -350,8 +350,8 @@ int main(int argc, char *argv[])
}
else
{
- key1[atoi(read_record+keyinfo[0].seg[0].start)]--;
- key3[atoi(read_record+keyinfo[2].seg[0].start)]=0;
+ key1[atoi((char*) read_record+keyinfo[0].seg[0].start)]--;
+ key3[atoi((char*) read_record+keyinfo[2].seg[0].start)]=0;
key1[n1]++; key3[n3]=1;
update++;
}
@@ -367,7 +367,7 @@ int main(int argc, char *argv[])
dupp_keys=key1[i]; j=i;
}
}
- sprintf(key,"%6d",j);
+ sprintf((char*) key,"%6d",j);
start=keyinfo[0].seg[0].start;
length=keyinfo[0].seg[0].length;
if (dupp_keys)
@@ -652,8 +652,8 @@ int main(int argc, char *argv[])
key_range min_key, max_key;
if (j > k)
swap_variables(int, j, k);
- sprintf(key,"%6d",j);
- sprintf(key2,"%6d",k);
+ sprintf((char*) key,"%6d",j);
+ sprintf((char*) key2,"%6d",k);
min_key.key= key;
min_key.length= USE_WHOLE_KEY;
@@ -1009,13 +1009,13 @@ static void fix_length(uchar *rec, uint length)
bmove(rec+STANDARD_LENGTH,
"0123456789012345678901234567890123456789012345678901234567890",
length-STANDARD_LENGTH);
- strfill(rec+length,STANDARD_LENGTH+60-length,' ');
+ strfill((char*) rec+length,STANDARD_LENGTH+60-length,' ');
} /* fix_length */
/* Put maybe a blob in record */
-static void put_blob_in_record(char *blob_pos, char **blob_buffer)
+static void put_blob_in_record(uchar *blob_pos, char **blob_buffer)
{
ulong i,length;
if (use_blob)
diff --git a/storage/myisam/mi_test3.c b/storage/myisam/mi_test3.c
index ed9cd8e7b8c..5bdc33b8518 100644
--- a/storage/myisam/mi_test3.c
+++ b/storage/myisam/mi_test3.c
@@ -48,9 +48,9 @@ int test_read(MI_INFO *,int),test_write(MI_INFO *,int,int),
test_update(MI_INFO *,int,int),test_rrnd(MI_INFO *,int);
struct record {
- char id[8];
- char nr[4];
- char text[10];
+ uchar id[8];
+ uchar nr[4];
+ uchar text[10];
} record;
@@ -362,8 +362,8 @@ int test_write(MI_INFO *file,int id,int lock_type)
mi_extra(file,HA_EXTRA_WRITE_CACHE,0);
}
- sprintf(record.id,"%7d",getpid());
- strnmov(record.text,"Testing...", sizeof(record.text));
+ sprintf((char*) record.id,"%7d",getpid());
+ strnmov((char*) record.text,"Testing...", sizeof(record.text));
tries=(uint) rnd(100)+10;
for (i=count=0 ; i < tries ; i++)
@@ -419,7 +419,7 @@ int test_update(MI_INFO *file,int id,int lock_type)
}
}
bzero((char*) &new_record,sizeof(new_record));
- strmov(new_record.text,"Updated");
+ strmov((char*) new_record.text,"Updated");
found=next=prev=update=0;
for (i=0 ; i < 100 ; i++)
diff --git a/storage/myisam/mi_update.c b/storage/myisam/mi_update.c
index 924cdfcbc21..956334b7806 100644
--- a/storage/myisam/mi_update.c
+++ b/storage/myisam/mi_update.c
@@ -102,7 +102,7 @@ int mi_update(register MI_INFO *info, const uchar *oldrec, uchar *newrec)
key_changed|=HA_STATE_WRITTEN;
}
changed|=((ulonglong) 1 << i);
- if (_mi_ft_update(info,i,(char*) old_key,oldrec,newrec,pos))
+ if (_mi_ft_update(info,i, old_key,oldrec,newrec,pos))
goto err;
}
}
@@ -207,8 +207,8 @@ err:
{
if (share->keyinfo[i].flag & HA_FULLTEXT)
{
- if ((flag++ && _mi_ft_del(info,i,(char*) new_key,newrec,pos)) ||
- _mi_ft_add(info,i,(char*) old_key,oldrec,pos))
+ if ((flag++ && _mi_ft_del(info,i, new_key,newrec,pos)) ||
+ _mi_ft_add(info,i, old_key,oldrec,pos))
break;
}
else
diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c
index 8ae979f8bf6..719008d3513 100644
--- a/storage/myisam/mi_write.c
+++ b/storage/myisam/mi_write.c
@@ -112,7 +112,7 @@ int mi_write(MI_INFO *info, uchar *record)
}
if (share->keyinfo[i].flag & HA_FULLTEXT )
{
- if (_mi_ft_add(info,i,(char*) buff,record,filepos))
+ if (_mi_ft_add(info,i, buff, record, filepos))
{
if (local_lock_tree)
rw_unlock(&share->key_root_lock[i]);
@@ -200,7 +200,7 @@ err:
rw_wrlock(&share->key_root_lock[i]);
if (share->keyinfo[i].flag & HA_FULLTEXT)
{
- if (_mi_ft_del(info,i,(char*) buff,record,filepos))
+ if (_mi_ft_del(info,i, buff,record,filepos))
{
if (local_lock_tree)
rw_unlock(&share->key_root_lock[i]);
@@ -562,7 +562,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo,
we cannot easily dispatch an empty page here */
b+=blen+ft2len+2;
for (a=anc_buff+a_length ; b < a ; b+=ft2len+2)
- insert_dynamic(info->ft1_to_ft2, (char*) b);
+ insert_dynamic(info->ft1_to_ft2, b);
/* fixing the page's length - it contains only one key now */
mi_putint(anc_buff,2+blen+ft2len+2,0);
diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h
index f68d66d4cbb..721d6b9f271 100644
--- a/storage/myisam/myisamdef.h
+++ b/storage/myisam/myisamdef.h
@@ -181,8 +181,8 @@ typedef struct st_mi_isam_share { /* Shared between opens */
ha_checksum (*calc_checksum)(struct st_myisam_info*, const uchar *);
int (*compare_unique)(struct st_myisam_info*, MI_UNIQUEDEF *,
const uchar *record, my_off_t pos);
- uint (*file_read)(MI_INFO *, uchar *, uint, my_off_t, myf);
- uint (*file_write)(MI_INFO *, uchar *, uint, my_off_t, myf);
+ size_t (*file_read)(MI_INFO *, uchar *, size_t, my_off_t, myf);
+ size_t (*file_write)(MI_INFO *, const uchar *, size_t, my_off_t, myf);
invalidator_by_filename invalidator; /* query cache invalidator */
ulong this_process; /* processid */
ulong last_process; /* For table-change-check */
@@ -346,7 +346,7 @@ typedef struct st_mi_sort_param
NEAR int (*write_keys)(struct st_mi_sort_param *, register uchar **,
uint , struct st_buffpek *, IO_CACHE *);
NEAR uint (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint);
- NEAR int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,char *,
+ NEAR int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,uchar *,
uint, uint);
} MI_SORT_PARAM;
@@ -717,14 +717,14 @@ extern void _mi_unmap_file(MI_INFO *info);
extern uint save_pack_length(uint version, uchar *block_buff, ulong length);
extern uint read_pack_length(uint version, const uchar *buf, ulong *length);
extern uint calc_pack_length(uint version, ulong length);
-extern uint mi_mmap_pread(MI_INFO *info, uchar *Buffer,
- uint Count, my_off_t offset, myf MyFlags);
-extern uint mi_mmap_pwrite(MI_INFO *info, uchar *Buffer,
- uint Count, my_off_t offset, myf MyFlags);
-extern uint mi_nommap_pread(MI_INFO *info, uchar *Buffer,
- uint Count, my_off_t offset, myf MyFlags);
-extern uint mi_nommap_pwrite(MI_INFO *info, uchar *Buffer,
- uint Count, my_off_t offset, myf MyFlags);
+extern size_t mi_mmap_pread(MI_INFO *info, uchar *Buffer,
+ size_t Count, my_off_t offset, myf MyFlags);
+extern size_t mi_mmap_pwrite(MI_INFO *info, const uchar *Buffer,
+ size_t Count, my_off_t offset, myf MyFlags);
+extern size_t mi_nommap_pread(MI_INFO *info, uchar *Buffer,
+ size_t Count, my_off_t offset, myf MyFlags);
+extern size_t mi_nommap_pwrite(MI_INFO *info, const uchar *Buffer,
+ size_t Count, my_off_t offset, myf MyFlags);
uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite);
uchar *mi_state_info_read(uchar *ptr, MI_STATE_INFO *state);
@@ -732,13 +732,13 @@ uint mi_state_info_read_dsk(File file, MI_STATE_INFO *state, my_bool pRead);
uint mi_base_info_write(File file, MI_BASE_INFO *base);
uchar *my_n_base_info_read(uchar *ptr, MI_BASE_INFO *base);
int mi_keyseg_write(File file, const HA_KEYSEG *keyseg);
-char *mi_keyseg_read(char *ptr, HA_KEYSEG *keyseg);
+uchar *mi_keyseg_read(uchar *ptr, HA_KEYSEG *keyseg);
uint mi_keydef_write(File file, MI_KEYDEF *keydef);
-char *mi_keydef_read(char *ptr, MI_KEYDEF *keydef);
+uchar *mi_keydef_read(uchar *ptr, MI_KEYDEF *keydef);
uint mi_uniquedef_write(File file, MI_UNIQUEDEF *keydef);
-char *mi_uniquedef_read(char *ptr, MI_UNIQUEDEF *keydef);
+uchar *mi_uniquedef_read(uchar *ptr, MI_UNIQUEDEF *keydef);
uint mi_recinfo_write(File file, MI_COLUMNDEF *recinfo);
-char *mi_recinfo_read(char *ptr, MI_COLUMNDEF *recinfo);
+uchar *mi_recinfo_read(uchar *ptr, MI_COLUMNDEF *recinfo);
extern int mi_disable_indexes(MI_INFO *info);
extern int mi_enable_indexes(MI_INFO *info);
extern int mi_indexes_are_disabled(MI_INFO *info);
diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c
index 1cf4ad730cb..6566a7a7a02 100644
--- a/storage/myisam/myisamlog.c
+++ b/storage/myisam/myisamlog.c
@@ -32,7 +32,8 @@ struct file_info {
long process;
int filenr,id;
uint rnd;
- char *name, *show_name, *record;
+ char *name, *show_name;
+ uchar *record;
MI_INFO *isam;
bool closed,used;
ulong accessed;
@@ -815,7 +816,7 @@ static int find_record_with_key(struct file_info *file_info, uchar *record)
info->s->keyinfo[key].flag & HA_NOSAME)
{
VOID(_mi_make_key(info,key,tmp_key,record,0L));
- return mi_rkey(info,file_info->record,(int) key,(char*) tmp_key,0,
+ return mi_rkey(info,file_info->record,(int) key,tmp_key,0,
HA_READ_KEY_EXACT);
}
}
diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c
index 5f7c4ee8f2e..37428ddd279 100644
--- a/storage/myisam/myisampack.c
+++ b/storage/myisam/myisampack.c
@@ -513,14 +513,14 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
{
/* Make a new indexfile based on first file in list */
uint length;
- char *buff;
+ uchar *buff;
strmov(org_name,result_table); /* Fix error messages */
VOID(fn_format(new_name,result_table,"",MI_NAME_IEXT,2));
if ((join_isam_file=my_create(new_name,0,tmpfile_createflag,MYF(MY_WME)))
< 0)
goto err;
length=(uint) share->base.keystart;
- if (!(buff=my_malloc(length,MYF(MY_WME))))
+ if (!(buff= (uchar*) my_malloc(length,MYF(MY_WME))))
goto err;
if (my_pread(share->kfile,buff,length,0L,MYF(MY_WME | MY_NABP)) ||
my_write(join_isam_file,buff,length,
@@ -644,7 +644,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
new_length=file_buffer.pos_in_file;
if (!error && !test_only)
{
- char buff[MEMMAP_EXTRA_MARGIN]; /* End marginal for memmap */
+ uchar buff[MEMMAP_EXTRA_MARGIN]; /* End marginal for memmap */
bzero(buff,sizeof(buff));
error=my_write(file_buffer.file,buff,sizeof(buff),
MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL)) != 0;
diff --git a/storage/myisam/rt_test.c b/storage/myisam/rt_test.c
index 55b52c0c3bf..7d15afd12ef 100644
--- a/storage/myisam/rt_test.c
+++ b/storage/myisam/rt_test.c
@@ -28,9 +28,9 @@
#define KEYALG HA_KEY_ALG_RTREE
static int read_with_pos(MI_INFO * file, int silent);
-static void create_record(char *record,uint rownr);
-static void create_record1(char *record,uint rownr);
-static void print_record(char * record,my_off_t offs,const char * tail);
+static void create_record(uchar *record,uint rownr);
+static void create_record1(uchar *record,uint rownr);
+static void print_record(uchar * record,my_off_t offs,const char * tail);
static int run_test(const char *filename);
static double rt_data[]=
@@ -108,8 +108,8 @@ static int run_test(const char *filename)
int i;
int error;
int row_count=0;
- char record[MAX_REC_LENGTH];
- char read_record[MAX_REC_LENGTH];
+ uchar record[MAX_REC_LENGTH];
+ uchar read_record[MAX_REC_LENGTH];
int upd= 10;
ha_rows hrows;
@@ -342,7 +342,7 @@ static int read_with_pos (MI_INFO * file,int silent)
{
int error;
int i;
- char read_record[MAX_REC_LENGTH];
+ uchar read_record[MAX_REC_LENGTH];
if (!silent)
printf("- Reading rows with position\n");
@@ -385,12 +385,12 @@ static void bprint_record(char * record,
#endif
-static void print_record(char * record,
+static void print_record(uchar * record,
my_off_t offs __attribute__((unused)),
const char * tail)
{
int i;
- char * pos;
+ uchar * pos;
double c;
printf(" rec=(%d)",(unsigned char)record[0]);
@@ -407,16 +407,16 @@ static void print_record(char * record,
-static void create_record1(char *record,uint rownr)
+static void create_record1(uchar *record,uint rownr)
{
int i;
- char * pos;
+ uchar * pos;
double c=rownr+10;
bzero((char*) record,MAX_REC_LENGTH);
record[0]=0x01; /* DEL marker */
- for ( pos=record+1, i=0; i<2*ndims; i++)
+ for (pos=record+1, i=0; i<2*ndims; i++)
{
memcpy(pos,&c,sizeof(c));
float8store(pos,c);
@@ -426,7 +426,7 @@ static void create_record1(char *record,uint rownr)
#ifdef NOT_USED
-static void create_record0(char *record,uint rownr)
+static void create_record0(uchar *record,uint rownr)
{
int i;
char * pos;
@@ -449,16 +449,16 @@ static void create_record0(char *record,uint rownr)
#endif
-static void create_record(char *record,uint rownr)
+static void create_record(uchar *record,uint rownr)
{
int i;
- char *pos;
+ uchar *pos;
double *data= rt_data+rownr*4;
record[0]=0x01; /* DEL marker */
- for ( pos=record+1, i=0; i<ndims*2; i++)
+ for (pos=record+1, i=0; i<ndims*2; i++)
{
- float8store(pos,data[i]);
- pos+=8;
+ float8store(pos,data[i]);
+ pos+=8;
}
}
diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c
index bf3281e7d32..27e4bd37af7 100644
--- a/storage/myisam/sort.c
+++ b/storage/myisam/sort.c
@@ -78,10 +78,10 @@ static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info,uchar **sort_keys,
static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile,BUFFPEK *buffpek,
uint sort_length);
static int NEAR_F write_merge_key(MI_SORT_PARAM *info, IO_CACHE *to_file,
- char *key, uint sort_length, uint count);
+ uchar *key, uint sort_length, uint count);
static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info,
IO_CACHE *to_file,
- char* key, uint sort_length,
+ uchar* key, uint sort_length,
uint count);
static inline int
my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs);
@@ -116,7 +116,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
{
info->write_keys=write_keys_varlen;
info->read_to_buffer=read_to_buffer_varlen;
- info->write_key=write_merge_key_varlen;
+ info->write_key= write_merge_key_varlen;
}
else
{
@@ -858,16 +858,16 @@ static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek,
static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info,
- IO_CACHE *to_file,char* key,
+ IO_CACHE *to_file, uchar* key,
uint sort_length, uint count)
{
uint idx;
+ uchar *bufs = key;
- char *bufs = key;
for (idx=1;idx<=count;idx++)
{
int err;
- if ((err= my_var_write(info,to_file, (uchar*) bufs)))
+ if ((err= my_var_write(info, to_file, bufs)))
return (err);
bufs=bufs+sort_length;
}
@@ -876,10 +876,10 @@ static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info,
static int NEAR_F write_merge_key(MI_SORT_PARAM *info __attribute__((unused)),
- IO_CACHE *to_file, char* key,
+ IO_CACHE *to_file, uchar *key,
uint sort_length, uint count)
{
- return my_b_write(to_file,(uchar*) key,(uint) sort_length*count);
+ return my_b_write(to_file, key, (size_t) sort_length*count);
}
/*
@@ -924,7 +924,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
sort_length));
if (error == -1)
goto err; /* purecov: inspected */
- queue_insert(&queue,(char*) buffpek);
+ queue_insert(&queue,(uchar*) buffpek);
}
while (queue.elements > 1)
diff --git a/storage/myisam/sp_test.c b/storage/myisam/sp_test.c
index 96ba05e8a74..dee32ba423e 100644
--- a/storage/myisam/sp_test.c
+++ b/storage/myisam/sp_test.c
@@ -24,11 +24,11 @@
#define MAX_REC_LENGTH 1024
#define KEYALG HA_KEY_ALG_RTREE
-static void create_linestring(char *record,uint rownr);
-static void print_record(char * record,my_off_t offs,const char * tail);
+static void create_linestring(uchar *record,uint rownr);
+static void print_record(uchar * record,my_off_t offs,const char * tail);
-static void create_key(char *key,uint rownr);
-static void print_key(const char *key,const char * tail);
+static void create_key(uchar *key,uint rownr);
+static void print_key(const uchar *key,const char * tail);
static int run_test(const char *filename);
static int read_with_pos(MI_INFO * file, int silent);
@@ -64,9 +64,9 @@ int run_test(const char *filename)
int i;
int error;
int row_count=0;
- char record[MAX_REC_LENGTH];
- char key[MAX_REC_LENGTH];
- char read_record[MAX_REC_LENGTH];
+ uchar record[MAX_REC_LENGTH];
+ uchar key[MAX_REC_LENGTH];
+ uchar read_record[MAX_REC_LENGTH];
int upd=10;
ha_rows hrows;
@@ -272,7 +272,7 @@ static int read_with_pos (MI_INFO * file,int silent)
{
int error;
int i;
- char read_record[MAX_REC_LENGTH];
+ uchar read_record[MAX_REC_LENGTH];
int rows=0;
if (!silent)
@@ -300,7 +300,7 @@ static int read_with_pos (MI_INFO * file,int silent)
#ifdef NOT_USED
-static void bprint_record(char * record,
+static void bprint_record(uchar * record,
my_off_t offs __attribute__((unused)),
const char * tail)
{
@@ -319,9 +319,9 @@ static void bprint_record(char * record,
#endif
-static void print_record(char * record, my_off_t offs,const char * tail)
+static void print_record(uchar * record, my_off_t offs,const char * tail)
{
- char *pos;
+ uchar *pos;
char *ptr;
uint len;
@@ -341,7 +341,7 @@ static void print_record(char * record, my_off_t offs,const char * tail)
#ifdef NOT_USED
-static void create_point(char *record,uint rownr)
+static void create_point(uchar *record,uint rownr)
{
uint tmp;
char *ptr;
@@ -368,11 +368,11 @@ static void create_point(char *record,uint rownr)
#endif
-static void create_linestring(char *record,uint rownr)
+static void create_linestring(uchar *record,uint rownr)
{
uint tmp;
char *ptr;
- char *pos=record;
+ uchar *pos= record;
double x[200];
int i,j;
int npoints=2;
@@ -396,21 +396,21 @@ static void create_linestring(char *record,uint rownr)
}
-static void create_key(char *key,uint rownr)
+static void create_key(uchar *key,uint rownr)
{
double c=rownr;
- char *pos;
+ uchar *pos;
uint i;
bzero(key,MAX_REC_LENGTH);
- for ( pos=key, i=0; i<2*SPDIMS; i++)
+ for (pos=key, i=0; i<2*SPDIMS; i++)
{
float8store(pos,c);
pos+=sizeof(c);
}
}
-static void print_key(const char *key,const char * tail)
+static void print_key(const uchar *key,const char * tail)
{
double c;
uint i;
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index c03c1e28014..8a914e8a2de 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -205,9 +205,9 @@ int ha_myisammrg::delete_row(const uchar * buf)
return myrg_delete(file,buf);
}
-int ha_myisammrg::index_read(uchar * buf, const uchar * key,
- key_part_map keypart_map,
- enum ha_rkey_function find_flag)
+int ha_myisammrg::index_read_map(uchar * buf, const uchar * key,
+ key_part_map keypart_map,
+ enum ha_rkey_function find_flag)
{
ha_statistic_increment(&SSV::ha_read_key_count);
int error=myrg_rkey(file,buf,active_index, key, keypart_map, find_flag);
@@ -215,9 +215,9 @@ int ha_myisammrg::index_read(uchar * buf, const uchar * key,
return error;
}
-int ha_myisammrg::index_read_idx(uchar * buf, uint index, const uchar * key,
- key_part_map keypart_map,
- enum ha_rkey_function find_flag)
+int ha_myisammrg::index_read_idx_map(uchar * buf, uint index, const uchar * key,
+ key_part_map keypart_map,
+ enum ha_rkey_function find_flag)
{
ha_statistic_increment(&SSV::ha_read_key_count);
int error=myrg_rkey(file,buf,index, key, keypart_map, find_flag);
@@ -225,8 +225,8 @@ int ha_myisammrg::index_read_idx(uchar * buf, uint index, const uchar * key,
return error;
}
-int ha_myisammrg::index_read_last(uchar * buf, const uchar * key,
- key_part_map keypart_map)
+int ha_myisammrg::index_read_last_map(uchar *buf, const uchar *key,
+ key_part_map keypart_map)
{
ha_statistic_increment(&SSV::ha_read_key_count);
int error=myrg_rkey(file,buf,active_index, key, keypart_map,
diff --git a/storage/myisammrg/ha_myisammrg.h b/storage/myisammrg/ha_myisammrg.h
index b88f4d52743..91aabe277f7 100644
--- a/storage/myisammrg/ha_myisammrg.h
+++ b/storage/myisammrg/ha_myisammrg.h
@@ -57,11 +57,12 @@ class ha_myisammrg: public handler
int write_row(uchar * buf);
int update_row(const uchar * old_data, uchar * new_data);
int delete_row(const uchar * buf);
- int index_read(uchar * buf, const uchar * key, key_part_map keypart_map,
- enum ha_rkey_function find_flag);
- int index_read_idx(uchar * buf, uint index, const uchar * key,
- key_part_map keypart_map, enum ha_rkey_function find_flag);
- int index_read_last(uchar * buf, const uchar * key, key_part_map keypart_map);
+ int index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map,
+ enum ha_rkey_function find_flag);
+ int index_read_idx_map(uchar *buf, uint index, const uchar *key,
+ key_part_map keypart_map,
+ enum ha_rkey_function find_flag);
+ int index_read_last_map(uchar *buf, const uchar *key, key_part_map keypart_map);
int index_next(uchar * buf);
int index_prev(uchar * buf);
int index_first(uchar * buf);
diff --git a/storage/myisammrg/myrg_create.c b/storage/myisammrg/myrg_create.c
index c4e91e7b29b..df81b730bfd 100644
--- a/storage/myisammrg/myrg_create.c
+++ b/storage/myisammrg/myrg_create.c
@@ -46,7 +46,7 @@ int myrg_create(const char *name, const char **table_names,
fn_same(buff,name,4);
*(end=strend(buff))='\n';
end[1]=0;
- if (my_write(file,buff,(uint) (end-buff+1),
+ if (my_write(file,(char*) buff,(uint) (end-buff+1),
MYF(MY_WME | MY_NABP)))
goto err;
}
@@ -55,7 +55,7 @@ int myrg_create(const char *name, const char **table_names,
{
end=strxmov(buff,"#INSERT_METHOD=",
get_type(&merge_insert_method,insert_method-1),"\n",NullS);
- if (my_write(file,buff,(uint) (end-buff),MYF(MY_WME | MY_NABP)))
+ if (my_write(file, (uchar*) buff,(uint) (end-buff),MYF(MY_WME | MY_NABP)))
goto err;
}
if (my_close(file,MYF(0)))
diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp
index 59b3de2227b..45766e5e9c4 100644
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp
@@ -1855,7 +1855,7 @@ int Dbtup::interpreterNextLab(Signal* signal,
Uint32 RstackPtr= 0;
union {
Uint32 TregMemBuffer[32];
- Uint64 Tdummy[16];
+ Uint64 align[16];
};
Uint32 TstackMemBuffer[32];
diff --git a/storage/ndb/src/kernel/vm/DynArr256.cpp b/storage/ndb/src/kernel/vm/DynArr256.cpp
index cfa8b8a51e6..4e73bb8830b 100644
--- a/storage/ndb/src/kernel/vm/DynArr256.cpp
+++ b/storage/ndb/src/kernel/vm/DynArr256.cpp
@@ -364,7 +364,6 @@ Uint32
DynArr256::release(ReleaseIterator &iter, Uint32 * retptr)
{
Uint32 sz = iter.m_sz;
- Uint32 pos = iter.m_pos;
Uint32 ptrI = iter.m_ptr_i[sz];
Uint32 page_no = ptrI >> DA256_BITS;
Uint32 page_idx = ptrI & DA256_MASK;
@@ -442,7 +441,6 @@ DynArr256::release(ReleaseIterator &iter, Uint32 * retptr)
return 2;
}
-done:
new (&m_head) Head();
return 0;
diff --git a/storage/ndb/src/ndbapi/Ndb.cpp b/storage/ndb/src/ndbapi/Ndb.cpp
index bbeeed3ae70..7471e9c84f8 100644
--- a/storage/ndb/src/ndbapi/Ndb.cpp
+++ b/storage/ndb/src/ndbapi/Ndb.cpp
@@ -316,7 +316,6 @@ Ndb::computeHash(Uint32 *retval,
const NdbTableImpl* impl = &NdbTableImpl::getImpl(*table);
const NdbColumnImpl* const * cols = impl->m_columns.getBase();
Uint32 len;
- NdbTransaction* trans;
char* pos;
Uint32 colcnt = impl->m_columns.size();
diff --git a/strings/strtod.c b/strings/strtod.c
index 0cec86f832d..4c9cf931cb3 100644
--- a/strings/strtod.c
+++ b/strings/strtod.c
@@ -28,6 +28,9 @@
#include "my_base.h" /* Includes errno.h + EOVERFLOW */
#include "m_ctype.h"
+#ifdef HAVE_IEEEFP_H
+#include <ieeefp.h>
+#endif
#define MAX_DBL_EXP 308
#define MAX_RESULT_FOR_MAX_EXP 1.7976931348623157
diff --git a/tests/bug25714.c b/tests/bug25714.c
index e9b2be44209..4782178e2f2 100644
--- a/tests/bug25714.c
+++ b/tests/bug25714.c
@@ -68,4 +68,5 @@ int main (int argc, char **argv)
my_end(0);
return 0;
-};
+}
+
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index eac1ad413ea..8a281332d24 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -2419,7 +2419,7 @@ static uint query_cache_hits(MYSQL *conn)
*/
static void test_ps_query_cache()
{
- MYSQL *org_mysql= mysql, *lmysql;
+ MYSQL *lmysql;
MYSQL_STMT *stmt;
int rc;
MYSQL_BIND p_bind[2],r_bind[2]; /* p: param bind; r: result bind */
@@ -2563,8 +2563,7 @@ static void test_ps_query_cache()
check_execute(stmt, rc);
test_ps_query_cache_result(1, "hh", 2, 2, "hh", 2, 1, "ii", 2);
hits2= query_cache_hits(mysql);
- switch(iteration)
- {
+ switch(iteration) {
case TEST_QCACHE_ON_WITH_OTHER_CONN:
case TEST_QCACHE_ON: /* should have hit */
DIE_UNLESS(hits2-hits1 == 1);
@@ -2572,6 +2571,7 @@ static void test_ps_query_cache()
case TEST_QCACHE_OFF_ON:
case TEST_QCACHE_ON_OFF: /* should not have hit */
DIE_UNLESS(hits2-hits1 == 0);
+ break;
}
/* now modify parameter values and see qcache hits */
@@ -2582,8 +2582,7 @@ static void test_ps_query_cache()
test_ps_query_cache_result(1, "hh", 2, 1, "ii", 2, 2, "ii", 2);
hits1= query_cache_hits(mysql);
- switch(iteration)
- {
+ switch(iteration) {
case TEST_QCACHE_ON:
case TEST_QCACHE_OFF_ON:
case TEST_QCACHE_ON_OFF: /* should not have hit */
@@ -2591,6 +2590,7 @@ static void test_ps_query_cache()
break;
case TEST_QCACHE_ON_WITH_OTHER_CONN: /* should have hit */
DIE_UNLESS(hits1-hits2 == 1);
+ break;
}
rc= mysql_stmt_execute(stmt);
@@ -2601,8 +2601,7 @@ static void test_ps_query_cache()
mysql_stmt_close(stmt);
- switch(iteration)
- {
+ switch(iteration) {
case TEST_QCACHE_ON: /* should have hit */
DIE_UNLESS(hits2-hits1 == 1);
break;
@@ -2613,8 +2612,6 @@ static void test_ps_query_cache()
case TEST_QCACHE_ON_WITH_OTHER_CONN: /* should have hit */
DIE_UNLESS(hits2-hits1 == 1);
break;
- mysql_close(lmysql);
- mysql= org_mysql;
}
} /* for(iteration=...) */
@@ -12296,24 +12293,24 @@ static void test_bug6081()
int rc;
myheader("test_bug6081");
- rc= simple_command(mysql, COM_DROP_DB, current_db,
+ rc= simple_command(mysql, COM_DROP_DB, (uchar*) current_db,
(ulong)strlen(current_db), 0);
if (rc == 0 && mysql_errno(mysql) != ER_UNKNOWN_COM_ERROR)
{
myerror(NULL); /* purecov: inspected */
die(__FILE__, __LINE__, "COM_DROP_DB failed"); /* purecov: inspected */
}
- rc= simple_command(mysql, COM_DROP_DB, current_db,
+ rc= simple_command(mysql, COM_DROP_DB, (uchar*) current_db,
(ulong)strlen(current_db), 0);
myquery_r(rc);
- rc= simple_command(mysql, COM_CREATE_DB, current_db,
+ rc= simple_command(mysql, COM_CREATE_DB, (uchar*) current_db,
(ulong)strlen(current_db), 0);
if (rc == 0 && mysql_errno(mysql) != ER_UNKNOWN_COM_ERROR)
{
myerror(NULL); /* purecov: inspected */
die(__FILE__, __LINE__, "COM_CREATE_DB failed"); /* purecov: inspected */
}
- rc= simple_command(mysql, COM_CREATE_DB, current_db,
+ rc= simple_command(mysql, COM_CREATE_DB, (uchar*) current_db,
(ulong)strlen(current_db), 0);
myquery_r(rc);
rc= mysql_select_db(mysql, current_db);
@@ -13540,7 +13537,8 @@ static void test_bug9478()
/* Fill in the fethc packet */
int4store(buff, stmt->stmt_id);
buff[4]= 1; /* prefetch rows */
- rc= ((*mysql->methods->advanced_command)(mysql, COM_STMT_FETCH, buff,
+ rc= ((*mysql->methods->advanced_command)(mysql, COM_STMT_FETCH,
+ (uchar*) buff,
sizeof(buff), 0,0,1,NULL) ||
(*mysql->methods->read_query_result)(mysql));
DIE_UNLESS(rc);
@@ -16106,7 +16104,7 @@ static void test_bug27876()
int rc;
MYSQL_RES *result;
- char utf8_func[] =
+ uchar utf8_func[] =
{
0xd1, 0x84, 0xd1, 0x83, 0xd0, 0xbd, 0xd0, 0xba,
0xd1, 0x86, 0xd0, 0xb8, 0xd0, 0xb9, 0xd0, 0xba,
@@ -16114,7 +16112,7 @@ static void test_bug27876()
0x00
};
- char utf8_param[] =
+ uchar utf8_param[] =
{
0xd0, 0xbf, 0xd0, 0xb0, 0xd1, 0x80, 0xd0, 0xb0,
0xd0, 0xbc, 0xd0, 0xb5, 0xd1, 0x82, 0xd1, 0x8a,
@@ -16136,23 +16134,23 @@ static void test_bug27876()
result= mysql_store_result(mysql);
mytest(result);
- sprintf(query, "DROP FUNCTION IF EXISTS %s", utf8_func);
+ sprintf(query, "DROP FUNCTION IF EXISTS %s", (char*) utf8_func);
rc= mysql_query(mysql, query);
myquery(rc);
sprintf(query,
"CREATE FUNCTION %s( %s VARCHAR(25))"
" RETURNS VARCHAR(25) DETERMINISTIC RETURN %s",
- utf8_func, utf8_param, utf8_param);
+ (char*) utf8_func, (char*) utf8_param, (char*) utf8_param);
rc= mysql_query(mysql, query);
myquery(rc);
- sprintf(query, "SELECT %s(VERSION())", utf8_func);
+ sprintf(query, "SELECT %s(VERSION())", (char*) utf8_func);
rc= mysql_query(mysql, query);
myquery(rc);
result= mysql_store_result(mysql);
mytest(result);
- sprintf(query, "DROP FUNCTION %s", utf8_func);
+ sprintf(query, "DROP FUNCTION %s", (char*) utf8_func);
rc= mysql_query(mysql, query);
myquery(rc);
diff --git a/vio/viosocket.c b/vio/viosocket.c
index 5d8ca6d118c..942f0330c57 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -80,7 +80,7 @@ size_t vio_read_buff(Vio *vio, uchar* buf, size_t size)
}
else if (size < VIO_UNBUFFERED_READ_MIN_SIZE)
{
- rc= vio_read(vio, vio->read_buffer, VIO_READ_BUFFER_SIZE);
+ rc= vio_read(vio, (uchar*) vio->read_buffer, VIO_READ_BUFFER_SIZE);
if (rc != 0 && rc != (size_t) -1)
{
if (rc > size)