summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-10-15 22:40:36 +0300
committerunknown <monty@mashka.mysql.fi>2003-10-15 22:40:36 +0300
commitddbc8428546da197a031d24cfcafd1a545467e9b (patch)
treedcc59a0d59657900722d4e51c1daeceec81df437 /sql
parent086ec556f87701cad20a75031d7fb1ab3cd3b350 (diff)
downloadmariadb-git-ddbc8428546da197a031d24cfcafd1a545467e9b.tar.gz
Portability fixes for windows
After merge fixes include/my_base.h: Fix comment syntax libmysql/client_settings.h: Portability fixes for windows libmysql/libmysql.c: Portability fixes for windows libmysql/libmysql.def: Portability fixes for windows mysql-test/r/variables.result: Fix result after merge sql-common/client.c: Portability fixes for windows sql/ha_berkeley.cc: Use defines instead of constants sql/item_strfunc.cc: Portability fixes for windows sql/mysql_priv.h: Use defines instead of defines sql/mysqld.cc: After merge fix sql/opt_range.h: After merge fix sql/set_var.h: Portability fixes for windows sql/sql_class.cc: Defines instead of constants sql/sql_help.cc: after merge fixes More OOM error checking sql/sql_prepare.cc: After merge fixes sql/sql_table.cc: Portability fixes for windows
Diffstat (limited to 'sql')
-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
10 files changed, 34 insertions, 19 deletions
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;