summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VC++Files/client/mysqlclient.dsp4
-rw-r--r--VC++Files/libmysql/libmysql.dsp4
-rw-r--r--VC++Files/sql/mysqld.dsp6
-rw-r--r--libmysql/libmysql.c207
-rw-r--r--sql-common/client.c206
-rw-r--r--sql/item_geofunc.cc4
-rw-r--r--sql/sql_help.cc13
7 files changed, 222 insertions, 222 deletions
diff --git a/VC++Files/client/mysqlclient.dsp b/VC++Files/client/mysqlclient.dsp
index 95821052f8d..2f66d99b33c 100644
--- a/VC++Files/client/mysqlclient.dsp
+++ b/VC++Files/client/mysqlclient.dsp
@@ -104,6 +104,10 @@ SOURCE=..\mysys\charset.c
# End Source File
# Begin Source File
+SOURCE=..\libmysql\client.c
+# End Source File
+# Begin Source File
+
SOURCE=.\completion_hash.cpp
# End Source File
# Begin Source File
diff --git a/VC++Files/libmysql/libmysql.dsp b/VC++Files/libmysql/libmysql.dsp
index 24c85f403f7..d4f7ed6df82 100644
--- a/VC++Files/libmysql/libmysql.dsp
+++ b/VC++Files/libmysql/libmysql.dsp
@@ -123,6 +123,10 @@ SOURCE=..\mysys\charset.c
# End Source File
# Begin Source File
+SOURCE=.\client.c
+# End Source File
+# Begin Source File
+
SOURCE="..\strings\ctype-big5.c"
# End Source File
# Begin Source File
diff --git a/VC++Files/sql/mysqld.dsp b/VC++Files/sql/mysqld.dsp
index d548a44550c..a475c44e948 100644
--- a/VC++Files/sql/mysqld.dsp
+++ b/VC++Files/sql/mysqld.dsp
@@ -178,7 +178,7 @@ LINK32=xilink6.exe
# Name "mysqld - Win32 Max"
# Begin Source File
-SOURCE=.\convert.cpp
+SOURCE=.\client.c
!IF "$(CFG)" == "mysqld - Win32 Release"
@@ -660,10 +660,6 @@ SOURCE=.\mf_iocache.cpp
# End Source File
# Begin Source File
-SOURCE=.\mini_client.cpp
-# End Source File
-# Begin Source File
-
SOURCE=..\myisammrg\myrg_rnext_same.c
# End Source File
# Begin Source File
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 44c5e3eecf4..e61906cdbf8 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -85,11 +85,6 @@ ulong net_write_timeout= NET_WRITE_TIMEOUT;
#define SOCKET_ERROR -1
#endif /* __WIN__ */
-#ifdef HAVE_SMEM
-char *shared_memory_base_name=0;
-const char *def_shared_memory_base_name=default_shared_memory_base_name;
-#endif
-
const char *sql_protocol_names_lib[] =
{ "TCP", "SOCKET", "PIPE", "MEMORY",NullS };
TYPELIB sql_protocol_typelib = {array_elements(sql_protocol_names_lib)-1,"",
@@ -161,209 +156,7 @@ static MYSQL* spawn_init(MYSQL* parent, const char* host,
const char* user,
const char* passwd);
-/*
- Create new shared memory connection, return handler of connection
-
- SYNOPSIS
- create_shared_memory()
- mysql Pointer of mysql structure
- net Pointer of net structure
- connect_timeout Timeout of connection
-*/
-
-#ifdef HAVE_SMEM
-HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout)
-{
- ulong smem_buffer_length = shared_memory_buffer_length + 4;
-/*
- event_connect_request is event object for start connection actions
- event_connect_answer is event object for confirm, that server put data
- handle_connect_file_map is file-mapping object, use for create shared memory
- handle_connect_map is pointer on shared memory
- handle_map is pointer on shared memory for client
- event_server_wrote,
- event_server_read,
- event_client_wrote,
- event_client_read are events for transfer data between server and client
- handle_file_map is file-mapping object, use for create shared memory
-*/
- HANDLE event_connect_request = NULL;
- HANDLE event_connect_answer = NULL;
- HANDLE handle_connect_file_map = NULL;
- char *handle_connect_map = NULL;
-
- char *handle_map = NULL;
- HANDLE event_server_wrote = NULL;
- HANDLE event_server_read = NULL;
- HANDLE event_client_wrote = NULL;
- HANDLE event_client_read = NULL;
- HANDLE handle_file_map = NULL;
- ulong connect_number;
- char connect_number_char[22], *p;
- char tmp[64];
- char *suffix_pos;
- DWORD error_allow = 0;
- DWORD error_code = 0;
- char *shared_memory_base_name = mysql->options.shared_memory_base_name;
-/*
- The name of event and file-mapping events create agree next rule:
- shared_memory_base_name+unique_part
- Where:
- shared_memory_base_name is unique value for each server
- unique_part is uniquel value for each object (events and file-mapping)
-*/
- suffix_pos = strxmov(tmp,shared_memory_base_name,"_",NullS);
- strmov(suffix_pos, "CONNECT_REQUEST");
- if (!(event_connect_request= OpenEvent(EVENT_ALL_ACCESS,FALSE,tmp)))
- {
- error_allow = CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR;
- goto err;
- }
- strmov(suffix_pos, "CONNECT_ANSWER");
- if (!(event_connect_answer= OpenEvent(EVENT_ALL_ACCESS,FALSE,tmp)))
- {
- error_allow = CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR;
- goto err;
- }
- strmov(suffix_pos, "CONNECT_DATA");
- if (!(handle_connect_file_map= OpenFileMapping(FILE_MAP_WRITE,FALSE,tmp)))
- {
- error_allow = CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR;
- goto err;
- }
- if (!(handle_connect_map= MapViewOfFile(handle_connect_file_map,
- FILE_MAP_WRITE,0,0,sizeof(DWORD))))
- {
- error_allow = CR_SHARED_MEMORY_CONNECT_MAP_ERROR;
- goto err;
- }
- /*
- Send to server request of connection
- */
- if (!SetEvent(event_connect_request))
- {
- error_allow = CR_SHARED_MEMORY_CONNECT_SET_ERROR;
- goto err;
- }
- /*
- Wait of answer from server
- */
- if (WaitForSingleObject(event_connect_answer,connect_timeout*1000) !=
- WAIT_OBJECT_0)
- {
- error_allow = CR_SHARED_MEMORY_CONNECT_ABANDODED_ERROR;
- goto err;
- }
- /*
- Get number of connection
- */
- connect_number = uint4korr(handle_connect_map);/*WAX2*/
- p= int2str(connect_number, connect_number_char, 10);
-
- /*
- The name of event and file-mapping events create agree next rule:
- shared_memory_base_name+unique_part+number_of_connection
- Where:
- shared_memory_base_name is uniquel value for each server
- unique_part is uniquel value for each object (events and file-mapping)
- number_of_connection is number of connection between server and client
- */
- suffix_pos = strxmov(tmp,shared_memory_base_name,"_",connect_number_char,
- "_",NullS);
- strmov(suffix_pos, "DATA");
- if ((handle_file_map = OpenFileMapping(FILE_MAP_WRITE,FALSE,tmp)) == NULL)
- {
- error_allow = CR_SHARED_MEMORY_FILE_MAP_ERROR;
- goto err2;
- }
- if ((handle_map = MapViewOfFile(handle_file_map,FILE_MAP_WRITE,0,0,
- smem_buffer_length)) == NULL)
- {
- error_allow = CR_SHARED_MEMORY_MAP_ERROR;
- goto err2;
- }
-
- strmov(suffix_pos, "SERVER_WROTE");
- if ((event_server_wrote = OpenEvent(EVENT_ALL_ACCESS,FALSE,tmp)) == NULL)
- {
- error_allow = CR_SHARED_MEMORY_EVENT_ERROR;
- goto err2;
- }
-
- strmov(suffix_pos, "SERVER_READ");
- if ((event_server_read = OpenEvent(EVENT_ALL_ACCESS,FALSE,tmp)) == NULL)
- {
- error_allow = CR_SHARED_MEMORY_EVENT_ERROR;
- goto err2;
- }
-
- strmov(suffix_pos, "CLIENT_WROTE");
- if ((event_client_wrote = OpenEvent(EVENT_ALL_ACCESS,FALSE,tmp)) == NULL)
- {
- error_allow = CR_SHARED_MEMORY_EVENT_ERROR;
- goto err2;
- }
-
- strmov(suffix_pos, "CLIENT_READ");
- if ((event_client_read = OpenEvent(EVENT_ALL_ACCESS,FALSE,tmp)) == NULL)
- {
- error_allow = CR_SHARED_MEMORY_EVENT_ERROR;
- goto err2;
- }
- /*
- Set event that server should send data
- */
- SetEvent(event_server_read);
-
-err2:
- if (error_allow == 0)
- {
- net->vio= vio_new_win32shared_memory(net,handle_file_map,handle_map,
- event_server_wrote,
- event_server_read,event_client_wrote,
- event_client_read);
- }
- else
- {
- error_code = GetLastError();
- if (event_server_read)
- CloseHandle(event_server_read);
- if (event_server_wrote)
- CloseHandle(event_server_wrote);
- if (event_client_read)
- CloseHandle(event_client_read);
- if (event_client_wrote)
- CloseHandle(event_client_wrote);
- if (handle_map)
- UnmapViewOfFile(handle_map);
- if (handle_file_map)
- CloseHandle(handle_file_map);
- }
-err:
- if (error_allow)
- error_code = GetLastError();
- if (event_connect_request)
- CloseHandle(event_connect_request);
- if (event_connect_answer)
- CloseHandle(event_connect_answer);
- if (handle_connect_map)
- UnmapViewOfFile(handle_connect_map);
- if (handle_connect_file_map)
- CloseHandle(handle_connect_file_map);
- if (error_allow)
- {
- net->last_errno=error_allow;
- strmov(net->sqlstate, unknown_sqlstate);
- if (error_allow == CR_SHARED_MEMORY_EVENT_ERROR)
- sprintf(net->last_error,ER(net->last_errno),suffix_pos,error_code);
- else
- sprintf(net->last_error,ER(net->last_errno),error_code);
- return(INVALID_HANDLE_VALUE);
- }
- return(handle_map);
-}
-#endif
/*
Expand wildcard to a sql string
diff --git a/sql-common/client.c b/sql-common/client.c
index 4baee2d2477..b5f0549279b 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -288,6 +288,210 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host,
}
#endif
+/*
+ Create new shared memory connection, return handler of connection
+
+ SYNOPSIS
+ create_shared_memory()
+ mysql Pointer of mysql structure
+ net Pointer of net structure
+ connect_timeout Timeout of connection
+*/
+
+#ifdef HAVE_SMEM
+HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout)
+{
+ ulong smem_buffer_length = shared_memory_buffer_length + 4;
+ /*
+ event_connect_request is event object for start connection actions
+ event_connect_answer is event object for confirm, that server put data
+ handle_connect_file_map is file-mapping object, use for create shared memory
+ handle_connect_map is pointer on shared memory
+ handle_map is pointer on shared memory for client
+ event_server_wrote,
+ event_server_read,
+ event_client_wrote,
+ event_client_read are events for transfer data between server and client
+ handle_file_map is file-mapping object, use for create shared memory
+ */
+ HANDLE event_connect_request = NULL;
+ HANDLE event_connect_answer = NULL;
+ HANDLE handle_connect_file_map = NULL;
+ char *handle_connect_map = NULL;
+
+ char *handle_map = NULL;
+ HANDLE event_server_wrote = NULL;
+ HANDLE event_server_read = NULL;
+ HANDLE event_client_wrote = NULL;
+ HANDLE event_client_read = NULL;
+ HANDLE handle_file_map = NULL;
+ ulong connect_number;
+ char connect_number_char[22], *p;
+ char tmp[64];
+ char *suffix_pos;
+ DWORD error_allow = 0;
+ DWORD error_code = 0;
+ char *shared_memory_base_name = mysql->options.shared_memory_base_name;
+
+ /*
+ The name of event and file-mapping events create agree next rule:
+ shared_memory_base_name+unique_part
+ Where:
+ shared_memory_base_name is unique value for each server
+ unique_part is uniquel value for each object (events and file-mapping)
+ */
+ suffix_pos = strxmov(tmp,shared_memory_base_name,"_",NullS);
+ strmov(suffix_pos, "CONNECT_REQUEST");
+ if (!(event_connect_request= OpenEvent(EVENT_ALL_ACCESS,FALSE,tmp)))
+ {
+ error_allow = CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR;
+ goto err;
+ }
+ strmov(suffix_pos, "CONNECT_ANSWER");
+ if (!(event_connect_answer= OpenEvent(EVENT_ALL_ACCESS,FALSE,tmp)))
+ {
+ error_allow = CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR;
+ goto err;
+ }
+ strmov(suffix_pos, "CONNECT_DATA");
+ if (!(handle_connect_file_map= OpenFileMapping(FILE_MAP_WRITE,FALSE,tmp)))
+ {
+ error_allow = CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR;
+ goto err;
+ }
+ if (!(handle_connect_map= MapViewOfFile(handle_connect_file_map,
+ FILE_MAP_WRITE,0,0,sizeof(DWORD))))
+ {
+ error_allow = CR_SHARED_MEMORY_CONNECT_MAP_ERROR;
+ goto err;
+ }
+ /*
+ Send to server request of connection
+ */
+ if (!SetEvent(event_connect_request))
+ {
+ error_allow = CR_SHARED_MEMORY_CONNECT_SET_ERROR;
+ goto err;
+ }
+ /*
+ Wait of answer from server
+ */
+ if (WaitForSingleObject(event_connect_answer,connect_timeout*1000) !=
+ WAIT_OBJECT_0)
+ {
+ error_allow = CR_SHARED_MEMORY_CONNECT_ABANDODED_ERROR;
+ goto err;
+ }
+ /*
+ Get number of connection
+ */
+ connect_number = uint4korr(handle_connect_map);/*WAX2*/
+ p= int2str(connect_number, connect_number_char, 10);
+
+ /*
+ The name of event and file-mapping events create agree next rule:
+ shared_memory_base_name+unique_part+number_of_connection
+ Where:
+ shared_memory_base_name is uniquel value for each server
+ unique_part is uniquel value for each object (events and file-mapping)
+ number_of_connection is number of connection between server and client
+ */
+ suffix_pos = strxmov(tmp,shared_memory_base_name,"_",connect_number_char,
+ "_",NullS);
+ strmov(suffix_pos, "DATA");
+ if ((handle_file_map = OpenFileMapping(FILE_MAP_WRITE,FALSE,tmp)) == NULL)
+ {
+ error_allow = CR_SHARED_MEMORY_FILE_MAP_ERROR;
+ goto err2;
+ }
+ if ((handle_map = MapViewOfFile(handle_file_map,FILE_MAP_WRITE,0,0,
+ smem_buffer_length)) == NULL)
+ {
+ error_allow = CR_SHARED_MEMORY_MAP_ERROR;
+ goto err2;
+ }
+
+ strmov(suffix_pos, "SERVER_WROTE");
+ if ((event_server_wrote = OpenEvent(EVENT_ALL_ACCESS,FALSE,tmp)) == NULL)
+ {
+ error_allow = CR_SHARED_MEMORY_EVENT_ERROR;
+ goto err2;
+ }
+
+ strmov(suffix_pos, "SERVER_READ");
+ if ((event_server_read = OpenEvent(EVENT_ALL_ACCESS,FALSE,tmp)) == NULL)
+ {
+ error_allow = CR_SHARED_MEMORY_EVENT_ERROR;
+ goto err2;
+ }
+
+ strmov(suffix_pos, "CLIENT_WROTE");
+ if ((event_client_wrote = OpenEvent(EVENT_ALL_ACCESS,FALSE,tmp)) == NULL)
+ {
+ error_allow = CR_SHARED_MEMORY_EVENT_ERROR;
+ goto err2;
+ }
+
+ strmov(suffix_pos, "CLIENT_READ");
+ if ((event_client_read = OpenEvent(EVENT_ALL_ACCESS,FALSE,tmp)) == NULL)
+ {
+ error_allow = CR_SHARED_MEMORY_EVENT_ERROR;
+ goto err2;
+ }
+ /*
+ Set event that server should send data
+ */
+ SetEvent(event_server_read);
+
+err2:
+ if (error_allow == 0)
+ {
+ net->vio= vio_new_win32shared_memory(net,handle_file_map,handle_map,
+ event_server_wrote,
+ event_server_read,event_client_wrote,
+ event_client_read);
+ }
+ else
+ {
+ error_code = GetLastError();
+ if (event_server_read)
+ CloseHandle(event_server_read);
+ if (event_server_wrote)
+ CloseHandle(event_server_wrote);
+ if (event_client_read)
+ CloseHandle(event_client_read);
+ if (event_client_wrote)
+ CloseHandle(event_client_wrote);
+ if (handle_map)
+ UnmapViewOfFile(handle_map);
+ if (handle_file_map)
+ CloseHandle(handle_file_map);
+ }
+err:
+ if (error_allow)
+ error_code = GetLastError();
+ if (event_connect_request)
+ CloseHandle(event_connect_request);
+ if (event_connect_answer)
+ CloseHandle(event_connect_answer);
+ if (handle_connect_map)
+ UnmapViewOfFile(handle_connect_map);
+ if (handle_connect_file_map)
+ CloseHandle(handle_connect_file_map);
+ if (error_allow)
+ {
+ net->last_errno=error_allow;
+ strmov(net->sqlstate, unknown_sqlstate);
+ if (error_allow == CR_SHARED_MEMORY_EVENT_ERROR)
+ sprintf(net->last_error,ER(net->last_errno),suffix_pos,error_code);
+ else
+ sprintf(net->last_error,ER(net->last_errno),error_code);
+ return(INVALID_HANDLE_VALUE);
+ }
+ return(handle_map);
+}
+#endif
+
/*****************************************************************************
Read a packet from server. Give error message if socket was down
or packet is an error message
@@ -865,7 +1069,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
#ifndef DELETE_SUPPORT_OF_4_0_PROTOCOL
else
unpack_fields_40(data->data, field, alloc, lengths, default_value ? 6 : 5,
- default_value, server_capabilities & CLIENT_LONG_FLAG);
+ default_value, (my_bool)(server_capabilities & CLIENT_LONG_FLAG));
#endif /* DELETE_SUPPORT_OF_4_0_PROTOCOL */
#endif /*MYSQL_SERVER*/
free_rows(data); /* Free old data */
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index fa858922c1b..6db139fdfa6 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -34,7 +34,7 @@ String *Item_func_geometry_from_text::val_str(String *str)
uint32 srid;
if ((arg_count == 2) && !args[1]->null_value)
- srid= args[1]->val_int();
+ srid= (uint32)args[1]->val_int();
else
srid= 0;
@@ -62,7 +62,7 @@ String *Item_func_geometry_from_wkb::val_str(String *str)
uint32 srid;
if ((arg_count == 2) && !args[1]->null_value)
- srid= args[1]->val_int();
+ srid= (uint32)args[1]->val_int();
else
srid= 0;
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index 2925141d331..9003d4b36cd 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -224,7 +224,7 @@ int search_keyword(THD *thd, TABLE *keywords, struct st_find_field *find_fields,
if (!select->cond->val_int()) // Dosn't match like
continue;
- *key_id= find_fields[help_keyword_help_keyword_id].field->val_int();
+ *key_id= (int)find_fields[help_keyword_help_keyword_id].field->val_int();
count++;
}
@@ -556,13 +556,12 @@ int send_variant_2_list(MEM_ROOT *mem_root, Protocol *protocol,
String **pos= pointers;
List_iterator<String> it(*names);
- String *cur_name;
while ((*pos++= it++));
qsort(pointers,names->elements,sizeof(String*),string_ptr_cmp);
String **end= pointers + names->elements;
- for (String **pos= pointers; pos!=end; pos++)
+ for (pos= pointers; pos!=end; pos++)
{
protocol->prepare_for_resend();
if (source_name)
@@ -688,8 +687,8 @@ int mysqld_help(THD *thd, const char *mask)
res= -1;
goto end;
}
-
- for (size_t i=0; i<sizeof(tables)/sizeof(TABLE_LIST); i++)
+ size_t i;
+ for (i=0; i<sizeof(tables)/sizeof(TABLE_LIST); i++)
tables[i].table->file->init_table_handle_for_HANDLER();
if (!(select_topics_by_name=
@@ -739,9 +738,9 @@ int mysqld_help(THD *thd, const char *mask)
{
Field *topic_cat_id= used_fields[help_topic_help_category_id].field;
Item *cond_topic_by_cat= new Item_func_equal(new Item_field(topic_cat_id),
- new Item_int(category_id));
+ new Item_int((int32)category_id));
Item *cond_cat_by_cat= new Item_func_equal(new Item_field(cat_cat_id),
- new Item_int(category_id));
+ new Item_int((int32)category_id));
if (!(select_topics_by_cat= prepare_simple_select(thd,cond_topic_by_cat,
tables,tables[0].table,
&error)) ||