mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00
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.
This commit is contained in:
parent
304ac03be4
commit
e8cbbc0637
32 changed files with 269 additions and 159 deletions
2
NEWS
2
NEWS
|
@ -1,6 +1,8 @@
|
||||||
PHP 4.0 NEWS
|
PHP 4.0 NEWS
|
||||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
?? ??? 200?, Version 4.0.7-dev
|
?? ??? 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
|
- Added the CONNECTION_ABORTED, CONNECTION_TIMEOUT and CONNECTION_NORMAL
|
||||||
constants. (Zak)
|
constants. (Zak)
|
||||||
- Added get_defined_constants() function to return an associative array of
|
- Added get_defined_constants() function to return an associative array of
|
||||||
|
|
|
@ -295,6 +295,30 @@ then
|
||||||
fi
|
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_DEFUN(MYSQL_HEADER_CHECKS,[
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS(sgtty.h sys/ioctl.h \
|
AC_CHECK_HEADERS(sgtty.h sys/ioctl.h \
|
||||||
|
@ -322,6 +346,7 @@ AC_TYPE_UID_T
|
||||||
MYSQL_CHECK_ULONG
|
MYSQL_CHECK_ULONG
|
||||||
MYSQL_CHECK_UCHAR
|
MYSQL_CHECK_UCHAR
|
||||||
MYSQL_CHECK_UINT
|
MYSQL_CHECK_UINT
|
||||||
|
MYSQL_CHECK_INT_8_16_32
|
||||||
|
|
||||||
MYSQL_TYPE_ACCEPT
|
MYSQL_TYPE_ACCEPT
|
||||||
MYSQL_TYPE_QSORT
|
MYSQL_TYPE_QSORT
|
||||||
|
|
|
@ -341,7 +341,7 @@ pthread_mutex_t THR_LOCK_dbug;
|
||||||
|
|
||||||
static void init_dbug_state(void)
|
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)
|
static CODE_STATE *code_state(void)
|
||||||
|
|
|
@ -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 *dir, const char *config_file,
|
||||||
const char *ext, TYPELIB *group)
|
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;
|
FILE *fp;
|
||||||
uint line=0;
|
uint line=0;
|
||||||
my_bool read_values=0,found_group=0;
|
my_bool read_values=0,found_group=0;
|
||||||
|
|
|
@ -22,7 +22,7 @@ const char *client_errors[]=
|
||||||
"MySQL client got out of memory",
|
"MySQL client got out of memory",
|
||||||
"Wrong host info",
|
"Wrong host info",
|
||||||
"Localhost via UNIX socket",
|
"Localhost via UNIX socket",
|
||||||
"%s via TCP/IP",
|
"%-.64s via TCP/IP",
|
||||||
"Error in server handshake",
|
"Error in server handshake",
|
||||||
"Lost connection to MySQL server during query",
|
"Lost connection to MySQL server during query",
|
||||||
"Commands out of sync; You can't run this command now",
|
"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",
|
"MySQL client run out of memory",
|
||||||
"Wrong host info",
|
"Wrong host info",
|
||||||
"Localhost via UNIX socket",
|
"Localhost via UNIX socket",
|
||||||
"%s via TCP/IP",
|
"%-.64s via TCP/IP",
|
||||||
"Error in server handshake",
|
"Error in server handshake",
|
||||||
"Lost connection to MySQL server during query",
|
"Lost connection to MySQL server during query",
|
||||||
"Commands out of sync; You can't run this command now",
|
"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 wait for named pipe to host: %-.64s pipe: %-.32s (%lu)",
|
||||||
"Can't open 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)",
|
"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)
|
void init_client_errs(void)
|
||||||
{
|
{
|
||||||
errmsg[CLIENT_ERRMAP] = &client_errors[0];
|
my_errmsg[CLIENT_ERRMAP] = &client_errors[0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,18 +32,21 @@ const char * NEAR globerrs[GLOBERRS]=
|
||||||
"Can't create directory '%s' (Errcode: %d)",
|
"Can't create directory '%s' (Errcode: %d)",
|
||||||
"Character set '%s' is not a compiled character set and is not specified in the '%s' file",
|
"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)",
|
"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)
|
void init_glob_errs(void)
|
||||||
{
|
{
|
||||||
errmsg[GLOB] = & globerrs[0];
|
my_errmsg[GLOB] = & globerrs[0];
|
||||||
} /* init_glob_errs */
|
} /* init_glob_errs */
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void init_glob_errs()
|
void init_glob_errs()
|
||||||
{
|
{
|
||||||
errmsg[GLOB] = & globerrs[0];
|
my_errmsg[GLOB] = & globerrs[0];
|
||||||
|
|
||||||
EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)";
|
EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)";
|
||||||
EE(EE_CANTCREATEFILE) = "Can't create/write to file '%s' (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_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_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_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
|
#endif
|
||||||
|
|
|
@ -14,6 +14,19 @@ This file is public domain and comes with NO WARRANTY of any kind */
|
||||||
#include <os2.h>
|
#include <os2.h>
|
||||||
#endif /* __EMX__ */
|
#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)
|
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||||
#include <config-win.h>
|
#include <config-win.h>
|
||||||
#else
|
#else
|
||||||
|
@ -305,7 +318,8 @@ typedef int File; /* File descriptor */
|
||||||
typedef int my_socket; /* File descriptor for sockets */
|
typedef int my_socket; /* File descriptor for sockets */
|
||||||
#define INVALID_SOCKET -1
|
#define INVALID_SOCKET -1
|
||||||
#endif
|
#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 */
|
typedef void (*sig_return)();/* Returns type from signal */
|
||||||
#if defined(__GNUC__) && !defined(_lint)
|
#if defined(__GNUC__) && !defined(_lint)
|
||||||
typedef char pchar; /* Mixed prototypes can take char */
|
typedef char pchar; /* Mixed prototypes can take char */
|
||||||
|
@ -797,6 +811,28 @@ typedef union {
|
||||||
#else
|
#else
|
||||||
#define float4get(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(float))
|
#define float4get(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(float))
|
||||||
#define float4store(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 float8get(V,M) doubleget((V),(M))
|
||||||
#define float8store(V,M) doublestore((V),(M))
|
#define float8store(V,M) doublestore((V),(M))
|
||||||
#endif /* WORDS_BIGENDIAN */
|
#endif /* WORDS_BIGENDIAN */
|
||||||
|
@ -849,7 +885,7 @@ typedef union {
|
||||||
#ifndef doubleget
|
#ifndef doubleget
|
||||||
#define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double))
|
#define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double))
|
||||||
#define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,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 longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong))
|
||||||
#define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong))
|
#define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong))
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
This file is public domain and comes with NO WARRANTY of any kind */
|
This file is public domain and comes with NO WARRANTY of any kind */
|
||||||
|
|
||||||
#define DONT_USE_RAID
|
#define DONT_USE_RAID
|
||||||
|
#include <global.h>
|
||||||
#if defined(__WIN__) || defined(_WIN32) || defined(_WIN64)
|
#if defined(__WIN__) || defined(_WIN32) || defined(_WIN64)
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
#include <odbcinst.h>
|
#include <odbcinst.h>
|
||||||
#endif
|
#endif
|
||||||
#include <global.h>
|
|
||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
#include <mysys_err.h>
|
#include <mysys_err.h>
|
||||||
#include <m_string.h>
|
#include <m_string.h>
|
||||||
|
@ -473,7 +473,7 @@ static void free_old_query(MYSQL *mysql)
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_GETPWUID
|
#if defined(HAVE_GETPWUID) && defined(NO_GETPWUID_DECL)
|
||||||
struct passwd *getpwuid(uid_t);
|
struct passwd *getpwuid(uid_t);
|
||||||
char* getlogin(void);
|
char* getlogin(void);
|
||||||
#endif
|
#endif
|
||||||
|
@ -489,14 +489,6 @@ static void read_user_name(char *name)
|
||||||
#ifdef HAVE_GETPWUID
|
#ifdef HAVE_GETPWUID
|
||||||
struct passwd *skr;
|
struct passwd *skr;
|
||||||
const char *str;
|
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 ((str=getlogin()) == NULL)
|
||||||
{
|
{
|
||||||
if ((skr=getpwuid(geteuid())) != NULL)
|
if ((skr=getpwuid(geteuid())) != NULL)
|
||||||
|
@ -1653,6 +1645,7 @@ mysql_close(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
free_old_query(mysql);
|
free_old_query(mysql);
|
||||||
mysql->status=MYSQL_STATUS_READY; /* Force command */
|
mysql->status=MYSQL_STATUS_READY; /* Force command */
|
||||||
|
mysql->reconnect=0;
|
||||||
simple_command(mysql,COM_QUIT,NullS,0,1);
|
simple_command(mysql,COM_QUIT,NullS,0,1);
|
||||||
end_server(mysql);
|
end_server(mysql);
|
||||||
}
|
}
|
||||||
|
@ -1696,87 +1689,30 @@ mysql_query(MYSQL *mysql, const char *query)
|
||||||
return mysql_real_query(mysql,query, (uint) strlen(query));
|
return mysql_real_query(mysql,query, (uint) strlen(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
int STDCALL
|
/*
|
||||||
mysql_send_query(MYSQL* mysql, const char* query)
|
Send the query and return so we can do something else.
|
||||||
{
|
Needs to be followed by mysql_read_query_result() when we want to
|
||||||
return mysql_real_send_query(mysql, query, strlen(query));
|
finish processing it.
|
||||||
}
|
|
||||||
|
|
||||||
/* 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
|
|
||||||
*/
|
*/
|
||||||
int STDCALL
|
|
||||||
mysql_real_send_query(MYSQL* mysql, const char* query, uint len)
|
|
||||||
{
|
|
||||||
return simple_command(mysql, COM_QUERY, query, len, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int STDCALL
|
int STDCALL
|
||||||
mysql_reap_query(MYSQL* mysql)
|
mysql_send_query(MYSQL* mysql, const char* query, uint length)
|
||||||
|
{
|
||||||
|
return simple_command(mysql, COM_QUERY, query, length, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int STDCALL mysql_read_query_result(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
uchar *pos;
|
uchar *pos;
|
||||||
ulong field_count;
|
ulong field_count;
|
||||||
MYSQL_DATA *fields;
|
MYSQL_DATA *fields;
|
||||||
uint len;
|
uint length;
|
||||||
DBUG_ENTER("mysql_reap_query");
|
DBUG_ENTER("mysql_read_query_result");
|
||||||
DBUG_PRINT("enter",("handle: %lx",mysql));
|
|
||||||
if((len = net_safe_read(mysql)) == packet_error)
|
if ((length = net_safe_read(mysql)) == packet_error)
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
free_old_query(mysql); /* Free old result */
|
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)
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int STDCALL
|
|
||||||
mysql_real_query(MYSQL *mysql, const char *query, uint length)
|
|
||||||
{
|
|
||||||
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));
|
|
||||||
|
|
||||||
if (simple_command(mysql,COM_QUERY,query,length,1) ||
|
|
||||||
(length=net_safe_read(mysql)) == packet_error)
|
|
||||||
DBUG_RETURN(-1);
|
|
||||||
free_old_query(mysql); /* Free old result */
|
|
||||||
get_info:
|
|
||||||
pos=(uchar*) mysql->net.read_pos;
|
pos=(uchar*) mysql->net.read_pos;
|
||||||
if ((field_count= net_field_length(&pos)) == 0)
|
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);
|
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
|
static int
|
||||||
send_file_to_server(MYSQL *mysql, const char *filename)
|
send_file_to_server(MYSQL *mysql, const char *filename)
|
||||||
|
|
|
@ -52,6 +52,7 @@ extern CHARSET_INFO compiled_charsets[];
|
||||||
#endif
|
#endif
|
||||||
/* Don't include std ctype.h when this is included */
|
/* Don't include std ctype.h when this is included */
|
||||||
#define _CTYPE_H
|
#define _CTYPE_H
|
||||||
|
#define _CTYPE_H_
|
||||||
#define _CTYPE_INCLUDED
|
#define _CTYPE_INCLUDED
|
||||||
#define __CTYPE_INCLUDED
|
#define __CTYPE_INCLUDED
|
||||||
#define _CTYPE_USING /* Don't put names in global namespace. */
|
#define _CTYPE_USING /* Don't put names in global namespace. */
|
||||||
|
|
|
@ -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 */
|
(void) strmov(pos,ext); /* Don't convert extension */
|
||||||
}
|
}
|
||||||
/* Purify gives a lot of UMR errors when using realpath */
|
/* 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)
|
if (flag & 16)
|
||||||
{
|
{
|
||||||
struct stat stat_buff;
|
struct stat stat_buff;
|
||||||
|
|
|
@ -222,11 +222,16 @@ void symdirget(char *dir)
|
||||||
*pos++=temp; *pos=0; /* Restore old filename */
|
*pos++=temp; *pos=0; /* Restore old filename */
|
||||||
if (fp)
|
if (fp)
|
||||||
{
|
{
|
||||||
if (fgets(buff, sizeof(buff), fp))
|
if (fgets(buff, sizeof(buff)-1, fp))
|
||||||
{
|
{
|
||||||
for (pos=strend(buff);
|
for (pos=strend(buff);
|
||||||
pos > buff && (iscntrl(pos[-1]) || isspace(pos[-1])) ;
|
pos > buff && (iscntrl(pos[-1]) || isspace(pos[-1])) ;
|
||||||
pos --);
|
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));
|
strmake(dir,buff, (uint) (pos-buff));
|
||||||
}
|
}
|
||||||
my_fclose(fp,MYF(0));
|
my_fclose(fp,MYF(0));
|
||||||
|
|
|
@ -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)
|
void init_alloc_root(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size)
|
||||||
{
|
{
|
||||||
mem_root->free=mem_root->used=0;
|
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->block_size=block_size-MALLOC_OVERHEAD-sizeof(USED_MEM)-8;
|
||||||
mem_root->error_handler=0;
|
mem_root->error_handler=0;
|
||||||
#if !(defined(HAVE_purify) && defined(EXTRA_DEBUG))
|
#if !(defined(HAVE_purify) && defined(EXTRA_DEBUG))
|
||||||
|
|
|
@ -9,7 +9,7 @@ This file is public domain and comes with NO WARRANTY of any kind */
|
||||||
|
|
||||||
/* Define some external variables for error handling */
|
/* 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];
|
char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
|
||||||
|
|
||||||
/* Error message to user */
|
/* Error message to user */
|
||||||
|
@ -28,10 +28,10 @@ int my_error(int nr,myf MyFlags, ...)
|
||||||
va_start(ap,MyFlags);
|
va_start(ap,MyFlags);
|
||||||
DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d", nr, MyFlags, errno));
|
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();
|
init_glob_errs();
|
||||||
|
|
||||||
olen=(uint) strlen(tpos=errmsg[nr / ERRMOD][nr % ERRMOD]);
|
olen=(uint) strlen(tpos=my_errmsg[nr / ERRMOD][nr % ERRMOD]);
|
||||||
endpos=ebuff;
|
endpos=ebuff;
|
||||||
|
|
||||||
while (*tpos)
|
while (*tpos)
|
||||||
|
@ -51,6 +51,8 @@ int my_error(int nr,myf MyFlags, ...)
|
||||||
/* Skipp if max size is used (to be compatible with printf) */
|
/* Skipp if max size is used (to be compatible with printf) */
|
||||||
while (isdigit(*tpos) || *tpos == '.' || *tpos == '-')
|
while (isdigit(*tpos) || *tpos == '.' || *tpos == '-')
|
||||||
tpos++;
|
tpos++;
|
||||||
|
if (*tpos == 'l') /* Skipp 'l' argument */
|
||||||
|
tpos++;
|
||||||
if (*tpos == 's') /* String parameter */
|
if (*tpos == 's') /* String parameter */
|
||||||
{
|
{
|
||||||
par = va_arg(ap, char *);
|
par = va_arg(ap, char *);
|
||||||
|
|
|
@ -15,6 +15,10 @@ This file is public domain and comes with NO WARRANTY of any kind */
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __EMX__
|
||||||
|
// chdir2 support also drive change
|
||||||
|
#define chdir _chdir2
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Gets current working directory in buff. Directory is allways ended
|
/* Gets current working directory in buff. Directory is allways ended
|
||||||
with FN_LIBCHAR */
|
with FN_LIBCHAR */
|
||||||
|
|
|
@ -34,6 +34,7 @@ static my_bool win32_init_tcp_ip();
|
||||||
static my_bool my_init_done=0;
|
static my_bool my_init_done=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static ulong atoi_octal(const char *str)
|
static ulong atoi_octal(const char *str)
|
||||||
{
|
{
|
||||||
long int tmp;
|
long int tmp;
|
||||||
|
@ -62,6 +63,9 @@ void my_init(void)
|
||||||
#ifndef __WIN__
|
#ifndef __WIN__
|
||||||
sigfillset(&my_signals); /* signals blocked by mf_brkhant */
|
sigfillset(&my_signals); /* signals blocked by mf_brkhant */
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* THREAD */
|
||||||
|
#ifdef UNIXWARE_7
|
||||||
|
(void) isatty(0); /* Go around connect() bug in UW7 */
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
DBUG_ENTER("my_init");
|
DBUG_ENTER("my_init");
|
||||||
|
@ -113,7 +117,12 @@ void my_end(int infoflag)
|
||||||
#ifdef HAVE_GETRUSAGE
|
#ifdef HAVE_GETRUSAGE
|
||||||
struct rusage rus;
|
struct rusage rus;
|
||||||
if (!getrusage(RUSAGE_SELF, &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_sec * SCALE_SEC +
|
||||||
rus.ru_utime.tv_usec / SCALE_USEC) / 100.0,
|
rus.ru_utime.tv_usec / SCALE_USEC) / 100.0,
|
||||||
(rus.ru_stime.tv_sec * SCALE_SEC +
|
(rus.ru_stime.tv_sec * SCALE_SEC +
|
||||||
|
|
|
@ -4,6 +4,10 @@ This file is public domain and comes with NO WARRANTY of any kind */
|
||||||
/* thread safe version of some common functions */
|
/* thread safe version of some common functions */
|
||||||
|
|
||||||
/* for thread safe my_inet_ntoa */
|
/* for thread safe my_inet_ntoa */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#if !defined(MSDOS) && !defined(__WIN__) && !defined(__BEOS__)
|
#if !defined(MSDOS) && !defined(__WIN__) && !defined(__BEOS__)
|
||||||
#ifdef HAVE_SYS_SOCKET_H
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
#include <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__) */
|
#endif /* !defined(MSDOS) && !defined(__WIN__) */
|
||||||
|
|
||||||
void my_inet_ntoa(struct in_addr in, char *buf);
|
void my_inet_ntoa(struct in_addr in, char *buf);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -93,7 +93,7 @@ File my_register_filename(File fd, const char *FileName, enum file_type
|
||||||
my_file_opened++;
|
my_file_opened++;
|
||||||
my_file_info[fd].type = type_of_file;
|
my_file_info[fd].type = type_of_file;
|
||||||
#if defined(THREAD) && !defined(HAVE_PREAD)
|
#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
|
#endif
|
||||||
pthread_mutex_unlock(&THR_LOCK_open);
|
pthread_mutex_unlock(&THR_LOCK_open);
|
||||||
DBUG_PRINT("exit",("fd: %d",fd));
|
DBUG_PRINT("exit",("fd: %d",fd));
|
||||||
|
|
|
@ -302,7 +302,7 @@ int sigwait(sigset_t *setp, int *sigp)
|
||||||
pthread_t sigwait_thread_id;
|
pthread_t sigwait_thread_id;
|
||||||
inited=1;
|
inited=1;
|
||||||
sigemptyset(&pending_set);
|
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_cond_init(&COND_sigwait,NULL);
|
||||||
|
|
||||||
pthread_attr_init(&thr_attr);
|
pthread_attr_init(&thr_attr);
|
||||||
|
|
|
@ -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_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_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_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
|
#define pthread_mutex_t safe_mutex_t
|
||||||
#endif /* SAFE_MUTEX */
|
#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)
|
#define pthread_attr_setstacksize(A,B) pthread_dummy(0)
|
||||||
#endif
|
#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 my_bool my_thread_global_init(void);
|
||||||
extern void my_thread_global_end(void);
|
extern void my_thread_global_end(void);
|
||||||
extern my_bool my_thread_init(void);
|
extern my_bool my_thread_init(void);
|
||||||
extern void my_thread_end(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 long my_thread_id(void);
|
||||||
extern int pthread_no_free(void *);
|
extern int pthread_no_free(void *);
|
||||||
extern int pthread_dummy(int);
|
extern int pthread_dummy(int);
|
||||||
|
|
|
@ -27,13 +27,6 @@ extern int NEAR my_errno; /* Last error in mysys */
|
||||||
|
|
||||||
#include <stdarg.h>
|
#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_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 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(); }
|
#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_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */
|
||||||
#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */
|
#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */
|
||||||
#define MY_COPYTIME 64 /* my_redel() copys time */
|
#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_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */
|
||||||
#define MY_REDEL_MAKE_BACKUP 256
|
#define MY_REDEL_MAKE_BACKUP 256
|
||||||
#define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */
|
#define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */
|
||||||
|
@ -155,7 +150,7 @@ void __CDECL hfree(void *ptr);
|
||||||
#else
|
#else
|
||||||
extern int errno; /* declare errno */
|
extern int errno; /* declare errno */
|
||||||
#endif
|
#endif
|
||||||
extern const char ** NEAR errmsg[];
|
extern const char ** NEAR my_errmsg[];
|
||||||
extern char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
|
extern char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
|
||||||
extern char *home_dir; /* Home directory for user */
|
extern char *home_dir; /* Home directory for user */
|
||||||
extern char *my_progname; /* program-name (printed in errors) */
|
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);
|
int AccsesFlags, myf MyFlags);
|
||||||
extern int my_close(File Filedes,myf MyFlags);
|
extern int my_close(File Filedes,myf MyFlags);
|
||||||
extern int my_mkdir(const char *dir, int Flags, 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_read(File Filedes,byte *Buffer,uint Count,myf MyFlags);
|
||||||
extern uint my_pread(File Filedes,byte *Buffer,uint Count,my_off_t offset,
|
extern uint my_pread(File Filedes,byte *Buffer,uint Count,my_off_t offset,
|
||||||
myf MyFlags);
|
myf MyFlags);
|
||||||
|
@ -411,7 +412,7 @@ extern int my_printf_error _VARARGS((uint my_err, const char *format,
|
||||||
__attribute__ ((format (printf, 2, 4))));
|
__attribute__ ((format (printf, 2, 4))));
|
||||||
extern int my_vsnprintf( char *str, size_t n,
|
extern int my_vsnprintf( char *str, size_t n,
|
||||||
const char *format, va_list ap );
|
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(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_no_curses(uint my_err, const char *str,myf MyFlags);
|
||||||
extern int my_message_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 int my_copystat(const char *from, const char *to, int MyFlags);
|
||||||
extern my_string my_filename(File fd);
|
extern my_string my_filename(File fd);
|
||||||
|
|
||||||
|
#ifndef THREAD
|
||||||
extern void dont_break(void);
|
extern void dont_break(void);
|
||||||
extern void allow_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 my_remember_signal(int signal_number,sig_handler (*func)(int));
|
||||||
extern void caseup(my_string str,uint length);
|
extern void caseup(my_string str,uint length);
|
||||||
extern void casedn(my_string str,uint length);
|
extern void casedn(my_string str,uint length);
|
||||||
|
|
|
@ -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);
|
pthread_key(struct st_my_thread_var*, THR_KEY_mysys);
|
||||||
#else
|
#else
|
||||||
pthread_key(struct st_my_thread_var, THR_KEY_mysys);
|
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,
|
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_lock,THR_LOCK_isam,THR_LOCK_myisam,THR_LOCK_heap,
|
||||||
THR_LOCK_net, THR_LOCK_charset;
|
THR_LOCK_net, THR_LOCK_charset;
|
||||||
#ifndef HAVE_LOCALTIME_R
|
#ifndef HAVE_LOCALTIME_R
|
||||||
pthread_mutex_t LOCK_localtime_r;
|
pthread_mutex_t LOCK_localtime_r;
|
||||||
#endif
|
#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
|
/* FIXME Note. TlsAlloc does not set an auto destructor, so
|
||||||
the function my_thread_global_free must be called from
|
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);
|
fprintf(stderr,"Can't initialize threads: error %d\n",errno);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
pthread_mutex_init(&THR_LOCK_malloc,NULL);
|
#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
|
||||||
pthread_mutex_init(&THR_LOCK_open,NULL);
|
pthread_mutexattr_init(&my_fast_mutexattr);
|
||||||
pthread_mutex_init(&THR_LOCK_keycache,NULL);
|
pthread_mutexattr_setkind_np(&my_fast_mutexattr,PTHREAD_MUTEX_ADAPTIVE_NP);
|
||||||
pthread_mutex_init(&THR_LOCK_lock,NULL);
|
#endif
|
||||||
pthread_mutex_init(&THR_LOCK_isam,NULL);
|
#ifdef PPTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
|
||||||
pthread_mutex_init(&THR_LOCK_myisam,NULL);
|
pthread_mutexattr_init(&my_errchk_mutexattr);
|
||||||
pthread_mutex_init(&THR_LOCK_heap,NULL);
|
pthread_mutexattr_setkind_np(&my_errchk_mutexattr,
|
||||||
pthread_mutex_init(&THR_LOCK_net,NULL);
|
PTHREAD_MUTEX_ERRORCHECK_NP);
|
||||||
pthread_mutex_init(&THR_LOCK_charset,NULL);
|
#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__
|
#ifdef __WIN__
|
||||||
win_pthread_init();
|
win_pthread_init();
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_LOCALTIME_R
|
#ifndef HAVE_LOCALTIME_R
|
||||||
pthread_mutex_init(&LOCK_localtime_r,NULL);
|
pthread_mutex_init(&LOCK_localtime_r,MY_MUTEX_INIT_SLOW);
|
||||||
#endif
|
#endif
|
||||||
return my_thread_init();
|
return my_thread_init();
|
||||||
}
|
}
|
||||||
|
@ -56,6 +72,12 @@ void my_thread_global_end(void)
|
||||||
#if defined(USE_TLS)
|
#if defined(USE_TLS)
|
||||||
(void) TlsFree(THR_KEY_mysys);
|
(void) TlsFree(THR_KEY_mysys);
|
||||||
#endif
|
#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;
|
static long thread_id=0;
|
||||||
|
@ -100,7 +122,7 @@ my_bool my_thread_init(void)
|
||||||
tmp= &THR_KEY_mysys;
|
tmp= &THR_KEY_mysys;
|
||||||
#endif
|
#endif
|
||||||
tmp->id= ++thread_id;
|
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);
|
pthread_cond_init(&tmp->suspend, NULL);
|
||||||
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
|
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
|
||||||
pthread_mutex_unlock(&THR_LOCK_lock);
|
pthread_mutex_unlock(&THR_LOCK_lock);
|
||||||
|
@ -166,14 +188,14 @@ long my_thread_id()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DBUG_OFF
|
#ifdef DBUG_OFF
|
||||||
char *my_thread_name(void)
|
const char *my_thread_name(void)
|
||||||
{
|
{
|
||||||
return "no_name";
|
return "no_name";
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
char *my_thread_name(void)
|
const char *my_thread_name(void)
|
||||||
{
|
{
|
||||||
char name_buff[100];
|
char name_buff[100];
|
||||||
struct st_my_thread_var *tmp=my_thread_var;
|
struct st_my_thread_var *tmp=my_thread_var;
|
||||||
|
|
|
@ -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
|
** Simulation of posix threads calls for WIN95 and NT
|
||||||
|
@ -24,7 +25,7 @@ struct pthread_map
|
||||||
|
|
||||||
void win_pthread_init(void)
|
void win_pthread_init(void)
|
||||||
{
|
{
|
||||||
pthread_mutex_init(&THR_LOCK_thread,NULL);
|
pthread_mutex_init(&THR_LOCK_thread,MY_MUTEX_INIT_FAST);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -6,6 +6,14 @@ This file is public domain and comes with NO WARRANTY of any kind */
|
||||||
#ifndef _mysql_h
|
#ifndef _mysql_h
|
||||||
#define _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
|
#ifndef MYSQL_SERVER
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -215,12 +223,11 @@ MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
|
||||||
void STDCALL mysql_close(MYSQL *sock);
|
void STDCALL mysql_close(MYSQL *sock);
|
||||||
int STDCALL mysql_select_db(MYSQL *mysql, const char *db);
|
int STDCALL mysql_select_db(MYSQL *mysql, const char *db);
|
||||||
int STDCALL mysql_query(MYSQL *mysql, const char *q);
|
int STDCALL mysql_query(MYSQL *mysql, const char *q);
|
||||||
int STDCALL mysql_send_query(MYSQL *mysql, const char *q);
|
int STDCALL mysql_send_query(MYSQL *mysql, const char *q,
|
||||||
int STDCALL mysql_reap_query(MYSQL *mysql);
|
unsigned int length);
|
||||||
|
int STDCALL mysql_read_query_result(MYSQL *mysql);
|
||||||
int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
|
int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
|
||||||
unsigned int length);
|
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_create_db(MYSQL *mysql, const char *DB);
|
||||||
int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
|
int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
|
||||||
int STDCALL mysql_shutdown(MYSQL *mysql);
|
int STDCALL mysql_shutdown(MYSQL *mysql);
|
||||||
|
|
|
@ -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_INTERACTIVE 1024 /* This is an interactive client */
|
||||||
#define CLIENT_SSL 2048 /* Switch to SSL after handshake */
|
#define CLIENT_SSL 2048 /* Switch to SSL after handshake */
|
||||||
#define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */
|
#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_IN_TRANS 1 /* Transaction has started */
|
||||||
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
|
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
|
||||||
|
|
|
@ -7,14 +7,18 @@ This file is public domain and comes with NO WARRANTY of any kind */
|
||||||
#include <custom_conf.h>
|
#include <custom_conf.h>
|
||||||
#else
|
#else
|
||||||
#define PROTOCOL_VERSION 10
|
#define PROTOCOL_VERSION 10
|
||||||
#define MYSQL_SERVER_VERSION "3.23.32"
|
#define MYSQL_SERVER_VERSION "3.23.39"
|
||||||
#define MYSQL_SERVER_SUFFIX ""
|
#define MYSQL_SERVER_SUFFIX ""
|
||||||
#define FRM_VER 6
|
#define FRM_VER 6
|
||||||
#define MYSQL_VERSION_ID 32332
|
#define MYSQL_VERSION_ID 32339
|
||||||
#define MYSQL_PORT 3306
|
|
||||||
|
|
||||||
/* This is defined at configure time and found in main/php_config.h */
|
#ifndef MYSQL_PORT
|
||||||
/* #define MYSQL_UNIX_ADDR "/tmp/mysql.sock" */
|
#define MYSQL_PORT 3306
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MYSQL_UNIX_ADDR
|
||||||
|
#define MYSQL_UNIX_ADDR "/tmp/mysql.sock"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* mysqld compile time options */
|
/* mysqld compile time options */
|
||||||
#ifndef MYSQL_CHARSET
|
#ifndef MYSQL_CHARSET
|
||||||
|
|
|
@ -198,4 +198,14 @@
|
||||||
#define ER_CRASHED_ON_REPAIR 1195
|
#define ER_CRASHED_ON_REPAIR 1195
|
||||||
#define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196
|
#define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196
|
||||||
#define ER_TRANS_CACHE_FULL 1197
|
#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
|
||||||
|
|
|
@ -8,7 +8,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GLOB 0 /* Error maps */
|
#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 */
|
#define EE(X) globerrs[ X ] /* Defines to add error to right map */
|
||||||
|
|
||||||
extern const char * NEAR globerrs[]; /* my_error_messages is here */
|
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_CANT_MKDIR 21
|
||||||
#define EE_UNKNOWN_CHARSET 22
|
#define EE_UNKNOWN_CHARSET 22
|
||||||
#define EE_OUT_OF_FILERESOURCES 23
|
#define EE_OUT_OF_FILERESOURCES 23
|
||||||
|
#define EE_CANT_READLINK 24
|
||||||
|
#define EE_CANT_SYMLINK 25
|
||||||
|
#define EE_REALPATH 26
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ This file is public domain and comes with NO WARRANTY of any kind */
|
||||||
#ifdef THREAD
|
#ifdef THREAD
|
||||||
extern pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache,
|
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;
|
THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_net,THR_LOCK_charset;
|
||||||
|
extern pthread_mutex_t LOCK_bitmap;
|
||||||
#else /* THREAD */
|
#else /* THREAD */
|
||||||
#define pthread_mutex_lock(A)
|
#define pthread_mutex_lock(A)
|
||||||
#define pthread_mutex_unlock(A)
|
#define pthread_mutex_unlock(A)
|
||||||
|
|
|
@ -20,7 +20,6 @@ This file is public domain and comes with NO WARRANTY of any kind */
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <violite.h>
|
|
||||||
|
|
||||||
#ifdef MYSQL_SERVER
|
#ifdef MYSQL_SERVER
|
||||||
ulong max_allowed_packet=65536;
|
ulong max_allowed_packet=65536;
|
||||||
|
|
|
@ -29,19 +29,8 @@ int safe_mutex_init(safe_mutex_t *mp,
|
||||||
const pthread_mutexattr_t *attr __attribute__((unused)))
|
const pthread_mutexattr_t *attr __attribute__((unused)))
|
||||||
{
|
{
|
||||||
bzero((char*) mp,sizeof(*mp));
|
bzero((char*) mp,sizeof(*mp));
|
||||||
#ifdef HAVE_LINUXTHREADS /* Some extra safety */
|
pthread_mutex_init(&mp->global,MY_MUTEX_INIT_ERRCHK);
|
||||||
{
|
|
||||||
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->mutex,attr);
|
pthread_mutex_init(&mp->mutex,attr);
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ int find_type(my_string x, TYPELIB *typelib, uint full_name)
|
||||||
if (! *i)
|
if (! *i)
|
||||||
DBUG_RETURN(pos+1);
|
DBUG_RETURN(pos+1);
|
||||||
}
|
}
|
||||||
if (! *i)
|
if (! *i && (!*j || !(full_name & 1)))
|
||||||
{
|
{
|
||||||
find++;
|
find++;
|
||||||
findpos=pos;
|
findpos=pos;
|
||||||
|
|
|
@ -10,13 +10,13 @@ $| = 1;
|
||||||
my $command = shift || usage();
|
my $command = shift || usage();
|
||||||
$command =~ /^--(?:update|huh|restore)$/ or 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_dirs = qw/dbug strings mysys libmysql include/;
|
||||||
my $source_re = qr/\.(?:cc?|h)$/;
|
my $source_re = qr/\.(?:cc?|h)$/;
|
||||||
my %skip = (
|
my %skip = (
|
||||||
'ctype_autoconf.c' => 1,
|
'ctype_autoconf.c' => 1, # PHP uses a pre-made one
|
||||||
'ctype_extra_sources.c' => 1,
|
'ctype_extra_sources.c' => 1, # same here
|
||||||
'my_config.h' => 1,
|
'my_config.h' => 1, # we use php_config.h
|
||||||
);
|
);
|
||||||
|
|
||||||
opendir D, "."
|
opendir D, "."
|
||||||
|
@ -75,6 +75,13 @@ sub usage
|
||||||
usage: $0 --update [mysql-source-dir]
|
usage: $0 --update [mysql-source-dir]
|
||||||
$0 --huh
|
$0 --huh
|
||||||
$0 --restore
|
$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
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue