summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMySQL Team <mysql@php.net>2001-06-01 20:07:26 +0000
committerMySQL Team <mysql@php.net>2001-06-01 20:07:26 +0000
commite8cbbc0637cb27c6fda64940a9138e08060475f8 (patch)
treef6353232aba5ae05c8f4779865cd742dc392b181
parent304ac03be434eecf6edc1f025c455e9089f8af37 (diff)
downloadphp-git-e8cbbc0637cb27c6fda64940a9138e08060475f8.tar.gz
Upgrade ext/mysql/libmysql to version 3.23.39. No major changes -
portability fixes. Also add configure test for HAVE_INT_8_16_32 which should solve compilation problems on AIX.
-rw-r--r--NEWS2
-rw-r--r--ext/mysql/libmysql/acinclude.m425
-rw-r--r--ext/mysql/libmysql/dbug.c2
-rw-r--r--ext/mysql/libmysql/default.c2
-rw-r--r--ext/mysql/libmysql/errmsg.c8
-rw-r--r--ext/mysql/libmysql/errors.c12
-rw-r--r--ext/mysql/libmysql/global.h40
-rw-r--r--ext/mysql/libmysql/libmysql.c102
-rw-r--r--ext/mysql/libmysql/m_ctype.h1
-rw-r--r--ext/mysql/libmysql/mf_format.c2
-rw-r--r--ext/mysql/libmysql/mf_pack.c7
-rw-r--r--ext/mysql/libmysql/my_alloc.c2
-rw-r--r--ext/mysql/libmysql/my_error.c8
-rw-r--r--ext/mysql/libmysql/my_getwd.c4
-rw-r--r--ext/mysql/libmysql/my_init.c11
-rw-r--r--ext/mysql/libmysql/my_net.h8
-rw-r--r--ext/mysql/libmysql/my_open.c2
-rw-r--r--ext/mysql/libmysql/my_pthread.c2
-rw-r--r--ext/mysql/libmysql/my_pthread.h18
-rw-r--r--ext/mysql/libmysql/my_sys.h25
-rw-r--r--ext/mysql/libmysql/my_thr_init.c50
-rw-r--r--ext/mysql/libmysql/my_winthread.c5
-rw-r--r--ext/mysql/libmysql/mysql.h15
-rw-r--r--ext/mysql/libmysql/mysql_com.h2
-rw-r--r--ext/mysql/libmysql/mysql_version.h12
-rw-r--r--ext/mysql/libmysql/mysqld_error.h12
-rw-r--r--ext/mysql/libmysql/mysys_err.h5
-rw-r--r--ext/mysql/libmysql/mysys_priv.h1
-rw-r--r--ext/mysql/libmysql/net.c1
-rw-r--r--ext/mysql/libmysql/thr_mutex.c13
-rw-r--r--ext/mysql/libmysql/typelib.c4
-rwxr-xr-xext/mysql/libmysql/update_sources15
32 files changed, 264 insertions, 154 deletions
diff --git a/NEWS b/NEWS
index b839e3bf7b..2d6aac6882 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
PHP 4.0 NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 200?, Version 4.0.7-dev
+- Updated ext/mysql/libmysql to version 3.23.39; Portability fixes, minor
+ bug fixes. (tim@mysql.com)
- Added the CONNECTION_ABORTED, CONNECTION_TIMEOUT and CONNECTION_NORMAL
constants. (Zak)
- Added get_defined_constants() function to return an associative array of
diff --git a/ext/mysql/libmysql/acinclude.m4 b/ext/mysql/libmysql/acinclude.m4
index c9e0973fef..0fb030b803 100644
--- a/ext/mysql/libmysql/acinclude.m4
+++ b/ext/mysql/libmysql/acinclude.m4
@@ -295,6 +295,30 @@ then
fi
])
+AC_DEFUN(MYSQL_CHECK_INT_8_16_32,
+[AC_MSG_CHECKING([for int8])
+AC_TRY_RUN([
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef HAVE_STDDEF_H
+#include <stddef.h>
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+int main()
+{
+ int8 i;
+ return 0;
+}
+], AC_DEFINE(HAVE_INT_8_16_32, , [ ]) AC_MSG_RESULT([yes]), AC_MSG_RESULT([no])
+)
+])
+
AC_DEFUN(MYSQL_HEADER_CHECKS,[
AC_HEADER_STDC
AC_CHECK_HEADERS(sgtty.h sys/ioctl.h \
@@ -322,6 +346,7 @@ AC_TYPE_UID_T
MYSQL_CHECK_ULONG
MYSQL_CHECK_UCHAR
MYSQL_CHECK_UINT
+MYSQL_CHECK_INT_8_16_32
MYSQL_TYPE_ACCEPT
MYSQL_TYPE_QSORT
diff --git a/ext/mysql/libmysql/dbug.c b/ext/mysql/libmysql/dbug.c
index c004de587f..f600b28100 100644
--- a/ext/mysql/libmysql/dbug.c
+++ b/ext/mysql/libmysql/dbug.c
@@ -341,7 +341,7 @@ pthread_mutex_t THR_LOCK_dbug;
static void init_dbug_state(void)
{
- pthread_mutex_init(&THR_LOCK_dbug,NULL);
+ pthread_mutex_init(&THR_LOCK_dbug,MY_MUTEX_INIT_FAST);
}
static CODE_STATE *code_state(void)
diff --git a/ext/mysql/libmysql/default.c b/ext/mysql/libmysql/default.c
index 6319860b48..d9dbfcf1c6 100644
--- a/ext/mysql/libmysql/default.c
+++ b/ext/mysql/libmysql/default.c
@@ -208,7 +208,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
const char *dir, const char *config_file,
const char *ext, TYPELIB *group)
{
- char name[FN_REFLEN+10],buff[257],*ptr,*end,*value,*tmp;
+ char name[FN_REFLEN+10],buff[FN_REFLEN+1],*ptr,*end,*value,*tmp;
FILE *fp;
uint line=0;
my_bool read_values=0,found_group=0;
diff --git a/ext/mysql/libmysql/errmsg.c b/ext/mysql/libmysql/errmsg.c
index f015a05ea3..216693042d 100644
--- a/ext/mysql/libmysql/errmsg.c
+++ b/ext/mysql/libmysql/errmsg.c
@@ -22,7 +22,7 @@ const char *client_errors[]=
"MySQL client got out of memory",
"Wrong host info",
"Localhost via UNIX socket",
- "%s via TCP/IP",
+ "%-.64s via TCP/IP",
"Error in server handshake",
"Lost connection to MySQL server during query",
"Commands out of sync; You can't run this command now",
@@ -48,11 +48,11 @@ const char *client_errors[]=
"MySQL client run out of memory",
"Wrong host info",
"Localhost via UNIX socket",
- "%s via TCP/IP",
+ "%-.64s via TCP/IP",
"Error in server handshake",
"Lost connection to MySQL server during query",
"Commands out of sync; You can't run this command now",
- "%s via named pipe",
+ "%-.64s via named pipe",
"Can't wait for named pipe to host: %-.64s pipe: %-.32s (%lu)",
"Can't open named pipe to host: %-.64s pipe: %-.32s (%lu)",
"Can't set state of named pipe to host: %-.64s pipe: %-.32s (%lu)",
@@ -64,5 +64,5 @@ const char *client_errors[]=
void init_client_errs(void)
{
- errmsg[CLIENT_ERRMAP] = &client_errors[0];
+ my_errmsg[CLIENT_ERRMAP] = &client_errors[0];
}
diff --git a/ext/mysql/libmysql/errors.c b/ext/mysql/libmysql/errors.c
index 7ecf991a9b..9b11bfb47a 100644
--- a/ext/mysql/libmysql/errors.c
+++ b/ext/mysql/libmysql/errors.c
@@ -32,18 +32,21 @@ const char * NEAR globerrs[GLOBERRS]=
"Can't create directory '%s' (Errcode: %d)",
"Character set '%s' is not a compiled character set and is not specified in the '%s' file",
"Out of resources when opening file '%s' (Errcode: %d)",
+ "Can't read value for symlink '%s' (Error %d)",
+ "Can't create symlink '%s' pointing at '%s' (Error %d)",
+ "Error on realpath() on '%s' (Error %d)",
};
void init_glob_errs(void)
{
- errmsg[GLOB] = & globerrs[0];
+ my_errmsg[GLOB] = & globerrs[0];
} /* init_glob_errs */
#else
void init_glob_errs()
{
- errmsg[GLOB] = & globerrs[0];
+ my_errmsg[GLOB] = & globerrs[0];
EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)";
EE(EE_CANTCREATEFILE) = "Can't create/write to file '%s' (Errcode: %d)";
@@ -67,6 +70,9 @@ void init_glob_errs()
EE(EE_DISK_FULL) = "Disk is full writing '%s'. Waiting for someone to free space...";
EE(EE_CANT_MKDIR) ="Can't create directory '%s' (Errcode: %d)";
EE(EE_UNKNOWN_CHARSET)= "Character set is not a compiled character set and is not specified in the %s file";
- EE(EE_OUT_OF_FILERESOURCES)="Out of resources when opening file '%s' (Errcode: %d)",
+ EE(EE_OUT_OF_FILERESOURCES)="Out of resources when opening file '%s' (Errcode: %d)";
+ EE(EE_CANT_READLINK)="Can't read value for symlink '%s' (Error %d)";
+ EE(EE_CANT_SYMLINK)="Can't create symlink '%s' pointing at '%s' (Error %d)";
+ EE(EE_REALPATH)="Error on realpath() on '%s' (Error %d)";
}
#endif
diff --git a/ext/mysql/libmysql/global.h b/ext/mysql/libmysql/global.h
index 94427003ca..f9e3295961 100644
--- a/ext/mysql/libmysql/global.h
+++ b/ext/mysql/libmysql/global.h
@@ -14,6 +14,19 @@ This file is public domain and comes with NO WARRANTY of any kind */
#include <os2.h>
#endif /* __EMX__ */
+#ifdef __CYGWIN__
+/* We use a Unix API, so pretend it's not Windows */
+#undef WIN
+#undef WIN32
+#undef _WIN
+#undef _WIN32
+#undef _WIN64
+#undef __WIN__
+#undef __WIN32__
+#define HAVE_ERRNO_AS_DEFINE
+#endif /* __CYGWIN__ */
+
+
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
#include <config-win.h>
#else
@@ -305,7 +318,8 @@ typedef int File; /* File descriptor */
typedef int my_socket; /* File descriptor for sockets */
#define INVALID_SOCKET -1
#endif
-typedef RETSIGTYPE sig_handler; /* Function to handle signals */
+/* Type for fuctions that handles signals */
+#define sig_handler RETSIGTYPE
typedef void (*sig_return)();/* Returns type from signal */
#if defined(__GNUC__) && !defined(_lint)
typedef char pchar; /* Mixed prototypes can take char */
@@ -797,6 +811,28 @@ typedef union {
#else
#define float4get(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(float))
#define float4store(V,M) memcpy_fixed((byte*) V,(byte*) (&M),sizeof(float))
+
+#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
+#define doublestore(T,V) { *(T)= ((byte *) &V)[4];\
+ *((T)+1)=(char) ((byte *) &V)[5];\
+ *((T)+2)=(char) ((byte *) &V)[6];\
+ *((T)+3)=(char) ((byte *) &V)[7];\
+ *((T)+4)=(char) ((byte *) &V)[0];\
+ *((T)+5)=(char) ((byte *) &V)[1];\
+ *((T)+6)=(char) ((byte *) &V)[2];\
+ *((T)+7)=(char) ((byte *) &V)[3]; }
+#define doubleget(V,M) { double def_temp;\
+ ((byte*) &def_temp)[0]=(M)[4];\
+ ((byte*) &def_temp)[1]=(M)[5];\
+ ((byte*) &def_temp)[2]=(M)[6];\
+ ((byte*) &def_temp)[3]=(M)[7];\
+ ((byte*) &def_temp)[4]=(M)[0];\
+ ((byte*) &def_temp)[5]=(M)[1];\
+ ((byte*) &def_temp)[6]=(M)[2];\
+ ((byte*) &def_temp)[7]=(M)[3];\
+ (V) = def_temp; }
+#endif /* __FLOAT_WORD_ORDER */
+
#define float8get(V,M) doubleget((V),(M))
#define float8store(V,M) doublestore((V),(M))
#endif /* WORDS_BIGENDIAN */
@@ -849,7 +885,7 @@ typedef union {
#ifndef doubleget
#define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double))
#define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double))
-#endif
+#endif /* doubleget */
#define longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong))
#define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong))
diff --git a/ext/mysql/libmysql/libmysql.c b/ext/mysql/libmysql/libmysql.c
index 52fa65d72a..48d388b798 100644
--- a/ext/mysql/libmysql/libmysql.c
+++ b/ext/mysql/libmysql/libmysql.c
@@ -2,11 +2,11 @@
This file is public domain and comes with NO WARRANTY of any kind */
#define DONT_USE_RAID
+#include <global.h>
#if defined(__WIN__) || defined(_WIN32) || defined(_WIN64)
#include <winsock.h>
#include <odbcinst.h>
#endif
-#include <global.h>
#include <my_sys.h>
#include <mysys_err.h>
#include <m_string.h>
@@ -473,7 +473,7 @@ static void free_old_query(MYSQL *mysql)
DBUG_VOID_RETURN;
}
-#ifdef HAVE_GETPWUID
+#if defined(HAVE_GETPWUID) && defined(NO_GETPWUID_DECL)
struct passwd *getpwuid(uid_t);
char* getlogin(void);
#endif
@@ -489,14 +489,6 @@ static void read_user_name(char *name)
#ifdef HAVE_GETPWUID
struct passwd *skr;
const char *str;
-/*#ifdef __cplusplus
- extern "C" struct passwd *getpwuid(uid_t);
- extern "C" { char* getlogin(void); }
-#else
- char * getlogin();
- struct passwd *getpwuid(uid_t);
-#endif
-*/
if ((str=getlogin()) == NULL)
{
if ((skr=getpwuid(geteuid())) != NULL)
@@ -1653,6 +1645,7 @@ mysql_close(MYSQL *mysql)
{
free_old_query(mysql);
mysql->status=MYSQL_STATUS_READY; /* Force command */
+ mysql->reconnect=0;
simple_command(mysql,COM_QUIT,NullS,0,1);
end_server(mysql);
}
@@ -1696,87 +1689,30 @@ mysql_query(MYSQL *mysql, const char *query)
return mysql_real_query(mysql,query, (uint) strlen(query));
}
-int STDCALL
-mysql_send_query(MYSQL* mysql, const char* query)
-{
- return mysql_real_send_query(mysql, query, strlen(query));
-}
-
-/* send the query and return so we can do something else */
-/* needs to be followed by mysql_reap_query() when we want to
- finish processing it
+/*
+ Send the query and return so we can do something else.
+ Needs to be followed by mysql_read_query_result() when we want to
+ finish processing it.
*/
-int STDCALL
-mysql_real_send_query(MYSQL* mysql, const char* query, uint len)
-{
- return simple_command(mysql, COM_QUERY, query, len, 1);
-}
int STDCALL
-mysql_reap_query(MYSQL* mysql)
+mysql_send_query(MYSQL* mysql, const char* query, uint length)
{
- uchar *pos;
- ulong field_count;
- MYSQL_DATA *fields;
- uint len;
- DBUG_ENTER("mysql_reap_query");
- DBUG_PRINT("enter",("handle: %lx",mysql));
- if((len = net_safe_read(mysql)) == packet_error)
- DBUG_RETURN(-1);
- free_old_query(mysql); /* Free old result */
- get_info:
- pos=(uchar*) mysql->net.read_pos;
- if ((field_count= net_field_length(&pos)) == 0)
- {
- mysql->affected_rows= net_field_length_ll(&pos);
- mysql->insert_id= net_field_length_ll(&pos);
- if (mysql->server_capabilities & CLIENT_TRANSACTIONS)
- {
- mysql->server_status=uint2korr(pos); pos+=2;
- }
- if (pos < mysql->net.read_pos+len && net_field_length(&pos))
- mysql->info=(char*) pos;
- DBUG_RETURN(0);
- }
- if (field_count == NULL_LENGTH) /* LOAD DATA LOCAL INFILE */
- {
- int error=send_file_to_server(mysql,(char*) pos);
- if ((len=net_safe_read(mysql)) == packet_error || error)
- DBUG_RETURN(-1);
- goto get_info; /* Get info packet */
- }
- if (!(mysql->server_status & SERVER_STATUS_AUTOCOMMIT))
- mysql->server_status|= SERVER_STATUS_IN_TRANS;
-
- mysql->extra_info= net_field_length_ll(&pos); /* Maybe number of rec */
- if (!(fields=read_rows(mysql,(MYSQL_FIELD*) 0,5)))
- DBUG_RETURN(-1);
- if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,
- (uint) field_count,0,
- (my_bool) test(mysql->server_capabilities &
- CLIENT_LONG_FLAG))))
- DBUG_RETURN(-1);
- mysql->status=MYSQL_STATUS_GET_RESULT;
- mysql->field_count=field_count;
- DBUG_RETURN(0);
-
+ return simple_command(mysql, COM_QUERY, query, length, 1);
}
-int STDCALL
-mysql_real_query(MYSQL *mysql, const char *query, uint length)
+int STDCALL mysql_read_query_result(MYSQL *mysql)
{
uchar *pos;
ulong field_count;
MYSQL_DATA *fields;
- DBUG_ENTER("mysql_real_query");
- DBUG_PRINT("enter",("handle: %lx",mysql));
- DBUG_PRINT("query",("Query = \"%s\"",query));
+ uint length;
+ DBUG_ENTER("mysql_read_query_result");
- if (simple_command(mysql,COM_QUERY,query,length,1) ||
- (length=net_safe_read(mysql)) == packet_error)
+ if ((length = net_safe_read(mysql)) == packet_error)
DBUG_RETURN(-1);
free_old_query(mysql); /* Free old result */
- get_info:
+get_info:
pos=(uchar*) mysql->net.read_pos;
if ((field_count= net_field_length(&pos)) == 0)
{
@@ -1813,6 +1749,16 @@ mysql_real_query(MYSQL *mysql, const char *query, uint length)
DBUG_RETURN(0);
}
+int STDCALL
+mysql_real_query(MYSQL *mysql, const char *query, uint length)
+{
+ DBUG_ENTER("mysql_real_query");
+ DBUG_PRINT("enter",("handle: %lx",mysql));
+ DBUG_PRINT("query",("Query = \"%s\"",query));
+ if (simple_command(mysql,COM_QUERY,query,length,1))
+ DBUG_RETURN(-1);
+ DBUG_RETURN(mysql_read_query_result(mysql));
+}
static int
send_file_to_server(MYSQL *mysql, const char *filename)
diff --git a/ext/mysql/libmysql/m_ctype.h b/ext/mysql/libmysql/m_ctype.h
index bd6e343c24..e322ac8f1a 100644
--- a/ext/mysql/libmysql/m_ctype.h
+++ b/ext/mysql/libmysql/m_ctype.h
@@ -52,6 +52,7 @@ extern CHARSET_INFO compiled_charsets[];
#endif
/* Don't include std ctype.h when this is included */
#define _CTYPE_H
+#define _CTYPE_H_
#define _CTYPE_INCLUDED
#define __CTYPE_INCLUDED
#define _CTYPE_USING /* Don't put names in global namespace. */
diff --git a/ext/mysql/libmysql/mf_format.c b/ext/mysql/libmysql/mf_format.c
index 72971ed318..21ba545797 100644
--- a/ext/mysql/libmysql/mf_format.c
+++ b/ext/mysql/libmysql/mf_format.c
@@ -96,7 +96,7 @@ my_string fn_format(my_string to, const char *name, const char *dsk,
(void) strmov(pos,ext); /* Don't convert extension */
}
/* Purify gives a lot of UMR errors when using realpath */
-#if defined(HAVE_REALPATH) && !defined(HAVE_purify)
+#if defined(HAVE_REALPATH) && !defined(HAVE_purify) && !defined(HAVE_BROKEN_REALPATH)
if (flag & 16)
{
struct stat stat_buff;
diff --git a/ext/mysql/libmysql/mf_pack.c b/ext/mysql/libmysql/mf_pack.c
index a6ab070870..b6b079bdac 100644
--- a/ext/mysql/libmysql/mf_pack.c
+++ b/ext/mysql/libmysql/mf_pack.c
@@ -222,11 +222,16 @@ void symdirget(char *dir)
*pos++=temp; *pos=0; /* Restore old filename */
if (fp)
{
- if (fgets(buff, sizeof(buff), fp))
+ if (fgets(buff, sizeof(buff)-1, fp))
{
for (pos=strend(buff);
pos > buff && (iscntrl(pos[-1]) || isspace(pos[-1])) ;
pos --);
+
+ /* Ensure that the symlink ends with the directory symbol */
+ if (pos == buff || pos[-1] != FN_LIBCHAR)
+ *pos++=FN_LIBCHAR;
+
strmake(dir,buff, (uint) (pos-buff));
}
my_fclose(fp,MYF(0));
diff --git a/ext/mysql/libmysql/my_alloc.c b/ext/mysql/libmysql/my_alloc.c
index 01992b64dd..a33f86fa00 100644
--- a/ext/mysql/libmysql/my_alloc.c
+++ b/ext/mysql/libmysql/my_alloc.c
@@ -10,7 +10,7 @@ This file is public domain and comes with NO WARRANTY of any kind */
void init_alloc_root(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size)
{
mem_root->free=mem_root->used=0;
- mem_root->min_malloc=16;
+ mem_root->min_malloc=32;
mem_root->block_size=block_size-MALLOC_OVERHEAD-sizeof(USED_MEM)-8;
mem_root->error_handler=0;
#if !(defined(HAVE_purify) && defined(EXTRA_DEBUG))
diff --git a/ext/mysql/libmysql/my_error.c b/ext/mysql/libmysql/my_error.c
index 78c2bb2a74..21dc3ec268 100644
--- a/ext/mysql/libmysql/my_error.c
+++ b/ext/mysql/libmysql/my_error.c
@@ -9,7 +9,7 @@ This file is public domain and comes with NO WARRANTY of any kind */
/* Define some external variables for error handling */
-const char ** NEAR errmsg[MAXMAPS]={0,0,0,0};
+const char ** NEAR my_errmsg[MAXMAPS]={0,0,0,0};
char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
/* Error message to user */
@@ -28,10 +28,10 @@ int my_error(int nr,myf MyFlags, ...)
va_start(ap,MyFlags);
DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d", nr, MyFlags, errno));
- if (nr / ERRMOD == GLOB && errmsg[GLOB] == 0)
+ if (nr / ERRMOD == GLOB && my_errmsg[GLOB] == 0)
init_glob_errs();
- olen=(uint) strlen(tpos=errmsg[nr / ERRMOD][nr % ERRMOD]);
+ olen=(uint) strlen(tpos=my_errmsg[nr / ERRMOD][nr % ERRMOD]);
endpos=ebuff;
while (*tpos)
@@ -51,6 +51,8 @@ int my_error(int nr,myf MyFlags, ...)
/* Skipp if max size is used (to be compatible with printf) */
while (isdigit(*tpos) || *tpos == '.' || *tpos == '-')
tpos++;
+ if (*tpos == 'l') /* Skipp 'l' argument */
+ tpos++;
if (*tpos == 's') /* String parameter */
{
par = va_arg(ap, char *);
diff --git a/ext/mysql/libmysql/my_getwd.c b/ext/mysql/libmysql/my_getwd.c
index 99ce4b9e0a..9e87c4d201 100644
--- a/ext/mysql/libmysql/my_getwd.c
+++ b/ext/mysql/libmysql/my_getwd.c
@@ -15,6 +15,10 @@ This file is public domain and comes with NO WARRANTY of any kind */
#include <direct.h>
#endif
+#ifdef __EMX__
+// chdir2 support also drive change
+#define chdir _chdir2
+#endif
/* Gets current working directory in buff. Directory is allways ended
with FN_LIBCHAR */
diff --git a/ext/mysql/libmysql/my_init.c b/ext/mysql/libmysql/my_init.c
index fb9b2ae100..9bccb2c652 100644
--- a/ext/mysql/libmysql/my_init.c
+++ b/ext/mysql/libmysql/my_init.c
@@ -34,6 +34,7 @@ static my_bool win32_init_tcp_ip();
static my_bool my_init_done=0;
+
static ulong atoi_octal(const char *str)
{
long int tmp;
@@ -62,6 +63,9 @@ void my_init(void)
#ifndef __WIN__
sigfillset(&my_signals); /* signals blocked by mf_brkhant */
#endif
+#endif /* THREAD */
+#ifdef UNIXWARE_7
+ (void) isatty(0); /* Go around connect() bug in UW7 */
#endif
{
DBUG_ENTER("my_init");
@@ -113,7 +117,12 @@ void my_end(int infoflag)
#ifdef HAVE_GETRUSAGE
struct rusage rus;
if (!getrusage(RUSAGE_SELF, &rus))
- fprintf(info_file,"\nUser time %.2f, System time %.2f\nMaximum resident set size %ld, Integral resident set size %ld\nNon physical pagefaults %ld, Physical pagefaults %ld, Swaps %ld\nBlocks in %ld out %ld, Messages in %ld out %ld, Signals %ld\nVouluntary context switches %ld, Invouluntary context switches %ld\n",
+ fprintf(info_file,"\n\
+User time %.2f, System time %.2f\n\
+Maximum resident set size %ld, Integral resident set size %ld\n\
+Non-physical pagefaults %ld, Physical pagefaults %ld, Swaps %ld\n\
+Blocks in %ld out %ld, Messages in %ld out %ld, Signals %ld\n\
+Voluntary context switches %ld, Involuntary context switches %ld\n",
(rus.ru_utime.tv_sec * SCALE_SEC +
rus.ru_utime.tv_usec / SCALE_USEC) / 100.0,
(rus.ru_stime.tv_sec * SCALE_SEC +
diff --git a/ext/mysql/libmysql/my_net.h b/ext/mysql/libmysql/my_net.h
index 143ddd9d65..4633f3dfbd 100644
--- a/ext/mysql/libmysql/my_net.h
+++ b/ext/mysql/libmysql/my_net.h
@@ -4,6 +4,10 @@ This file is public domain and comes with NO WARRANTY of any kind */
/* thread safe version of some common functions */
/* for thread safe my_inet_ntoa */
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
#if !defined(MSDOS) && !defined(__WIN__) && !defined(__BEOS__)
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
@@ -17,3 +21,7 @@ This file is public domain and comes with NO WARRANTY of any kind */
#endif /* !defined(MSDOS) && !defined(__WIN__) */
void my_inet_ntoa(struct in_addr in, char *buf);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/ext/mysql/libmysql/my_open.c b/ext/mysql/libmysql/my_open.c
index 32f90b635e..49d7735818 100644
--- a/ext/mysql/libmysql/my_open.c
+++ b/ext/mysql/libmysql/my_open.c
@@ -93,7 +93,7 @@ File my_register_filename(File fd, const char *FileName, enum file_type
my_file_opened++;
my_file_info[fd].type = type_of_file;
#if defined(THREAD) && !defined(HAVE_PREAD)
- pthread_mutex_init(&my_file_info[fd].mutex,NULL);
+ pthread_mutex_init(&my_file_info[fd].mutex,MY_MUTEX_INIT_FAST);
#endif
pthread_mutex_unlock(&THR_LOCK_open);
DBUG_PRINT("exit",("fd: %d",fd));
diff --git a/ext/mysql/libmysql/my_pthread.c b/ext/mysql/libmysql/my_pthread.c
index d5cecc8d45..367542ee8d 100644
--- a/ext/mysql/libmysql/my_pthread.c
+++ b/ext/mysql/libmysql/my_pthread.c
@@ -302,7 +302,7 @@ int sigwait(sigset_t *setp, int *sigp)
pthread_t sigwait_thread_id;
inited=1;
sigemptyset(&pending_set);
- pthread_mutex_init(&LOCK_sigwait,NULL);
+ pthread_mutex_init(&LOCK_sigwait,MY_MUTEX_INIT_FAST);
pthread_cond_init(&COND_sigwait,NULL);
pthread_attr_init(&thr_attr);
diff --git a/ext/mysql/libmysql/my_pthread.h b/ext/mysql/libmysql/my_pthread.h
index 7e5a1cb840..3b451dca51 100644
--- a/ext/mysql/libmysql/my_pthread.h
+++ b/ext/mysql/libmysql/my_pthread.h
@@ -427,6 +427,7 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
#define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__)
#define pthread_cond_wait(A,B) safe_cond_wait((A),(B),__FILE__,__LINE__)
#define pthread_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__)
+#define pthread_mutex_trylock(A) pthread_mutex_lock(A)
#define pthread_mutex_t safe_mutex_t
#endif /* SAFE_MUTEX */
@@ -484,11 +485,26 @@ extern int my_rw_unlock( my_rw_lock_t * );
#define pthread_attr_setstacksize(A,B) pthread_dummy(0)
#endif
+/* Define mutex types */
+#define MY_MUTEX_INIT_SLOW NULL
+#define MY_MUTEX_INIT_FAST NULL
+#define MY_MUTEX_INIT_ERRCHK NULL
+#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+extern pthread_mutexattr_t my_fast_mutexattr;
+#undef MY_MUTEX_INIT_FAST
+#define MY_MUTEX_INIT_FAST &my_fast_mutexattr
+#endif
+#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
+extern pthread_mutexattr_t my_errchk_mutexattr;
+#undef MY_INIT_MUTEX_ERRCHK
+#define MY_INIT_MUTEX_ERRCHK &my_errchk_mutexattr
+#endif
+
extern my_bool my_thread_global_init(void);
extern void my_thread_global_end(void);
extern my_bool my_thread_init(void);
extern void my_thread_end(void);
-extern char *my_thread_name(void);
+extern const char *my_thread_name(void);
extern long my_thread_id(void);
extern int pthread_no_free(void *);
extern int pthread_dummy(int);
diff --git a/ext/mysql/libmysql/my_sys.h b/ext/mysql/libmysql/my_sys.h
index ca9c564501..5a2689da2a 100644
--- a/ext/mysql/libmysql/my_sys.h
+++ b/ext/mysql/libmysql/my_sys.h
@@ -27,13 +27,6 @@ extern int NEAR my_errno; /* Last error in mysys */
#include <stdarg.h>
-#ifdef __EMX__
-/* record loging flags (F_GETLK, F_SETLK, F_SETLKW) */
-#define F_RDLCK 1 /* FreeBSD: shared or read lock */
-#define F_UNLCK 2 /* FreeBSD: unlock */
-#define F_WRLCK 3 /* FreeBSD: exclusive or write lock */
-#endif
-
#define MYSYS_PROGRAM_USES_CURSES() { error_handler_hook = my_message_curses; mysys_uses_curses=1; }
#define MYSYS_PROGRAM_DONT_USE_CURSES() { error_handler_hook = my_message_no_curses; mysys_uses_curses=0;}
#define MY_INIT(name); { my_progname= name; my_init(); }
@@ -55,6 +48,8 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */
#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */
#define MY_COPYTIME 64 /* my_redel() copys time */
+#define MY_DELETE_OLD 256 /* my_create_with_symlink() */
+#define MY_RESOLVE_LINK 128 /* my_realpath(); Only resolve links */
#define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */
#define MY_REDEL_MAKE_BACKUP 256
#define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */
@@ -155,7 +150,7 @@ void __CDECL hfree(void *ptr);
#else
extern int errno; /* declare errno */
#endif
-extern const char ** NEAR errmsg[];
+extern const char ** NEAR my_errmsg[];
extern char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
extern char *home_dir; /* Home directory for user */
extern char *my_progname; /* program-name (printed in errors) */
@@ -371,6 +366,12 @@ extern File my_create(const char *FileName,int CreateFlags,
int AccsesFlags, myf MyFlags);
extern int my_close(File Filedes,myf MyFlags);
extern int my_mkdir(const char *dir, int Flags, myf MyFlags);
+extern int my_readlink(char *to, const char *filename, myf MyFlags);
+extern int my_realpath(char *to, const char *filename, myf MyFlags);
+extern File my_create_with_symlink(const char *linkname, const char *filename,
+ int createflags, int access_flags,
+ myf MyFlags);
+extern int my_symlink(const char *content, const char *linkname, myf MyFlags);
extern uint my_read(File Filedes,byte *Buffer,uint Count,myf MyFlags);
extern uint my_pread(File Filedes,byte *Buffer,uint Count,my_off_t offset,
myf MyFlags);
@@ -411,7 +412,7 @@ extern int my_printf_error _VARARGS((uint my_err, const char *format,
__attribute__ ((format (printf, 2, 4))));
extern int my_vsnprintf( char *str, size_t n,
const char *format, va_list ap );
-
+extern int my_snprintf(char* to, size_t n, const char* fmt, ...);
extern int my_message(uint my_err, const char *str,myf MyFlags);
extern int my_message_no_curses(uint my_err, const char *str,myf MyFlags);
extern int my_message_curses(uint my_err, const char *str,myf MyFlags);
@@ -421,8 +422,14 @@ extern int my_redel(const char *from, const char *to, int MyFlags);
extern int my_copystat(const char *from, const char *to, int MyFlags);
extern my_string my_filename(File fd);
+#ifndef THREAD
extern void dont_break(void);
extern void allow_break(void);
+#else
+#define dont_break()
+#define allow_break()
+#endif
+
extern void my_remember_signal(int signal_number,sig_handler (*func)(int));
extern void caseup(my_string str,uint length);
extern void casedn(my_string str,uint length);
diff --git a/ext/mysql/libmysql/my_thr_init.c b/ext/mysql/libmysql/my_thr_init.c
index 2992d483d5..0d0e755bcd 100644
--- a/ext/mysql/libmysql/my_thr_init.c
+++ b/ext/mysql/libmysql/my_thr_init.c
@@ -14,13 +14,19 @@ This file is public domain and comes with NO WARRANTY of any kind */
pthread_key(struct st_my_thread_var*, THR_KEY_mysys);
#else
pthread_key(struct st_my_thread_var, THR_KEY_mysys);
-#endif
+#endif /* USE_TLS */
pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache,
THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_myisam,THR_LOCK_heap,
THR_LOCK_net, THR_LOCK_charset;
#ifndef HAVE_LOCALTIME_R
pthread_mutex_t LOCK_localtime_r;
#endif
+#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+pthread_mutexattr_t my_fast_mutexattr;
+#endif
+#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
+pthread_mutexattr_t my_errchk_mutexattr;
+#endif
/* FIXME Note. TlsAlloc does not set an auto destructor, so
the function my_thread_global_free must be called from
@@ -33,20 +39,30 @@ my_bool my_thread_global_init(void)
fprintf(stderr,"Can't initialize threads: error %d\n",errno);
exit(1);
}
- pthread_mutex_init(&THR_LOCK_malloc,NULL);
- pthread_mutex_init(&THR_LOCK_open,NULL);
- pthread_mutex_init(&THR_LOCK_keycache,NULL);
- pthread_mutex_init(&THR_LOCK_lock,NULL);
- pthread_mutex_init(&THR_LOCK_isam,NULL);
- pthread_mutex_init(&THR_LOCK_myisam,NULL);
- pthread_mutex_init(&THR_LOCK_heap,NULL);
- pthread_mutex_init(&THR_LOCK_net,NULL);
- pthread_mutex_init(&THR_LOCK_charset,NULL);
+#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+ pthread_mutexattr_init(&my_fast_mutexattr);
+ pthread_mutexattr_setkind_np(&my_fast_mutexattr,PTHREAD_MUTEX_ADAPTIVE_NP);
+#endif
+#ifdef PPTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
+ pthread_mutexattr_init(&my_errchk_mutexattr);
+ pthread_mutexattr_setkind_np(&my_errchk_mutexattr,
+ PTHREAD_MUTEX_ERRORCHECK_NP);
+#endif
+
+ pthread_mutex_init(&THR_LOCK_malloc,MY_MUTEX_INIT_FAST);
+ pthread_mutex_init(&THR_LOCK_open,MY_MUTEX_INIT_FAST);
+ pthread_mutex_init(&THR_LOCK_keycache,MY_MUTEX_INIT_FAST);
+ pthread_mutex_init(&THR_LOCK_lock,MY_MUTEX_INIT_FAST);
+ pthread_mutex_init(&THR_LOCK_isam,MY_MUTEX_INIT_SLOW);
+ pthread_mutex_init(&THR_LOCK_myisam,MY_MUTEX_INIT_SLOW);
+ pthread_mutex_init(&THR_LOCK_heap,MY_MUTEX_INIT_FAST);
+ pthread_mutex_init(&THR_LOCK_net,MY_MUTEX_INIT_FAST);
+ pthread_mutex_init(&THR_LOCK_charset,MY_MUTEX_INIT_FAST);
#ifdef __WIN__
win_pthread_init();
#endif
#ifndef HAVE_LOCALTIME_R
- pthread_mutex_init(&LOCK_localtime_r,NULL);
+ pthread_mutex_init(&LOCK_localtime_r,MY_MUTEX_INIT_SLOW);
#endif
return my_thread_init();
}
@@ -56,6 +72,12 @@ void my_thread_global_end(void)
#if defined(USE_TLS)
(void) TlsFree(THR_KEY_mysys);
#endif
+#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+ pthread_mutexattr_destroy(&my_fast_mutexattr);
+#endif
+#ifdef PPTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
+ pthread_mutexattr_destroy(&my_errchk_mutexattr);
+#endif
}
static long thread_id=0;
@@ -100,7 +122,7 @@ my_bool my_thread_init(void)
tmp= &THR_KEY_mysys;
#endif
tmp->id= ++thread_id;
- pthread_mutex_init(&tmp->mutex,NULL);
+ pthread_mutex_init(&tmp->mutex,MY_MUTEX_INIT_FAST);
pthread_cond_init(&tmp->suspend, NULL);
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
pthread_mutex_unlock(&THR_LOCK_lock);
@@ -166,14 +188,14 @@ long my_thread_id()
}
#ifdef DBUG_OFF
-char *my_thread_name(void)
+const char *my_thread_name(void)
{
return "no_name";
}
#else
-char *my_thread_name(void)
+const char *my_thread_name(void)
{
char name_buff[100];
struct st_my_thread_var *tmp=my_thread_var;
diff --git a/ext/mysql/libmysql/my_winthread.c b/ext/mysql/libmysql/my_winthread.c
index 675ff54cfc..5d06b698ee 100644
--- a/ext/mysql/libmysql/my_winthread.c
+++ b/ext/mysql/libmysql/my_winthread.c
@@ -1,4 +1,5 @@
-/* Copyright Abandoned. Public domain, no warranty, etc. */
+/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
+This file is public domain and comes with NO WARRANTY of any kind */
/*****************************************************************************
** Simulation of posix threads calls for WIN95 and NT
@@ -24,7 +25,7 @@ struct pthread_map
void win_pthread_init(void)
{
- pthread_mutex_init(&THR_LOCK_thread,NULL);
+ pthread_mutex_init(&THR_LOCK_thread,MY_MUTEX_INIT_FAST);
}
/*
diff --git a/ext/mysql/libmysql/mysql.h b/ext/mysql/libmysql/mysql.h
index 7f7d3dd203..f44252c9c7 100644
--- a/ext/mysql/libmysql/mysql.h
+++ b/ext/mysql/libmysql/mysql.h
@@ -6,6 +6,14 @@ This file is public domain and comes with NO WARRANTY of any kind */
#ifndef _mysql_h
#define _mysql_h
+#ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */
+#undef WIN
+#undef _WIN
+#undef _WIN32
+#undef _WIN64
+#undef __WIN__
+#endif
+
#ifndef MYSQL_SERVER
#ifdef __cplusplus
extern "C" {
@@ -215,12 +223,11 @@ MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
void STDCALL mysql_close(MYSQL *sock);
int STDCALL mysql_select_db(MYSQL *mysql, const char *db);
int STDCALL mysql_query(MYSQL *mysql, const char *q);
-int STDCALL mysql_send_query(MYSQL *mysql, const char *q);
-int STDCALL mysql_reap_query(MYSQL *mysql);
+int STDCALL mysql_send_query(MYSQL *mysql, const char *q,
+ unsigned int length);
+int STDCALL mysql_read_query_result(MYSQL *mysql);
int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
unsigned int length);
-int STDCALL mysql_real_send_query(MYSQL *mysql, const char *q,
- unsigned int len);
int STDCALL mysql_create_db(MYSQL *mysql, const char *DB);
int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
int STDCALL mysql_shutdown(MYSQL *mysql);
diff --git a/ext/mysql/libmysql/mysql_com.h b/ext/mysql/libmysql/mysql_com.h
index 47e60af524..0f6b5928db 100644
--- a/ext/mysql/libmysql/mysql_com.h
+++ b/ext/mysql/libmysql/mysql_com.h
@@ -76,7 +76,7 @@ enum enum_server_command {COM_SLEEP,COM_QUIT,COM_INIT_DB,COM_QUERY,
#define CLIENT_INTERACTIVE 1024 /* This is an interactive client */
#define CLIENT_SSL 2048 /* Switch to SSL after handshake */
#define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */
-#define CLIENT_TRANSACTIONS 8196 /* Client knows about transactions */
+#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */
#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
diff --git a/ext/mysql/libmysql/mysql_version.h b/ext/mysql/libmysql/mysql_version.h
index 3ec9679c04..1587579818 100644
--- a/ext/mysql/libmysql/mysql_version.h
+++ b/ext/mysql/libmysql/mysql_version.h
@@ -7,14 +7,18 @@ This file is public domain and comes with NO WARRANTY of any kind */
#include <custom_conf.h>
#else
#define PROTOCOL_VERSION 10
-#define MYSQL_SERVER_VERSION "3.23.32"
+#define MYSQL_SERVER_VERSION "3.23.39"
#define MYSQL_SERVER_SUFFIX ""
#define FRM_VER 6
-#define MYSQL_VERSION_ID 32332
+#define MYSQL_VERSION_ID 32339
+
+#ifndef MYSQL_PORT
#define MYSQL_PORT 3306
+#endif
-/* This is defined at configure time and found in main/php_config.h */
-/* #define MYSQL_UNIX_ADDR "/tmp/mysql.sock" */
+#ifndef MYSQL_UNIX_ADDR
+#define MYSQL_UNIX_ADDR "/tmp/mysql.sock"
+#endif
/* mysqld compile time options */
#ifndef MYSQL_CHARSET
diff --git a/ext/mysql/libmysql/mysqld_error.h b/ext/mysql/libmysql/mysqld_error.h
index 0391c3e6c4..e412f95a8e 100644
--- a/ext/mysql/libmysql/mysqld_error.h
+++ b/ext/mysql/libmysql/mysqld_error.h
@@ -198,4 +198,14 @@
#define ER_CRASHED_ON_REPAIR 1195
#define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196
#define ER_TRANS_CACHE_FULL 1197
-#define ER_ERROR_MESSAGES 198
+#define ER_SLAVE_MUST_STOP 1198
+#define ER_SLAVE_NOT_RUNNING 1199
+#define ER_BAD_SLAVE 1200
+#define ER_MASTER_INFO 1201
+#define ER_SLAVE_THREAD 1202
+#define ER_TOO_MANY_USER_CONNECTIONS 1203
+#define ER_SET_CONSTANTS_ONLY 1204
+#define ER_LOCK_WAIT_TIMEOUT 1205
+#define ER_LOCK_TABLE_FULL 1206
+#define ER_READ_ONLY_TRANSACTION 1207
+#define ER_ERROR_MESSAGES 208
diff --git a/ext/mysql/libmysql/mysys_err.h b/ext/mysql/libmysql/mysys_err.h
index 066162cf48..469d5a680e 100644
--- a/ext/mysql/libmysql/mysys_err.h
+++ b/ext/mysql/libmysql/mysys_err.h
@@ -8,7 +8,7 @@ extern "C" {
#endif
#define GLOB 0 /* Error maps */
-#define GLOBERRS 24 /* Max number of error messages in map's */
+#define GLOBERRS 27 /* Max number of error messages in map's */
#define EE(X) globerrs[ X ] /* Defines to add error to right map */
extern const char * NEAR globerrs[]; /* my_error_messages is here */
@@ -37,6 +37,9 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */
#define EE_CANT_MKDIR 21
#define EE_UNKNOWN_CHARSET 22
#define EE_OUT_OF_FILERESOURCES 23
+#define EE_CANT_READLINK 24
+#define EE_CANT_SYMLINK 25
+#define EE_REALPATH 26
#ifdef __cplusplus
}
diff --git a/ext/mysql/libmysql/mysys_priv.h b/ext/mysql/libmysql/mysys_priv.h
index 96e777d854..a0131ea77e 100644
--- a/ext/mysql/libmysql/mysys_priv.h
+++ b/ext/mysql/libmysql/mysys_priv.h
@@ -11,6 +11,7 @@ This file is public domain and comes with NO WARRANTY of any kind */
#ifdef THREAD
extern pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache,
THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_net,THR_LOCK_charset;
+extern pthread_mutex_t LOCK_bitmap;
#else /* THREAD */
#define pthread_mutex_lock(A)
#define pthread_mutex_unlock(A)
diff --git a/ext/mysql/libmysql/net.c b/ext/mysql/libmysql/net.c
index 3e15657865..0dc0c06ffa 100644
--- a/ext/mysql/libmysql/net.c
+++ b/ext/mysql/libmysql/net.c
@@ -20,7 +20,6 @@ This file is public domain and comes with NO WARRANTY of any kind */
#include <signal.h>
#include <errno.h>
#include <sys/types.h>
-#include <violite.h>
#ifdef MYSQL_SERVER
ulong max_allowed_packet=65536;
diff --git a/ext/mysql/libmysql/thr_mutex.c b/ext/mysql/libmysql/thr_mutex.c
index a6147b409a..7ec8bfb59a 100644
--- a/ext/mysql/libmysql/thr_mutex.c
+++ b/ext/mysql/libmysql/thr_mutex.c
@@ -29,19 +29,8 @@ int safe_mutex_init(safe_mutex_t *mp,
const pthread_mutexattr_t *attr __attribute__((unused)))
{
bzero((char*) mp,sizeof(*mp));
-#ifdef HAVE_LINUXTHREADS /* Some extra safety */
- {
- pthread_mutexattr_t tmp;
- pthread_mutexattr_init(&tmp);
- pthread_mutexattr_setkind_np(&tmp,PTHREAD_MUTEX_ERRORCHECK_NP);
- pthread_mutex_init(&mp->global,&tmp);
- pthread_mutex_init(&mp->mutex, &tmp);
- pthread_mutexattr_destroy(&tmp);
- }
-#else
- pthread_mutex_init(&mp->global,NULL);
+ pthread_mutex_init(&mp->global,MY_MUTEX_INIT_ERRCHK);
pthread_mutex_init(&mp->mutex,attr);
-#endif
return 0;
}
diff --git a/ext/mysql/libmysql/typelib.c b/ext/mysql/libmysql/typelib.c
index fde423353a..0fd4415b2c 100644
--- a/ext/mysql/libmysql/typelib.c
+++ b/ext/mysql/libmysql/typelib.c
@@ -42,7 +42,7 @@ int find_type(my_string x, TYPELIB *typelib, uint full_name)
if (! *i)
DBUG_RETURN(pos+1);
}
- if (! *i)
+ if (! *i && (!*j || !(full_name & 1)))
{
find++;
findpos=pos;
@@ -50,7 +50,7 @@ int find_type(my_string x, TYPELIB *typelib, uint full_name)
}
if (find == 0 && (full_name & 4) && x[0] == '#' && strend(x)[-1] == '#' &&
(findpos=atoi(x+1)-1) >= 0 && (uint) findpos < typelib->count)
- find=1;
+ find=1;
else if (find == 0 || ! x[0])
{
DBUG_PRINT("exit",("Couldn't find type"));
diff --git a/ext/mysql/libmysql/update_sources b/ext/mysql/libmysql/update_sources
index 573129b020..87547e483e 100755
--- a/ext/mysql/libmysql/update_sources
+++ b/ext/mysql/libmysql/update_sources
@@ -10,13 +10,13 @@ $| = 1;
my $command = shift || usage();
$command =~ /^--(?:update|huh|restore)$/ or usage();
-my $from = shift || '/users/tim/my/work';
+my $from = shift || '/my/mysql';
my @source_dirs = qw/dbug strings mysys libmysql include/;
my $source_re = qr/\.(?:cc?|h)$/;
my %skip = (
- 'ctype_autoconf.c' => 1,
- 'ctype_extra_sources.c' => 1,
- 'my_config.h' => 1,
+ 'ctype_autoconf.c' => 1, # PHP uses a pre-made one
+ 'ctype_extra_sources.c' => 1, # same here
+ 'my_config.h' => 1, # we use php_config.h
);
opendir D, "."
@@ -75,6 +75,13 @@ sub usage
usage: $0 --update [mysql-source-dir]
$0 --huh
$0 --restore
+
+ Typical use is:
+ \$ $0 --update 2>&1 > /tmp/php-update.diff
+ \$ @{[$ENV{EDITOR}||'vi']} /tmp/php-update.diff #does it look okay?
+ \$ Monkey around a bit
+ \$ cvs diff -u | less # does this look okay?
+ \$ rm *.orig
EOF
}