Commit 9ef2a83f authored by monty@mashka.mysql.fi's avatar monty@mashka.mysql.fi

Portability fixes for windows

After merge fixes
parent e71b53a8
......@@ -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 */
......
......@@ -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,
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);
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
......@@ -1137,7 +1137,7 @@ 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,
MYSQL_DATA * STDCALL cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
unsigned int fields)
{
uint field;
......
......@@ -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,
......
......@@ -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);
......
......@@ -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
......
......@@ -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,
......
......@@ -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,
......
......@@ -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)
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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())
{
......@@ -945,6 +948,7 @@ void mysql_stmt_execute(THD *thd, char *packet)
{
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);
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment