Commit 1106c26b authored by miguel@hegel.local's avatar miguel@hegel.local

Windows VC++ compiler compatibility

parents 510b5d96 a0540f3c
......@@ -160,6 +160,10 @@ SOURCE="..\strings\ctype-tis620.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-uca.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-ucs2.c"
# End Source File
# Begin Source File
......@@ -510,10 +514,6 @@ SOURCE=..\strings\strxnmov.c
# End Source File
# Begin Source File
SOURCE=..\strings\strxnmov.c
# End Source File
# Begin Source File
SOURCE=..\mysys\thr_mutex.c
# End Source File
# Begin Source File
......
......@@ -179,6 +179,10 @@ SOURCE="..\strings\ctype-tis620.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-uca.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-ucs2.c"
# End Source File
# Begin Source File
......
......@@ -50,7 +50,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib setargv.obj /nologo /subsystem:console /machine:I386 /out:"../client_release/myisam_ftdump.exe"
# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib setargv.obj ..\lib_release\zlib.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/myisam_ftdump.exe"
!ELSEIF "$(CFG)" == "myisam_ftdump - Win32 Debug"
......@@ -75,7 +75,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib wsock32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/myisam_ftdump.exe" /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib wsock32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj ..\lib_debug\zlib.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/myisam_ftdump.exe" /pdbtype:sept
!ENDIF
......
......@@ -218,6 +218,10 @@ SOURCE=.\derror.cpp
# End Source File
# Begin Source File
SOURCE=.\discover.cpp
# End Source File
# Begin Source File
SOURCE=..\libmysql\errmsg.c
# End Source File
# Begin Source File
......
......@@ -152,6 +152,10 @@ SOURCE=".\ctype-tis620.c"
# End Source File
# Begin Source File
SOURCE=".\ctype-uca.c"
# End Source File
# Begin Source File
SOURCE=".\ctype-ucs2.c"
# End Source File
# Begin Source File
......
......@@ -358,6 +358,14 @@ os_file_set_size(
size */
ulint size_high);/* in: most significant 32 bits of size */
/***************************************************************************
Truncates a file at its current position. */
ibool
os_file_set_eof(
/*============*/
/* out: TRUE if success */
FILE* file); /* in: file to be truncated */
/***************************************************************************
Flushes the write buffers of a given file to the disk. */
ibool
......
......@@ -1582,6 +1582,23 @@ error_handling:
return(FALSE);
}
/***************************************************************************
Truncates a file at its current position. */
ibool
os_file_set_eof(
/*============*/
/* out: TRUE if success */
FILE* file) /* in: file to be truncated */
{
#ifdef __WIN__
HANDLE h = (HANDLE) _get_osfhandle(fileno(file));
return(SetEndOfFile(h));
#else /* __WIN__ */
return(!ftruncate(fileno(file), ftell(file)));
#endif /* __WIN__ */
}
/***************************************************************************
Flushes the write buffers of a given file to the disk. */
......
......@@ -1655,11 +1655,7 @@ loop:
mutex_enter(&srv_monitor_file_mutex);
rewind(srv_monitor_file);
srv_printf_innodb_monitor(srv_monitor_file);
#ifdef __WIN__
chsize(fileno(srv_monitor_file), ftell(srv_monitor_file));
#else /* __WIN__ */
ftruncate(fileno(srv_monitor_file), ftell(srv_monitor_file));
#endif /* __WIN__ */
os_file_set_eof(srv_monitor_file);
mutex_exit(&srv_monitor_file_mutex);
if (srv_print_innodb_tablespace_monitor
......
......@@ -3992,7 +3992,8 @@ my_bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt)
mysql= stmt->mysql->last_used_con;
int4store(buff, stmt->stmt_id); /* Send stmt id to server */
if ((*mysql->methods->advanced_command)(mysql, COM_RESET_STMT,buff,MYSQL_STMT_HEADER,0,0,1))
if ((*mysql->methods->advanced_command)(mysql, COM_RESET_STMT, buff,
MYSQL_STMT_HEADER,0,0,0))
{
set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno,
mysql->net.sqlstate);
......
......@@ -20,4 +20,5 @@ select * from t1;
n
1
1
stop slave;
drop table t1;
......@@ -18,4 +18,8 @@ insert into t1 values (1);
save_master_pos;
sync_with_master;
select * from t1; # check that indeed 2 were inserted
# We stop the slave before cleaning up otherwise we'll get
# 'drop table t1' executed twice, so an error in the slave.err
# (not critical).
stop slave;
drop table t1;
......@@ -4817,7 +4817,7 @@ innodb_show_status(
rewind(srv_monitor_file);
srv_printf_innodb_monitor(srv_monitor_file);
flen = ftell(srv_monitor_file);
my_chsize(fileno(srv_monitor_file), flen, 0, MYF(0));
os_file_set_eof(srv_monitor_file);
if(flen > 64000 - 1) {
flen = 64000 - 1;
}
......
......@@ -322,11 +322,11 @@ public:
{
return (my_errno=HA_ERR_WRONG_COMMAND);
}
virtual int handler::read_range_first(const key_range *start_key,
virtual int read_range_first(const key_range *start_key,
const key_range *end_key,
bool sorted);
virtual int handler::read_range_next(bool eq_range);
int handler::compare_key(key_range *range);
virtual int read_range_next(bool eq_range);
int compare_key(key_range *range);
virtual int ft_init()
{ return -1; }
virtual FT_INFO *ft_init_ext(uint flags,uint inx,const byte *key, uint keylen)
......
......@@ -96,7 +96,8 @@ protected:
bool save_cache;
public:
Item_in_optimizer(Item *a, Item_in_subselect *b):
Item_bool_func(a, (Item *)b), cache(0), save_cache(0) {}
Item_bool_func(a, my_reinterpret_cast(Item *)(b)), cache(0), save_cache(0)
{}
bool fix_fields(THD *, struct st_table_list *, Item **);
bool fix_left(THD *thd, struct st_table_list *tables, Item **ref);
bool is_null();
......
......@@ -140,7 +140,7 @@ public:
void fix_length_and_dec();
uint cols();
Item* el(uint i) { return (Item*)row[i]; }
Item* el(uint i) { return my_reinterpret_cast(Item*)(row[i]); }
Item** addr(uint i) { return (Item**)row + i; }
bool check_cols(uint c);
bool null_inside();
......
......@@ -853,7 +853,7 @@ bool update_sys_var_str(sys_var_str *var_str, rw_lock_t *var_mutex,
uint new_length= (var ? var->value->str_value.length() : 0);
if (!old_value)
old_value= (char*) "";
if (!(res= my_strdup_with_length((byte*) old_value, new_length, MYF(0))))
if (!(res= my_strdup_with_length((byte*)old_value, new_length, MYF(0))))
return 1;
/*
Replace the old value in such a way that the any thread using
......
......@@ -217,7 +217,7 @@ public:
if (!(ci= find_class((int) type_id)))
return NULL;
(*ci->m_create_func)((void *)buffer);
return (Geometry *)buffer;
return my_reinterpret_cast(Geometry *)(buffer);
}
static Geometry *create_from_wkb(Geometry_buffer *buffer,
......
......@@ -2764,9 +2764,9 @@ bool check_grant_column(THD *thd,TABLE *table, const char *name,
if (table->grant.version != grant_version)
{
table->grant.grant_table=
table_hash_search(thd->host,thd->ip,thd->db,
table_hash_search(thd->host, thd->ip, table->table_cache_key,
thd->priv_user,
table->real_name,0); /* purecov: inspected */
table->real_name, 0); /* purecov: inspected */
table->grant.version=grant_version; /* purecov: inspected */
}
if (!(grant_table=table->grant.grant_table))
......@@ -3161,7 +3161,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
/* Add database access */
for (counter=0 ; counter < acl_dbs.elements ; counter++)
{
const char *user,*host;
const char *user, *host;
acl_db=dynamic_element(&acl_dbs,counter,ACL_DB*);
if (!(user=acl_db->user))
......
......@@ -661,7 +661,7 @@ void query_cache_end_of_result(THD *thd)
if (thd->net.query_cache_query != 0) // Quick check on unlocked structure
{
#ifdef EMBEDDED_LIBRARY
query_cache_insert(&thd->net, (byte*)thd,
query_cache_insert(&thd->net, (char*)thd,
emb_count_querycache_size(thd));
#endif
STRUCT_LOCK(&query_cache.structure_guard_mutex);
......
......@@ -341,12 +341,18 @@ public:
bool create_total_list(THD *thd, st_lex *lex, TABLE_LIST **result);
st_select_lex_unit* master_unit();
st_select_lex* outer_select();
st_select_lex* first_select() { return (st_select_lex*) slave; }
st_select_lex* first_select()
{
return my_reinterpret_cast(st_select_lex*)(slave);
}
st_select_lex* first_select_in_union()
{
return (st_select_lex*) slave;
return my_reinterpret_cast(st_select_lex*)(slave);
}
st_select_lex_unit* next_unit()
{
return my_reinterpret_cast(st_select_lex_unit*)(next);
}
st_select_lex_unit* next_unit() { return (st_select_lex_unit*) next; }
st_select_lex* return_after_parsing() { return return_to; }
void exclude_level();
void exclude_tree();
......
......@@ -1555,18 +1555,20 @@ set_params_data_err:
/*
Reset a prepared statement, in case there was an error in send_longdata.
Note: we don't send any reply to that command.
Reset a prepared statement in case there was a recoverable error.
SYNOPSIS
mysql_stmt_reset()
thd Thread handle
packet Packet with stmt id
DESCRIPTION
This function is useful when one gets an error after calling
mysql_stmt_getlongdata() and wants to reset the handle
so that one can call execute again.
See also bug #1664
This function resets statement to the state it was right after prepare.
It can be used to:
- clear an error happened during mysql_stmt_send_long_data
- cancel long data stream for all placeholders without
having to call mysql_stmt_execute.
Sends 'OK' packet in case of success (statement was reset)
or 'ERROR' packet (unrecoverable error/statement not found/etc).
*/
void mysql_stmt_reset(THD *thd, char *packet)
......@@ -1577,7 +1579,7 @@ void mysql_stmt_reset(THD *thd, char *packet)
DBUG_ENTER("mysql_stmt_reset");
if (!(stmt= find_prepared_statement(thd, stmt_id, "reset", DONT_SEND_ERROR)))
if (!(stmt= find_prepared_statement(thd, stmt_id, "reset", SEND_ERROR)))
DBUG_VOID_RETURN;
stmt->get_longdata_error= 0;
......@@ -1588,6 +1590,8 @@ void mysql_stmt_reset(THD *thd, char *packet)
*/
reset_stmt_params(stmt);
send_ok(thd);
DBUG_VOID_RETURN;
}
......
......@@ -163,8 +163,11 @@ MYSQL_STMT *STDCALL
mysql_simple_prepare(MYSQL *mysql, const char *query)
{
MYSQL_STMT *stmt= mysql_stmt_init(mysql);
if (mysql_stmt_prepare(stmt, query, strlen(query)))
if (stmt && mysql_stmt_prepare(stmt, query, strlen(query)))
{
mysql_stmt_close(stmt);
return 0;
}
return stmt;
}
......
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