diff options
Diffstat (limited to 'libmysql')
-rw-r--r--[-rwxr-xr-x] | libmysql/CMakeLists.txt | 7 | ||||
-rw-r--r-- | libmysql/Makefile.am | 1 | ||||
-rw-r--r-- | libmysql/Makefile.shared | 8 | ||||
-rw-r--r-- | libmysql/client_settings.h | 6 | ||||
-rw-r--r-- | libmysql/dll.c | 23 | ||||
-rw-r--r-- | libmysql/errmsg.c | 3 | ||||
-rw-r--r-- | libmysql/get_password.c | 8 | ||||
-rw-r--r-- | libmysql/libmysql.c | 30 | ||||
-rw-r--r-- | libmysql/manager.c | 8 |
9 files changed, 33 insertions, 61 deletions
diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index 3b18531f6c0..7d4dcc1e919 100755..100644 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -12,16 +12,13 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake") # Need to set USE_TLS, since __declspec(thread) approach to thread local # storage does not work properly in DLLs. +INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake") + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS") -SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS") -SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS") -SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS") -SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS") INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib diff --git a/libmysql/Makefile.am b/libmysql/Makefile.am index 38680c98d53..ebfe15774ff 100644 --- a/libmysql/Makefile.am +++ b/libmysql/Makefile.am @@ -70,6 +70,7 @@ link_sources: @LN_CP_F@ $(top_srcdir)/sql/net_serv.cc net.c ; \ rm -f password.c; \ @LN_CP_F@ $(top_srcdir)/sql/password.c password.c + echo timestamp > link_sources # This part requires GNUmake # diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index dc6d658fcdf..c24c6ab52db 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -79,8 +79,11 @@ target_libadd = $(mysysobjects) $(mystringsobjects) $(dbugobjects) \ $(sql_cmn_objects) $(vio_objects) $(sqlobjects) target_ldflags = -version-info @SHARED_LIB_VERSION@ @LD_VERSION_SCRIPT@ vio_objects= vio.lo viosocket.lo viossl.lo viosslfactories.lo + +BUILT_SOURCES = link_sources + CLEANFILES = $(target_libadd) $(SHLIBOBJS) \ - $(target) + $(target) $(BUILT_SOURCES) DEFS = -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \ -DDATADIR="\"$(MYSQLDATAdir)\"" \ -DDEFAULT_HOME_ENV=MYSQL_HOME \ @@ -103,8 +106,7 @@ clean-local: `echo $(vio_objects) | sed "s;\.lo;.c;g"` \ `echo $(sql_cmn_objects) | sed "s;\.lo;.c;g"` \ $(CHARSET_SRCS) $(CHARSET_OBJS) \ - $(mystringsextra) $(mysysheaders) $(vioheaders)\ - ../linked_libmysql_sources ../linked_libmysql_r_sources \ + $(mystringsextra) $(mysysheaders) $(vioheaders) \ net.c conf_to_src_SOURCES = conf_to_src.c diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h index b67fbbc03af..a803ff8372f 100644 --- a/libmysql/client_settings.h +++ b/libmysql/client_settings.h @@ -14,7 +14,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ extern uint mysql_port; -extern my_string mysql_unix_port; +extern char * mysql_unix_port; #define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | \ CLIENT_TRANSACTIONS | \ @@ -41,8 +41,8 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename); void mysql_read_default_options(struct st_mysql_options *options, const char *filename,const char *group); -void mysql_detach_stmt_list(LIST **stmt_list); -MYSQL * +void mysql_detach_stmt_list(LIST **stmt_list, const char *func_name); +MYSQL * STDCALL cli_mysql_real_connect(MYSQL *mysql,const char *host, const char *user, const char *passwd, const char *db, uint port, const char *unix_socket,ulong client_flag); diff --git a/libmysql/dll.c b/libmysql/dll.c index b0e4b9cab3b..f5db0bb4669 100644 --- a/libmysql/dll.c +++ b/libmysql/dll.c @@ -112,26 +112,3 @@ int _export FAR PASCAL libmain(HANDLE hModule,short cbHeapSize, } #endif - -#ifdef OS2 - -/* - This function is called automatically by _DLL_InitTerm - Every dll runtime enviroment is not tz enabled, so tzset() - must be called to enable TZ handling - Also timezone is fixed. -*/ - -extern "C" unsigned long _System DllMain(unsigned long modhandle, - unsigned long flag) -{ - if (flag == 0) { - tzset(); /* Set tzname */ - time_t currentTime = time(NULL); - struct tm *ts = localtime(¤tTime); - if (ts->tm_isdst > 0) - _timezone -= 3600; - } -} - -#endif diff --git a/libmysql/errmsg.c b/libmysql/errmsg.c index 59089d5ec18..e7f495d1f43 100644 --- a/libmysql/errmsg.c +++ b/libmysql/errmsg.c @@ -83,6 +83,7 @@ const char *client_errors[]= "Attempt to read a row while there is no result set associated with the statement", "This feature is not implemented yet", "Lost connection to MySQL server at '%s', system error: %d", + "Statement closed indirectly because of a preceeding %s() call", "" }; @@ -147,6 +148,7 @@ const char *client_errors[]= "Attempt to read a row while there is no result set associated with the statement", "This feature is not implemented yet", "Lost connection to MySQL server at '%s', system error: %d", + "Statement closed indirectly because of a preceeding %s() call", "" }; @@ -209,6 +211,7 @@ const char *client_errors[]= "Attempt to read a row while there is no result set associated with the statement", "This feature is not implemented yet", "Lost connection to MySQL server at '%s', system error: %d", + "Statement closed indirectly because of a preceeding %s() call", "" }; #endif diff --git a/libmysql/get_password.c b/libmysql/get_password.c index e55e77320f0..4c251677a66 100644 --- a/libmysql/get_password.c +++ b/libmysql/get_password.c @@ -36,7 +36,7 @@ #include <pwd.h> #endif /* HAVE_PWD_H */ #else /* ! HAVE_GETPASS */ -#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) +#if !defined(__WIN__) && !defined(__NETWARE__) #include <sys/ioctl.h> #ifdef HAVE_TERMIOS_H /* For tty-password */ #include <termios.h> @@ -65,7 +65,7 @@ #define getpass(A) getpassphrase(A) #endif -#if defined( __WIN__) || defined(OS2) || defined(__NETWARE__) +#if defined( __WIN__) || defined(__NETWARE__) /* were just going to fake it here and get input from the keyboard */ #ifdef __NETWARE__ @@ -75,7 +75,7 @@ #define _cputs(A) putstring(A) #endif -char *get_tty_password(char *opt_message) +char *get_tty_password(const char *opt_message) { char to[80]; char *pos=to,*end=to+sizeof(to)-1; @@ -159,7 +159,7 @@ static void get_password(char *to,uint length,int fd,bool echo) #endif /* ! HAVE_GETPASS */ -char *get_tty_password(char *opt_message) +char *get_tty_password(const char *opt_message) { #ifdef HAVE_GETPASS char *passbuff; diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 1a0aae414ed..46d0c8f1037 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -195,10 +195,8 @@ void STDCALL mysql_server_end() if (!org_my_init_done) { my_end(MY_DONT_FREE_DBUG); -#ifndef THREAD - /* Remove TRACING, if enabled by mysql_debug() */ + /* Remove TRACING, if enabled by mysql_debug() */ DBUG_POP(); -#endif } else { @@ -285,16 +283,12 @@ mysql_debug(const char *debug __attribute__((unused))) { #ifndef DBUG_OFF char *env; - if (_db_on_) - return; /* Already using debugging */ if (debug) { - DEBUGGER_ON; DBUG_PUSH(debug); } else if ((env = getenv("MYSQL_DEBUG"))) { - DEBUGGER_ON; DBUG_PUSH(env); #if !defined(_WINVER) && !defined(WINVER) puts("\n-------------------------------------------------------"); @@ -644,7 +638,7 @@ mysql_connect(MYSQL *mysql,const char *host, if (!(res=mysql_real_connect(mysql,host,user,passwd,NullS,0,NullS,0))) { if (mysql->free_me) - my_free((gptr) mysql,MYF(0)); + my_free((uchar*) mysql,MYF(0)); } mysql->reconnect= 1; DBUG_RETURN(res); @@ -734,7 +728,7 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, The server will close all statements no matter was the attempt to change user successful or not. */ - mysql_detach_stmt_list(&mysql->stmts); + mysql_detach_stmt_list(&mysql->stmts, "mysql_change_user"); if (rc == 0) { /* Free old connect information */ @@ -763,7 +757,7 @@ void read_user_name(char *name) strmake(name, str ? str : "UNKNOWN_USER", USERNAME_LENGTH); } -#elif !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__) && !defined(OS2) +#elif !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__) void read_user_name(char *name) { @@ -965,7 +959,7 @@ static int default_local_infile_read(void *ptr, char *buf, uint buf_len) int count; default_local_infile_data*data = (default_local_infile_data *) ptr; - if ((count= (int) my_read(data->fd, (byte *) buf, buf_len, MYF(0))) < 0) + if ((count= (int) my_read(data->fd, (uchar *) buf, buf_len, MYF(0))) < 0) { data->error_num= EE_READ; /* the errmsg for not entire file read */ my_snprintf(data->error_msg, sizeof(data->error_msg)-1, @@ -2554,7 +2548,7 @@ int cli_stmt_execute(MYSQL_STMT *stmt) DBUG_RETURN(1); } - net_clear(net); /* Sets net->write_pos */ + net_clear(net, 1); /* Sets net->write_pos */ /* Reserve place for null-marker bytes */ null_count= (stmt->param_count+7) /8; if (my_realloc_str(net, null_count + 1)) @@ -2825,11 +2819,11 @@ my_bool STDCALL mysql_stmt_attr_get(MYSQL_STMT *stmt, { switch (attr_type) { case STMT_ATTR_UPDATE_MAX_LENGTH: - *(unsigned long *) value= stmt->update_max_length; + *(my_bool*) value= stmt->update_max_length; break; case STMT_ATTR_CURSOR_TYPE: *(ulong*) value= stmt->flags; - break; + break; case STMT_ATTR_PREFETCH_ROWS: *(ulong*) value= stmt->prefetch_rows; break; @@ -2891,7 +2885,7 @@ int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt) if (!mysql) { - set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate); + /* Error is already set in mysql_detatch_stmt_list */ DBUG_RETURN(1); } @@ -4563,7 +4557,7 @@ static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row) } if (!((bit<<=1) & 255)) { - bit= 1; /* To next byte */ + bit= 1; /* To next uchar */ null_ptr++; } } @@ -4756,7 +4750,7 @@ static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data) DBUG_ASSERT(row <= row_end); if (!((bit<<=1) & 255)) { - bit= 1; /* To next byte */ + bit= 1; /* To next uchar */ null_ptr++; } } @@ -5067,7 +5061,7 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt) } } - my_free((gptr) stmt, MYF(MY_WME)); + my_free((uchar*) stmt, MYF(MY_WME)); DBUG_RETURN(test(rc)); } diff --git a/libmysql/manager.c b/libmysql/manager.c index 631bfa26cb2..2989c9dcccf 100644 --- a/libmysql/manager.c +++ b/libmysql/manager.c @@ -35,9 +35,7 @@ #include <signal.h> #include <errno.h> -#if defined(OS2) -# include <sys/un.h> -#elif defined(__NETWARE__) +#if defined(__NETWARE__) #include <netdb.h> #include <sys/select.h> #include <sys/utsname.h> @@ -208,10 +206,10 @@ void STDCALL mysql_manager_close(MYSQL_MANAGER* con) allocated in my_multimalloc() along with con->host, freeing con->hosts frees the whole block */ - my_free((gptr)con->host,MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*)con->host,MYF(MY_ALLOW_ZERO_PTR)); net_end(&con->net); if (con->free_me) - my_free((gptr)con,MYF(0)); + my_free((uchar*)con,MYF(0)); } |