summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/my_base.h32
-rw-r--r--libmysql/client_settings.h6
-rw-r--r--libmysql/libmysql.c2
-rw-r--r--libmysql/libmysql.def2
-rw-r--r--mysql-test/r/variables.result2
-rw-r--r--sql-common/client.c4
-rw-r--r--sql/ha_berkeley.cc3
-rw-r--r--sql/item_strfunc.cc2
-rw-r--r--sql/mysql_priv.h3
-rw-r--r--sql/mysqld.cc1
-rw-r--r--sql/opt_range.h3
-rw-r--r--sql/set_var.h2
-rw-r--r--sql/sql_class.cc8
-rw-r--r--sql/sql_help.cc4
-rw-r--r--sql/sql_prepare.cc18
-rw-r--r--sql/sql_table.cc9
16 files changed, 60 insertions, 41 deletions
diff --git a/include/my_base.h b/include/my_base.h
index e36f73afe75..5af8a968cd0 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -49,20 +49,24 @@
/* The following is parameter to ha_rkey() how to use key */
-/* We define a complete-field prefix of a key value as a prefix where the
-last included field in the prefix contains the full field, not just some bytes
-from the start of the field. A partial-field prefix is allowed to
-contain only a few first bytes from the last included field.
-
-Below HA_READ_KEY_EXACT, ..., HA_READ_BEFORE_KEY can take a
-complete-field prefix of a key value as the search key. HA_READ_PREFIX
-and HA_READ_PREFIX_LAST could also take a partial-field prefix, but
-currently (4.0.10) they are only used with complete-field prefixes. MySQL uses
-a padding trick to implement LIKE 'abc%' queries.
-
-NOTE that in InnoDB HA_READ_PREFIX_LAST will NOT work with a partial-field
-prefix because InnoDB currently strips spaces from the end of varchar
-fields! */
+/*
+ We define a complete-field prefix of a key value as a prefix where
+ the last included field in the prefix contains the full field, not
+ just some bytes from the start of the field. A partial-field prefix
+ is allowed to contain only a few first bytes from the last included
+ field.
+
+ Below HA_READ_KEY_EXACT, ..., HA_READ_BEFORE_KEY can take a
+ complete-field prefix of a key value as the search
+ key. HA_READ_PREFIX and HA_READ_PREFIX_LAST could also take a
+ partial-field prefix, but currently (4.0.10) they are only used with
+ complete-field prefixes. MySQL uses a padding trick to implement
+ LIKE 'abc%' queries.
+
+ NOTE that in InnoDB HA_READ_PREFIX_LAST will NOT work with a
+ partial-field prefix because InnoDB currently strips spaces from the
+ end of varchar fields!
+*/
enum ha_rkey_function {
HA_READ_KEY_EXACT, /* Find first record else error */
diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h
index b9c47c1dd55..582f9613ee0 100644
--- a/libmysql/client_settings.h
+++ b/libmysql/client_settings.h
@@ -52,9 +52,9 @@ void STDCALL cli_mysql_close(MYSQL *mysql);
MYSQL_FIELD * STDCALL cli_list_fields(MYSQL *mysql);
my_bool STDCALL cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt);
-MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
- uint fields);
+MYSQL_DATA * STDCALL cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
+ uint fields);
int STDCALL cli_stmt_execute(MYSQL_STMT *stmt);
-MYSQL_DATA *cli_read_binary_rows(MYSQL_STMT *stmt);
+MYSQL_DATA * STDCALL cli_read_binary_rows(MYSQL_STMT *stmt);
int STDCALL cli_unbuffered_fetch(MYSQL *mysql, char **row);
const char * STDCALL cli_read_statistic(MYSQL *mysql);
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 08ea9deb11e..af39d3228e0 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -3098,7 +3098,7 @@ no_data:
Read all rows of data from server (binary format)
*/
-MYSQL_DATA *cli_read_binary_rows(MYSQL_STMT *stmt)
+MYSQL_DATA * STDCALL cli_read_binary_rows(MYSQL_STMT *stmt)
{
ulong pkt_len;
uchar *cp;
diff --git a/libmysql/libmysql.def b/libmysql/libmysql.def
index 1abc924e9c0..787aa645017 100644
--- a/libmysql/libmysql.def
+++ b/libmysql/libmysql.def
@@ -81,7 +81,7 @@ EXPORTS
mysql_param_result
mysql_ping
mysql_prepare
- mysql_prepare_result
+ mysql_get_metadata
mysql_query
mysql_read_query_result
mysql_real_connect
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 3674d058bee..d65b44e7846 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -235,7 +235,7 @@ ERROR HY000: Variable 'myisam_max_sort_file_size' is a GLOBAL variable and shoul
set myisam_max_extra_sort_file_size=100;
ERROR HY000: Variable 'myisam_max_extra_sort_file_size' is a GLOBAL variable and should be set with SET GLOBAL
set @@SQL_WARNINGS=NULL;
-ERROR HY000: Variable 'sql_warnings' can't be set to the value of 'NULL'
+ERROR 42000: Variable 'sql_warnings' can't be set to the value of 'NULL'
set autocommit=1;
set big_tables=1;
select @@autocommit, @@big_tables;
diff --git a/sql-common/client.c b/sql-common/client.c
index 80a5a719376..15f906f4e34 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1137,8 +1137,8 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
/* Read all rows (fields or data) from server */
-MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
- unsigned int fields)
+MYSQL_DATA * STDCALL cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
+ unsigned int fields)
{
uint field;
ulong pkt_len;
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 0795c9d6a96..5b0fc95442c 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -238,7 +238,8 @@ int berkeley_show_logs(Protocol *protocol)
MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
DBUG_ENTER("berkeley_show_logs");
- init_sql_alloc(&show_logs_root, 1024, 1024);
+ init_sql_alloc(&show_logs_root, BDB_LOG_ALLOC_BLOCK_SIZE,
+ BDB_LOG_ALLOC_BLOCK_SIZE);
my_pthread_setspecific_ptr(THR_MALLOC,&show_logs_root);
if ((error= db_env->log_archive(db_env, &all_logs,
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index c8ee64dc707..aa7a69769aa 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -33,7 +33,9 @@
#include "md5.h"
#include "sha1.h"
#include "my_aes.h"
+C_MODE_START
#include "../mysys/my_static.h" // For soundex_map
+C_MODE_END
String my_empty_string("",default_charset_info);
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index d1fe1abb2bd..f8ce32c6607 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -94,6 +94,9 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
#define ACL_ALLOC_BLOCK_SIZE 1024
#define UDF_ALLOC_BLOCK_SIZE 1024
#define TABLE_ALLOC_BLOCK_SIZE 1024
+#define BDB_LOG_ALLOC_BLOCK_SIZE 1024
+#define WARN_ALLOC_BLOCK_SIZE 2048
+#define WARN_ALLOC_PREALLOC_SIZE 1024
/*
The following parameters is to decide when to use an extra cache to
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 0664175d2a2..e3da3a31a3a 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3575,7 +3575,6 @@ enum options
OPT_SHARED_MEMORY_BASE_NAME,
OPT_OLD_PASSWORDS,
OPT_EXPIRE_LOGS_DAYS,
- OPT_DEFAULT_WEEK_FORMAT,
OPT_GROUP_CONCAT_MAX_LEN,
OPT_DEFAULT_COLLATION,
OPT_SECURE_AUTH,
diff --git a/sql/opt_range.h b/sql/opt_range.h
index 4c1aba7b829..128f6259055 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -127,8 +127,7 @@ class SQL_SELECT :public Sql_alloc {
SQL_SELECT();
~SQL_SELECT();
- bool check_quick(THD *thd, bool force_quick_range= 0,
- ha_rows limit= HA_POS_ERROR)
+ bool check_quick(THD *thd, bool force_quick_range, ha_rows limit)
{ return test_quick_select(thd, ~0L,0,limit, force_quick_range) < 0; }
inline bool skipp_record() { return cond ? cond->val_int() == 0 : 0; }
int test_quick_select(THD *thd, key_map keys, table_map prev_tables,
diff --git a/sql/set_var.h b/sql/set_var.h
index 812bd6c9420..70667c719e5 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -693,7 +693,7 @@ public:
uint name_length_arg, gptr data_arg)
:name_length(name_length_arg), data(data_arg)
{
- name= my_memdup(name_arg, name_length, MYF(MY_WME));
+ name= my_memdup((byte*) name_arg, name_length, MYF(MY_WME));
links->push_back(this);
}
inline bool cmp(const char *name_cmp, uint length)
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 2ac7b0856bd..2a869679adf 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -148,7 +148,7 @@ THD::THD():user_time(0), is_fatal_error(0),
bzero((char*) &transaction.mem_root,sizeof(transaction.mem_root));
bzero((char*) &con_root,sizeof(con_root));
bzero((char*) &warn_root,sizeof(warn_root));
- init_alloc_root(&warn_root, 1024, 0);
+ init_alloc_root(&warn_root, WARN_ALLOC_BLOCK_SIZE, WARN_ALLOC_PREALLOC_SIZE);
user_connect=(USER_CONN *)0;
hash_init(&user_vars, &my_charset_bin, USER_VARS_HASH_SIZE, 0, 0,
(hash_get_key) get_var_key,
@@ -230,9 +230,11 @@ void THD::init(void)
void THD::init_for_queries()
{
- init_sql_alloc(&mem_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC);
+ init_sql_alloc(&mem_root, variables.query_alloc_block_size,
+ variables.query_prealloc_size);
init_sql_alloc(&transaction.mem_root,
- TRANS_MEM_ROOT_BLOCK_SIZE, TRANS_MEM_ROOT_PREALLOC);
+ variables.trans_alloc_block_size,
+ variables.trans_prealloc_size);
}
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index 02fc8591370..6af4ffde0e1 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -599,7 +599,7 @@ SQL_SELECT *prepare_simple_select(THD *thd, Item *cond, TABLE_LIST *tables,
{
cond->fix_fields(thd, tables, &cond); // can never fail
SQL_SELECT *res= make_select(table,0,0,cond,error);
- return (*error || (res && res->check_quick(0, HA_POS_ERROR))) ? 0 : res;
+ return (*error || (res && res->check_quick(thd, 0, HA_POS_ERROR))) ? 0 : res;
}
/*
@@ -627,6 +627,8 @@ SQL_SELECT *prepare_select_for_name(THD *thd, const char *mask, uint mlen,
Item *cond= new Item_func_like(new Item_field(pfname),
new Item_string(mask,mlen,pfname->charset()),
(char*) "\\");
+ if (thd->is_fatal_error)
+ return 0; // OOM
return prepare_simple_select(thd,cond,tables,table,error);
}
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index dd8d5613880..522879c863a 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -888,12 +888,15 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length)
{
MEM_ROOT thd_root= thd->mem_root;
PREP_STMT stmt;
+ SELECT_LEX *sl;
DBUG_ENTER("mysql_stmt_prepare");
bzero((char*) &stmt, sizeof(stmt));
stmt.stmt_id= ++thd->current_stmt_id;
- init_sql_alloc(&stmt.mem_root, 8192, 8192);
+ init_sql_alloc(&stmt.mem_root,
+ thd->variables.query_alloc_block_size,
+ thd->variables.query_prealloc_size);
stmt.thd= thd;
stmt.thd->mem_root= stmt.mem_root;
@@ -908,7 +911,7 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length)
my_pthread_setprio(pthread_self(),WAIT_PRIOR);
// save WHERE clause pointers to avoid damaging they by optimisation
- for (SELECT_LEX *sl= thd->lex.all_selects_list;
+ for (sl= thd->lex.all_selects_list;
sl;
sl= sl->next_select_in_list())
{
@@ -943,8 +946,9 @@ err:
void mysql_stmt_execute(THD *thd, char *packet)
{
- ulong stmt_id= uint4korr(packet);
- PREP_STMT *stmt;
+ ulong stmt_id= uint4korr(packet);
+ PREP_STMT *stmt;
+ SELECT_LEX *sl;
DBUG_ENTER("mysql_stmt_execute");
if (!(stmt=find_prepared_statement(thd, stmt_id, "execute")))
@@ -963,11 +967,13 @@ void mysql_stmt_execute(THD *thd, char *packet)
LEX thd_lex= thd->lex;
thd->lex= stmt->lex;
- for (SELECT_LEX *sl= stmt->lex.all_selects_list;
+ for (sl= stmt->lex.all_selects_list;
sl;
sl= sl->next_select_in_list())
{
- // copy WHERE clause pointers to avoid damaging they by optimisation
+ /*
+ Copy WHERE clause pointers to avoid damaging they by optimisation
+ */
if (sl->prep_where)
sl->where= sl->prep_where->copy_andor_structure(thd);
DBUG_ASSERT(sl->join == 0);
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 8a736d91ffa..3c19464d80c 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2656,9 +2656,9 @@ int mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
while (!t->file->rnd_next(t->record[0]))
{
ha_checksum row_crc= 0;
- if (t->record[0] != t->field[0]->ptr)
+ if (t->record[0] != (byte*) t->field[0]->ptr)
row_crc= my_checksum(row_crc, t->record[0],
- t->field[0]->ptr - t->record[0]);
+ ((byte*) t->field[0]->ptr) - t->record[0]);
for (uint i= 0; i < t->fields; i++ )
{
@@ -2667,10 +2667,11 @@ int mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
{
String tmp;
f->val_str(&tmp,&tmp);
- row_crc= my_checksum(row_crc, tmp.ptr(), tmp.length());
+ row_crc= my_checksum(row_crc, (byte*) tmp.ptr(), tmp.length());
}
else
- row_crc= my_checksum(row_crc, f->ptr, f->pack_length());
+ row_crc= my_checksum(row_crc, (byte*) f->ptr,
+ f->pack_length());
}
crc+= row_crc;