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" ...@@ -160,6 +160,10 @@ SOURCE="..\strings\ctype-tis620.c"
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE="..\strings\ctype-uca.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-ucs2.c" SOURCE="..\strings\ctype-ucs2.c"
# End Source File # End Source File
# Begin Source File # Begin Source File
...@@ -510,10 +514,6 @@ SOURCE=..\strings\strxnmov.c ...@@ -510,10 +514,6 @@ SOURCE=..\strings\strxnmov.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\strings\strxnmov.c
# End Source File
# Begin Source File
SOURCE=..\mysys\thr_mutex.c SOURCE=..\mysys\thr_mutex.c
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -179,6 +179,10 @@ SOURCE="..\strings\ctype-tis620.c" ...@@ -179,6 +179,10 @@ SOURCE="..\strings\ctype-tis620.c"
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE="..\strings\ctype-uca.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-ucs2.c" SOURCE="..\strings\ctype-ucs2.c"
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -50,7 +50,7 @@ BSC32=bscmake.exe ...@@ -50,7 +50,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe 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 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" !ELSEIF "$(CFG)" == "myisam_ftdump - Win32 Debug"
...@@ -75,7 +75,7 @@ BSC32=bscmake.exe ...@@ -75,7 +75,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe 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 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 !ENDIF
......
...@@ -218,6 +218,10 @@ SOURCE=.\derror.cpp ...@@ -218,6 +218,10 @@ SOURCE=.\derror.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\discover.cpp
# End Source File
# Begin Source File
SOURCE=..\libmysql\errmsg.c SOURCE=..\libmysql\errmsg.c
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -151,6 +151,10 @@ SOURCE=".\ctype-sjis.c" ...@@ -151,6 +151,10 @@ SOURCE=".\ctype-sjis.c"
SOURCE=".\ctype-tis620.c" SOURCE=".\ctype-tis620.c"
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=".\ctype-uca.c"
# End Source File
# Begin Source File
SOURCE=".\ctype-ucs2.c" SOURCE=".\ctype-ucs2.c"
# End Source File # End Source File
......
...@@ -358,6 +358,14 @@ os_file_set_size( ...@@ -358,6 +358,14 @@ os_file_set_size(
size */ size */
ulint size_high);/* in: most significant 32 bits of 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. */ Flushes the write buffers of a given file to the disk. */
ibool ibool
......
...@@ -1582,6 +1582,23 @@ error_handling: ...@@ -1582,6 +1582,23 @@ error_handling:
return(FALSE); 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. */ Flushes the write buffers of a given file to the disk. */
......
...@@ -1655,11 +1655,7 @@ loop: ...@@ -1655,11 +1655,7 @@ loop:
mutex_enter(&srv_monitor_file_mutex); mutex_enter(&srv_monitor_file_mutex);
rewind(srv_monitor_file); rewind(srv_monitor_file);
srv_printf_innodb_monitor(srv_monitor_file); srv_printf_innodb_monitor(srv_monitor_file);
#ifdef __WIN__ os_file_set_eof(srv_monitor_file);
chsize(fileno(srv_monitor_file), ftell(srv_monitor_file));
#else /* __WIN__ */
ftruncate(fileno(srv_monitor_file), ftell(srv_monitor_file));
#endif /* __WIN__ */
mutex_exit(&srv_monitor_file_mutex); mutex_exit(&srv_monitor_file_mutex);
if (srv_print_innodb_tablespace_monitor if (srv_print_innodb_tablespace_monitor
......
...@@ -3992,7 +3992,8 @@ my_bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt) ...@@ -3992,7 +3992,8 @@ my_bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt)
mysql= stmt->mysql->last_used_con; mysql= stmt->mysql->last_used_con;
int4store(buff, stmt->stmt_id); /* Send stmt id to server */ 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, set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno,
mysql->net.sqlstate); mysql->net.sqlstate);
......
...@@ -20,4 +20,5 @@ select * from t1; ...@@ -20,4 +20,5 @@ select * from t1;
n n
1 1
1 1
stop slave;
drop table t1; drop table t1;
...@@ -18,4 +18,8 @@ insert into t1 values (1); ...@@ -18,4 +18,8 @@ insert into t1 values (1);
save_master_pos; save_master_pos;
sync_with_master; sync_with_master;
select * from t1; # check that indeed 2 were inserted 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; drop table t1;
...@@ -4817,7 +4817,7 @@ innodb_show_status( ...@@ -4817,7 +4817,7 @@ innodb_show_status(
rewind(srv_monitor_file); rewind(srv_monitor_file);
srv_printf_innodb_monitor(srv_monitor_file); srv_printf_innodb_monitor(srv_monitor_file);
flen = ftell(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) { if(flen > 64000 - 1) {
flen = 64000 - 1; flen = 64000 - 1;
} }
......
...@@ -322,11 +322,11 @@ public: ...@@ -322,11 +322,11 @@ public:
{ {
return (my_errno=HA_ERR_WRONG_COMMAND); 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, const key_range *end_key,
bool sorted); bool sorted);
virtual int handler::read_range_next(bool eq_range); virtual int read_range_next(bool eq_range);
int handler::compare_key(key_range *range); int compare_key(key_range *range);
virtual int ft_init() virtual int ft_init()
{ return -1; } { return -1; }
virtual FT_INFO *ft_init_ext(uint flags,uint inx,const byte *key, uint keylen) virtual FT_INFO *ft_init_ext(uint flags,uint inx,const byte *key, uint keylen)
......
...@@ -96,7 +96,8 @@ protected: ...@@ -96,7 +96,8 @@ protected:
bool save_cache; bool save_cache;
public: public:
Item_in_optimizer(Item *a, Item_in_subselect *b): 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_fields(THD *, struct st_table_list *, Item **);
bool fix_left(THD *thd, struct st_table_list *tables, Item **ref); bool fix_left(THD *thd, struct st_table_list *tables, Item **ref);
bool is_null(); bool is_null();
......
...@@ -140,7 +140,7 @@ public: ...@@ -140,7 +140,7 @@ public:
void fix_length_and_dec(); void fix_length_and_dec();
uint cols(); 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; } Item** addr(uint i) { return (Item**)row + i; }
bool check_cols(uint c); bool check_cols(uint c);
bool null_inside(); bool null_inside();
......
...@@ -853,7 +853,7 @@ bool update_sys_var_str(sys_var_str *var_str, rw_lock_t *var_mutex, ...@@ -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); uint new_length= (var ? var->value->str_value.length() : 0);
if (!old_value) if (!old_value)
old_value= (char*) ""; 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; return 1;
/* /*
Replace the old value in such a way that the any thread using Replace the old value in such a way that the any thread using
......
...@@ -217,7 +217,7 @@ public: ...@@ -217,7 +217,7 @@ public:
if (!(ci= find_class((int) type_id))) if (!(ci= find_class((int) type_id)))
return NULL; return NULL;
(*ci->m_create_func)((void *)buffer); (*ci->m_create_func)((void *)buffer);
return (Geometry *)buffer; return my_reinterpret_cast(Geometry *)(buffer);
} }
static Geometry *create_from_wkb(Geometry_buffer *buffer, static Geometry *create_from_wkb(Geometry_buffer *buffer,
......
...@@ -2764,9 +2764,9 @@ bool check_grant_column(THD *thd,TABLE *table, const char *name, ...@@ -2764,9 +2764,9 @@ bool check_grant_column(THD *thd,TABLE *table, const char *name,
if (table->grant.version != grant_version) if (table->grant.version != grant_version)
{ {
table->grant.grant_table= 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, thd->priv_user,
table->real_name,0); /* purecov: inspected */ table->real_name, 0); /* purecov: inspected */
table->grant.version=grant_version; /* purecov: inspected */ table->grant.version=grant_version; /* purecov: inspected */
} }
if (!(grant_table=table->grant.grant_table)) if (!(grant_table=table->grant.grant_table))
...@@ -3161,7 +3161,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) ...@@ -3161,7 +3161,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
/* Add database access */ /* Add database access */
for (counter=0 ; counter < acl_dbs.elements ; counter++) 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*); acl_db=dynamic_element(&acl_dbs,counter,ACL_DB*);
if (!(user=acl_db->user)) if (!(user=acl_db->user))
......
...@@ -661,7 +661,7 @@ void query_cache_end_of_result(THD *thd) ...@@ -661,7 +661,7 @@ void query_cache_end_of_result(THD *thd)
if (thd->net.query_cache_query != 0) // Quick check on unlocked structure if (thd->net.query_cache_query != 0) // Quick check on unlocked structure
{ {
#ifdef EMBEDDED_LIBRARY #ifdef EMBEDDED_LIBRARY
query_cache_insert(&thd->net, (byte*)thd, query_cache_insert(&thd->net, (char*)thd,
emb_count_querycache_size(thd)); emb_count_querycache_size(thd));
#endif #endif
STRUCT_LOCK(&query_cache.structure_guard_mutex); STRUCT_LOCK(&query_cache.structure_guard_mutex);
......
...@@ -341,12 +341,18 @@ public: ...@@ -341,12 +341,18 @@ public:
bool create_total_list(THD *thd, st_lex *lex, TABLE_LIST **result); bool create_total_list(THD *thd, st_lex *lex, TABLE_LIST **result);
st_select_lex_unit* master_unit(); st_select_lex_unit* master_unit();
st_select_lex* outer_select(); 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() 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; } st_select_lex* return_after_parsing() { return return_to; }
void exclude_level(); void exclude_level();
void exclude_tree(); void exclude_tree();
......
...@@ -1555,18 +1555,20 @@ set_params_data_err: ...@@ -1555,18 +1555,20 @@ set_params_data_err:
/* /*
Reset a prepared statement, in case there was an error in send_longdata. Reset a prepared statement in case there was a recoverable error.
Note: we don't send any reply to that command.
SYNOPSIS SYNOPSIS
mysql_stmt_reset() mysql_stmt_reset()
thd Thread handle thd Thread handle
packet Packet with stmt id packet Packet with stmt id
DESCRIPTION DESCRIPTION
This function is useful when one gets an error after calling This function resets statement to the state it was right after prepare.
mysql_stmt_getlongdata() and wants to reset the handle It can be used to:
so that one can call execute again. - clear an error happened during mysql_stmt_send_long_data
See also bug #1664 - 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) void mysql_stmt_reset(THD *thd, char *packet)
...@@ -1577,7 +1579,7 @@ 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"); 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; DBUG_VOID_RETURN;
stmt->get_longdata_error= 0; stmt->get_longdata_error= 0;
...@@ -1587,6 +1589,8 @@ void mysql_stmt_reset(THD *thd, char *packet) ...@@ -1587,6 +1589,8 @@ void mysql_stmt_reset(THD *thd, char *packet)
mysql_stmt_send_long_data() call. mysql_stmt_send_long_data() call.
*/ */
reset_stmt_params(stmt); reset_stmt_params(stmt);
send_ok(thd);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -163,8 +163,11 @@ MYSQL_STMT *STDCALL ...@@ -163,8 +163,11 @@ MYSQL_STMT *STDCALL
mysql_simple_prepare(MYSQL *mysql, const char *query) mysql_simple_prepare(MYSQL *mysql, const char *query)
{ {
MYSQL_STMT *stmt= mysql_stmt_init(mysql); 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 0;
}
return stmt; 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