Commit 62c80141 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

Fixed some build problems.

Fix that compressed packets and normal packets looks indentical before calling net_real_write()
(Needed for query cache)
Optimize IS NULL handling
parent 55a6911b
gmake -k clean || true
/bin/rm -f */.deps/*.P config.cache
aclocal && autoheader && aclocal && automake && autoconf
(cd bdb/dist && sh s_all)
(cd innobase && aclocal && autoheader && aclocal && automake && autoconf)
if [ -d gemini ]
then
(cd gemini && aclocal && autoheader && aclocal && automake && autoconf)
fi
CC=ecc CFLAGS="-w1 -DEXTRA_DEBUG -DSAFEMALLOC -DSAFE_MUTEX -O2" CXX=ecc CXXFLAGS="-w1 -DEXTRA_DEBUG -DSAFEMALLOC -DSAFE_MUTEX -O2" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-debug --with-innodb --with-embedded-server
gmake
...@@ -105,8 +105,23 @@ $|=1; ...@@ -105,8 +105,23 @@ $|=1;
safe_cd("$host"); safe_cd("$host");
if ($opt_stage == 0 && ! $opt_use_old_distribution) if ($opt_stage == 0 && ! $opt_use_old_distribution)
{ {
my ($name);
safe_system("gunzip < $opt_distribution | $tar xf -"); safe_system("gunzip < $opt_distribution | $tar xf -");
# Fix file times; This is needed because the time for files may be
# in the future
system("touch timestamp; find $var -newer timestamp -print | xargs touch; rm -f timestamp");
sleep(2);
# Ensure that files we don't want to rebuild are newer than other files
foreach $name ("configure",
"Docs/include.texi",
"Docs/*.html", "Docs/manual.txt", "Docs/mysql.info",
"sql/sql_yacc.h", "sql/sql_yacc.cc")
{
system("touch $name");
}
} }
safe_cd($ver); safe_cd($ver);
if ($opt_stage <= 1) if ($opt_stage <= 1)
{ {
......
...@@ -7908,8 +7908,11 @@ The initial download of the source tree may take a while, depending on the ...@@ -7908,8 +7908,11 @@ The initial download of the source tree may take a while, depending on the
speed of your connection; be patient. speed of your connection; be patient.
@item @item
You will need GNU @code{autoconf}, @code{automake}, @code{libtool}, and You will need GNU @code{autoconf 2.13}, @code{automake 1.4},
@code{m4} to run the next set of commands. @code{libtool}, and @code{m4} to run the next set of commands.
Note that the new versions of @code{autoconf} (2.52) and @code{automake}
(1.5) do not work.
If you get some strange error during this stage, check that you really If you get some strange error during this stage, check that you really
have @code{libtool} installed! have @code{libtool} installed!
...@@ -53420,7 +53423,7 @@ in the @code{mysql} mail archive, you should report the bug to ...@@ -53420,7 +53423,7 @@ in the @code{mysql} mail archive, you should report the bug to
online at the @uref{http://www.mysql.com/documentation/, MySQL online at the @uref{http://www.mysql.com/documentation/, MySQL
documentation page}. documentation page}.
If you have started @code{mysqld} with @code{--with-myisam-recover}, If you have started @code{mysqld} with @code{myisam-recover},
MySQL will automatically check and try to repair @code{MyISAM} MySQL will automatically check and try to repair @code{MyISAM}
tables if they are marked as 'not closed properly' or 'crashed'. If tables if they are marked as 'not closed properly' or 'crashed'. If
this happens, MySQL will write an entry in the this happens, MySQL will write an entry in the
...@@ -726,7 +726,7 @@ AC_MSG_CHECKING(for OpenSSL) ...@@ -726,7 +726,7 @@ AC_MSG_CHECKING(for OpenSSL)
openssl_includes="-I/usr/local/ssl/include" openssl_includes="-I/usr/local/ssl/include"
AC_DEFINE(HAVE_OPENSSL) AC_DEFINE(HAVE_OPENSSL)
else else
AC_MSG_RESULT(disabled because --with-vio wasn not used) AC_MSG_RESULT(disabled because --with-vio was not used)
fi fi
else else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
......
...@@ -23,15 +23,6 @@ ...@@ -23,15 +23,6 @@
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES) #define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES)
#ifndef OS2
extern "C"
{
int simple_command(MYSQL *mysql,enum enum_server_command command,
const char *arg, uint length, my_bool skipp_check);
uint net_safe_read(MYSQL* mysql);
}
#endif
char server_version[SERVER_VERSION_LENGTH]; char server_version[SERVER_VERSION_LENGTH];
uint32 server_id = 0; uint32 server_id = 0;
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
**********************************************************************/ **********************************************************************/
#define MTEST_VERSION "1.10" #define MTEST_VERSION "1.11"
#include <my_global.h> #include <my_global.h>
#include <mysql_embed.h> #include <mysql_embed.h>
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
static int record = 0, verbose = 0, silent = 0, opt_sleep=0; static int record = 0, verbose = 0, silent = 0, opt_sleep=0;
static char *db = 0, *pass=0; static char *db = 0, *pass=0;
const char* user = 0, *host = 0, *unix_sock = 0; const char* user = 0, *host = 0, *unix_sock = 0;
static int port = 0, opt_big_test=0; static int port = 0, opt_big_test=0, opt_compress=0;
static uint start_lineno, *lineno; static uint start_lineno, *lineno;
static char **default_argv; static char **default_argv;
...@@ -246,11 +246,11 @@ static uint out_length; ...@@ -246,11 +246,11 @@ static uint out_length;
static int eval_result = 0; static int eval_result = 0;
/* Disable functions that only exist in MySQL 4.0 */ /* Disable functions that only exist in MySQL 4.0 */
#if MYSQL_VERSION_ID < 40000 #if MYSQL_VERSION_ID < 40000 || defined(EMBEDDED_LIBRARY)
static void mysql_enable_rpl_parse(MYSQL* mysql __attribute__((unused))) {} void mysql_enable_rpl_parse(MYSQL* mysql __attribute__((unused))) {}
static void mysql_disable_rpl_parse(MYSQL* mysql __attribute__((unused))) {} void mysql_disable_rpl_parse(MYSQL* mysql __attribute__((unused))) {}
static int mysql_rpl_parse_enabled(MYSQL* mysql __attribute__((unused))) { return 1; } int mysql_rpl_parse_enabled(MYSQL* mysql __attribute__((unused))) { return 1; }
static int mysql_rpl_probe(MYSQL *mysql __attribute__((unused))) { return 1; } int mysql_rpl_probe(MYSQL *mysql __attribute__((unused))) { return 1; }
#endif #endif
static void do_eval(DYNAMIC_STRING* query_eval, const char* query) static void do_eval(DYNAMIC_STRING* query_eval, const char* query)
...@@ -1164,6 +1164,8 @@ int do_connect(struct st_query* q) ...@@ -1164,6 +1164,8 @@ int do_connect(struct st_query* q)
if (!mysql_init(&next_con->mysql)) if (!mysql_init(&next_con->mysql))
die("Failed on mysql_init()"); die("Failed on mysql_init()");
if (opt_compress)
mysql_options(&next_con->mysql,MYSQL_OPT_COMPRESS,NullS);
if (con_sock) if (con_sock)
con_sock=fn_format(buff, con_sock, TMPDIR, "",0); con_sock=fn_format(buff, con_sock, TMPDIR, "",0);
if (!con_db[0]) if (!con_db[0])
...@@ -1503,6 +1505,7 @@ struct option long_options[] = ...@@ -1503,6 +1505,7 @@ struct option long_options[] =
{"debug", optional_argument, 0, '#'}, {"debug", optional_argument, 0, '#'},
{"database", required_argument, 0, 'D'}, {"database", required_argument, 0, 'D'},
{"big-test", no_argument, 0, 'B'}, {"big-test", no_argument, 0, 'B'},
{"compress", no_argument, 0, 'C'},
{"help", no_argument, 0, '?'}, {"help", no_argument, 0, '?'},
{"host", required_argument, 0, 'h'}, {"host", required_argument, 0, 'h'},
{"password", optional_argument, 0, 'p'}, {"password", optional_argument, 0, 'p'},
...@@ -1547,6 +1550,7 @@ void usage() ...@@ -1547,6 +1550,7 @@ void usage()
-p[password], --password[=...]\n\ -p[password], --password[=...]\n\
Password to use when connecting to server.\n\ Password to use when connecting to server.\n\
-B, --big-test Define BIG_TEST to 1\n\ -B, --big-test Define BIG_TEST to 1\n\
-C, --compress Use the compressed server/client protocol\n\
-D, --database=... Database to use.\n\ -D, --database=... Database to use.\n\
-P, --port=... Port number to use for connection.\n\ -P, --port=... Port number to use for connection.\n\
-S, --socket=... Socket file to use for connection.\n\ -S, --socket=... Socket file to use for connection.\n\
...@@ -1569,8 +1573,8 @@ int parse_args(int argc, char **argv) ...@@ -1569,8 +1573,8 @@ int parse_args(int argc, char **argv)
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
default_argv= argv; default_argv= argv;
while((c = getopt_long(argc, argv, "h:p::u:BP:D:S:R:x:t:T:#:?rvVq", while ((c = getopt_long(argc, argv, "h:p::u:BCP:D:S:R:x:t:T:#:?rvVq",
long_options, &option_index)) != EOF) long_options, &option_index)) != EOF)
{ {
switch(c) { switch(c) {
case '#': case '#':
...@@ -1605,6 +1609,9 @@ int parse_args(int argc, char **argv) ...@@ -1605,6 +1609,9 @@ int parse_args(int argc, char **argv)
case 'B': case 'B':
opt_big_test=1; opt_big_test=1;
break; break;
case 'C':
opt_compress=1;
break;
case 'P': case 'P':
port = atoi(optarg); port = atoi(optarg);
break; break;
...@@ -1984,6 +1991,8 @@ int main(int argc, char** argv) ...@@ -1984,6 +1991,8 @@ int main(int argc, char** argv)
if (!( mysql_init(&cur_con->mysql))) if (!( mysql_init(&cur_con->mysql)))
die("Failed in mysql_init()"); die("Failed in mysql_init()");
if (opt_compress)
mysql_options(&cur_con->mysql,MYSQL_OPT_COMPRESS,NullS);
cur_con->name = my_strdup("default", MYF(MY_WME)); cur_con->name = my_strdup("default", MYF(MY_WME));
if (!cur_con->name) if (!cur_con->name)
die("Out of memory"); die("Out of memory");
......
...@@ -10,7 +10,7 @@ AM_CONFIG_HEADER(config.h) ...@@ -10,7 +10,7 @@ AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10 PROTOCOL_VERSION=10
DOT_FRM_VERSION=6 DOT_FRM_VERSION=6
# See the libtool docs for information on how to do shared lib versions. # See the libtool docs for information on how to do shared lib versions.
SHARED_LIB_VERSION=10:0:0 SHARED_LIB_VERSION=11:0:0
# Set all version vars based on $VERSION. How do we do this more elegant ? # Set all version vars based on $VERSION. How do we do this more elegant ?
# Remember that regexps needs to quote [ and ] since this is run through m4 # Remember that regexps needs to quote [ and ] since this is run through m4
......
...@@ -72,11 +72,11 @@ typedef struct st_mysql_field { ...@@ -72,11 +72,11 @@ typedef struct st_mysql_field {
char *name; /* Name of column */ char *name; /* Name of column */
char *table; /* Table of column if column was a field */ char *table; /* Table of column if column was a field */
char *def; /* Default value (set by mysql_list_fields) */ char *def; /* Default value (set by mysql_list_fields) */
enum enum_field_types type; /* Type of field. Se mysql_com.h for types */ unsigned long length; /* Width of column */
unsigned int length; /* Width of column */ unsigned long max_length; /* Max width of selected set */
unsigned int max_length; /* Max width of selected set */
unsigned int flags; /* Div flags */ unsigned int flags; /* Div flags */
unsigned int decimals; /* Number of decimals in field */ unsigned int decimals; /* Number of decimals in field */
enum enum_field_types type; /* Type of field. Se mysql_com.h for types */
} MYSQL_FIELD; } MYSQL_FIELD;
typedef char **MYSQL_ROW; /* return data as array of strings */ typedef char **MYSQL_ROW; /* return data as array of strings */
...@@ -175,25 +175,30 @@ typedef struct st_mysql { ...@@ -175,25 +175,30 @@ typedef struct st_mysql {
gptr connector_fd; /* ConnectorFd for SSL */ gptr connector_fd; /* ConnectorFd for SSL */
char *host,*user,*passwd,*unix_socket,*server_version,*host_info, char *host,*user,*passwd,*unix_socket,*server_version,*host_info,
*info,*db; *info,*db;
unsigned int port,client_flag,server_capabilities; struct charset_info_st *charset;
unsigned int protocol_version; MYSQL_FIELD *fields;
unsigned int field_count; MEM_ROOT field_alloc;
unsigned int server_status;
unsigned long thread_id; /* Id for connection in server */
my_ulonglong affected_rows; my_ulonglong affected_rows;
my_ulonglong insert_id; /* id if insert on table with NEXTNR */ my_ulonglong insert_id; /* id if insert on table with NEXTNR */
my_ulonglong extra_info; /* Used by mysqlshow */ my_ulonglong extra_info; /* Used by mysqlshow */
unsigned long thread_id; /* Id for connection in server */
unsigned long packet_length; unsigned long packet_length;
unsigned int port,client_flag,server_capabilities;
unsigned int protocol_version;
unsigned int field_count;
unsigned int server_status;
unsigned int server_language;
struct st_mysql_options options;
enum mysql_status status; enum mysql_status status;
MYSQL_FIELD *fields;
MEM_ROOT field_alloc;
my_bool free_me; /* If free in mysql_close */ my_bool free_me; /* If free in mysql_close */
my_bool reconnect; /* set to 1 if automatic reconnect */ my_bool reconnect; /* set to 1 if automatic reconnect */
struct st_mysql_options options;
char scramble_buff[9]; char scramble_buff[9];
struct charset_info_st *charset;
unsigned int server_language;
/*
Set if this is the original connection, not a master or a slave we have
added though mysql_rpl_probe() or mysql_set_master()/ mysql_add_slave()
*/
my_bool rpl_pivot;
/* pointers to the master, and the next slave /* pointers to the master, and the next slave
connections, points to itself if lone connection */ connections, points to itself if lone connection */
struct st_mysql* master, *next_slave; struct st_mysql* master, *next_slave;
...@@ -201,26 +206,21 @@ typedef struct st_mysql { ...@@ -201,26 +206,21 @@ typedef struct st_mysql {
struct st_mysql* last_used_slave; /* needed for round-robin slave pick */ struct st_mysql* last_used_slave; /* needed for round-robin slave pick */
/* needed for send/read/store/use result to work correctly with replication */ /* needed for send/read/store/use result to work correctly with replication */
struct st_mysql* last_used_con; struct st_mysql* last_used_con;
/*
Set if this is the original connection, not a master or a slave we have
added though mysql_rpl_probe() or mysql_set_master()/ mysql_add_slave()
*/
my_bool rpl_pivot;
} MYSQL; } MYSQL;
typedef struct st_mysql_res { typedef struct st_mysql_res {
my_ulonglong row_count; my_ulonglong row_count;
unsigned int field_count, current_field;
MYSQL_FIELD *fields; MYSQL_FIELD *fields;
MYSQL_DATA *data; MYSQL_DATA *data;
MYSQL_ROWS *data_cursor; MYSQL_ROWS *data_cursor;
unsigned long *lengths; /* column lengths of current row */
MYSQL *handle; /* for unbuffered reads */
MEM_ROOT field_alloc; MEM_ROOT field_alloc;
unsigned int field_count, current_field;
MYSQL_ROW row; /* If unbuffered read */ MYSQL_ROW row; /* If unbuffered read */
MYSQL_ROW current_row; /* buffer to current row */ MYSQL_ROW current_row; /* buffer to current row */
unsigned long *lengths; /* column lengths of current row */ my_bool eof; /* Used by mysql_fetch_row */
MYSQL *handle; /* for unbuffered reads */
my_bool eof; /* Used my mysql_fetch_row */
} MYSQL_RES; } MYSQL_RES;
...@@ -228,14 +228,14 @@ typedef struct st_mysql_res { ...@@ -228,14 +228,14 @@ typedef struct st_mysql_res {
* work when linked against either the standard client library or the * work when linked against either the standard client library or the
* embedded server library, these functions should be called. */ * embedded server library, these functions should be called. */
int mysql_server_init(int argc, const char **argv, const char **groups); int mysql_server_init(int argc, const char **argv, const char **groups);
void mysql_server_end(); void mysql_server_end(void);
/* Set up and bring down a thread; these function should be called /* Set up and bring down a thread; these function should be called
* for each thread in an application which opens at least one MySQL * for each thread in an application which opens at least one MySQL
* connection. All uses of the connection(s) should be between these * connection. All uses of the connection(s) should be between these
* function calls. */ * function calls. */
my_bool mysql_thread_init(); my_bool mysql_thread_init(void);
void mysql_thread_end(); void mysql_thread_end(void);
/* Functions to get information from the MYSQL and MYSQL_RES structures */ /* Functions to get information from the MYSQL and MYSQL_RES structures */
/* Should definitely be used if one uses shared libraries */ /* Should definitely be used if one uses shared libraries */
...@@ -276,20 +276,20 @@ void STDCALL mysql_close(MYSQL *sock); ...@@ -276,20 +276,20 @@ 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,
unsigned int length); unsigned long length);
int STDCALL mysql_read_query_result(MYSQL *mysql); 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 long length);
/* perform query on master */ /* perform query on master */
int STDCALL mysql_master_query(MYSQL *mysql, const char *q, int STDCALL mysql_master_query(MYSQL *mysql, const char *q,
unsigned int length); unsigned long length);
int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q, int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
unsigned int length); unsigned long length);
/* perform query on slave */ /* perform query on slave */
int STDCALL mysql_slave_query(MYSQL *mysql, const char *q, int STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
unsigned int length); unsigned long length);
int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q, int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
unsigned int length); unsigned long length);
/* /*
enable/disable parsing of all queries to decide if they go on master or enable/disable parsing of all queries to decide if they go on master or
...@@ -369,16 +369,23 @@ char * STDCALL mysql_odbc_escape_string(MYSQL *mysql, ...@@ -369,16 +369,23 @@ char * STDCALL mysql_odbc_escape_string(MYSQL *mysql,
void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name); void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
unsigned int STDCALL mysql_thread_safe(void); unsigned int STDCALL mysql_thread_safe(void);
#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
#ifdef USE_OLD_FUNCTIONS #ifdef USE_OLD_FUNCTIONS
MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host, MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host,
const char *user, const char *passwd); const char *user, const char *passwd);
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);
#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
#define HAVE_MYSQL_REAL_CONNECT
#endif #endif
#define HAVE_MYSQL_REAL_CONNECT /*
The following functions are mainly exported because of mysqlbinlog;
They are not for general usage
*/
int simple_command(MYSQL *mysql,enum enum_server_command command,
const char *arg, ulong length, my_bool skipp_check);
ulong net_safe_read(MYSQL* mysql);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -108,11 +108,12 @@ typedef struct st_vio Vio; ...@@ -108,11 +108,12 @@ typedef struct st_vio Vio;
typedef struct st_net { typedef struct st_net {
Vio* vio; Vio* vio;
unsigned char *buff,*buff_end,*write_pos,*read_pos;
my_socket fd; /* For Perl DBI/dbd */ my_socket fd; /* For Perl DBI/dbd */
unsigned long max_packet;
int fcntl; int fcntl;
unsigned char *buff,*buff_end,*write_pos,*read_pos; unsigned int last_errno,timeout,pkt_nr,compress_pkt_nr;
char last_error[MYSQL_ERRMSG_SIZE]; char last_error[MYSQL_ERRMSG_SIZE];
unsigned int last_errno,max_packet,timeout,pkt_nr;
unsigned char error; unsigned char error;
my_bool return_errno,compress; my_bool return_errno,compress;
/* /*
...@@ -120,14 +121,14 @@ typedef struct st_net { ...@@ -120,14 +121,14 @@ typedef struct st_net {
command ( as in LOAD TABLE ... FROM MASTER ), command ( as in LOAD TABLE ... FROM MASTER ),
and do not want to confuse the client with OK at the wrong time and do not want to confuse the client with OK at the wrong time
*/ */
my_bool no_send_ok;
unsigned long remain_in_buf,length, buf_length, where_b; unsigned long remain_in_buf,length, buf_length, where_b;
unsigned int *return_status; unsigned int *return_status;
unsigned char reading_or_writing; unsigned char reading_or_writing;
char save_char; char save_char;
my_bool no_send_ok;
} NET; } NET;
#define packet_error ((unsigned int) -1) #define packet_error (~(unsigned long) 0)
enum enum_field_types { FIELD_TYPE_DECIMAL, FIELD_TYPE_TINY, enum enum_field_types { FIELD_TYPE_DECIMAL, FIELD_TYPE_TINY,
FIELD_TYPE_SHORT, FIELD_TYPE_LONG, FIELD_TYPE_SHORT, FIELD_TYPE_LONG,
......
...@@ -316,11 +316,11 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host, ...@@ -316,11 +316,11 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host,
** or packet is an error message ** or packet is an error message
*****************************************************************************/ *****************************************************************************/
uint ulong
net_safe_read(MYSQL *mysql) net_safe_read(MYSQL *mysql)
{ {
NET *net= &mysql->net; NET *net= &mysql->net;
uint len=0; ulong len=0;
init_sigpipe_variables init_sigpipe_variables
/* Don't give sigpipe errors if the client doesn't want them */ /* Don't give sigpipe errors if the client doesn't want them */
...@@ -338,7 +338,7 @@ net_safe_read(MYSQL *mysql) ...@@ -338,7 +338,7 @@ net_safe_read(MYSQL *mysql)
CR_NET_PACKET_TOO_LARGE: CR_NET_PACKET_TOO_LARGE:
CR_SERVER_LOST); CR_SERVER_LOST);
strmov(net->last_error,ER(net->last_errno)); strmov(net->last_error,ER(net->last_errno));
return(packet_error); return (packet_error);
} }
if (net->read_pos[0] == 255) if (net->read_pos[0] == 255)
{ {
...@@ -349,7 +349,7 @@ net_safe_read(MYSQL *mysql) ...@@ -349,7 +349,7 @@ net_safe_read(MYSQL *mysql)
pos+=2; pos+=2;
len-=2; len-=2;
(void) strmake(net->last_error,(char*) pos, (void) strmake(net->last_error,(char*) pos,
min(len,sizeof(net->last_error)-1)); min((uint) len,(uint) sizeof(net->last_error)-1));
} }
else else
{ {
...@@ -440,7 +440,7 @@ static void free_rows(MYSQL_DATA *cur) ...@@ -440,7 +440,7 @@ static void free_rows(MYSQL_DATA *cur)
int int
simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg, simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
uint length, my_bool skipp_check) ulong length, my_bool skipp_check)
{ {
NET *net= &mysql->net; NET *net= &mysql->net;
int result= -1; int result= -1;
...@@ -671,8 +671,8 @@ mysql_free_result(MYSQL_RES *result) ...@@ -671,8 +671,8 @@ mysql_free_result(MYSQL_RES *result)
DBUG_PRINT("warning",("Not all rows in set were read; Ignoring rows")); DBUG_PRINT("warning",("Not all rows in set were read; Ignoring rows"));
for (;;) for (;;)
{ {
uint pkt_len; ulong pkt_len;
if ((pkt_len=(uint) net_safe_read(result->handle)) == packet_error) if ((pkt_len=net_safe_read(result->handle)) == packet_error)
break; break;
if (pkt_len == 1 && result->handle->net.read_pos[0] == 254) if (pkt_len == 1 && result->handle->net.read_pos[0] == 254)
break; /* End of data */ break; /* End of data */
...@@ -866,7 +866,8 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, ...@@ -866,7 +866,8 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
MYSQL_FIELD *field,*result; MYSQL_FIELD *field,*result;
DBUG_ENTER("unpack_fields"); DBUG_ENTER("unpack_fields");
field=result=(MYSQL_FIELD*) alloc_root(alloc,sizeof(MYSQL_FIELD)*fields); field=result=(MYSQL_FIELD*) alloc_root(alloc,
(uint) sizeof(MYSQL_FIELD)*fields);
if (!result) if (!result)
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -913,7 +914,7 @@ static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, ...@@ -913,7 +914,7 @@ static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
NET *net = &mysql->net; NET *net = &mysql->net;
DBUG_ENTER("read_rows"); DBUG_ENTER("read_rows");
if ((pkt_len=(uint) net_safe_read(mysql)) == packet_error) if ((pkt_len= net_safe_read(mysql)) == packet_error)
DBUG_RETURN(0); DBUG_RETURN(0);
if (!(result=(MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA), if (!(result=(MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA),
MYF(MY_WME | MY_ZEROFILL)))) MYF(MY_WME | MY_ZEROFILL))))
...@@ -1020,7 +1021,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) ...@@ -1020,7 +1021,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
/* perform query on master */ /* perform query on master */
int STDCALL mysql_master_query(MYSQL *mysql, const char *q, int STDCALL mysql_master_query(MYSQL *mysql, const char *q,
unsigned int length) unsigned long length)
{ {
if (mysql_master_send_query(mysql, q, length)) if (mysql_master_send_query(mysql, q, length))
return 1; return 1;
...@@ -1028,7 +1029,7 @@ int STDCALL mysql_master_query(MYSQL *mysql, const char *q, ...@@ -1028,7 +1029,7 @@ int STDCALL mysql_master_query(MYSQL *mysql, const char *q,
} }
int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q, int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
unsigned int length) unsigned long length)
{ {
MYSQL*master = mysql->master; MYSQL*master = mysql->master;
if (!length) if (!length)
...@@ -1042,7 +1043,7 @@ int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q, ...@@ -1042,7 +1043,7 @@ int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
/* perform query on slave */ /* perform query on slave */
int STDCALL mysql_slave_query(MYSQL *mysql, const char *q, int STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
unsigned int length) unsigned long length)
{ {
if (mysql_slave_send_query(mysql, q, length)) if (mysql_slave_send_query(mysql, q, length))
return 1; return 1;
...@@ -1050,7 +1051,7 @@ int STDCALL mysql_slave_query(MYSQL *mysql, const char *q, ...@@ -1050,7 +1051,7 @@ int STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
} }
int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q, int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
unsigned int length) unsigned long length)
{ {
MYSQL* last_used_slave, *slave_to_use = 0; MYSQL* last_used_slave, *slave_to_use = 0;
...@@ -1271,7 +1272,7 @@ STDCALL mysql_rpl_query_type(const char* q, int len) ...@@ -1271,7 +1272,7 @@ STDCALL mysql_rpl_query_type(const char* q, int len)
case 'c': /* create or check */ case 'c': /* create or check */
return tolower(q[1]) == 'h' ? MYSQL_RPL_ADMIN : MYSQL_RPL_MASTER ; return tolower(q[1]) == 'h' ? MYSQL_RPL_ADMIN : MYSQL_RPL_MASTER ;
case 's': /* select or show */ case 's': /* select or show */
return tolower(q[1] == 'h') ? MYSQL_RPL_ADMIN : MYSQL_RPL_SLAVE; return tolower(q[1]) == 'h' ? MYSQL_RPL_ADMIN : MYSQL_RPL_SLAVE;
case 'f': /* flush */ case 'f': /* flush */
case 'r': /* repair */ case 'r': /* repair */
case 'g': /* grant */ case 'g': /* grant */
...@@ -1280,8 +1281,7 @@ STDCALL mysql_rpl_query_type(const char* q, int len) ...@@ -1280,8 +1281,7 @@ STDCALL mysql_rpl_query_type(const char* q, int len)
return MYSQL_RPL_SLAVE; return MYSQL_RPL_SLAVE;
} }
} }
return MYSQL_RPL_MASTER; /* By default, send to master */
return 0;
} }
...@@ -1829,7 +1829,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -1829,7 +1829,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
mysql->db=my_strdup(db,MYF(MY_WME)); mysql->db=my_strdup(db,MYF(MY_WME));
db=0; db=0;
} }
if (my_net_write(net,buff,(uint) (end-buff)) || net_flush(net) || if (my_net_write(net,buff,(ulong) (end-buff)) || net_flush(net) ||
net_safe_read(mysql) == packet_error) net_safe_read(mysql) == packet_error)
goto error; goto error;
if (client_flag & CLIENT_COMPRESS) /* We will use compression */ if (client_flag & CLIENT_COMPRESS) /* We will use compression */
...@@ -1935,7 +1935,7 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, ...@@ -1935,7 +1935,7 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
pos=scramble(pos, mysql->scramble_buff, passwd, pos=scramble(pos, mysql->scramble_buff, passwd,
(my_bool) (mysql->protocol_version == 9)); (my_bool) (mysql->protocol_version == 9));
pos=strmov(pos+1,db ? db : ""); pos=strmov(pos+1,db ? db : "");
if (simple_command(mysql,COM_CHANGE_USER, buff,(uint) (pos-buff),0)) if (simple_command(mysql,COM_CHANGE_USER, buff,(ulong) (pos-buff),0))
DBUG_RETURN(1); DBUG_RETURN(1);
my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
...@@ -1960,7 +1960,7 @@ mysql_select_db(MYSQL *mysql, const char *db) ...@@ -1960,7 +1960,7 @@ mysql_select_db(MYSQL *mysql, const char *db)
DBUG_ENTER("mysql_select_db"); DBUG_ENTER("mysql_select_db");
DBUG_PRINT("enter",("db: '%s'",db)); DBUG_PRINT("enter",("db: '%s'",db));
if ((error=simple_command(mysql,COM_INIT_DB,db,(uint) strlen(db),0))) if ((error=simple_command(mysql,COM_INIT_DB,db,(ulong) strlen(db),0)))
DBUG_RETURN(error); DBUG_RETURN(error);
my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
mysql->db=my_strdup(db,MYF(MY_WME)); mysql->db=my_strdup(db,MYF(MY_WME));
...@@ -2111,7 +2111,7 @@ STDCALL mysql_add_slave(MYSQL* mysql, const char* host, ...@@ -2111,7 +2111,7 @@ STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
*/ */
int STDCALL int STDCALL
mysql_send_query(MYSQL* mysql, const char* query, uint length) mysql_send_query(MYSQL* mysql, const char* query, ulong length)
{ {
if (mysql->options.rpl_parse && mysql->rpl_pivot) if (mysql->options.rpl_parse && mysql->rpl_pivot)
{ {
...@@ -2179,13 +2179,13 @@ get_info: ...@@ -2179,13 +2179,13 @@ get_info:
CLIENT_LONG_FLAG)))) CLIENT_LONG_FLAG))))
DBUG_RETURN(-1); DBUG_RETURN(-1);
mysql->status=MYSQL_STATUS_GET_RESULT; mysql->status=MYSQL_STATUS_GET_RESULT;
mysql->field_count=field_count; mysql->field_count= (uint) field_count;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
int STDCALL int STDCALL
mysql_real_query(MYSQL *mysql, const char *query, uint length) mysql_real_query(MYSQL *mysql, const char *query, ulong length)
{ {
DBUG_ENTER("mysql_real_query"); DBUG_ENTER("mysql_real_query");
DBUG_PRINT("enter",("handle: %lx",mysql)); DBUG_PRINT("enter",("handle: %lx",mysql));
...@@ -2276,8 +2276,9 @@ mysql_store_result(MYSQL *mysql) ...@@ -2276,8 +2276,9 @@ mysql_store_result(MYSQL *mysql)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
mysql->status=MYSQL_STATUS_READY; /* server is ready */ mysql->status=MYSQL_STATUS_READY; /* server is ready */
if (!(result=(MYSQL_RES*) my_malloc(sizeof(MYSQL_RES)+ if (!(result=(MYSQL_RES*) my_malloc((uint) (sizeof(MYSQL_RES)+
sizeof(ulong)*mysql->field_count, sizeof(ulong) *
mysql->field_count),
MYF(MY_WME | MY_ZEROFILL)))) MYF(MY_WME | MY_ZEROFILL))))
{ {
mysql->net.last_errno=CR_OUT_OF_MEMORY; mysql->net.last_errno=CR_OUT_OF_MEMORY;
...@@ -2433,7 +2434,7 @@ mysql_fetch_lengths(MYSQL_RES *res) ...@@ -2433,7 +2434,7 @@ mysql_fetch_lengths(MYSQL_RES *res)
continue; continue;
} }
if (start) /* Found end of prev string */ if (start) /* Found end of prev string */
*prev_length= (uint) (*column-start-1); *prev_length= (ulong) (*column-start-1);
start= *column; start= *column;
prev_length=lengths; prev_length=lengths;
} }
...@@ -2534,7 +2535,7 @@ mysql_list_fields(MYSQL *mysql, const char *table, const char *wild) ...@@ -2534,7 +2535,7 @@ mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)
LINT_INIT(query); LINT_INIT(query);
end=strmake(strmake(buff, table,128)+1,wild ? wild : "",128); end=strmake(strmake(buff, table,128)+1,wild ? wild : "",128);
if (simple_command(mysql,COM_FIELD_LIST,buff,(uint) (end-buff),1) || if (simple_command(mysql,COM_FIELD_LIST,buff,(ulong) (end-buff),1) ||
!(query = read_rows(mysql,(MYSQL_FIELD*) 0,6))) !(query = read_rows(mysql,(MYSQL_FIELD*) 0,6)))
DBUG_RETURN(NULL); DBUG_RETURN(NULL);
...@@ -2590,7 +2591,7 @@ mysql_create_db(MYSQL *mysql, const char *db) ...@@ -2590,7 +2591,7 @@ mysql_create_db(MYSQL *mysql, const char *db)
{ {
DBUG_ENTER("mysql_createdb"); DBUG_ENTER("mysql_createdb");
DBUG_PRINT("enter",("db: %s",db)); DBUG_PRINT("enter",("db: %s",db));
DBUG_RETURN(simple_command(mysql,COM_CREATE_DB,db, (uint) strlen(db),0)); DBUG_RETURN(simple_command(mysql,COM_CREATE_DB,db, (ulong) strlen(db),0));
} }
...@@ -2599,7 +2600,7 @@ mysql_drop_db(MYSQL *mysql, const char *db) ...@@ -2599,7 +2600,7 @@ mysql_drop_db(MYSQL *mysql, const char *db)
{ {
DBUG_ENTER("mysql_drop_db"); DBUG_ENTER("mysql_drop_db");
DBUG_PRINT("enter",("db: %s",db)); DBUG_PRINT("enter",("db: %s",db));
DBUG_RETURN(simple_command(mysql,COM_DROP_DB,db,(uint) strlen(db),0)); DBUG_RETURN(simple_command(mysql,COM_DROP_DB,db,(ulong) strlen(db),0));
} }
#endif #endif
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <winsock.h> #include <winsock.h>
#endif #endif
#include <my_global.h> #include <my_global.h>
#include "mysql_embed.h"
#include <mysql_com.h> #include <mysql_com.h>
#include <violite.h> #include <violite.h>
#include <my_sys.h> #include <my_sys.h>
...@@ -89,7 +90,7 @@ extern ulong mysqld_net_retry_count; ...@@ -89,7 +90,7 @@ extern ulong mysqld_net_retry_count;
typedef my_bool thr_alarm_t; typedef my_bool thr_alarm_t;
typedef my_bool ALARM; typedef my_bool ALARM;
#define thr_alarm_init(A) (*(A))=0 #define thr_alarm_init(A) (*(A))=0
#define thr_alarm_in_use(A) (*(A)!= 0) #define thr_alarm_in_use(A) (*(A) != 0)
#define thr_end_alarm(A) #define thr_end_alarm(A)
#define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C)) #define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C))
inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused))) inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused)))
...@@ -129,7 +130,7 @@ int my_net_init(NET *net, Vio* vio) ...@@ -129,7 +130,7 @@ int my_net_init(NET *net, Vio* vio)
net->no_send_ok = 0; net->no_send_ok = 0;
net->error=0; net->return_errno=0; net->return_status=0; net->error=0; net->return_errno=0; net->return_status=0;
net->timeout=(uint) net_read_timeout; /* Timeout for read */ net->timeout=(uint) net_read_timeout; /* Timeout for read */
net->pkt_nr=0; net->pkt_nr=net->compress_pkt_nr=0;
net->write_pos=net->read_pos = net->buff; net->write_pos=net->read_pos = net->buff;
net->last_error[0]=0; net->last_error[0]=0;
net->compress=0; net->reading_or_writing=0; net->compress=0; net->reading_or_writing=0;
...@@ -190,7 +191,7 @@ static my_bool net_realloc(NET *net, ulong length) ...@@ -190,7 +191,7 @@ static my_bool net_realloc(NET *net, ulong length)
void net_clear(NET *net) void net_clear(NET *net)
{ {
#ifndef EXTRA_DEBUG #ifndef EXTRA_DEBUG
int count; int count; /* One may get 'unused' warn */
bool is_blocking=vio_is_blocking(net->vio); bool is_blocking=vio_is_blocking(net->vio);
if (is_blocking) if (is_blocking)
vio_blocking(net->vio, FALSE); vio_blocking(net->vio, FALSE);
...@@ -204,7 +205,7 @@ void net_clear(NET *net) ...@@ -204,7 +205,7 @@ void net_clear(NET *net)
vio_blocking(net->vio, TRUE); vio_blocking(net->vio, TRUE);
} }
#endif /* EXTRA_DEBUG */ #endif /* EXTRA_DEBUG */
net->pkt_nr=0; /* Ready for new command */ net->pkt_nr=net->compress_pkt_nr=0; /* Ready for new command */
net->write_pos=net->buff; net->write_pos=net->buff;
} }
...@@ -217,9 +218,12 @@ int net_flush(NET *net) ...@@ -217,9 +218,12 @@ int net_flush(NET *net)
if (net->buff != net->write_pos) if (net->buff != net->write_pos)
{ {
error=net_real_write(net,(char*) net->buff, error=net_real_write(net,(char*) net->buff,
(uint) (net->write_pos - net->buff)); (ulong) (net->write_pos - net->buff));
net->write_pos=net->buff; net->write_pos=net->buff;
} }
/* Sync packet number if using compression */
if (net->compress)
net->pkt_nr=net->compress_pkt_nr;
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -248,7 +252,7 @@ my_net_write(NET *net,const char *packet,ulong len) ...@@ -248,7 +252,7 @@ my_net_write(NET *net,const char *packet,ulong len)
{ {
const ulong z_size = MAX_THREE_BYTES; const ulong z_size = MAX_THREE_BYTES;
int3store(buff, z_size); int3store(buff, z_size);
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++); buff[3]= net->pkt_nr++;
if (net_write_buff(net, (char*) buff, NET_HEADER_SIZE) || if (net_write_buff(net, (char*) buff, NET_HEADER_SIZE) ||
net_write_buff(net, packet, z_size)) net_write_buff(net, packet, z_size))
return 1; return 1;
...@@ -257,7 +261,7 @@ my_net_write(NET *net,const char *packet,ulong len) ...@@ -257,7 +261,7 @@ my_net_write(NET *net,const char *packet,ulong len)
} }
/* Write last packet */ /* Write last packet */
int3store(buff,len); int3store(buff,len);
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++); buff[3]= net->pkt_nr++;
if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE)) if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE))
return 1; return 1;
return net_write_buff(net,packet,len); return net_write_buff(net,packet,len);
...@@ -275,7 +279,7 @@ my_net_write(NET *net,const char *packet,ulong len) ...@@ -275,7 +279,7 @@ my_net_write(NET *net,const char *packet,ulong len)
int int
net_write_command(NET *net,uchar command,const char *packet,ulong len) net_write_command(NET *net,uchar command,const char *packet,ulong len)
{ {
uint length=len+1; /* 1 extra byte for command */ ulong length=len+1; /* 1 extra byte for command */
uchar buff[NET_HEADER_SIZE+1]; uchar buff[NET_HEADER_SIZE+1];
uint header_size=NET_HEADER_SIZE+1; uint header_size=NET_HEADER_SIZE+1;
buff[4]=command; /* For first packet */ buff[4]=command; /* For first packet */
...@@ -287,7 +291,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len) ...@@ -287,7 +291,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len)
do do
{ {
int3store(buff, MAX_THREE_BYTES); int3store(buff, MAX_THREE_BYTES);
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++); buff[3]= net->pkt_nr++;
if (net_write_buff(net,(char*) buff, header_size) || if (net_write_buff(net,(char*) buff, header_size) ||
net_write_buff(net,packet,len)) net_write_buff(net,packet,len))
return 1; return 1;
...@@ -299,7 +303,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len) ...@@ -299,7 +303,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len)
len=length; /* Data left to be written */ len=length; /* Data left to be written */
} }
int3store(buff,length); int3store(buff,length);
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++); buff[3]= net->pkt_nr++;
return test(net_write_buff(net,(char*) buff,header_size) || return test(net_write_buff(net,(char*) buff,header_size) ||
net_write_buff(net,packet,len) || net_flush(net)); net_write_buff(net,packet,len) || net_flush(net));
} }
...@@ -312,7 +316,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len) ...@@ -312,7 +316,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len)
static int static int
net_write_buff(NET *net,const char *packet,ulong len) net_write_buff(NET *net,const char *packet,ulong len)
{ {
uint left_length=(uint) (net->buff_end - net->write_pos); ulong left_length=(ulong) (net->buff_end - net->write_pos);
while (len > left_length) while (len > left_length)
{ {
...@@ -338,7 +342,7 @@ net_write_buff(NET *net,const char *packet,ulong len) ...@@ -338,7 +342,7 @@ net_write_buff(NET *net,const char *packet,ulong len)
int int
net_real_write(NET *net,const char *packet,ulong len) net_real_write(NET *net,const char *packet,ulong len)
{ {
int length; long int length;
char *pos,*end; char *pos,*end;
thr_alarm_t alarmed; thr_alarm_t alarmed;
#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) #if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
...@@ -378,7 +382,7 @@ net_real_write(NET *net,const char *packet,ulong len) ...@@ -378,7 +382,7 @@ net_real_write(NET *net,const char *packet,ulong len)
} }
int3store(&b[NET_HEADER_SIZE],complen); int3store(&b[NET_HEADER_SIZE],complen);
int3store(b,len); int3store(b,len);
b[3]=(uchar) (net->pkt_nr++); b[3]=(uchar) (net->compress_pkt_nr++);
len+= header_length; len+= header_length;
packet= (char*) b; packet= (char*) b;
} }
...@@ -396,7 +400,7 @@ net_real_write(NET *net,const char *packet,ulong len) ...@@ -396,7 +400,7 @@ net_real_write(NET *net,const char *packet,ulong len)
pos=(char*) packet; end=pos+len; pos=(char*) packet; end=pos+len;
while (pos != end) while (pos != end)
{ {
if ((int) (length=vio_write(net->vio,pos,(int) (end-pos))) <= 0) if ((long) (length=vio_write(net->vio,pos,(ulong) (end-pos))) <= 0)
{ {
my_bool interrupted = vio_should_retry(net->vio); my_bool interrupted = vio_should_retry(net->vio);
#if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2)) #if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2))
...@@ -496,7 +500,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed) ...@@ -496,7 +500,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
if ((int) (length=vio_read(net->vio,(char*) net->buff,remain)) <= 0L) if ((int) (length=vio_read(net->vio,(char*) net->buff,remain)) <= 0L)
{ {
my_bool interrupted = vio_should_retry(net->vio); my_bool interrupted = vio_should_retry(net->vio);
if (!thr_got_alarm(alarmed) && interrupted) if (!thr_got_alarm(&alarmed) && interrupted)
{ /* Probably in MIT threads */ { /* Probably in MIT threads */
if (retry_count++ < RETRY_COUNT) if (retry_count++ < RETRY_COUNT)
continue; continue;
...@@ -516,7 +520,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed) ...@@ -516,7 +520,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
This function reallocates the net->buff buffer if necessary. This function reallocates the net->buff buffer if necessary.
*/ */
static uint static ulong
my_real_read(NET *net, ulong *complen) my_real_read(NET *net, ulong *complen)
{ {
uchar *pos; uchar *pos;
...@@ -627,9 +631,9 @@ my_real_read(NET *net, ulong *complen) ...@@ -627,9 +631,9 @@ my_real_read(NET *net, ulong *complen)
if (net->buff[net->where_b] != (uchar) 255) if (net->buff[net->where_b] != (uchar) 255)
{ {
DBUG_PRINT("error", DBUG_PRINT("error",
("Packets out of order (Found: %d, expected %d)", ("Packets out of order (Found: %d, expected %u)",
(int) net->buff[net->where_b + 3], (int) net->buff[net->where_b + 3],
(uint) (uchar) net->pkt_nr)); net->pkt_nr));
#ifdef EXTRA_DEBUG #ifdef EXTRA_DEBUG
fprintf(stderr,"Packets out of order (Found: %d, expected %d)\n", fprintf(stderr,"Packets out of order (Found: %d, expected %d)\n",
(int) net->buff[net->where_b + 3], (int) net->buff[net->where_b + 3],
...@@ -642,7 +646,7 @@ my_real_read(NET *net, ulong *complen) ...@@ -642,7 +646,7 @@ my_real_read(NET *net, ulong *complen)
#endif #endif
goto end; goto end;
} }
net->pkt_nr++; net->compress_pkt_nr= ++net->pkt_nr;
#ifdef HAVE_COMPRESS #ifdef HAVE_COMPRESS
if (net->compress) if (net->compress)
{ {
...@@ -710,7 +714,7 @@ my_net_read(NET *net) ...@@ -710,7 +714,7 @@ my_net_read(NET *net)
if (len == MAX_THREE_BYTES) if (len == MAX_THREE_BYTES)
{ {
/* First packet of a multi-packet. Concatenate the packets */ /* First packet of a multi-packet. Concatenate the packets */
int save_pos = net->where_b; ulong save_pos = net->where_b;
ulong total_length=0; ulong total_length=0;
do do
{ {
...@@ -820,8 +824,8 @@ my_net_read(NET *net) ...@@ -820,8 +824,8 @@ my_net_read(NET *net)
net->read_pos= net->buff+ first_packet_offset + NET_HEADER_SIZE; net->read_pos= net->buff+ first_packet_offset + NET_HEADER_SIZE;
net->buf_length= buf_length; net->buf_length= buf_length;
net->remain_in_buf= buf_length - start_of_packet; net->remain_in_buf= (ulong) (buf_length - start_of_packet);
len = ((uint) (start_of_packet - first_packet_offset) - NET_HEADER_SIZE - len = ((ulong) (start_of_packet - first_packet_offset) - NET_HEADER_SIZE -
multi_byte_packet); multi_byte_packet);
net->save_char= net->read_pos[len]; /* Must be saved */ net->save_char= net->read_pos[len]; /* Must be saved */
net->read_pos[len]=0; /* Safeguard for mysql_use_result */ net->read_pos[len]=0; /* Safeguard for mysql_use_result */
......
...@@ -26,7 +26,7 @@ LDADD = $(top_builddir)/libmysqld/libmysqld.la \ ...@@ -26,7 +26,7 @@ LDADD = $(top_builddir)/libmysqld/libmysqld.la \
mysqltest_DEPENDENCIES = ../libmysqld.la mysqltest_DEPENDENCIES = ../libmysqld.la
mysqltest_SOURCES = mysqltest.c mysqltest_SOURCES = mysqltest.c
mysql_SOURCES = mysql.cc readline.cc sql_string.cc completion_hash.cc \ mysql_SOURCES = mysql.cc readline.cc completion_hash.cc \
my_readline.h sql_string.h completion_hash.h my_readline.h sql_string.h completion_hash.h
mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD) mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD)
......
...@@ -89,7 +89,7 @@ static MYSQL* spawn_init(MYSQL* parent, const char* host, ...@@ -89,7 +89,7 @@ static MYSQL* spawn_init(MYSQL* parent, const char* host,
** or packet is an error message ** or packet is an error message
*****************************************************************************/ *****************************************************************************/
static uint ulong
net_safe_read(MYSQL *mysql) net_safe_read(MYSQL *mysql)
{ {
NET *net= &mysql->net; NET *net= &mysql->net;
...@@ -218,9 +218,9 @@ static void free_rows(MYSQL_DATA *cur) ...@@ -218,9 +218,9 @@ static void free_rows(MYSQL_DATA *cur)
} }
static int int
simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg, simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
uint length, my_bool skipp_check) ulong length, my_bool skipp_check)
{ {
NET *net= &mysql->net; NET *net= &mysql->net;
int result= -1; int result= -1;
...@@ -700,7 +700,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) ...@@ -700,7 +700,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
ulong pkt_len,len; ulong pkt_len,len;
uchar *pos,*prev_pos; uchar *pos,*prev_pos;
if ((pkt_len=(uint) net_safe_read(mysql)) == packet_error) if ((pkt_len=net_safe_read(mysql)) == packet_error)
return -1; return -1;
if (pkt_len == 1 && mysql->net.read_pos[0] == 254) if (pkt_len == 1 && mysql->net.read_pos[0] == 254)
return 1; /* End of data */ return 1; /* End of data */
...@@ -728,301 +728,6 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) ...@@ -728,301 +728,6 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
return 0; return 0;
} }
/* perform query on master */
int STDCALL mysql_master_query(MYSQL *mysql, const char *q,
unsigned int length)
{
if(mysql_master_send_query(mysql, q, length))
return 1;
return mysql_read_query_result(mysql);
}
int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
unsigned int length)
{
MYSQL*master = mysql->master;
if (!length)
length = strlen(q);
if (!master->net.vio && !mysql_real_connect(master,0,0,0,0,0,0,0))
return 1;
mysql->last_used_con = master;
return simple_command(master, COM_QUERY, q, length, 1);
}
/* perform query on slave */
int STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
unsigned int length)
{
if(mysql_slave_send_query(mysql, q, length))
return 1;
return mysql_read_query_result(mysql);
}
int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
unsigned int length)
{
MYSQL* last_used_slave, *slave_to_use = 0;
if((last_used_slave = mysql->last_used_slave))
slave_to_use = last_used_slave->next_slave;
else
slave_to_use = mysql->next_slave;
/* next_slave is always safe to use - we have a circular list of slaves
if there are no slaves, mysql->next_slave == mysql
*/
mysql->last_used_con = mysql->last_used_slave = slave_to_use;
if(!length)
length = strlen(q);
if(!slave_to_use->net.vio && !mysql_real_connect(slave_to_use, 0,0,0,
0,0,0,0))
return 1;
return simple_command(slave_to_use, COM_QUERY, q, length, 1);
}
/* enable/disable parsing of all queries to decide
if they go on master or slave */
void STDCALL mysql_enable_rpl_parse(MYSQL* mysql)
{
mysql->options.rpl_parse = 1;
}
void STDCALL mysql_disable_rpl_parse(MYSQL* mysql)
{
mysql->options.rpl_parse = 0;
}
/* get the value of the parse flag */
int STDCALL mysql_rpl_parse_enabled(MYSQL* mysql)
{
return mysql->options.rpl_parse;
}
/* enable/disable reads from master */
void STDCALL mysql_enable_reads_from_master(MYSQL* mysql)
{
mysql->options.no_master_reads = 0;
}
void STDCALL mysql_disable_reads_from_master(MYSQL* mysql)
{
mysql->options.no_master_reads = 1;
}
/* get the value of the master read flag */
int STDCALL mysql_reads_from_master_enabled(MYSQL* mysql)
{
return !(mysql->options.no_master_reads);
}
/* We may get an error while doing replication internals.
In this case, we add a special explanation to the original
error
*/
static inline void expand_error(MYSQL* mysql, int error)
{
char tmp[MYSQL_ERRMSG_SIZE];
char* p, *tmp_end;
tmp_end = strnmov(tmp, mysql->net.last_error, MYSQL_ERRMSG_SIZE);
p = strnmov(mysql->net.last_error, ER(error), MYSQL_ERRMSG_SIZE);
memcpy(p, tmp, tmp_end - tmp);
mysql->net.last_errno = error;
}
/* This function assumes we have just called SHOW SLAVE STATUS and have
read the given result and row
*/
static inline int get_master(MYSQL* mysql, MYSQL_RES* res, MYSQL_ROW row)
{
MYSQL* master;
if(mysql_num_fields(res) < 3)
return 1; /* safety */
/* use the same username and password as the original connection */
if(!(master = spawn_init(mysql, row[0], atoi(row[2]), 0, 0)))
return 1;
mysql->master = master;
return 0;
}
/* assuming we already know that mysql points to a master connection,
retrieve all the slaves
*/
static inline int get_slaves_from_master(MYSQL* mysql)
{
MYSQL_RES* res = 0;
MYSQL_ROW row;
int error = 1;
int has_auth_info;
if (!mysql->net.vio && !mysql_real_connect(mysql,0,0,0,0,0,0,0))
{
expand_error(mysql, CR_PROBE_MASTER_CONNECT);
return 1;
}
if (mysql_query(mysql, "SHOW SLAVE HOSTS") ||
!(res = mysql_store_result(mysql)))
{
expand_error(mysql, CR_PROBE_SLAVE_HOSTS);
return 1;
}
switch (mysql_num_fields(res))
{
case 3: has_auth_info = 0; break;
case 5: has_auth_info = 1; break;
default:
goto err;
}
while ((row = mysql_fetch_row(res)))
{
MYSQL* slave;
const char* tmp_user, *tmp_pass;
if (has_auth_info)
{
tmp_user = row[3];
tmp_pass = row[4];
}
else
{
tmp_user = mysql->user;
tmp_pass = mysql->passwd;
}
if(!(slave = spawn_init(mysql, row[1], atoi(row[2]),
tmp_user, tmp_pass)))
goto err;
/* Now add slave into the circular linked list */
slave->next_slave = mysql->next_slave;
mysql->next_slave = slave;
}
error = 0;
err:
if(res)
mysql_free_result(res);
return error;
}
int STDCALL mysql_rpl_probe(MYSQL* mysql)
{
MYSQL_RES* res = 0;
MYSQL_ROW row;
int error = 1;
/* first determine the replication role of the server we connected to
the most reliable way to do this is to run SHOW SLAVE STATUS and see
if we have a non-empty master host. This is still not fool-proof -
it is not a sin to have a master that has a dormant slave thread with
a non-empty master host. However, it is more reliable to check
for empty master than whether the slave thread is actually running
*/
if (mysql_query(mysql, "SHOW SLAVE STATUS") ||
!(res = mysql_store_result(mysql)))
{
expand_error(mysql, CR_PROBE_SLAVE_STATUS);
return 1;
}
if (!(row = mysql_fetch_row(res)))
goto err;
/* check master host for emptiness/NULL */
if (row[0] && *(row[0]))
{
/* this is a slave, ask it for the master */
if (get_master(mysql, res, row) || get_slaves_from_master(mysql))
goto err;
}
else
{
mysql->master = mysql;
if (get_slaves_from_master(mysql))
goto err;
}
error = 0;
err:
if(res)
mysql_free_result(res);
return error;
}
/* make a not so fool-proof decision on where the query should go, to
the master or the slave. Ideally the user should always make this
decision himself with mysql_master_query() or mysql_slave_query().
However, to be able to more easily port the old code, we support the
option of an educated guess - this should work for most applications,
however, it may make the wrong decision in some particular cases. If
that happens, the user would have to change the code to call
mysql_master_query() or mysql_slave_query() explicitly in the place
where we have made the wrong decision
*/
enum mysql_rpl_type
STDCALL mysql_rpl_query_type(const char* q, int len)
{
const char* q_end;
q_end = (len) ? q + len : strend(q);
for(; q < q_end; ++q)
{
char c;
if(isalpha(c=*q))
switch(tolower(c))
{
case 'i': /* insert */
case 'u': /* update or unlock tables */
case 'l': /* lock tables or load data infile */
case 'd': /* drop or delete */
case 'a': /* alter */
return MYSQL_RPL_MASTER;
case 'c': /* create or check */
return tolower(q[1]) == 'h' ? MYSQL_RPL_ADMIN : MYSQL_RPL_MASTER ;
case 's': /* select or show */
return tolower(q[1] == 'h') ? MYSQL_RPL_ADMIN : MYSQL_RPL_SLAVE;
case 'f': /* flush */
case 'r': /* repair */
case 'g': /* grant */
return MYSQL_RPL_ADMIN;
default:
return MYSQL_RPL_SLAVE;
}
}
return 0;
}
static MYSQL* spawn_init(MYSQL* parent, const char* host,
unsigned int port,
const char* user,
const char* passwd)
{
MYSQL* child;
if (!(child = mysql_init(0)))
return 0;
child->options.user = my_strdup((user) ? user :
(parent->user ? parent->user :
parent->options.user), MYF(0));
child->options.password = my_strdup((passwd) ? passwd : (parent->passwd ?
parent->passwd :
parent->options.password), MYF(0));
child->options.port = port;
child->options.host = my_strdup((host) ? host : (parent->host ?
parent->host :
parent->options.host), MYF(0));
if(parent->db)
child->options.db = my_strdup(parent->db, MYF(0));
else if(parent->options.db)
child->options.db = my_strdup(parent->options.db, MYF(0));
child->options.rpl_parse = child->options.rpl_probe = child->rpl_pivot = 0;
return child;
}
/**************************************************************************** /****************************************************************************
** Init MySQL structure or allocate one ** Init MySQL structure or allocate one
****************************************************************************/ ****************************************************************************/
...@@ -1269,7 +974,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -1269,7 +974,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
mysql->db=my_strdup(db,MYF(MY_WME)); mysql->db=my_strdup(db,MYF(MY_WME));
db=0; db=0;
} }
if (my_net_write(net,buff,(uint) (end-buff)) || net_flush(net)) if (my_net_write(net,buff,(ulong) (end-buff)) || net_flush(net))
goto error; goto error;
lib_connection_phase(net,2); lib_connection_phase(net,2);
...@@ -1326,7 +1031,7 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, ...@@ -1326,7 +1031,7 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
pos=scramble(pos, mysql->scramble_buff, passwd, pos=scramble(pos, mysql->scramble_buff, passwd,
(my_bool) (mysql->protocol_version == 9)); (my_bool) (mysql->protocol_version == 9));
pos=strmov(pos+1,db ? db : ""); pos=strmov(pos+1,db ? db : "");
if (simple_command(mysql,COM_CHANGE_USER, buff,(uint) (pos-buff),0)) if (simple_command(mysql,COM_CHANGE_USER, buff,(ulong) (pos-buff),0))
DBUG_RETURN(1); DBUG_RETURN(1);
my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
...@@ -1351,7 +1056,7 @@ mysql_select_db(MYSQL *mysql, const char *db) ...@@ -1351,7 +1056,7 @@ mysql_select_db(MYSQL *mysql, const char *db)
DBUG_ENTER("mysql_select_db"); DBUG_ENTER("mysql_select_db");
DBUG_PRINT("enter",("db: '%s'",db)); DBUG_PRINT("enter",("db: '%s'",db));
if ((error=simple_command(mysql,COM_INIT_DB,db,(uint) strlen(db),0))) if ((error=simple_command(mysql,COM_INIT_DB,db,(ulong) strlen(db),0)))
DBUG_RETURN(error); DBUG_RETURN(error);
my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
mysql->db=my_strdup(db,MYF(MY_WME)); mysql->db=my_strdup(db,MYF(MY_WME));
...@@ -1414,11 +1119,11 @@ mysql_close(MYSQL *mysql) ...@@ -1414,11 +1119,11 @@ mysql_close(MYSQL *mysql)
int STDCALL int STDCALL
mysql_query(MYSQL *mysql, const char *query) mysql_query(MYSQL *mysql, const char *query)
{ {
return mysql_real_query(mysql,query, (uint) strlen(query)); return mysql_real_query(mysql,query, (ulong) strlen(query));
} }
int STDCALL int STDCALL
mysql_send_query(MYSQL* mysql, const char* query, uint length) mysql_send_query(MYSQL* mysql, const char* query, ulong length)
{ {
return simple_command(mysql, COM_QUERY, query, length, 1); return simple_command(mysql, COM_QUERY, query, length, 1);
} }
...@@ -1474,7 +1179,7 @@ get_info: ...@@ -1474,7 +1179,7 @@ get_info:
} }
int STDCALL int STDCALL
mysql_real_query(MYSQL *mysql, const char *query, uint length) mysql_real_query(MYSQL *mysql, const char *query, ulong length)
{ {
DBUG_ENTER("mysql_real_query"); DBUG_ENTER("mysql_real_query");
DBUG_PRINT("enter",("handle: %lx",mysql)); DBUG_PRINT("enter",("handle: %lx",mysql));
...@@ -1872,7 +1577,7 @@ mysql_create_db(MYSQL *mysql, const char *db) ...@@ -1872,7 +1577,7 @@ mysql_create_db(MYSQL *mysql, const char *db)
{ {
DBUG_ENTER("mysql_createdb"); DBUG_ENTER("mysql_createdb");
DBUG_PRINT("enter",("db: %s",db)); DBUG_PRINT("enter",("db: %s",db));
DBUG_RETURN(simple_command(mysql,COM_CREATE_DB,db, (uint) strlen(db),0)); DBUG_RETURN(simple_command(mysql,COM_CREATE_DB,db, (ulong) strlen(db),0));
} }
...@@ -1881,7 +1586,7 @@ mysql_drop_db(MYSQL *mysql, const char *db) ...@@ -1881,7 +1586,7 @@ mysql_drop_db(MYSQL *mysql, const char *db)
{ {
DBUG_ENTER("mysql_drop_db"); DBUG_ENTER("mysql_drop_db");
DBUG_PRINT("enter",("db: %s",db)); DBUG_PRINT("enter",("db: %s",db));
DBUG_RETURN(simple_command(mysql,COM_DROP_DB,db,(uint) strlen(db),0)); DBUG_RETURN(simple_command(mysql,COM_DROP_DB,db,(ulong) strlen(db),0));
} }
......
...@@ -166,6 +166,8 @@ while test $# -gt 0; do ...@@ -166,6 +166,8 @@ while test $# -gt 0; do
;; ;;
--big*) # Actually --big-test --big*) # Actually --big-test
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;; EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
--compress)
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
--sleep=*) --sleep=*)
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1"
SLEEP_TIME=`$ECHO "$1" | $SED -e "s;--sleep=;;"` SLEEP_TIME=`$ECHO "$1" | $SED -e "s;--sleep=;;"`
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# Problem with many enums # Problem with many enums
# #
DROP TABLE if exists t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
field enum('001001','001004','001010','001018','001019','001020','001021','001027','001028','001029','001030','001031','001100','002003','002004','002005','002007','002008','002009','002012','002013','002014','003002','003003','003004','003005','003006','003007','003008','003009','003010','003011','003012','003013','003014','003015','003016','003017','003018','003019','004002','004003','004005','004006','004007','004008','004010','004012','004014','004016','004017','004020','004021','004022','004023','004024','004025','004026','006002','006004','006006','006010','006011','006012','006013','006014','007001','007002','007003','007004','007005','007006','007007','007008','007009','007010','007011','007012','007013','007014','007015','007016','007017','007018','007019','007020','007021','007022','007023','007024','007025','007026','007027','007028','007029','007030','007031','007032','007033','007034','007035','007036','007037','007038','007039','007040','007043','007044','009001','009002','009004','009005','009006','009007','009008','009009','009010','009011','009012','009013','010002','010003','010004','010005','010006','010007','010008','010009','010010','010011','010012','010013','010015','010016','010017','010018','010019','010020','010021','010022','010023','010024','010025','010026','010027','010028','011001','011002','011003','011004','011006','011012','011013','011014','011015','011016','012017','012018','012019','012023','012027','012028','012029','012030','012031','012032','012033','012034','012035','012036','012037','012038','012039','014001','016002','016003','016004','016007','016010','016011','016016','016019','016020','016021','016022','016023','016024','016026','016027','016028','016029','016030','016031','016032','016033','016034','017002','018001','019002','019004','020001','020003','020004','020005','020006','020007','020008','020009','022001','022002','022003','023001','023002','023003','023004','023005','023006','023007','023008','023010','023011','023012','023017','023019','023020','023021','023025','023026','023027','023028','023029','023030','023031','023032','023033','023034','023035','025001','025003','025004','025005','025006','025007','025008','025009','025010','025011','025012','025013','025014','025015','025016','025017','025018','025019','025020','025021','025022','025023','025024','025025','025026','025027','025028','025029','025030','025031','025032','025033','025034','025035','025036','025037','025038','025039','025040','025041','025042','025043','025044','025045','025046','025047','025048','025049','025050','025051','025052','025053','025054','025055','025056','025057','025058','025059','025060','025061','025062','025063','027001','027002','027011','035008','035012','036001','037001','037003','037004','037005','037006','037007','037008','037009','038004','038005','038006','038007','038009','039001','039002','039003','039004','039005','039006','046001','046002','046003','046004','046005','046007','046008','046009','046010','046011','046012','046013','046014','047001','047002','048001','051001','051002','051003','051004','052001','052002','052005','053015','053016','053019','053020','053023','053024','053026','053028','053029','053033','053034','053036','053037','053038','053039','053041','053042','053043','053045','053046','053047','053048','053051','053052','053054','053055','053056','053057','053068','053069','053070','053073','053074','053075','053086','053094','053095','053096','053097','053098','053099','053100','053101','053102','053103','053104','053105','053107','053122','053123','053124','053125','053127','053128','054001','054002','054003','054004','054005','054006','054007','054009','054010','056001','056002','056003','056004','056005','056006','056009','056010','056011','056016','056017','056018','056019','056020','056021','056022','057001','057002','057003','057004','058002','058003','058004','058005','060001','060003','060004','060005','060006','060007','061002','061003','061004','061005','061006','069006','069007','069010','069011','069012','069013','069014','069015','069016','069017','069018','069020','069021','069022','069023','069024','071002','071003','071004','071005','071006','071008','071011','071013','071020','071021','071022','072001','073001','073002','073003','073004','074001','074002','074003','074004','074005','074006','074007','074008','074009','074010','074011','074012','075001','075007','076101','076102','076103','077001','077002','077003','077004','077006','077007','077008','077009','078005','079002','079003','079004','079005','079006','079007','081001','082006','082007','082011','082013','082014','082015','082016','082017','082021','082022','082023','082024','082025','082026','082027','082028','082029','082030','082031','082032','082033','082034','082035','082036','082037','082038','082039','082040','082041','082042','082043','082044','084001','084002','084003','084004','084005','084007','084008','084009','084011','084013','084014','084016','084017','084027','084031','084032','084033','084035','084036','084037','084038','084039','084040','084041','084042','084043','084044','084045','084046','084047','084048','084049','084050','084051','085001','085002','085003','085004','085005','085006','085007','085009','085011','085012','085013','085014','085015','085016','085017','085018','085019','085020','085021','085022','085023','085028','085029','085030','085031','085033','085034','085035','085036','085037','085038','085040','085041','085042','085043','085044','085045','085046','085047','085048','085063','085064','085065','085068','085070','085071','085073','085082','085083','085086','085088','085089','085090','085091','085092','085093','085094','085095','085096','085097','085098','085099','085100','085101','085102','085103','085104','085105','085106','085107','085108','085109','085110','085111','085112','085113','085115','085119','085120','085121','085122','085123','085124','085125','085126','085127','085128','085129','085130','085132','085133','085134','085135','085136','085137','086001','086002','086003','086004','086005','088001','088003','088005','088006','088007','088008','088009','089001','090001','090002','090003','090004','090005','090006','090007','090008','090009','090010','090013','090015','090016','090017','090018','090019','090022','090027','090028','091001','091002','091005','091008','091009','091010','091011','091012','091013','091014','091015','091016','091017','091018','093001','093003','093098','093100','093102','093104','093141','093142','093146','093151','093153','093167','093168','093176','094001','094002','094004','094005','095004','099001','099002','100001','101001','102002','102003','105001','105002','106001','113001','113002','113003','113004','113005','113006','113007','113008','113009','113010','113011','113012','113013','113014','113015','113016','113017','113018','113019','113020','113021','113022','113023','113024','113025','113026','113027','113028','114001','115001','115002','115003','115004','115005','115006','115007','115008','115009','115010','115011','115012','115013','115014','115015','115016','115017','115018','115020','115021','115022','115023','115025','115026','115027','115028','115029','115030','115031','115032','115033','115034','115035','115036','115039','115040','115041','115042','115043','115044','115045','115046','115047','115048','115049','115050','115051','115052','115053','115054','115055','115056','115057','115059','115060','115061','115062','115063','115064','115065','115066','115067','115068','115069','115070','115071','115072','115073','115075','115076','115081','115082','115085','115086','115087','115088','115095','115096','115097','115098','115099','115101','115102','115103','115104','115105','115106','115108','115109','115110','115111','115112','115113','115114','115115','115116','115117','115118','115119','115120','115121','115122','116001','116002','116003','116004','116005','116006','116007','116008','116009','116010','116011','116012','117001','117002','117003','123001','124010','124014','124015','124019','124024','124025','124026','124027','124028','124029','124030','124031','124032','124033','124035','124036','124037','124038','124039','124040','124041','124042','124043','124044','124045','124046','124047','124048','124049','124050','124051','124052','124053','124054','124055','124056','124057','124058','124059','124060','124061','124062','124063','124064','124065','126001','126002','126003','126004','126005','126006','126007','126008','126009','126010','126011','126012','130001','132001','132002','132003','133001','133008','133009','133010','133011','133012','133013','133014','133015','133016','133017','133018','133019','133020','133021','133022','133023','133024','133025','133027','133028','133029','133030','133031','134001','135001','135002','135003','135004','135005','135006','135007','135008','135009','135010','136001','137009','137010','137011','137012','137013','137014','137015','137016','137017','137018','137019','138001','138002','138003','138004','139001','139003','140001','141001','141002','141003','141006','141007','141008','141009','141011','141012','141014','141015','141016','141017','141018','141019','141020','141021','141022','141023','141024','141025','141026','141027','141028','142001','142002','142003','142004','142005','142006','142007','142008','142010','142011','142012','144001','145001','145002','145003','145004','145005','145006','145007','145008','145009','145010','145011','145012','145013','145014','145015','145016','147001','150003','150005','150009','150013','150014','150015','150016','150017','150020','150021','152001','152002','152003','152004','152005','152006','152007','154001','154002','154003','155001','155002','155003','155004','155005','155006','159001','159002','159003','159004','160001','160002','160003','161001','162001','162002','162003','162004','162007','162010','162011','162012','163001','163002','163003','163005','163010','163011','163014','163015','163016','165001','165002','165003','165004','165005','165006','165007','165008','165009','165010','165011','165012','165013','165014','165015','165016','165017','165018','165019','165020','165021','165022','165023','165024','165025','165026','165027','165028','165029','165030','165031','165032','165033','165034','165035','165036','167001','168001','168002','168003','168004','168005','168007','168008','168009','168010','168011','168012','168013','168014','169001','169002','169003','169007','169008','169009','169010','170001','171001','171002','171003','171004','171005','171006','171007','171008','171009','172001','174001','174002','174003','176001','176002','176003','177001','177002','179001','179002','179003','179004','179005','179006','179007','179008','179009','179010','179011','179012','179013','179014','179015','179016','179017','179018','179019','179020','179021','179022','179023','179024','179025','179026','179027','179028','179029','179030','179031','179032','179033','179034','179035','179036','179037','179038','179039','179040','179041','179042','179043','179044','179045','179046','179047','180001','180010','180012','180013','180014','180015','180016','180017','180018','180019','180020','180021','180022','180023','180024','180025','180026','180027','180028','180030','180031','180032','180033','180034','180035','180036','180037','180038','180039','180041','180042','180043','180044','180045','180046','180047','180048','180049','180050','180051','180052','180053','180054','180055','180056','180057','180058','180059','180060','180061','180062','180063','180064','180065','180066','180067','180068','180069','180070','180071','182001','184001','184002','184005','184006','184007','184008','184009','184010','184011','185001','185003','187001','188001','188002','188003','188004','188005','188006','188007','188008','188009','188010','188011','191001','191002','192002','194001','194002','194003','194004','194005','194006','194007','195001','195002','195003','195004','195005','195006','195007','196001','196002','197001','197002','197003','197004','197005','197006','198001','198003','198004','198005','198006','198007','198008','198009','198010','198011','198012','198013','198014','198015','198016','198017','201001','201002','201005','202001','203001','203002','203003','203017','203018','203019','204001','204002','204003','205001','208001','208002','208003','208004','208005','209001','209002','209003','210001','210002','210003','210004','210005','210006','210007','210008','210009','210010','210011','210012','210013','211017','212001','212002','212003','212004','212005','212006','212007','212008','212009','212010','212011','212012','212013','218001','218003','218004','218006','218007','218008','218009','218011','218015','218016','218017','218018','218019','218020','218021','218022','218023','218024','218025','218026','218027','218028','218029','218030','218031','218032','218033','218034','218035','218036','221001','221002','221003','221004','221005','221006','221007','221008','221009','221010','221011','221012','221013','223001','223002','223003','224001','224002','224003','224006','224007','224008','225001','225002','225003','225004','225005','225006','225007','225008','225009','225010','225011','225012','225013','226001','226002','226003','226004','226005','226006','226007','226008','226009','227001','227002','227003','227004','227005','227006','227007','227008','227009','227010','227011','227012','227013','227014','227015','227016','227017','227018','227019','227020','227021','227022','227023','227024','227025','227026','227027','227028','227029','227030','227031','227032','227033','227034','227035','227036','227037','227038','227039','227040','227041','227042','227043','227044','227045','227046','227047','227048','227049','227050','227051','227052','227053','227054','227055','227056','227057','227058','227059','227060','227061','227062','227063','227064','227065','227066','227067','227068','227069','227070','227071','227072','227073','227074','227075','227076','227077','227078','227079','227080','227081','227082','227083','227084','227085','227086','227087','227088','227089','227090','227091','227092','227093','227094','227095','227096','227097','227098','227099','227100','227101','227102','227103','227104','227105','227106','227107','227108','227109','227110','227111','227112','227113','227114','227115','227116','227117','227118','227119','227120','227122','227123','227124','227125','227126','227127','227128','227129','227130','227131','227132','227133','227134','227135','227136','227137','227138','227139','227140','227141','227142','227143','227144','227145','227146','227147','227148','227149','227150','227151','227152','228001','229001','229002','229003','229004','229005','230001','230002','232001','233001','233002','233003','233004','233005','233006','233007','233008','234001','234002','234003','234004','234005','234006','234007','234008','234009','234010','234011','234012','234013','234014','234015','234016','234017','234018','234019','234020','234021','234022','234023','234024','234025','234026','234027','234028','234029','234030','235001','235002','235003','235004','235005','236001','236002','236003','237001','238002','238003','238004','238005','238006','238007','238008','333013','333014','333015','333016','333017','333018','333019','333020','333021','333022','333023','333024','333025','333030','333031','333032','333033','333034','333035','334001','334002','334003','334004','334005','334006','334007','336004','337001','337002','337003','337004','339001','339002','343001','344001','344002','344003','344004','344005','345001','345002','345003','347001','347002','348001','348002','348003','348004','348005','349001','349002','349003','350001','353001','353002','353003','353004','355001','355002','355003','355004','355005','355006','356001','358001','359001','359002','360001','360002','360003','360004','360005','366001','366002','366003','366004','369001','373001','373002','373003','373004','373005','373006','373007','373008','373009','373010','373011','373012','373013','373014','373015','373016','373017','373018','373019','373020','373021','374001','374002','374003','374004','374005','374006','374007','374008','374009','374010','374011','374012','374013','374014','374015','374016','376001','376002','376003','376004','376005','376006','376007','376008','376009','376010','376011','376012','376013','376016','376017','376018','376019','376020','376021','379003','382001','382002','383001','384001','384002','385001','385002','386001','386002','386003','386004','386005','386006','386007','386008','386009','386010','386011','386012','386013','386014','387001','389001','389002','389003','389004','392001','393001','393002','393003','393004','395001','396001','397001','397002','399001','399002','399003','400001','400002','401001','401002','401003','402001','402002','402003','402004','402005','403001','403002','403003','504001','504002','504004','504005','504006','504007','504008','504009','504010','504011','504012','504013','504014','504017','504018','504019','504021','504022','504023','504024','504025','506001','506002','508001','508002','511001','511002','511003','511004','511005','511006','511007','511008','511009','511010','511011','511012','511013','511014','511017','511018','511020','511021','511022','511024','511028','511029','513001','513002','513003','513004','514001','515001','515002','515003','515007','515008','515009','515010','515011','515012','515013','515014','515015','518001','518002','518003','520001','520002','521001','521002','521003','521004','521005','521006','521007','521008','521009','521010','521011','521012','521013','521014','521015','521016','523001','523002','523003','523004','523005','523006','523007','524001','700001','701001','701002','701003','702001','702002','702003','702004','702005','702006','702007','702008','703001','703002','703003','704001','704002','704003','704004','705001','706001','706002','707001','707002','707003','708001','709001','709002','710001','710002','711001','711002','712001','713001','713002','714001','714002','715001','716001','718001','718002','719001','719002','991001','991002','991003','991004','991005','991006','991007','991008','992001','995001','996001','996002','996003','998001','998002','998003','998004','998005','998006','998007','999001','999002','011017','011018','034001','034002','071010','208006','239001','519001','519003','126013','184012','053071','374017','374018','374019','374020','374021','404001','405002','405001','405003','405007','405006','405005','405004','240011','240010','240009','240008','240007','240006','240005','240004','240003','240002','240001','240012','240013','240014','240015','240016','240017','357001','235006','235007','712002','355008','355007','056023','999999','046015','019005','126014','241003','241002','241001','240018','240020','240019','242001','242002','242003','242004','242005','242006','089002','406001','406002','406003','406004','406005','406006','243001','243002','243003','243004','243005','243006','243007','243008','010030','010029','407001','407006','407005','407004','407003','407002','408001','366005','133032','016035','077010','996004','025064','011019','407007','407008','407009','409001','115123','504026','039007','039009','039008','039010','039011','039012','180072','240021','240023','408002','405008','235008','525001','525002','525003','525004','410001','410002','410003','410004','410005','410006','410007','410008','410009','410010','410011','410012','410013','410014','410015','410016','344006','240031','240030','240029','240028','240027','240026','240025','240024','240034','240033','240032','410017','410018','411001','411002','411003','411004','411005','411006','411007','411008','203020','203021','203022','412001','412002','412003','412004','069025','244001','244002','244009','244008','244007','244006','244005','244004','244003','244015','244014','244013','244012','244011','244010','244016','244017','240042','240041','240040','240039','240038','240037','240036','240035','405009','405010','240043','504034','504033','504032','504031','504030','504029','504028','504027','504042','504041','504040','504039','504038','504037','504036','504035','800001','410019','410020','410021','244018','244019','244020','399004','413001','504043','198018','198019','344007','082045','010031','010032','010033','010034','010035','504044','515016','801002','801003','801004','801005','802001','801001','414001','414002','414003','141029','141030','803001','803002','803003','803004','803005','803006','803007','803008','803009','803010','803011','803012','803013','803014','803015','803016','803017','410022','410023','803018','803019','803020','415002','415001','244021','011020','011023','011022','011021','025065','165037','165038','165039','416001','416002','416003','417001','418001','504045','803022','803021','240022','419001','420001','804010','804009','804008','804007','804006','804005','804004','804003','804002','804001','804020','804019','804018','804017','804016','804015','804014','804013','804012','804011','804024','804021','804023','804022','511019','511016','511015','511032','511031','511030','511027','511026','511025','511033','511023','133034','133033','169011','344008','344009','244022','244026','244025','244030','244023','244024','244027','244028','244029','244031','082046','082047','082048','126015','126016','416004','416005','421001','421002','016037','016036','115124','115125','115126','240049','240048','240047','240046','240045','240044','244032','244033','422001','422002','422003','422004','422005','184013','239002','805001','805002','805003','805004','805005','056024','423001','344010','235009','212014','056025','056026','802002','244034','244035','244036','244037','244038','244039','515017','504046','203015','245002','245001','071023','056027','056028','056029','056030','056031','056032','424001','056034','056033','805006','805007','805008','805009','805010','422008','422007','422006','422010','422009','422011','209004','150022','150023','100002','056035','023036','185004','185005','246001','247001','247002','425001','416006','165042','165041','165040','165043','010040','010039','010038','010037','010036','422012','422013','422014','422015','426000','248001','248002','248003','248004','248005','249001','249002','249003','249004','249005','249006','250007','250001','250002','250003','250004','250005','250006','250008','250009','250010','250011','250012','250013','251001','251002','422016','422017','422018','806001','806002','116013','235010','235011','091026','091027','091028','091029','091019','091020','091021','091022','091023','091024','091025','252001','243009','249007','249008','249009','011024','011025','427001','428002','428001','169012','429001','429002','429003') DEFAULT '001001' NOT NULL, field enum('001001','001004','001010','001018','001019','001020','001021','001027','001028','001029','001030','001031','001100','002003','002004','002005','002007','002008','002009','002012','002013','002014','003002','003003','003004','003005','003006','003007','003008','003009','003010','003011','003012','003013','003014','003015','003016','003017','003018','003019','004002','004003','004005','004006','004007','004008','004010','004012','004014','004016','004017','004020','004021','004022','004023','004024','004025','004026','006002','006004','006006','006010','006011','006012','006013','006014','007001','007002','007003','007004','007005','007006','007007','007008','007009','007010','007011','007012','007013','007014','007015','007016','007017','007018','007019','007020','007021','007022','007023','007024','007025','007026','007027','007028','007029','007030','007031','007032','007033','007034','007035','007036','007037','007038','007039','007040','007043','007044','009001','009002','009004','009005','009006','009007','009008','009009','009010','009011','009012','009013','010002','010003','010004','010005','010006','010007','010008','010009','010010','010011','010012','010013','010015','010016','010017','010018','010019','010020','010021','010022','010023','010024','010025','010026','010027','010028','011001','011002','011003','011004','011006','011012','011013','011014','011015','011016','012017','012018','012019','012023','012027','012028','012029','012030','012031','012032','012033','012034','012035','012036','012037','012038','012039','014001','016002','016003','016004','016007','016010','016011','016016','016019','016020','016021','016022','016023','016024','016026','016027','016028','016029','016030','016031','016032','016033','016034','017002','018001','019002','019004','020001','020003','020004','020005','020006','020007','020008','020009','022001','022002','022003','023001','023002','023003','023004','023005','023006','023007','023008','023010','023011','023012','023017','023019','023020','023021','023025','023026','023027','023028','023029','023030','023031','023032','023033','023034','023035','025001','025003','025004','025005','025006','025007','025008','025009','025010','025011','025012','025013','025014','025015','025016','025017','025018','025019','025020','025021','025022','025023','025024','025025','025026','025027','025028','025029','025030','025031','025032','025033','025034','025035','025036','025037','025038','025039','025040','025041','025042','025043','025044','025045','025046','025047','025048','025049','025050','025051','025052','025053','025054','025055','025056','025057','025058','025059','025060','025061','025062','025063','027001','027002','027011','035008','035012','036001','037001','037003','037004','037005','037006','037007','037008','037009','038004','038005','038006','038007','038009','039001','039002','039003','039004','039005','039006','046001','046002','046003','046004','046005','046007','046008','046009','046010','046011','046012','046013','046014','047001','047002','048001','051001','051002','051003','051004','052001','052002','052005','053015','053016','053019','053020','053023','053024','053026','053028','053029','053033','053034','053036','053037','053038','053039','053041','053042','053043','053045','053046','053047','053048','053051','053052','053054','053055','053056','053057','053068','053069','053070','053073','053074','053075','053086','053094','053095','053096','053097','053098','053099','053100','053101','053102','053103','053104','053105','053107','053122','053123','053124','053125','053127','053128','054001','054002','054003','054004','054005','054006','054007','054009','054010','056001','056002','056003','056004','056005','056006','056009','056010','056011','056016','056017','056018','056019','056020','056021','056022','057001','057002','057003','057004','058002','058003','058004','058005','060001','060003','060004','060005','060006','060007','061002','061003','061004','061005','061006','069006','069007','069010','069011','069012','069013','069014','069015','069016','069017','069018','069020','069021','069022','069023','069024','071002','071003','071004','071005','071006','071008','071011','071013','071020','071021','071022','072001','073001','073002','073003','073004','074001','074002','074003','074004','074005','074006','074007','074008','074009','074010','074011','074012','075001','075007','076101','076102','076103','077001','077002','077003','077004','077006','077007','077008','077009','078005','079002','079003','079004','079005','079006','079007','081001','082006','082007','082011','082013','082014','082015','082016','082017','082021','082022','082023','082024','082025','082026','082027','082028','082029','082030','082031','082032','082033','082034','082035','082036','082037','082038','082039','082040','082041','082042','082043','082044','084001','084002','084003','084004','084005','084007','084008','084009','084011','084013','084014','084016','084017','084027','084031','084032','084033','084035','084036','084037','084038','084039','084040','084041','084042','084043','084044','084045','084046','084047','084048','084049','084050','084051','085001','085002','085003','085004','085005','085006','085007','085009','085011','085012','085013','085014','085015','085016','085017','085018','085019','085020','085021','085022','085023','085028','085029','085030','085031','085033','085034','085035','085036','085037','085038','085040','085041','085042','085043','085044','085045','085046','085047','085048','085063','085064','085065','085068','085070','085071','085073','085082','085083','085086','085088','085089','085090','085091','085092','085093','085094','085095','085096','085097','085098','085099','085100','085101','085102','085103','085104','085105','085106','085107','085108','085109','085110','085111','085112','085113','085115','085119','085120','085121','085122','085123','085124','085125','085126','085127','085128','085129','085130','085132','085133','085134','085135','085136','085137','086001','086002','086003','086004','086005','088001','088003','088005','088006','088007','088008','088009','089001','090001','090002','090003','090004','090005','090006','090007','090008','090009','090010','090013','090015','090016','090017','090018','090019','090022','090027','090028','091001','091002','091005','091008','091009','091010','091011','091012','091013','091014','091015','091016','091017','091018','093001','093003','093098','093100','093102','093104','093141','093142','093146','093151','093153','093167','093168','093176','094001','094002','094004','094005','095004','099001','099002','100001','101001','102002','102003','105001','105002','106001','113001','113002','113003','113004','113005','113006','113007','113008','113009','113010','113011','113012','113013','113014','113015','113016','113017','113018','113019','113020','113021','113022','113023','113024','113025','113026','113027','113028','114001','115001','115002','115003','115004','115005','115006','115007','115008','115009','115010','115011','115012','115013','115014','115015','115016','115017','115018','115020','115021','115022','115023','115025','115026','115027','115028','115029','115030','115031','115032','115033','115034','115035','115036','115039','115040','115041','115042','115043','115044','115045','115046','115047','115048','115049','115050','115051','115052','115053','115054','115055','115056','115057','115059','115060','115061','115062','115063','115064','115065','115066','115067','115068','115069','115070','115071','115072','115073','115075','115076','115081','115082','115085','115086','115087','115088','115095','115096','115097','115098','115099','115101','115102','115103','115104','115105','115106','115108','115109','115110','115111','115112','115113','115114','115115','115116','115117','115118','115119','115120','115121','115122','116001','116002','116003','116004','116005','116006','116007','116008','116009','116010','116011','116012','117001','117002','117003','123001','124010','124014','124015','124019','124024','124025','124026','124027','124028','124029','124030','124031','124032','124033','124035','124036','124037','124038','124039','124040','124041','124042','124043','124044','124045','124046','124047','124048','124049','124050','124051','124052','124053','124054','124055','124056','124057','124058','124059','124060','124061','124062','124063','124064','124065','126001','126002','126003','126004','126005','126006','126007','126008','126009','126010','126011','126012','130001','132001','132002','132003','133001','133008','133009','133010','133011','133012','133013','133014','133015','133016','133017','133018','133019','133020','133021','133022','133023','133024','133025','133027','133028','133029','133030','133031','134001','135001','135002','135003','135004','135005','135006','135007','135008','135009','135010','136001','137009','137010','137011','137012','137013','137014','137015','137016','137017','137018','137019','138001','138002','138003','138004','139001','139003','140001','141001','141002','141003','141006','141007','141008','141009','141011','141012','141014','141015','141016','141017','141018','141019','141020','141021','141022','141023','141024','141025','141026','141027','141028','142001','142002','142003','142004','142005','142006','142007','142008','142010','142011','142012','144001','145001','145002','145003','145004','145005','145006','145007','145008','145009','145010','145011','145012','145013','145014','145015','145016','147001','150003','150005','150009','150013','150014','150015','150016','150017','150020','150021','152001','152002','152003','152004','152005','152006','152007','154001','154002','154003','155001','155002','155003','155004','155005','155006','159001','159002','159003','159004','160001','160002','160003','161001','162001','162002','162003','162004','162007','162010','162011','162012','163001','163002','163003','163005','163010','163011','163014','163015','163016','165001','165002','165003','165004','165005','165006','165007','165008','165009','165010','165011','165012','165013','165014','165015','165016','165017','165018','165019','165020','165021','165022','165023','165024','165025','165026','165027','165028','165029','165030','165031','165032','165033','165034','165035','165036','167001','168001','168002','168003','168004','168005','168007','168008','168009','168010','168011','168012','168013','168014','169001','169002','169003','169007','169008','169009','169010','170001','171001','171002','171003','171004','171005','171006','171007','171008','171009','172001','174001','174002','174003','176001','176002','176003','177001','177002','179001','179002','179003','179004','179005','179006','179007','179008','179009','179010','179011','179012','179013','179014','179015','179016','179017','179018','179019','179020','179021','179022','179023','179024','179025','179026','179027','179028','179029','179030','179031','179032','179033','179034','179035','179036','179037','179038','179039','179040','179041','179042','179043','179044','179045','179046','179047','180001','180010','180012','180013','180014','180015','180016','180017','180018','180019','180020','180021','180022','180023','180024','180025','180026','180027','180028','180030','180031','180032','180033','180034','180035','180036','180037','180038','180039','180041','180042','180043','180044','180045','180046','180047','180048','180049','180050','180051','180052','180053','180054','180055','180056','180057','180058','180059','180060','180061','180062','180063','180064','180065','180066','180067','180068','180069','180070','180071','182001','184001','184002','184005','184006','184007','184008','184009','184010','184011','185001','185003','187001','188001','188002','188003','188004','188005','188006','188007','188008','188009','188010','188011','191001','191002','192002','194001','194002','194003','194004','194005','194006','194007','195001','195002','195003','195004','195005','195006','195007','196001','196002','197001','197002','197003','197004','197005','197006','198001','198003','198004','198005','198006','198007','198008','198009','198010','198011','198012','198013','198014','198015','198016','198017','201001','201002','201005','202001','203001','203002','203003','203017','203018','203019','204001','204002','204003','205001','208001','208002','208003','208004','208005','209001','209002','209003','210001','210002','210003','210004','210005','210006','210007','210008','210009','210010','210011','210012','210013','211017','212001','212002','212003','212004','212005','212006','212007','212008','212009','212010','212011','212012','212013','218001','218003','218004','218006','218007','218008','218009','218011','218015','218016','218017','218018','218019','218020','218021','218022','218023','218024','218025','218026','218027','218028','218029','218030','218031','218032','218033','218034','218035','218036','221001','221002','221003','221004','221005','221006','221007','221008','221009','221010','221011','221012','221013','223001','223002','223003','224001','224002','224003','224006','224007','224008','225001','225002','225003','225004','225005','225006','225007','225008','225009','225010','225011','225012','225013','226001','226002','226003','226004','226005','226006','226007','226008','226009','227001','227002','227003','227004','227005','227006','227007','227008','227009','227010','227011','227012','227013','227014','227015','227016','227017','227018','227019','227020','227021','227022','227023','227024','227025','227026','227027','227028','227029','227030','227031','227032','227033','227034','227035','227036','227037','227038','227039','227040','227041','227042','227043','227044','227045','227046','227047','227048','227049','227050','227051','227052','227053','227054','227055','227056','227057','227058','227059','227060','227061','227062','227063','227064','227065','227066','227067','227068','227069','227070','227071','227072','227073','227074','227075','227076','227077','227078','227079','227080','227081','227082','227083','227084','227085','227086','227087','227088','227089','227090','227091','227092','227093','227094','227095','227096','227097','227098','227099','227100','227101','227102','227103','227104','227105','227106','227107','227108','227109','227110','227111','227112','227113','227114','227115','227116','227117','227118','227119','227120','227122','227123','227124','227125','227126','227127','227128','227129','227130','227131','227132','227133','227134','227135','227136','227137','227138','227139','227140','227141','227142','227143','227144','227145','227146','227147','227148','227149','227150','227151','227152','228001','229001','229002','229003','229004','229005','230001','230002','232001','233001','233002','233003','233004','233005','233006','233007','233008','234001','234002','234003','234004','234005','234006','234007','234008','234009','234010','234011','234012','234013','234014','234015','234016','234017','234018','234019','234020','234021','234022','234023','234024','234025','234026','234027','234028','234029','234030','235001','235002','235003','235004','235005','236001','236002','236003','237001','238002','238003','238004','238005','238006','238007','238008','333013','333014','333015','333016','333017','333018','333019','333020','333021','333022','333023','333024','333025','333030','333031','333032','333033','333034','333035','334001','334002','334003','334004','334005','334006','334007','336004','337001','337002','337003','337004','339001','339002','343001','344001','344002','344003','344004','344005','345001','345002','345003','347001','347002','348001','348002','348003','348004','348005','349001','349002','349003','350001','353001','353002','353003','353004','355001','355002','355003','355004','355005','355006','356001','358001','359001','359002','360001','360002','360003','360004','360005','366001','366002','366003','366004','369001','373001','373002','373003','373004','373005','373006','373007','373008','373009','373010','373011','373012','373013','373014','373015','373016','373017','373018','373019','373020','373021','374001','374002','374003','374004','374005','374006','374007','374008','374009','374010','374011','374012','374013','374014','374015','374016','376001','376002','376003','376004','376005','376006','376007','376008','376009','376010','376011','376012','376013','376016','376017','376018','376019','376020','376021','379003','382001','382002','383001','384001','384002','385001','385002','386001','386002','386003','386004','386005','386006','386007','386008','386009','386010','386011','386012','386013','386014','387001','389001','389002','389003','389004','392001','393001','393002','393003','393004','395001','396001','397001','397002','399001','399002','399003','400001','400002','401001','401002','401003','402001','402002','402003','402004','402005','403001','403002','403003','504001','504002','504004','504005','504006','504007','504008','504009','504010','504011','504012','504013','504014','504017','504018','504019','504021','504022','504023','504024','504025','506001','506002','508001','508002','511001','511002','511003','511004','511005','511006','511007','511008','511009','511010','511011','511012','511013','511014','511017','511018','511020','511021','511022','511024','511028','511029','513001','513002','513003','513004','514001','515001','515002','515003','515007','515008','515009','515010','515011','515012','515013','515014','515015','518001','518002','518003','520001','520002','521001','521002','521003','521004','521005','521006','521007','521008','521009','521010','521011','521012','521013','521014','521015','521016','523001','523002','523003','523004','523005','523006','523007','524001','700001','701001','701002','701003','702001','702002','702003','702004','702005','702006','702007','702008','703001','703002','703003','704001','704002','704003','704004','705001','706001','706002','707001','707002','707003','708001','709001','709002','710001','710002','711001','711002','712001','713001','713002','714001','714002','715001','716001','718001','718002','719001','719002','991001','991002','991003','991004','991005','991006','991007','991008','992001','995001','996001','996002','996003','998001','998002','998003','998004','998005','998006','998007','999001','999002','011017','011018','034001','034002','071010','208006','239001','519001','519003','126013','184012','053071','374017','374018','374019','374020','374021','404001','405002','405001','405003','405007','405006','405005','405004','240011','240010','240009','240008','240007','240006','240005','240004','240003','240002','240001','240012','240013','240014','240015','240016','240017','357001','235006','235007','712002','355008','355007','056023','999999','046015','019005','126014','241003','241002','241001','240018','240020','240019','242001','242002','242003','242004','242005','242006','089002','406001','406002','406003','406004','406005','406006','243001','243002','243003','243004','243005','243006','243007','243008','010030','010029','407001','407006','407005','407004','407003','407002','408001','366005','133032','016035','077010','996004','025064','011019','407007','407008','407009','409001','115123','504026','039007','039009','039008','039010','039011','039012','180072','240021','240023','408002','405008','235008','525001','525002','525003','525004','410001','410002','410003','410004','410005','410006','410007','410008','410009','410010','410011','410012','410013','410014','410015','410016','344006','240031','240030','240029','240028','240027','240026','240025','240024','240034','240033','240032','410017','410018','411001','411002','411003','411004','411005','411006','411007','411008','203020','203021','203022','412001','412002','412003','412004','069025','244001','244002','244009','244008','244007','244006','244005','244004','244003','244015','244014','244013','244012','244011','244010','244016','244017','240042','240041','240040','240039','240038','240037','240036','240035','405009','405010','240043','504034','504033','504032','504031','504030','504029','504028','504027','504042','504041','504040','504039','504038','504037','504036','504035','800001','410019','410020','410021','244018','244019','244020','399004','413001','504043','198018','198019','344007','082045','010031','010032','010033','010034','010035','504044','515016','801002','801003','801004','801005','802001','801001','414001','414002','414003','141029','141030','803001','803002','803003','803004','803005','803006','803007','803008','803009','803010','803011','803012','803013','803014','803015','803016','803017','410022','410023','803018','803019','803020','415002','415001','244021','011020','011023','011022','011021','025065','165037','165038','165039','416001','416002','416003','417001','418001','504045','803022','803021','240022','419001','420001','804010','804009','804008','804007','804006','804005','804004','804003','804002','804001','804020','804019','804018','804017','804016','804015','804014','804013','804012','804011','804024','804021','804023','804022','511019','511016','511015','511032','511031','511030','511027','511026','511025','511033','511023','133034','133033','169011','344008','344009','244022','244026','244025','244030','244023','244024','244027','244028','244029','244031','082046','082047','082048','126015','126016','416004','416005','421001','421002','016037','016036','115124','115125','115126','240049','240048','240047','240046','240045','240044','244032','244033','422001','422002','422003','422004','422005','184013','239002','805001','805002','805003','805004','805005','056024','423001','344010','235009','212014','056025','056026','802002','244034','244035','244036','244037','244038','244039','515017','504046','203015','245002','245001','071023','056027','056028','056029','056030','056031','056032','424001','056034','056033','805006','805007','805008','805009','805010','422008','422007','422006','422010','422009','422011','209004','150022','150023','100002','056035','023036','185004','185005','246001','247001','247002','425001','416006','165042','165041','165040','165043','010040','010039','010038','010037','010036','422012','422013','422014','422015','426000','248001','248002','248003','248004','248005','249001','249002','249003','249004','249005','249006','250007','250001','250002','250003','250004','250005','250006','250008','250009','250010','250011','250012','250013','251001','251002','422016','422017','422018','806001','806002','116013','235010','235011','091026','091027','091028','091029','091019','091020','091021','091022','091023','091024','091025','252001','243009','249007','249008','249009','011024','011025','427001','428002','428001','169012','429001','429002','429003') DEFAULT '001001' NOT NULL,
KEY field (field) KEY field (field)
......
...@@ -35,7 +35,7 @@ void caseup_str(my_string str) ...@@ -35,7 +35,7 @@ void caseup_str(my_string str)
if (use_mb(default_charset_info)) if (use_mb(default_charset_info))
{ {
register uint32 l; register uint32 l;
register char *end=str+(uint) strlen(str); register char *end=str+strlen(str);
while (*str) while (*str)
{ {
if ((l=my_ismbchar(default_charset_info, str,end))) str+=l; if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
...@@ -56,7 +56,7 @@ void casedn_str(my_string str) ...@@ -56,7 +56,7 @@ void casedn_str(my_string str)
if (use_mb(default_charset_info)) if (use_mb(default_charset_info))
{ {
register uint32 l; register uint32 l;
register char *end=str+(uint) strlen(str); register char *end=str+strlen(str);
while (*str) while (*str)
{ {
if ((l=my_ismbchar(default_charset_info, str,end))) str+=l; if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
...@@ -155,7 +155,7 @@ int my_strcasecmp(const char *s, const char *t) ...@@ -155,7 +155,7 @@ int my_strcasecmp(const char *s, const char *t)
if (use_mb(default_charset_info)) if (use_mb(default_charset_info))
{ {
register uint32 l; register uint32 l;
register const char *end=s+(uint) strlen(s); register const char *end=s+strlen(s);
while (s<end) while (s<end)
{ {
if ((l=my_ismbchar(default_charset_info, s,end))) if ((l=my_ismbchar(default_charset_info, s,end)))
......
...@@ -90,9 +90,10 @@ File create_temp_file(char *to, const char *dir, const char *prefix, ...@@ -90,9 +90,10 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
uint pfx_len; uint pfx_len;
File org_file; File org_file;
pfx_len=(strmov(strnmov(prefix_buff, pfx_len= (uint) (strmov(strnmov(prefix_buff,
prefix ? prefix : "tmp.", prefix ? prefix : "tmp.",
sizeof(prefix_buff)-7),"XXXXXX") - prefix_buff); sizeof(prefix_buff)-7),"XXXXXX") -
prefix_buff);
if (!dir && ! (dir =getenv("TMPDIR"))) if (!dir && ! (dir =getenv("TMPDIR")))
dir=P_tmpdir; dir=P_tmpdir;
if (strlen(dir)+ pfx_len > FN_REFLEN-2) if (strlen(dir)+ pfx_len > FN_REFLEN-2)
......
...@@ -88,7 +88,7 @@ do ...@@ -88,7 +88,7 @@ do
fi fi
done done
for i in libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* libmysql/libmysqlclient.* libmysql_r/.libs/libmysqlclient_r.a libmysql_r/.libs/libmysqlclient_r.so* libmysql_r/libmysqlclient_r.* mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a $BASE/lib for i in libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* libmysql/libmysqlclient.* libmysql_r/.libs/libmysqlclient_r.a libmysql_r/.libs/libmysqlclient_r.so* libmysql_r/libmysqlclient_r.* mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a libmysqld/.libs/libmysqld.a libmysqld/.libs/libmysqld.so* libmysqld/libmysqld.a libmysqld/libmysqld.a
do do
if [ -f $i ] if [ -f $i ]
then then
......
...@@ -73,7 +73,7 @@ sub get_server ...@@ -73,7 +73,7 @@ sub get_server
{ $server= new db_interbase($host,$database); } { $server= new db_interbase($host,$database); }
else else
{ {
die "Unknown sql server name used: $name\nUse one of: Access, Adabas, AdabasD, Empress, FrontBase, Oracle, Informix, DB2, mSQL, Mimer, MS-SQL, MySQL, Pg, Solid or Sybase.\nIf the connection is done trough ODBC the name must end with _ODBC\n"; die "Unknown sql server name used: $name\nUse one of: Access, Adabas, AdabasD, Empress, FrontBase, Oracle, Informix, InterBase, DB2, mSQL, Mimer, MS-SQL, MySQL, Pg, Solid or Sybase.\nIf the connection is done trough ODBC the name must end with _ODBC\n";
} }
if ($name =~ /_ODBC$/i || defined($odbc) && $odbc) if ($name =~ /_ODBC$/i || defined($odbc) && $odbc)
{ {
...@@ -2962,7 +2962,7 @@ sub new ...@@ -2962,7 +2962,7 @@ sub new
bless $self; bless $self;
$self->{'cmp_name'} = "interbase"; $self->{'cmp_name'} = "interbase";
$self->{'data_source'} = "DBI:InterBase:database=$database"; $self->{'data_source'} = "DBI:InterBase:database=$database:ib_dialect=3";
$self->{'limits'} = \%limits; $self->{'limits'} = \%limits;
$self->{'smds'} = \%smds; $self->{'smds'} = \%smds;
$self->{'blob'} = "blob"; $self->{'blob'} = "blob";
......
...@@ -81,6 +81,7 @@ public: ...@@ -81,6 +81,7 @@ public:
virtual void split_sum_func(List<Item> &fields) {} virtual void split_sum_func(List<Item> &fields) {}
virtual bool get_date(TIME *ltime,bool fuzzydate); virtual bool get_date(TIME *ltime,bool fuzzydate);
virtual bool get_time(TIME *ltime); virtual bool get_time(TIME *ltime);
virtual bool is_null() { return 0; }
}; };
...@@ -130,6 +131,7 @@ public: ...@@ -130,6 +131,7 @@ public:
Field *tmp_table_field() { return result_field; } Field *tmp_table_field() { return result_field; }
bool get_date(TIME *ltime,bool fuzzydate); bool get_date(TIME *ltime,bool fuzzydate);
bool get_time(TIME *ltime); bool get_time(TIME *ltime);
bool is_null() { return field->is_null(); }
}; };
...@@ -150,6 +152,7 @@ public: ...@@ -150,6 +152,7 @@ public:
bool send(String *str); bool send(String *str);
bool basic_const_item() const { return 1; } bool basic_const_item() const { return 1; }
Item *new_item() { return new Item_null(name); } Item *new_item() { return new Item_null(name); }
bool is_null() { return 1; }
}; };
...@@ -383,6 +386,7 @@ public: ...@@ -383,6 +386,7 @@ public:
void copy(); void copy();
table_map used_tables() const { return (table_map) 1L; } table_map used_tables() const { return (table_map) 1L; }
bool const_item() const { return 0; } bool const_item() const { return 0; }
bool is_null() { return null_value; }
}; };
......
...@@ -1197,20 +1197,12 @@ longlong Item_cond_or::val_int() ...@@ -1197,20 +1197,12 @@ longlong Item_cond_or::val_int()
longlong Item_func_isnull::val_int() longlong Item_func_isnull::val_int()
{ {
if (internal_result_type == REAL_RESULT) return args[0]->is_null() ? 1: 0;
(void) args[0]->val();
else
(void) args[0]->val_int();
return (args[0]->null_value) ? 1 : 0;
} }
longlong Item_func_isnotnull::val_int() longlong Item_func_isnotnull::val_int()
{ {
if (internal_result_type == REAL_RESULT) return args[0]->is_null() ? 0 : 1;
(void) args[0]->val();
else
(void) args[0]->val_int();
return !(args[0]->null_value) ? 1 : 0;
} }
......
...@@ -46,6 +46,7 @@ public: ...@@ -46,6 +46,7 @@ public:
virtual enum Functype rev_functype() const { return UNKNOWN_FUNC; } virtual enum Functype rev_functype() const { return UNKNOWN_FUNC; }
bool have_rev_func() const { return rev_functype() != UNKNOWN_FUNC; } bool have_rev_func() const { return rev_functype() != UNKNOWN_FUNC; }
void print(String *str) { Item_func::print_op(str); } void print(String *str) { Item_func::print_op(str); }
bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); }
}; };
...@@ -429,7 +430,6 @@ class Item_func_in :public Item_int_func ...@@ -429,7 +430,6 @@ class Item_func_in :public Item_int_func
class Item_func_isnull :public Item_bool_func class Item_func_isnull :public Item_bool_func
{ {
enum Item_result internal_result_type;
public: public:
Item_func_isnull(Item *a) :Item_bool_func(a) {} Item_func_isnull(Item *a) :Item_bool_func(a) {}
longlong val_int(); longlong val_int();
...@@ -438,7 +438,6 @@ public: ...@@ -438,7 +438,6 @@ public:
{ {
decimals=0; max_length=1; maybe_null=0; decimals=0; max_length=1; maybe_null=0;
Item_func_isnull::update_used_tables(); Item_func_isnull::update_used_tables();
internal_result_type=args[0]->result_type();
} }
const char *func_name() const { return "isnull"; } const char *func_name() const { return "isnull"; }
/* Optimize case of not_null_column IS NULL */ /* Optimize case of not_null_column IS NULL */
...@@ -457,7 +456,6 @@ public: ...@@ -457,7 +456,6 @@ public:
class Item_func_isnotnull :public Item_bool_func class Item_func_isnotnull :public Item_bool_func
{ {
enum Item_result internal_result_type;
public: public:
Item_func_isnotnull(Item *a) :Item_bool_func(a) {} Item_func_isnotnull(Item *a) :Item_bool_func(a) {}
longlong val_int(); longlong val_int();
...@@ -465,7 +463,6 @@ public: ...@@ -465,7 +463,6 @@ public:
void fix_length_and_dec() void fix_length_and_dec()
{ {
decimals=0; max_length=1; maybe_null=0; decimals=0; max_length=1; maybe_null=0;
internal_result_type=args[0]->result_type();
} }
const char *func_name() const { return "isnotnull"; } const char *func_name() const { return "isnotnull"; }
optimize_type select_optimize() const { return OPTIMIZE_NULL; } optimize_type select_optimize() const { return OPTIMIZE_NULL; }
......
...@@ -209,7 +209,6 @@ void Item_func::fix_num_length_and_dec() ...@@ -209,7 +209,6 @@ void Item_func::fix_num_length_and_dec()
max_length=float_length(decimals); max_length=float_length(decimals);
} }
String *Item_int_func::val_str(String *str) String *Item_int_func::val_str(String *str)
{ {
longlong nr=val_int(); longlong nr=val_int();
......
...@@ -119,6 +119,7 @@ public: ...@@ -119,6 +119,7 @@ public:
{ {
return (null_value=args[0]->get_time(ltime)); return (null_value=args[0]->get_time(ltime));
} }
bool is_null() { (void) val_int(); return null_value; }
friend class udf_handler; friend class udf_handler;
}; };
...@@ -147,6 +148,7 @@ public: ...@@ -147,6 +148,7 @@ public:
longlong val_int() { return (longlong) val(); } longlong val_int() { return (longlong) val(); }
enum Item_result result_type () const { return hybrid_type; } enum Item_result result_type () const { return hybrid_type; }
void fix_length_and_dec() { fix_num_length_and_dec(); } void fix_length_and_dec() { fix_num_length_and_dec(); }
bool is_null() { (void) val(); return null_value; }
}; };
...@@ -161,6 +163,7 @@ class Item_num_op :public Item_func ...@@ -161,6 +163,7 @@ class Item_num_op :public Item_func
enum Item_result result_type () const { return hybrid_type; } enum Item_result result_type () const { return hybrid_type; }
void fix_length_and_dec() { fix_num_length_and_dec(); find_num_type(); } void fix_length_and_dec() { fix_num_length_and_dec(); find_num_type(); }
void find_num_type(void); void find_num_type(void);
bool is_null() { (void) val(); return null_value; }
}; };
......
...@@ -508,7 +508,7 @@ void sql_print_error(const char *format,...) ...@@ -508,7 +508,7 @@ void sql_print_error(const char *format,...)
extern uint32 server_id; extern uint32 server_id;
extern char *mysql_data_home,server_version[SERVER_VERSION_LENGTH], extern char *mysql_data_home,server_version[SERVER_VERSION_LENGTH],
max_sort_char, mysql_real_data_home[]; max_sort_char, mysql_real_data_home[];
extern my_string mysql_unix_port,mysql_tmpdir; extern my_string mysql_tmpdir;
extern const char *first_keyword, *localhost, *delayed_user; extern const char *first_keyword, *localhost, *delayed_user;
extern ulong refresh_version,flush_version, thread_id,query_id,opened_tables, extern ulong refresh_version,flush_version, thread_id,query_id,opened_tables,
created_tmp_tables, created_tmp_disk_tables, created_tmp_tables, created_tmp_disk_tables,
...@@ -522,7 +522,7 @@ extern ulong filesort_merge_passes; ...@@ -522,7 +522,7 @@ extern ulong filesort_merge_passes;
extern ulong select_range_check_count, select_range_count, select_scan_count; extern ulong select_range_check_count, select_range_count, select_scan_count;
extern ulong select_full_range_join_count,select_full_join_count, extern ulong select_full_range_join_count,select_full_join_count,
slave_open_temp_tables; slave_open_temp_tables;
extern uint test_flags,select_errors,mysql_port,ha_open_options; extern uint test_flags,select_errors,ha_open_options;
extern ulong thd_startup_options, slow_launch_threads, slow_launch_time; extern ulong thd_startup_options, slow_launch_threads, slow_launch_time;
extern time_t start_time; extern time_t start_time;
extern const char *command_name[]; extern const char *command_name[];
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include <signal.h> #include <signal.h>
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
#include <assert.h>
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
ulong max_allowed_packet=65536; ulong max_allowed_packet=65536;
...@@ -91,7 +90,7 @@ extern ulong mysqld_net_retry_count; ...@@ -91,7 +90,7 @@ extern ulong mysqld_net_retry_count;
typedef my_bool thr_alarm_t; typedef my_bool thr_alarm_t;
typedef my_bool ALARM; typedef my_bool ALARM;
#define thr_alarm_init(A) (*(A))=0 #define thr_alarm_init(A) (*(A))=0
#define thr_alarm_in_use(A) (*(A)) #define thr_alarm_in_use(A) (*(A) != 0)
#define thr_end_alarm(A) #define thr_end_alarm(A)
#define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C)) #define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C))
inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused))) inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused)))
...@@ -131,7 +130,7 @@ int my_net_init(NET *net, Vio* vio) ...@@ -131,7 +130,7 @@ int my_net_init(NET *net, Vio* vio)
net->no_send_ok = 0; net->no_send_ok = 0;
net->error=0; net->return_errno=0; net->return_status=0; net->error=0; net->return_errno=0; net->return_status=0;
net->timeout=(uint) net_read_timeout; /* Timeout for read */ net->timeout=(uint) net_read_timeout; /* Timeout for read */
net->pkt_nr=0; net->pkt_nr=net->compress_pkt_nr=0;
net->write_pos=net->read_pos = net->buff; net->write_pos=net->read_pos = net->buff;
net->last_error[0]=0; net->last_error[0]=0;
net->compress=0; net->reading_or_writing=0; net->compress=0; net->reading_or_writing=0;
...@@ -192,7 +191,7 @@ static my_bool net_realloc(NET *net, ulong length) ...@@ -192,7 +191,7 @@ static my_bool net_realloc(NET *net, ulong length)
void net_clear(NET *net) void net_clear(NET *net)
{ {
#ifndef EXTRA_DEBUG #ifndef EXTRA_DEBUG
int count; // One may get 'unused' warning int count; /* One may get 'unused' warn */
bool is_blocking=vio_is_blocking(net->vio); bool is_blocking=vio_is_blocking(net->vio);
if (is_blocking) if (is_blocking)
vio_blocking(net->vio, FALSE); vio_blocking(net->vio, FALSE);
...@@ -206,7 +205,7 @@ void net_clear(NET *net) ...@@ -206,7 +205,7 @@ void net_clear(NET *net)
vio_blocking(net->vio, TRUE); vio_blocking(net->vio, TRUE);
} }
#endif /* EXTRA_DEBUG */ #endif /* EXTRA_DEBUG */
net->pkt_nr=0; /* Ready for new command */ net->pkt_nr=net->compress_pkt_nr=0; /* Ready for new command */
net->write_pos=net->buff; net->write_pos=net->buff;
} }
...@@ -219,9 +218,12 @@ int net_flush(NET *net) ...@@ -219,9 +218,12 @@ int net_flush(NET *net)
if (net->buff != net->write_pos) if (net->buff != net->write_pos)
{ {
error=net_real_write(net,(char*) net->buff, error=net_real_write(net,(char*) net->buff,
(uint) (net->write_pos - net->buff)); (ulong) (net->write_pos - net->buff));
net->write_pos=net->buff; net->write_pos=net->buff;
} }
/* Sync packet number if using compression */
if (net->compress)
net->pkt_nr=net->compress_pkt_nr;
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -250,7 +252,7 @@ my_net_write(NET *net,const char *packet,ulong len) ...@@ -250,7 +252,7 @@ my_net_write(NET *net,const char *packet,ulong len)
{ {
const ulong z_size = MAX_THREE_BYTES; const ulong z_size = MAX_THREE_BYTES;
int3store(buff, z_size); int3store(buff, z_size);
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++); buff[3]= net->pkt_nr++;
if (net_write_buff(net, (char*) buff, NET_HEADER_SIZE) || if (net_write_buff(net, (char*) buff, NET_HEADER_SIZE) ||
net_write_buff(net, packet, z_size)) net_write_buff(net, packet, z_size))
return 1; return 1;
...@@ -259,7 +261,7 @@ my_net_write(NET *net,const char *packet,ulong len) ...@@ -259,7 +261,7 @@ my_net_write(NET *net,const char *packet,ulong len)
} }
/* Write last packet */ /* Write last packet */
int3store(buff,len); int3store(buff,len);
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++); buff[3]= net->pkt_nr++;
if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE)) if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE))
return 1; return 1;
return net_write_buff(net,packet,len); return net_write_buff(net,packet,len);
...@@ -277,7 +279,7 @@ my_net_write(NET *net,const char *packet,ulong len) ...@@ -277,7 +279,7 @@ my_net_write(NET *net,const char *packet,ulong len)
int int
net_write_command(NET *net,uchar command,const char *packet,ulong len) net_write_command(NET *net,uchar command,const char *packet,ulong len)
{ {
uint length=len+1; /* 1 extra byte for command */ ulong length=len+1; /* 1 extra byte for command */
uchar buff[NET_HEADER_SIZE+1]; uchar buff[NET_HEADER_SIZE+1];
uint header_size=NET_HEADER_SIZE+1; uint header_size=NET_HEADER_SIZE+1;
buff[4]=command; /* For first packet */ buff[4]=command; /* For first packet */
...@@ -289,7 +291,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len) ...@@ -289,7 +291,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len)
do do
{ {
int3store(buff, MAX_THREE_BYTES); int3store(buff, MAX_THREE_BYTES);
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++); buff[3]= net->pkt_nr++;
if (net_write_buff(net,(char*) buff, header_size) || if (net_write_buff(net,(char*) buff, header_size) ||
net_write_buff(net,packet,len)) net_write_buff(net,packet,len))
return 1; return 1;
...@@ -301,7 +303,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len) ...@@ -301,7 +303,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len)
len=length; /* Data left to be written */ len=length; /* Data left to be written */
} }
int3store(buff,length); int3store(buff,length);
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++); buff[3]= net->pkt_nr++;
return test(net_write_buff(net,(char*) buff,header_size) || return test(net_write_buff(net,(char*) buff,header_size) ||
net_write_buff(net,packet,len) || net_flush(net)); net_write_buff(net,packet,len) || net_flush(net));
} }
...@@ -314,7 +316,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len) ...@@ -314,7 +316,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len)
static int static int
net_write_buff(NET *net,const char *packet,ulong len) net_write_buff(NET *net,const char *packet,ulong len)
{ {
uint left_length=(uint) (net->buff_end - net->write_pos); ulong left_length=(ulong) (net->buff_end - net->write_pos);
while (len > left_length) while (len > left_length)
{ {
...@@ -340,10 +342,10 @@ net_write_buff(NET *net,const char *packet,ulong len) ...@@ -340,10 +342,10 @@ net_write_buff(NET *net,const char *packet,ulong len)
int int
net_real_write(NET *net,const char *packet,ulong len) net_real_write(NET *net,const char *packet,ulong len)
{ {
int length; long int length;
char *pos,*end; char *pos,*end;
thr_alarm_t alarmed; thr_alarm_t alarmed;
#if !defined(__WIN__) #if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
ALARM alarm_buff; ALARM alarm_buff;
#endif #endif
uint retry_count=0; uint retry_count=0;
...@@ -380,7 +382,7 @@ net_real_write(NET *net,const char *packet,ulong len) ...@@ -380,7 +382,7 @@ net_real_write(NET *net,const char *packet,ulong len)
} }
int3store(&b[NET_HEADER_SIZE],complen); int3store(&b[NET_HEADER_SIZE],complen);
int3store(b,len); int3store(b,len);
b[3]=(uchar) (net->pkt_nr++); b[3]=(uchar) (net->compress_pkt_nr++);
len+= header_length; len+= header_length;
packet= (char*) b; packet= (char*) b;
} }
...@@ -398,7 +400,7 @@ net_real_write(NET *net,const char *packet,ulong len) ...@@ -398,7 +400,7 @@ net_real_write(NET *net,const char *packet,ulong len)
pos=(char*) packet; end=pos+len; pos=(char*) packet; end=pos+len;
while (pos != end) while (pos != end)
{ {
if ((int) (length=vio_write(net->vio,pos,(int) (end-pos))) <= 0) if ((long) (length=vio_write(net->vio,pos,(ulong) (end-pos))) <= 0)
{ {
my_bool interrupted = vio_should_retry(net->vio); my_bool interrupted = vio_should_retry(net->vio);
#if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2)) #if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2))
...@@ -499,7 +501,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed) ...@@ -499,7 +501,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
{ {
my_bool interrupted = vio_should_retry(net->vio); my_bool interrupted = vio_should_retry(net->vio);
if (!thr_got_alarm(&alarmed) && interrupted) if (!thr_got_alarm(&alarmed) && interrupted)
{ /* Probably in MIT threads */ { /* Probably in MIT threads */
if (retry_count++ < RETRY_COUNT) if (retry_count++ < RETRY_COUNT)
continue; continue;
} }
...@@ -518,7 +520,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed) ...@@ -518,7 +520,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
This function reallocates the net->buff buffer if necessary. This function reallocates the net->buff buffer if necessary.
*/ */
static uint static ulong
my_real_read(NET *net, ulong *complen) my_real_read(NET *net, ulong *complen)
{ {
uchar *pos; uchar *pos;
...@@ -629,9 +631,9 @@ my_real_read(NET *net, ulong *complen) ...@@ -629,9 +631,9 @@ my_real_read(NET *net, ulong *complen)
if (net->buff[net->where_b] != (uchar) 255) if (net->buff[net->where_b] != (uchar) 255)
{ {
DBUG_PRINT("error", DBUG_PRINT("error",
("Packets out of order (Found: %d, expected %d)", ("Packets out of order (Found: %d, expected %u)",
(int) net->buff[net->where_b + 3], (int) net->buff[net->where_b + 3],
(uint) (uchar) net->pkt_nr)); net->pkt_nr));
#ifdef EXTRA_DEBUG #ifdef EXTRA_DEBUG
fprintf(stderr,"Packets out of order (Found: %d, expected %d)\n", fprintf(stderr,"Packets out of order (Found: %d, expected %d)\n",
(int) net->buff[net->where_b + 3], (int) net->buff[net->where_b + 3],
...@@ -644,7 +646,7 @@ my_real_read(NET *net, ulong *complen) ...@@ -644,7 +646,7 @@ my_real_read(NET *net, ulong *complen)
#endif #endif
goto end; goto end;
} }
net->pkt_nr++; net->compress_pkt_nr= ++net->pkt_nr;
#ifdef HAVE_COMPRESS #ifdef HAVE_COMPRESS
if (net->compress) if (net->compress)
{ {
...@@ -712,7 +714,7 @@ my_net_read(NET *net) ...@@ -712,7 +714,7 @@ my_net_read(NET *net)
if (len == MAX_THREE_BYTES) if (len == MAX_THREE_BYTES)
{ {
/* First packet of a multi-packet. Concatenate the packets */ /* First packet of a multi-packet. Concatenate the packets */
int save_pos = net->where_b; ulong save_pos = net->where_b;
ulong total_length=0; ulong total_length=0;
do do
{ {
...@@ -822,8 +824,8 @@ my_net_read(NET *net) ...@@ -822,8 +824,8 @@ my_net_read(NET *net)
net->read_pos= net->buff+ first_packet_offset + NET_HEADER_SIZE; net->read_pos= net->buff+ first_packet_offset + NET_HEADER_SIZE;
net->buf_length= buf_length; net->buf_length= buf_length;
net->remain_in_buf= buf_length - start_of_packet; net->remain_in_buf= (ulong) (buf_length - start_of_packet);
len = ((uint) (start_of_packet - first_packet_offset) - NET_HEADER_SIZE - len = ((ulong) (start_of_packet - first_packet_offset) - NET_HEADER_SIZE -
multi_byte_packet); multi_byte_packet);
net->save_char= net->read_pos[len]; /* Must be saved */ net->save_char= net->read_pos[len]; /* Must be saved */
net->read_pos[len]=0; /* Safeguard for mysql_use_result */ net->read_pos[len]=0; /* Safeguard for mysql_use_result */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment