Big purge about embedded library (scrum)
client/mysql.cc: #ifdef EMBEDDED_LIBRARY added client/mysqltest.c: #ifdef EMBEDDED_LIBRARY added include/mysql.h: MYSQL structure changed for embedded case include/mysql_com.h: NET structure changed for embedded case include/violite.h: no need to special vio types libmysqld/embedded_priv.h: superfluous functions removed libmysqld/lib_sql.cc: several modifications libmysqld/lib_vio.c: file should be removed libmysqld/libmysqld.c: several modifications sql/ha_berkeley.cc: modification for embedded case sql/ha_innodb.cc: modifications for embedded case sql/ha_myisam.cc: modifications for embedded case sql/item_func.cc: modifications for embedded case sql/log.cc: #ifdef-ed parts of file which don't work in embedded case sql/log_event.cc: #ifdef-ed parts of file which don't work in embedded case sql/log_event.h: #ifdef-ed parts of file which don't work in embedded case sql/mf_iocache.cc: file doesn't work in embedded case sql/mini_client.cc: file should be removed from embedded library sql/mysqld.cc: several modifications sql/net_pkg.cc: #ifdef-ed functions which can't work in embedded case sql/net_serv.cc: file doesn't work in embedded case sql/repl_failsafe.cc: no replication in embedded case sql/repl_failsafe.h: no replication in embedded case sql/set_var.cc: #ifdef-ed variables which have no sense in embedded library sql/set_var.h: #ifdef-ed variables which have no sense in embedded library sql/slave.cc: no replication in embedded library sql/slave.h: no replication in embedded library sql/sql_acl.cc: modifications for embedded case sql/sql_cache.cc: modifications for embedded case sql/sql_class.cc: modifications for embedded case sql/sql_class.h: THD structure modified for embedded case sql/sql_db.cc: modification for embedded case sql/sql_error.cc: modification for embedded case sql/sql_help.cc: modification for embedded case sql/sql_load.cc: #ifdef-ed code which doesn't work in embedded case sql/sql_parse.cc: #ifdef-ed code which doesn't work in embedded case sql/sql_prepare.cc: #ifdef-ed code which doesn't work in embedded case sql/sql_repl.cc: no replication in embedded library sql/sql_repl.h: no replication in embedded library sql/sql_select.cc: query cache don't work now in embedded library sql/sql_show.cc: modifications for embedded case
This commit is contained in:
parent
e9525947d4
commit
632717fd8d
@ -2464,7 +2464,9 @@ sql_real_connect(char *host,char *database,char *user,char *password,
|
|||||||
return -1; // Retryable
|
return -1; // Retryable
|
||||||
}
|
}
|
||||||
connected=1;
|
connected=1;
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
mysql.reconnect=info_flag ? 1 : 0; // We want to know if this happens
|
mysql.reconnect=info_flag ? 1 : 0; // We want to know if this happens
|
||||||
|
#endif
|
||||||
#ifdef HAVE_READLINE
|
#ifdef HAVE_READLINE
|
||||||
build_completion_hash(rehash, 1);
|
build_completion_hash(rehash, 1);
|
||||||
#endif
|
#endif
|
||||||
@ -2558,12 +2560,14 @@ com_status(String *buffer __attribute__((unused)),
|
|||||||
tee_fprintf(stdout, "Client characterset:\t%s\n",
|
tee_fprintf(stdout, "Client characterset:\t%s\n",
|
||||||
system_charset_info->name);
|
system_charset_info->name);
|
||||||
tee_fprintf(stdout, "Server characterset:\t%s\n", mysql.charset->name);
|
tee_fprintf(stdout, "Server characterset:\t%s\n", mysql.charset->name);
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (strstr(mysql_get_host_info(&mysql),"TCP/IP") || ! mysql.unix_socket)
|
if (strstr(mysql_get_host_info(&mysql),"TCP/IP") || ! mysql.unix_socket)
|
||||||
tee_fprintf(stdout, "TCP port:\t\t%d\n", mysql.port);
|
tee_fprintf(stdout, "TCP port:\t\t%d\n", mysql.port);
|
||||||
else
|
else
|
||||||
tee_fprintf(stdout, "UNIX socket:\t\t%s\n", mysql.unix_socket);
|
tee_fprintf(stdout, "UNIX socket:\t\t%s\n", mysql.unix_socket);
|
||||||
if (mysql.net.compress)
|
if (mysql.net.compress)
|
||||||
tee_fprintf(stdout, "Protocol:\t\tCompressed\n");
|
tee_fprintf(stdout, "Protocol:\t\tCompressed\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
if ((status=mysql_stat(&mysql)) && !mysql_error(&mysql)[0])
|
if ((status=mysql_stat(&mysql)) && !mysql_error(&mysql)[0])
|
||||||
{
|
{
|
||||||
@ -2829,11 +2833,13 @@ static const char* construct_prompt()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'p':
|
case 'p':
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (strstr(mysql_get_host_info(&mysql),"TCP/IP") ||
|
if (strstr(mysql_get_host_info(&mysql),"TCP/IP") ||
|
||||||
! mysql.unix_socket)
|
! mysql.unix_socket)
|
||||||
add_int_to_prompt(mysql.port);
|
add_int_to_prompt(mysql.port);
|
||||||
else
|
else
|
||||||
processed_prompt.append(strrchr(mysql.unix_socket,'/')+1);
|
processed_prompt.append(strrchr(mysql.unix_socket,'/')+1);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case 'U':
|
case 'U':
|
||||||
if (!full_username)
|
if (!full_username)
|
||||||
@ -2975,4 +2981,3 @@ void sql_element_free(void *ptr)
|
|||||||
}
|
}
|
||||||
#endif /* EMBEDDED_LIBRARY */
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
|
||||||
|
@ -314,10 +314,6 @@ int mysql_rpl_parse_enabled(MYSQL* mysql __attribute__((unused))) { return 1; }
|
|||||||
my_bool mysql_rpl_probe(MYSQL *mysql __attribute__((unused))) { return 1; }
|
my_bool mysql_rpl_probe(MYSQL *mysql __attribute__((unused))) { return 1; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EMBEDDED_LIBRARY
|
|
||||||
#define mysql_send_query mysql_real_query
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MAX_SERVER_ARGS 20
|
#define MAX_SERVER_ARGS 20
|
||||||
|
|
||||||
static int embedded_server_arg_count=0;
|
static int embedded_server_arg_count=0;
|
||||||
@ -1325,6 +1321,7 @@ int close_connection(struct st_query* q)
|
|||||||
{
|
{
|
||||||
if (!strcmp(con->name, name))
|
if (!strcmp(con->name, name))
|
||||||
{
|
{
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (q->type == Q_DIRTY_CLOSE)
|
if (q->type == Q_DIRTY_CLOSE)
|
||||||
{
|
{
|
||||||
if (con->mysql.net.vio)
|
if (con->mysql.net.vio)
|
||||||
@ -1333,7 +1330,7 @@ int close_connection(struct st_query* q)
|
|||||||
con->mysql.net.vio = 0;
|
con->mysql.net.vio = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
mysql_close(&con->mysql);
|
mysql_close(&con->mysql);
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
@ -183,18 +183,14 @@ enum mysql_rpl_type
|
|||||||
MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN
|
MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN
|
||||||
};
|
};
|
||||||
|
|
||||||
struct st_mysql_res;
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
|
||||||
typedef struct st_mysql
|
typedef struct st_mysql
|
||||||
{
|
{
|
||||||
NET net; /* Communication parameters */
|
NET net; /* Communication parameters */
|
||||||
gptr connector_fd; /* ConnectorFd for SSL */
|
gptr connector_fd; /* ConnectorFd for SSL */
|
||||||
#ifndef _0EMBEDDED_LIBRARY
|
|
||||||
char *host,*user,*passwd,*unix_socket,*server_version,*host_info,*info;
|
char *host,*user,*passwd,*unix_socket,*server_version,*host_info,*info;
|
||||||
#endif
|
|
||||||
#ifdef EMBEDDED_LIBRARY
|
|
||||||
struct st_mysql_res *result;
|
|
||||||
#endif
|
|
||||||
char *db;
|
char *db;
|
||||||
struct charset_info_st *charset;
|
struct charset_info_st *charset;
|
||||||
MYSQL_FIELD *fields;
|
MYSQL_FIELD *fields;
|
||||||
@ -234,11 +230,31 @@ typedef struct st_mysql
|
|||||||
LIST *stmts; /* list of all statements */
|
LIST *stmts; /* list of all statements */
|
||||||
} MYSQL;
|
} MYSQL;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
struct st_mysql_res;
|
||||||
|
|
||||||
|
typedef struct st_mysql
|
||||||
|
{
|
||||||
|
struct st_mysql_res *result;
|
||||||
|
void *thd;
|
||||||
|
struct charset_info_st *charset;
|
||||||
|
unsigned int server_language;
|
||||||
|
MYSQL_FIELD *fields;
|
||||||
|
MEM_ROOT field_alloc;
|
||||||
|
my_ulonglong affected_rows;
|
||||||
|
unsigned int field_count;
|
||||||
|
struct st_mysql_options options;
|
||||||
|
enum mysql_status status;
|
||||||
|
my_bool free_me; /* If free in mysql_close */
|
||||||
|
my_ulonglong insert_id; /* id if insert on table with NEXTNR */
|
||||||
|
unsigned int last_errno;
|
||||||
|
char *last_error;
|
||||||
|
} MYSQL;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct st_mysql_res {
|
typedef struct st_mysql_res {
|
||||||
#ifdef EMBEDDED_LIBRARY
|
|
||||||
const char *query_str;
|
|
||||||
#endif
|
|
||||||
my_ulonglong row_count;
|
my_ulonglong row_count;
|
||||||
MYSQL_FIELD *fields;
|
MYSQL_FIELD *fields;
|
||||||
MYSQL_DATA *data;
|
MYSQL_DATA *data;
|
||||||
|
@ -121,16 +121,15 @@ typedef struct st_vio Vio;
|
|||||||
#define MAX_BLOB_WIDTH 8192 /* Default width for blob */
|
#define MAX_BLOB_WIDTH 8192 /* Default width for blob */
|
||||||
|
|
||||||
typedef struct st_net {
|
typedef struct st_net {
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
Vio* vio;
|
Vio* vio;
|
||||||
unsigned char *buff,*buff_end,*write_pos,*read_pos;
|
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,max_packet_size;
|
unsigned long max_packet,max_packet_size;
|
||||||
unsigned int last_errno,pkt_nr,compress_pkt_nr;
|
unsigned int pkt_nr,compress_pkt_nr;
|
||||||
unsigned int write_timeout, read_timeout, retry_count;
|
unsigned int write_timeout, read_timeout, retry_count;
|
||||||
int fcntl;
|
int fcntl;
|
||||||
char last_error[MYSQL_ERRMSG_SIZE];
|
my_bool compress;
|
||||||
unsigned char error;
|
|
||||||
my_bool return_errno,compress;
|
|
||||||
/*
|
/*
|
||||||
The following variable is set if we are doing several queries in one
|
The following variable is set if we are doing several queries in one
|
||||||
command ( as in LOAD TABLE ... FROM MASTER ),
|
command ( as in LOAD TABLE ... FROM MASTER ),
|
||||||
@ -140,13 +139,18 @@ typedef struct st_net {
|
|||||||
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 report_error; /* We should report error (we have unreported error) */
|
|
||||||
my_bool no_send_ok;
|
my_bool no_send_ok;
|
||||||
/*
|
/*
|
||||||
Pointer to query object in query cache, do not equal NULL (0) for
|
Pointer to query object in query cache, do not equal NULL (0) for
|
||||||
queries in cache that have not stored its results yet
|
queries in cache that have not stored its results yet
|
||||||
*/
|
*/
|
||||||
|
#endif
|
||||||
|
char last_error[MYSQL_ERRMSG_SIZE];
|
||||||
|
unsigned int last_errno;
|
||||||
|
unsigned char error;
|
||||||
gptr query_cache_query;
|
gptr query_cache_query;
|
||||||
|
my_bool report_error; /* We should report error (we have unreported error) */
|
||||||
|
my_bool return_errno;
|
||||||
} NET;
|
} NET;
|
||||||
|
|
||||||
#define packet_error (~(unsigned long) 0)
|
#define packet_error (~(unsigned long) 0)
|
||||||
|
@ -32,11 +32,7 @@ extern "C" {
|
|||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
enum enum_vio_type { VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET,
|
enum enum_vio_type { VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET,
|
||||||
VIO_TYPE_NAMEDPIPE, VIO_TYPE_SSL,VIO_TYPE_SHARED_MEMORY
|
VIO_TYPE_NAMEDPIPE, VIO_TYPE_SSL };
|
||||||
#ifdef EMBEDDED_LIBRARY
|
|
||||||
, VIO_TYPE_BUFFER
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifndef __WIN__
|
#ifndef __WIN__
|
||||||
#define HANDLE void *
|
#define HANDLE void *
|
||||||
|
@ -23,12 +23,9 @@
|
|||||||
#include <my_pthread.h>
|
#include <my_pthread.h>
|
||||||
|
|
||||||
C_MODE_START
|
C_MODE_START
|
||||||
extern void start_embedded_connection(NET * net);
|
|
||||||
extern void end_embedded_connection(NET * net);
|
|
||||||
extern void lib_connection_phase(NET *net, int phase);
|
extern void lib_connection_phase(NET *net, int phase);
|
||||||
extern void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db);
|
extern void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db);
|
||||||
extern void *create_embedded_thd(Vio *vio, unsigned char *buff, int client_flag, char *db);
|
extern void *create_embedded_thd(int client_flag, char *db);
|
||||||
extern NET *get_mysql_net(MYSQL *mysql);
|
|
||||||
extern my_bool simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
extern my_bool simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
||||||
ulong length, my_bool skipp_check);
|
ulong length, my_bool skipp_check);
|
||||||
C_MODE_END
|
C_MODE_END
|
||||||
|
@ -36,7 +36,7 @@ static char inited, org_my_init_done;
|
|||||||
|
|
||||||
#define SCRAMBLE_LENGTH 8
|
#define SCRAMBLE_LENGTH 8
|
||||||
C_MODE_START
|
C_MODE_START
|
||||||
#include "lib_vio.c"
|
#include <mysql.h>
|
||||||
#include "errmsg.h"
|
#include "errmsg.h"
|
||||||
|
|
||||||
static int check_connections1(THD * thd);
|
static int check_connections1(THD * thd);
|
||||||
@ -50,198 +50,40 @@ char * get_mysql_real_data_home(){ return mysql_real_data_home;};
|
|||||||
my_bool simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
my_bool simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
||||||
ulong length, my_bool skipp_check)
|
ulong length, my_bool skipp_check)
|
||||||
{
|
{
|
||||||
NET *net= &mysql->net;
|
|
||||||
my_bool result= 1;
|
my_bool result= 1;
|
||||||
THD *thd=(THD *) net->vio->dest_thd;
|
THD *thd=(THD *) mysql->thd;
|
||||||
|
|
||||||
/* Check that we are calling the client functions in right order */
|
/* Check that we are calling the client functions in right order */
|
||||||
if (mysql->status != MYSQL_STATUS_READY)
|
if (mysql->status != MYSQL_STATUS_READY)
|
||||||
{
|
{
|
||||||
strmov(net->last_error,ER(mysql->net.last_errno=CR_COMMANDS_OUT_OF_SYNC));
|
strmov(thd->net.last_error,ER(thd->net.last_errno=CR_COMMANDS_OUT_OF_SYNC));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear result variables */
|
/* Clear result variables */
|
||||||
mysql->net.last_error[0]=0;
|
thd->net.last_error[0]=0;
|
||||||
mysql->net.last_errno=0;
|
thd->net.last_errno=0;
|
||||||
mysql->info=0;
|
|
||||||
mysql->affected_rows= ~(my_ulonglong) 0;
|
mysql->affected_rows= ~(my_ulonglong) 0;
|
||||||
|
|
||||||
/* Clear receive buffer and vio packet list */
|
|
||||||
net_clear(net);
|
|
||||||
vio_reset(net->vio);
|
|
||||||
|
|
||||||
thd->store_globals(); // Fix if more than one connect
|
thd->store_globals(); // Fix if more than one connect
|
||||||
// thd->net.last_error[0]=0; // Clear error message
|
|
||||||
// thd->net.last_errno=0;
|
|
||||||
|
|
||||||
net_new_transaction(net);
|
|
||||||
result= dispatch_command(command, thd, (char *) arg, length + 1);
|
result= dispatch_command(command, thd, (char *) arg, length + 1);
|
||||||
|
|
||||||
if (!skipp_check)
|
if (!skipp_check)
|
||||||
result= net->last_errno ? -1 : 0;
|
result= thd->net.last_errno ? -1 : 0;
|
||||||
|
|
||||||
|
mysql->last_error= thd->net.last_error;
|
||||||
|
mysql->last_errno= thd->net.last_errno;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DUMMY
|
|
||||||
void lib_connection_phase(NET * net, int phase)
|
|
||||||
{
|
|
||||||
THD * thd;
|
|
||||||
thd = (THD *)(net->vio->dest_thd);
|
|
||||||
if (thd)
|
|
||||||
{
|
|
||||||
switch (phase)
|
|
||||||
{
|
|
||||||
case 2:
|
|
||||||
check_connections2(thd);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
C_MODE_END
|
C_MODE_END
|
||||||
|
|
||||||
|
void THD::clear_error()
|
||||||
void start_embedded_conn1(NET * net)
|
|
||||||
{
|
{
|
||||||
THD * thd = new THD;
|
net.last_error[0]= 0;
|
||||||
my_net_init(&thd->net,NULL);
|
net.last_errno= 0;
|
||||||
/* if (protocol_version>9) */
|
net.report_error= 0;
|
||||||
thd->net.return_errno=1;
|
|
||||||
thd->thread_id = thread_id++;
|
|
||||||
|
|
||||||
Vio * v = net->vio;
|
|
||||||
if (!v)
|
|
||||||
{
|
|
||||||
v = vio_new(0,VIO_BUFFER,0);
|
|
||||||
net->vio = v;
|
|
||||||
}
|
}
|
||||||
if (v)
|
|
||||||
{
|
|
||||||
v -> dest_thd = thd;
|
|
||||||
}
|
|
||||||
thd->net.vio = v;
|
|
||||||
if (thd->store_globals())
|
|
||||||
{
|
|
||||||
fprintf(stderr,"store_globals failed.\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
thd->mysys_var=my_thread_var;
|
|
||||||
thd->dbug_thread_id=my_thread_id();
|
|
||||||
thd->thread_stack= (char*) &thd;
|
|
||||||
|
|
||||||
if (thd->variables.max_join_size == (ulong) HA_POS_ERROR)
|
|
||||||
thd->options |= OPTION_BIG_SELECTS;
|
|
||||||
|
|
||||||
thd->proc_info=0; // Remove 'login'
|
|
||||||
thd->command=COM_SLEEP;
|
|
||||||
thd->version=refresh_version;
|
|
||||||
thd->set_time();
|
|
||||||
bzero(thd->scramble, sizeof(thd->scramble));
|
|
||||||
init_sql_alloc(&thd->mem_root,8192,8192);
|
|
||||||
|
|
||||||
check_connections1(thd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
check_connections1(THD *thd)
|
|
||||||
{
|
|
||||||
uint connect_errors=0;
|
|
||||||
NET *net= &thd->net;
|
|
||||||
/*
|
|
||||||
** store the connection details
|
|
||||||
*/
|
|
||||||
DBUG_PRINT("info", (("check_connections called by thread %d"),
|
|
||||||
thd->thread_id));
|
|
||||||
DBUG_PRINT("general",("New connection received on %s",
|
|
||||||
vio_description(net->vio)));
|
|
||||||
if (!thd->host) // If TCP/IP connection
|
|
||||||
{
|
|
||||||
thd->host=(char*) localhost;
|
|
||||||
}
|
|
||||||
else /* Hostname given means that the connection was on a socket */
|
|
||||||
{
|
|
||||||
DBUG_PRINT("general",("Host: %s",thd->host));
|
|
||||||
thd->ip=0;
|
|
||||||
bzero((char*) &thd->remote,sizeof(struct sockaddr));
|
|
||||||
}
|
|
||||||
//vio_keepalive(net->vio, TRUE);
|
|
||||||
|
|
||||||
/* nasty, but any other way? */
|
|
||||||
uint pkt_len = 0;
|
|
||||||
|
|
||||||
char buff[80],*end;
|
|
||||||
int client_flags = CLIENT_LONG_FLAG | CLIENT_CONNECT_WITH_DB |
|
|
||||||
CLIENT_TRANSACTIONS;
|
|
||||||
LINT_INIT(pkt_len);
|
|
||||||
|
|
||||||
end=strmov(buff,server_version)+1;
|
|
||||||
int4store((uchar*) end,thd->thread_id);
|
|
||||||
end+=4;
|
|
||||||
memcpy(end,thd->scramble,SCRAMBLE_LENGTH+1);
|
|
||||||
end+=SCRAMBLE_LENGTH +1;
|
|
||||||
int2store(end,client_flags);
|
|
||||||
end[2]=MY_CHARSET_CURRENT;
|
|
||||||
int2store(end+3,thd->server_status);
|
|
||||||
bzero(end+5,13);
|
|
||||||
end+=18;
|
|
||||||
if (net_write_command(net,protocol_version,
|
|
||||||
NullS, 0,
|
|
||||||
buff, (uint) (end-buff)))
|
|
||||||
{
|
|
||||||
inc_host_errors(&thd->remote.sin_addr);
|
|
||||||
return(ER_HANDSHAKE_ERROR);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MIN_HANDSHAKE_SIZE 6
|
|
||||||
|
|
||||||
static int
|
|
||||||
check_connections2(THD * thd)
|
|
||||||
{
|
|
||||||
uint connect_errors=0;
|
|
||||||
uint pkt_len = 0;
|
|
||||||
NET * net = &thd -> net;
|
|
||||||
if (protocol_version>9) net -> return_errno=1;
|
|
||||||
|
|
||||||
if ( (pkt_len=my_net_read(net)) == packet_error ||
|
|
||||||
pkt_len < MIN_HANDSHAKE_SIZE)
|
|
||||||
{
|
|
||||||
inc_host_errors(&thd->remote.sin_addr);
|
|
||||||
return(ER_HANDSHAKE_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _CUSTOMCONFIG_
|
|
||||||
#include "_cust_sql_parse.h"
|
|
||||||
#endif
|
|
||||||
if (connect_errors)
|
|
||||||
reset_host_errors(&thd->remote.sin_addr);
|
|
||||||
if (thd->packet.alloc(thd->variables.net_buffer_length))
|
|
||||||
return(ER_OUT_OF_RESOURCES);
|
|
||||||
|
|
||||||
thd->client_capabilities=uint2korr(net->read_pos);
|
|
||||||
|
|
||||||
thd->max_client_packet_length=uint3korr(net->read_pos+2);
|
|
||||||
char *user= (char*) net->read_pos+5;
|
|
||||||
char *passwd= strend(user)+1;
|
|
||||||
char *db=0;
|
|
||||||
if (passwd[0] && strlen(passwd) != SCRAMBLE_LENGTH)
|
|
||||||
return ER_HANDSHAKE_ERROR;
|
|
||||||
if (thd->client_capabilities & CLIENT_CONNECT_WITH_DB)
|
|
||||||
db=strend(passwd)+1;
|
|
||||||
if (thd->client_capabilities & CLIENT_TRANSACTIONS)
|
|
||||||
thd->net.return_status= &thd->server_status;
|
|
||||||
net->read_timeout=thd->variables.net_read_timeout;
|
|
||||||
if (check_user(thd,COM_CONNECT, user, passwd, db, 1))
|
|
||||||
return (-1);
|
|
||||||
thd->password=test(passwd[0]);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
C_MODE_END
|
|
||||||
#endif /* _DUMMY */
|
|
||||||
|
|
||||||
static bool check_user(THD *thd,enum_server_command command, const char *user,
|
static bool check_user(THD *thd,enum_server_command command, const char *user,
|
||||||
const char *passwd, const char *db, bool check_count)
|
const char *passwd, const char *db, bool check_count)
|
||||||
@ -430,581 +272,6 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __DUMMY
|
|
||||||
int STDCALL mysql_server_init(int argc, char **argv, char **groups)
|
|
||||||
{
|
|
||||||
char glob_hostname[FN_REFLEN];
|
|
||||||
|
|
||||||
/* This mess is to allow people to call the init function without
|
|
||||||
* having to mess with a fake argv */
|
|
||||||
int *argcp;
|
|
||||||
char ***argvp;
|
|
||||||
int fake_argc = 1;
|
|
||||||
char *fake_argv[] = { (char *)"", 0 };
|
|
||||||
const char *fake_groups[] = { "server", "embedded", 0 };
|
|
||||||
if (argc)
|
|
||||||
{
|
|
||||||
argcp = &argc;
|
|
||||||
argvp = (char***) &argv;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
argcp = &fake_argc;
|
|
||||||
argvp = (char ***) &fake_argv;
|
|
||||||
}
|
|
||||||
if (!groups)
|
|
||||||
groups = (char**) fake_groups;
|
|
||||||
|
|
||||||
my_umask=0660; // Default umask for new files
|
|
||||||
my_umask_dir=0700; // Default umask for new directories
|
|
||||||
|
|
||||||
/* Only call MY_INIT() if it hasn't been called before */
|
|
||||||
if (!inited)
|
|
||||||
{
|
|
||||||
inited=1;
|
|
||||||
org_my_init_done=my_init_done;
|
|
||||||
}
|
|
||||||
if (!org_my_init_done)
|
|
||||||
{
|
|
||||||
MY_INIT((char *)"mysql_embedded"); // init my_sys library & pthreads
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Make a copy of the arguments to guard against applications that
|
|
||||||
may change or move the initial arguments.
|
|
||||||
*/
|
|
||||||
if (argvp == &argv)
|
|
||||||
if (!(copy_arguments_ptr= argv= copy_arguments(argc, argv)))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
tzset(); // Set tzname
|
|
||||||
|
|
||||||
start_time=time((time_t*) 0);
|
|
||||||
#ifdef HAVE_TZNAME
|
|
||||||
#if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT)
|
|
||||||
{
|
|
||||||
struct tm tm_tmp;
|
|
||||||
localtime_r(&start_time,&tm_tmp);
|
|
||||||
strmov(time_zone,tzname[tm_tmp.tm_isdst != 0 ? 1 : 0]);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
{
|
|
||||||
struct tm *start_tm;
|
|
||||||
start_tm=localtime(&start_time);
|
|
||||||
strmov(time_zone,tzname[start_tm->tm_isdst != 0 ? 1 : 0]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (gethostname(glob_hostname,sizeof(glob_hostname)-4) < 0)
|
|
||||||
strmov(glob_hostname,"mysql");
|
|
||||||
#ifndef DBUG_OFF
|
|
||||||
strxmov(strend(server_version),MYSQL_SERVER_SUFFIX,"-debug",NullS);
|
|
||||||
#else
|
|
||||||
strmov(strend(server_version),MYSQL_SERVER_SUFFIX);
|
|
||||||
#endif
|
|
||||||
load_defaults("my", (const char **) groups, argcp, argvp);
|
|
||||||
defaults_argv=*argvp;
|
|
||||||
|
|
||||||
/* Get default temporary directory */
|
|
||||||
opt_mysql_tmpdir=getenv("TMPDIR"); /* Use this if possible */
|
|
||||||
#if defined( __WIN__) || defined(OS2)
|
|
||||||
if (!opt_mysql_tmpdir)
|
|
||||||
opt_mysql_tmpdir=getenv("TEMP");
|
|
||||||
if (!opt_mysql_tmpdir)
|
|
||||||
opt_mysql_tmpdir=getenv("TMP");
|
|
||||||
#endif
|
|
||||||
if (!opt_mysql_tmpdir || !opt_mysql_tmpdir[0])
|
|
||||||
opt_mysql_tmpdir=(char*) P_tmpdir; /* purecov: inspected */
|
|
||||||
|
|
||||||
set_options();
|
|
||||||
get_options(*argcp, *argvp);
|
|
||||||
|
|
||||||
if (opt_log || opt_update_log || opt_slow_log || opt_bin_log)
|
|
||||||
strcat(server_version,"-log");
|
|
||||||
DBUG_PRINT("info",("%s Ver %s for %s on %s\n",my_progname,
|
|
||||||
server_version, SYSTEM_TYPE,MACHINE_TYPE));
|
|
||||||
|
|
||||||
/* These must be set early */
|
|
||||||
|
|
||||||
(void) pthread_mutex_init(&LOCK_mysql_create_db,MY_MUTEX_INIT_SLOW);
|
|
||||||
(void) pthread_mutex_init(&LOCK_Acl,MY_MUTEX_INIT_SLOW);
|
|
||||||
(void) pthread_mutex_init(&LOCK_open,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_mapped_file,MY_MUTEX_INIT_SLOW);
|
|
||||||
(void) pthread_mutex_init(&LOCK_status,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_error_log,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_delayed_insert,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_delayed_status,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_delayed_create,MY_MUTEX_INIT_SLOW);
|
|
||||||
(void) pthread_mutex_init(&LOCK_manager,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_crypt,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_bytes_sent,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_bytes_received,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_timezone,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_rpl_status, MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_active_mi, MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_global_system_variables, MY_MUTEX_INIT_FAST);
|
|
||||||
(void) my_rwlock_init(&LOCK_grant, NULL);
|
|
||||||
(void) pthread_cond_init(&COND_thread_count,NULL);
|
|
||||||
(void) pthread_cond_init(&COND_refresh,NULL);
|
|
||||||
(void) pthread_cond_init(&COND_thread_cache,NULL);
|
|
||||||
(void) pthread_cond_init(&COND_flush_thread_cache,NULL);
|
|
||||||
(void) pthread_cond_init(&COND_manager,NULL);
|
|
||||||
(void) pthread_cond_init(&COND_rpl_status, NULL);
|
|
||||||
|
|
||||||
if (set_default_charset_by_name(sys_charset.value, MYF(MY_WME)))
|
|
||||||
{
|
|
||||||
mysql_server_end();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
charsets_list = list_charsets(MYF(MY_CS_COMPILED|MY_CS_CONFIG));
|
|
||||||
|
|
||||||
/* Parameter for threads created for connections */
|
|
||||||
(void) pthread_attr_init(&connection_attrib);
|
|
||||||
(void) pthread_attr_setdetachstate(&connection_attrib,
|
|
||||||
PTHREAD_CREATE_DETACHED);
|
|
||||||
pthread_attr_setstacksize(&connection_attrib,thread_stack);
|
|
||||||
pthread_attr_setscope(&connection_attrib, PTHREAD_SCOPE_SYSTEM);
|
|
||||||
|
|
||||||
#if defined( SET_RLIMIT_NOFILE) || defined( OS2)
|
|
||||||
/* connections and databases needs lots of files */
|
|
||||||
{
|
|
||||||
uint wanted_files=10+(uint) max(max_connections*5,
|
|
||||||
max_connections+table_cache_size*2);
|
|
||||||
set_if_bigger(wanted_files, open_files_limit);
|
|
||||||
// Note that some system returns 0 if we succeed here:
|
|
||||||
uint files=set_maximum_open_files(wanted_files);
|
|
||||||
if (files && files < wanted_files && ! open_files_limit)
|
|
||||||
{
|
|
||||||
max_connections= (ulong) min((files-10),max_connections);
|
|
||||||
table_cache_size= (ulong) max((files-10-max_connections)/2,64);
|
|
||||||
DBUG_PRINT("warning",
|
|
||||||
("Changed limits: max_connections: %ld table_cache: %ld",
|
|
||||||
max_connections,table_cache_size));
|
|
||||||
sql_print_error("Warning: Changed limits: max_connections: %ld table_cache: %ld",max_connections,table_cache_size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
unireg_init(opt_specialflag); /* Set up extern variabels */
|
|
||||||
init_errmessage(); /* Read error messages from file */
|
|
||||||
lex_init();
|
|
||||||
item_init();
|
|
||||||
set_var_init();
|
|
||||||
mysys_uses_curses=0;
|
|
||||||
#ifdef USE_REGEX
|
|
||||||
regex_init();
|
|
||||||
#endif
|
|
||||||
if (use_temp_pool && bitmap_init(&temp_pool,1024,1))
|
|
||||||
{
|
|
||||||
mysql_server_end();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
We have enough space for fiddling with the argv, continue
|
|
||||||
*/
|
|
||||||
umask(((~my_umask) & 0666));
|
|
||||||
table_cache_init();
|
|
||||||
hostname_cache_init();
|
|
||||||
query_cache_result_size_limit(query_cache_limit);
|
|
||||||
query_cache_resize(query_cache_size);
|
|
||||||
randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2);
|
|
||||||
reset_floating_point_exceptions();
|
|
||||||
init_thr_lock();
|
|
||||||
init_slave_list();
|
|
||||||
|
|
||||||
/* Setup log files */
|
|
||||||
if (opt_log)
|
|
||||||
open_log(&mysql_log, glob_hostname, opt_logname, ".log", NullS,
|
|
||||||
LOG_NORMAL);
|
|
||||||
if (opt_update_log)
|
|
||||||
{
|
|
||||||
open_log(&mysql_update_log, glob_hostname, opt_update_logname, "",
|
|
||||||
NullS, LOG_NEW);
|
|
||||||
using_update_log=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opt_slow_log)
|
|
||||||
open_log(&mysql_slow_log, glob_hostname, opt_slow_logname, "-slow.log",
|
|
||||||
NullS, LOG_NORMAL);
|
|
||||||
if (ha_init())
|
|
||||||
{
|
|
||||||
sql_print_error("Can't init databases");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
ha_key_cache();
|
|
||||||
#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT)
|
|
||||||
if (locked_in_memory && !geteuid())
|
|
||||||
{
|
|
||||||
if (mlockall(MCL_CURRENT))
|
|
||||||
{
|
|
||||||
sql_print_error("Warning: Failed to lock memory. Errno: %d\n",errno);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
locked_in_memory=1;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
locked_in_memory=0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (opt_myisam_log)
|
|
||||||
(void) mi_log( 1 );
|
|
||||||
ft_init_stopwords(ft_precompiled_stopwords);
|
|
||||||
|
|
||||||
/*
|
|
||||||
init signals & alarm
|
|
||||||
After this we can't quit by a simple unireg_abort
|
|
||||||
*/
|
|
||||||
error_handler_hook = my_message_sql;
|
|
||||||
if (pthread_key_create(&THR_THD,NULL) ||
|
|
||||||
pthread_key_create(&THR_MALLOC,NULL))
|
|
||||||
{
|
|
||||||
sql_print_error("Can't create thread-keys");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
opt_noacl = 1; // No permissions
|
|
||||||
if (acl_init(opt_noacl))
|
|
||||||
{
|
|
||||||
mysql_server_end();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (!opt_noacl)
|
|
||||||
(void) grant_init();
|
|
||||||
init_max_user_conn();
|
|
||||||
init_update_queries();
|
|
||||||
|
|
||||||
#ifdef HAVE_DLOPEN
|
|
||||||
if (!opt_noacl)
|
|
||||||
udf_init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (opt_bin_log)
|
|
||||||
{
|
|
||||||
if (!opt_bin_logname)
|
|
||||||
{
|
|
||||||
char tmp[FN_REFLEN];
|
|
||||||
/* TODO: The following should be using fn_format(); We just need to
|
|
||||||
first change fn_format() to cut the file name if it's too long.
|
|
||||||
*/
|
|
||||||
strmake(tmp,glob_hostname,FN_REFLEN-5);
|
|
||||||
strmov(strcend(tmp,'.'),"-bin");
|
|
||||||
opt_bin_logname=my_strdup(tmp,MYF(MY_WME));
|
|
||||||
}
|
|
||||||
open_log(&mysql_bin_log, glob_hostname, opt_bin_logname, "-bin",
|
|
||||||
opt_binlog_index_name, LOG_BIN);
|
|
||||||
using_update_log=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
(void) thr_setconcurrency(concurrency); // 10 by default
|
|
||||||
|
|
||||||
if (
|
|
||||||
#ifdef HAVE_BERKELEY_DB
|
|
||||||
!berkeley_skip ||
|
|
||||||
#endif
|
|
||||||
(flush_time && flush_time != ~(ulong) 0L))
|
|
||||||
{
|
|
||||||
pthread_t hThread;
|
|
||||||
if (pthread_create(&hThread,&connection_attrib,handle_manager,0))
|
|
||||||
sql_print_error("Warning: Can't create thread to manage maintenance");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Update mysqld variables from client variables if set
|
|
||||||
The client variables are set also by get_one_option() in mysqld.cc
|
|
||||||
*/
|
|
||||||
if (max_allowed_packet)
|
|
||||||
global_system_variables.max_allowed_packet= max_allowed_packet;
|
|
||||||
if (net_buffer_length)
|
|
||||||
global_system_variables.net_buffer_length= net_buffer_length;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int STDCALL mysql_server_init(int argc, char **argv, char **groups)
|
|
||||||
{
|
|
||||||
char glob_hostname[FN_REFLEN];
|
|
||||||
|
|
||||||
/* This mess is to allow people to call the init function without
|
|
||||||
* having to mess with a fake argv */
|
|
||||||
int *argcp;
|
|
||||||
char ***argvp;
|
|
||||||
int fake_argc = 1;
|
|
||||||
char *fake_argv[] = { (char *)"", 0 };
|
|
||||||
const char *fake_groups[] = { "server", "embedded", 0 };
|
|
||||||
if (argc)
|
|
||||||
{
|
|
||||||
argcp = &argc;
|
|
||||||
argvp = (char***) &argv;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
argcp = &fake_argc;
|
|
||||||
argvp = (char ***) &fake_argv;
|
|
||||||
}
|
|
||||||
if (!groups)
|
|
||||||
groups = (char**) fake_groups;
|
|
||||||
|
|
||||||
my_umask=0660; // Default umask for new files
|
|
||||||
my_umask_dir=0700; // Default umask for new directories
|
|
||||||
|
|
||||||
/* Only call MY_INIT() if it hasn't been called before */
|
|
||||||
if (!inited)
|
|
||||||
{
|
|
||||||
inited=1;
|
|
||||||
org_my_init_done=my_init_done;
|
|
||||||
}
|
|
||||||
if (!org_my_init_done)
|
|
||||||
{
|
|
||||||
MY_INIT((char *)"mysql_embedded"); // init my_sys library & pthreads
|
|
||||||
}
|
|
||||||
|
|
||||||
tzset(); // Set tzname
|
|
||||||
|
|
||||||
start_time=time((time_t*) 0);
|
|
||||||
#ifdef HAVE_TZNAME
|
|
||||||
#if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT)
|
|
||||||
{
|
|
||||||
struct tm tm_tmp;
|
|
||||||
localtime_r(&start_time,&tm_tmp);
|
|
||||||
strmov(time_zone,tzname[tm_tmp.tm_isdst != 0 ? 1 : 0]);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
{
|
|
||||||
struct tm *start_tm;
|
|
||||||
start_tm=localtime(&start_time);
|
|
||||||
strmov(time_zone,tzname[start_tm->tm_isdst != 0 ? 1 : 0]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (gethostname(glob_hostname,sizeof(glob_hostname)-4) < 0)
|
|
||||||
strmov(glob_hostname,"mysql");
|
|
||||||
#ifndef DBUG_OFF
|
|
||||||
strxmov(strend(server_version),MYSQL_SERVER_SUFFIX,"-debug",NullS);
|
|
||||||
#else
|
|
||||||
strmov(strend(server_version),MYSQL_SERVER_SUFFIX);
|
|
||||||
#endif
|
|
||||||
load_defaults("my", (const char **) groups, argcp, argvp);
|
|
||||||
defaults_argv=*argvp;
|
|
||||||
|
|
||||||
/* Get default temporary directory */
|
|
||||||
opt_mysql_tmpdir=getenv("TMPDIR"); /* Use this if possible */
|
|
||||||
#if defined( __WIN__) || defined(OS2)
|
|
||||||
if (!opt_mysql_tmpdir)
|
|
||||||
opt_mysql_tmpdir=getenv("TEMP");
|
|
||||||
if (!opt_mysql_tmpdir)
|
|
||||||
opt_mysql_tmpdir=getenv("TMP");
|
|
||||||
#endif
|
|
||||||
if (!opt_mysql_tmpdir || !opt_mysql_tmpdir[0])
|
|
||||||
opt_mysql_tmpdir=(char*) P_tmpdir; /* purecov: inspected */
|
|
||||||
|
|
||||||
set_options();
|
|
||||||
get_options(*argcp, *argvp);
|
|
||||||
|
|
||||||
if (opt_log || opt_update_log || opt_slow_log || opt_bin_log)
|
|
||||||
strcat(server_version,"-log");
|
|
||||||
DBUG_PRINT("info",("%s Ver %s for %s on %s\n",my_progname,
|
|
||||||
server_version, SYSTEM_TYPE,MACHINE_TYPE));
|
|
||||||
|
|
||||||
/* These must be set early */
|
|
||||||
|
|
||||||
(void) pthread_mutex_init(&LOCK_mysql_create_db,MY_MUTEX_INIT_SLOW);
|
|
||||||
(void) pthread_mutex_init(&LOCK_Acl,MY_MUTEX_INIT_SLOW);
|
|
||||||
(void) pthread_mutex_init(&LOCK_open,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_mapped_file,MY_MUTEX_INIT_SLOW);
|
|
||||||
(void) pthread_mutex_init(&LOCK_status,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_error_log,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_delayed_insert,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_delayed_status,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_delayed_create,MY_MUTEX_INIT_SLOW);
|
|
||||||
(void) pthread_mutex_init(&LOCK_manager,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_crypt,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_bytes_sent,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_bytes_received,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_timezone,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_rpl_status, MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_active_mi, MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_global_system_variables, MY_MUTEX_INIT_FAST);
|
|
||||||
(void) my_rwlock_init(&LOCK_grant, NULL);
|
|
||||||
(void) pthread_cond_init(&COND_thread_count,NULL);
|
|
||||||
(void) pthread_cond_init(&COND_refresh,NULL);
|
|
||||||
(void) pthread_cond_init(&COND_thread_cache,NULL);
|
|
||||||
(void) pthread_cond_init(&COND_flush_thread_cache,NULL);
|
|
||||||
(void) pthread_cond_init(&COND_manager,NULL);
|
|
||||||
(void) pthread_cond_init(&COND_rpl_status, NULL);
|
|
||||||
|
|
||||||
if (set_default_charset_by_name(sys_charset.value, MYF(MY_WME)))
|
|
||||||
{
|
|
||||||
mysql_server_end();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
charsets_list = list_charsets(MYF(MY_CS_COMPILED|MY_CS_CONFIG));
|
|
||||||
|
|
||||||
/* Parameter for threads created for connections */
|
|
||||||
(void) pthread_attr_init(&connection_attrib);
|
|
||||||
(void) pthread_attr_setdetachstate(&connection_attrib,
|
|
||||||
PTHREAD_CREATE_DETACHED);
|
|
||||||
pthread_attr_setstacksize(&connection_attrib,thread_stack);
|
|
||||||
pthread_attr_setscope(&connection_attrib, PTHREAD_SCOPE_SYSTEM);
|
|
||||||
|
|
||||||
#if defined( SET_RLIMIT_NOFILE) || defined( OS2)
|
|
||||||
/* connections and databases needs lots of files */
|
|
||||||
{
|
|
||||||
uint wanted_files=10+(uint) max(max_connections*5,
|
|
||||||
max_connections+table_cache_size*2);
|
|
||||||
set_if_bigger(wanted_files, open_files_limit);
|
|
||||||
// Note that some system returns 0 if we succeed here:
|
|
||||||
uint files=set_maximum_open_files(wanted_files);
|
|
||||||
if (files && files < wanted_files && ! open_files_limit)
|
|
||||||
{
|
|
||||||
max_connections= (ulong) min((files-10),max_connections);
|
|
||||||
table_cache_size= (ulong) max((files-10-max_connections)/2,64);
|
|
||||||
DBUG_PRINT("warning",
|
|
||||||
("Changed limits: max_connections: %ld table_cache: %ld",
|
|
||||||
max_connections,table_cache_size));
|
|
||||||
sql_print_error("Warning: Changed limits: max_connections: %ld table_cache: %ld",max_connections,table_cache_size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
unireg_init(opt_specialflag); /* Set up extern variabels */
|
|
||||||
init_errmessage(); /* Read error messages from file */
|
|
||||||
lex_init();
|
|
||||||
item_init();
|
|
||||||
set_var_init();
|
|
||||||
mysys_uses_curses=0;
|
|
||||||
#ifdef USE_REGEX
|
|
||||||
regex_init();
|
|
||||||
#endif
|
|
||||||
if (use_temp_pool && bitmap_init(&temp_pool,1024,1))
|
|
||||||
{
|
|
||||||
mysql_server_end();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
We have enough space for fiddling with the argv, continue
|
|
||||||
*/
|
|
||||||
umask(((~my_umask) & 0666));
|
|
||||||
table_cache_init();
|
|
||||||
hostname_cache_init();
|
|
||||||
query_cache_result_size_limit(query_cache_limit);
|
|
||||||
query_cache_resize(query_cache_size);
|
|
||||||
randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2);
|
|
||||||
reset_floating_point_exceptions();
|
|
||||||
init_thr_lock();
|
|
||||||
init_slave_list();
|
|
||||||
|
|
||||||
/* Setup log files */
|
|
||||||
if (opt_log)
|
|
||||||
open_log(&mysql_log, glob_hostname, opt_logname, ".log", NullS,
|
|
||||||
LOG_NORMAL);
|
|
||||||
if (opt_update_log)
|
|
||||||
{
|
|
||||||
open_log(&mysql_update_log, glob_hostname, opt_update_logname, "",
|
|
||||||
NullS, LOG_NEW);
|
|
||||||
using_update_log=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opt_slow_log)
|
|
||||||
open_log(&mysql_slow_log, glob_hostname, opt_slow_logname, "-slow.log",
|
|
||||||
NullS, LOG_NORMAL);
|
|
||||||
if (ha_init())
|
|
||||||
{
|
|
||||||
sql_print_error("Can't init databases");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
ha_key_cache();
|
|
||||||
#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT)
|
|
||||||
if (locked_in_memory && !geteuid())
|
|
||||||
{
|
|
||||||
if (mlockall(MCL_CURRENT))
|
|
||||||
{
|
|
||||||
sql_print_error("Warning: Failed to lock memory. Errno: %d\n",errno);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
locked_in_memory=1;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
locked_in_memory=0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (opt_myisam_log)
|
|
||||||
(void) mi_log( 1 );
|
|
||||||
ft_init_stopwords(ft_precompiled_stopwords);
|
|
||||||
|
|
||||||
/*
|
|
||||||
init signals & alarm
|
|
||||||
After this we can't quit by a simple unireg_abort
|
|
||||||
*/
|
|
||||||
error_handler_hook = my_message_sql;
|
|
||||||
if (pthread_key_create(&THR_THD,NULL) ||
|
|
||||||
pthread_key_create(&THR_MALLOC,NULL))
|
|
||||||
{
|
|
||||||
sql_print_error("Can't create thread-keys");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
opt_noacl = 1; // No permissions
|
|
||||||
if (acl_init(opt_noacl))
|
|
||||||
{
|
|
||||||
mysql_server_end();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (!opt_noacl)
|
|
||||||
(void) grant_init();
|
|
||||||
init_max_user_conn();
|
|
||||||
init_update_queries();
|
|
||||||
|
|
||||||
#ifdef HAVE_DLOPEN
|
|
||||||
if (!opt_noacl)
|
|
||||||
udf_init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (opt_bin_log)
|
|
||||||
{
|
|
||||||
if (!opt_bin_logname)
|
|
||||||
{
|
|
||||||
char tmp[FN_REFLEN];
|
|
||||||
/* TODO: The following should be using fn_format(); We just need to
|
|
||||||
first change fn_format() to cut the file name if it's too long.
|
|
||||||
*/
|
|
||||||
strmake(tmp,glob_hostname,FN_REFLEN-5);
|
|
||||||
strmov(strcend(tmp,'.'),"-bin");
|
|
||||||
opt_bin_logname=my_strdup(tmp,MYF(MY_WME));
|
|
||||||
}
|
|
||||||
open_log(&mysql_bin_log, glob_hostname, opt_bin_logname, "-bin",
|
|
||||||
opt_binlog_index_name, LOG_BIN);
|
|
||||||
using_update_log=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
(void) thr_setconcurrency(concurrency); // 10 by default
|
|
||||||
|
|
||||||
if (
|
|
||||||
#ifdef HAVE_BERKELEY_DB
|
|
||||||
!berkeley_skip ||
|
|
||||||
#endif
|
|
||||||
(flush_time && flush_time != ~(ulong) 0L))
|
|
||||||
{
|
|
||||||
pthread_t hThread;
|
|
||||||
if (pthread_create(&hThread,&connection_attrib,handle_manager,0))
|
|
||||||
sql_print_error("Warning: Can't create thread to manage maintenance");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Update mysqld variables from client variables if set
|
|
||||||
The client variables are set also by get_one_option() in mysqld.cc
|
|
||||||
*/
|
|
||||||
if (max_allowed_packet)
|
|
||||||
global_system_variables.max_allowed_packet= max_allowed_packet;
|
|
||||||
if (net_buffer_length)
|
|
||||||
global_system_variables.net_buffer_length= net_buffer_length;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void STDCALL mysql_server_end()
|
void STDCALL mysql_server_end()
|
||||||
{
|
{
|
||||||
my_free((char*) copy_arguments_ptr, MYF(MY_ALLOW_ZERO_PTR));
|
my_free((char*) copy_arguments_ptr, MYF(MY_ALLOW_ZERO_PTR));
|
||||||
@ -1035,75 +302,19 @@ void STDCALL mysql_thread_end()
|
|||||||
my_thread_end();
|
my_thread_end();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void start_embedded_connection(NET * net)
|
|
||||||
{
|
|
||||||
// start_embedded_conn1(net);
|
|
||||||
}
|
|
||||||
|
|
||||||
void end_embedded_connection(NET * net)
|
|
||||||
{
|
|
||||||
THD *thd = (THD *) net->vio->dest_thd;
|
|
||||||
delete thd;
|
|
||||||
}
|
|
||||||
|
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|
||||||
C_MODE_START
|
C_MODE_START
|
||||||
NET *get_mysql_net(MYSQL *mysql)
|
|
||||||
{
|
|
||||||
return &((THD *)mysql->net.vio->dest_thd)->net;
|
|
||||||
}
|
|
||||||
|
|
||||||
void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db)
|
void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db)
|
||||||
{
|
{
|
||||||
THD *thd = (THD *)mysql->net.vio->dest_thd;
|
THD *thd = (THD *)mysql->thd;
|
||||||
mysql->reconnect= 1; /* Reconnect as default */
|
|
||||||
mysql->server_status= SERVER_STATUS_AUTOCOMMIT;
|
|
||||||
|
|
||||||
mysql->protocol_version= ::protocol_version;
|
|
||||||
mysql->thread_id= thd->thread_id;
|
|
||||||
strmake(mysql->scramble_buff, thd->scramble, 8);
|
|
||||||
mysql->server_capabilities= CLIENT_LONG_FLAG | CLIENT_CONNECT_WITH_DB |
|
|
||||||
CLIENT_TRANSACTIONS;
|
|
||||||
mysql->server_language= MY_CHARSET_CURRENT;
|
|
||||||
mysql->server_status= thd->server_status;
|
|
||||||
mysql->client_flag= client_flag | mysql->options.client_flag;
|
|
||||||
mysql->db= db;
|
|
||||||
thd->mysql= mysql;
|
thd->mysql= mysql;
|
||||||
}
|
mysql->last_error= thd->net.last_error;
|
||||||
C_MODE_END
|
|
||||||
|
|
||||||
static int embedded_thd_net_init(NET *net, unsigned char *buff)
|
|
||||||
{
|
|
||||||
net->buff = buff;
|
|
||||||
if (net_buffer_length > max_allowed_packet)
|
|
||||||
max_allowed_packet= net_buffer_length;
|
|
||||||
net->buff_end= net->buff+(net->max_packet=net_buffer_length);
|
|
||||||
net->vio= NULL;
|
|
||||||
net->no_send_ok= 0;
|
|
||||||
net->error=0; net->return_errno=0; net->return_status=0;
|
|
||||||
// net->timeout=(uint) net_read_timeout; /* Timeout for read */
|
|
||||||
net->pkt_nr= net->compress_pkt_nr=0;
|
|
||||||
net->write_pos= net->read_pos = net->buff;
|
|
||||||
net->last_error[0]= 0;
|
|
||||||
net->compress= 0;
|
|
||||||
net->reading_or_writing= 0;
|
|
||||||
net->where_b = net->remain_in_buf= 0;
|
|
||||||
net->last_errno= 0;
|
|
||||||
net->query_cache_query= 0;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
C_MODE_START
|
void *create_embedded_thd(int client_flag, char *db)
|
||||||
|
|
||||||
void *create_embedded_thd(Vio *vio, unsigned char *buff, int client_flag, char *db)
|
|
||||||
{
|
{
|
||||||
THD * thd= new THD;
|
THD * thd= new THD;
|
||||||
embedded_thd_net_init(&thd->net, buff);
|
|
||||||
|
|
||||||
/* if (protocol_version>9) */
|
|
||||||
thd->net.return_errno=1;
|
|
||||||
thd->thread_id= thread_id++;
|
thd->thread_id= thread_id++;
|
||||||
|
|
||||||
if (thd->store_globals())
|
if (thd->store_globals())
|
||||||
@ -1116,30 +327,22 @@ void *create_embedded_thd(Vio *vio, unsigned char *buff, int client_flag, char *
|
|||||||
thd->dbug_thread_id= my_thread_id();
|
thd->dbug_thread_id= my_thread_id();
|
||||||
thd->thread_stack= (char*) &thd;
|
thd->thread_stack= (char*) &thd;
|
||||||
|
|
||||||
// if (thd->max_join_size == HA_POS_ERROR)
|
|
||||||
// thd->options |= OPTION_BIG_SELECTS;
|
|
||||||
|
|
||||||
thd->proc_info=0; // Remove 'login'
|
thd->proc_info=0; // Remove 'login'
|
||||||
thd->command=COM_SLEEP;
|
thd->command=COM_SLEEP;
|
||||||
thd->version=refresh_version;
|
thd->version=refresh_version;
|
||||||
thd->set_time();
|
thd->set_time();
|
||||||
init_sql_alloc(&thd->mem_root,8192,8192);
|
init_sql_alloc(&thd->mem_root,8192,8192);
|
||||||
thd->client_capabilities= client_flag;
|
thd->client_capabilities= client_flag;
|
||||||
// thd->max_packet_length= max_allowed_packet;
|
|
||||||
thd->net.vio = vio;
|
|
||||||
|
|
||||||
// if (thd->client_capabilities & CLIENT_INTERACTIVE)
|
|
||||||
// thd->inactive_timeout= net_interactive_timeout;
|
|
||||||
if (thd->client_capabilities & CLIENT_TRANSACTIONS)
|
|
||||||
thd->net.return_status= &thd->server_status;
|
|
||||||
|
|
||||||
thd->db= db;
|
thd->db= db;
|
||||||
thd->db_length= db ? strip_sp(db) : 0;
|
thd->db_length= db ? strip_sp(db) : 0;
|
||||||
thd->db_access= DB_ACLS;
|
thd->db_access= DB_ACLS;
|
||||||
thd->master_access= ~NO_ACCESS;
|
thd->master_access= ~NO_ACCESS;
|
||||||
|
thd->net.query_cache_query= 0;
|
||||||
|
|
||||||
return thd;
|
return thd;
|
||||||
}
|
}
|
||||||
|
|
||||||
C_MODE_END
|
C_MODE_END
|
||||||
|
|
||||||
bool send_fields(THD *thd, List<Item> &list, uint flag)
|
bool send_fields(THD *thd, List<Item> &list, uint flag)
|
||||||
@ -1295,63 +498,16 @@ bool select_send::send_data(List<Item> &items)
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool do_command(THD *thd)
|
|
||||||
{
|
|
||||||
MYSQL *mysql= thd->mysql;
|
|
||||||
|
|
||||||
char *packet;
|
|
||||||
uint old_timeout;
|
|
||||||
ulong packet_length;
|
|
||||||
NET *net;
|
|
||||||
enum enum_server_command command;
|
|
||||||
DBUG_ENTER("do_command");
|
|
||||||
|
|
||||||
net= &thd->net;
|
|
||||||
thd->current_tablenr=0;
|
|
||||||
|
|
||||||
packet=0;
|
|
||||||
// old_timeout=net->timeout;
|
|
||||||
// net->timeout=(uint) thd->inactive_timeout; // Wait max for 8 hours
|
|
||||||
net->last_error[0]=0; // Clear error message
|
|
||||||
net->last_errno=0;
|
|
||||||
|
|
||||||
net_new_transaction(net);
|
|
||||||
if ((packet_length=my_net_read(net)) == packet_error)
|
|
||||||
{
|
|
||||||
DBUG_PRINT("info",("Got error reading command from socket %s",
|
|
||||||
vio_description(net->vio) ));
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
packet=(char*) net->read_pos;
|
|
||||||
|
|
||||||
command = (enum enum_server_command) (uchar) packet[0];
|
|
||||||
DBUG_PRINT("info",("Command on %s = %d (%s)",
|
|
||||||
vio_description(net->vio), command,
|
|
||||||
command_name[command]));
|
|
||||||
}
|
|
||||||
// net->timeout=old_timeout; // Timeout for writing
|
|
||||||
DBUG_RETURN(dispatch_command(command,thd, packet+1, (uint) packet_length));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
send_ok(THD *thd,ha_rows affected_rows,ulonglong id,const char *message)
|
send_ok(THD *thd,ha_rows affected_rows,ulonglong id,const char *message)
|
||||||
{
|
{
|
||||||
NET *net= &thd->net;
|
|
||||||
if (net->no_send_ok) // hack for re-parsing queries
|
|
||||||
return;
|
|
||||||
|
|
||||||
DBUG_ENTER("send_ok");
|
DBUG_ENTER("send_ok");
|
||||||
MYSQL *mysql= current_thd->mysql;
|
MYSQL *mysql= current_thd->mysql;
|
||||||
mysql->affected_rows= affected_rows;
|
mysql->affected_rows= affected_rows;
|
||||||
mysql->insert_id= id;
|
mysql->insert_id= id;
|
||||||
if (net->return_status)
|
|
||||||
mysql->server_status= *net->return_status;
|
|
||||||
if (message)
|
if (message)
|
||||||
{
|
{
|
||||||
strmake(net->last_error, message, sizeof(net->last_error));
|
strmake(thd->net.last_error, message, sizeof(thd->net.last_error)-1);
|
||||||
mysql->info= net->last_error;
|
|
||||||
}
|
}
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
@ -1438,3 +594,7 @@ int embedded_send_row(THD *thd, int n_fields, char *data, int data_len)
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint STDCALL mysql_warning_count(MYSQL *mysql)
|
||||||
|
{
|
||||||
|
return ((THD *)mysql->thd)->total_warn_count;
|
||||||
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
we are working on. In this case we should just return read errors from
|
we are working on. In this case we should just return read errors from
|
||||||
the file descriptior.
|
the file descriptior.
|
||||||
*/
|
*/
|
||||||
|
#ifdef DUMMY
|
||||||
|
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "mysql_embed.h"
|
#include "mysql_embed.h"
|
||||||
@ -219,7 +220,7 @@ int create_vio(NET *net, int separate_thread)
|
|||||||
Vio * v = net->vio;
|
Vio * v = net->vio;
|
||||||
if (!v)
|
if (!v)
|
||||||
{
|
{
|
||||||
v = vio_new(0, separate_thread ? VIO_TYPE_SHARED_MEMORY : VIO_TYPE_BUFFER, 0);
|
v = vio_new(0, separate_thread ? VIO_CLOSED : VIO_TYPE_TCPIP, 0);
|
||||||
net->vio = v;
|
net->vio = v;
|
||||||
}
|
}
|
||||||
return !v;
|
return !v;
|
||||||
@ -233,3 +234,5 @@ void set_thd(Vio *v, void *thd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* HAVE_VIO */
|
#endif /* HAVE_VIO */
|
||||||
|
#endif /* DUMMY */
|
||||||
|
|
||||||
|
@ -67,15 +67,8 @@ TYPELIB sql_protocol_typelib = {array_elements(sql_protocol_names_lib)-1,"",
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void mysql_once_init(void);
|
static void mysql_once_init(void);
|
||||||
static MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields,
|
|
||||||
uint field_count);
|
|
||||||
static int read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row,
|
|
||||||
ulong *lengths);
|
|
||||||
static void end_server(MYSQL *mysql);
|
static void end_server(MYSQL *mysql);
|
||||||
/*static void read_user_name(char *name);
|
|
||||||
*/
|
|
||||||
static void append_wild(char *to,char *end,const char *wild);
|
static void append_wild(char *to,char *end,const char *wild);
|
||||||
static int send_file_to_server(MYSQL *mysql,const char *filename);
|
|
||||||
static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
|
static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
|
||||||
const char *from, ulong length);
|
const char *from, ulong length);
|
||||||
|
|
||||||
@ -83,130 +76,6 @@ static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
|
|||||||
#define set_sigpipe(mysql)
|
#define set_sigpipe(mysql)
|
||||||
#define reset_sigpipe(mysql)
|
#define reset_sigpipe(mysql)
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
** read a packet from server. Give error message if socket was down
|
|
||||||
** or packet is an error message
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
ulong
|
|
||||||
net_safe_read(MYSQL *mysql)
|
|
||||||
{
|
|
||||||
NET *net= &mysql->net;
|
|
||||||
uint len=0;
|
|
||||||
//init_sigpipe_variables
|
|
||||||
/* Don't give sigpipe errors if the client doesn't want them */
|
|
||||||
set_sigpipe(mysql);
|
|
||||||
if (net->vio != 0)
|
|
||||||
len=my_net_read(net);
|
|
||||||
reset_sigpipe(mysql);
|
|
||||||
if (len == packet_error || len == 0)
|
|
||||||
{
|
|
||||||
DBUG_PRINT("error",("Wrong connection or packet. fd: %s len: %d",
|
|
||||||
vio_description(net->vio),len));
|
|
||||||
end_server(mysql);
|
|
||||||
net->last_errno=(net->last_errno == ER_NET_PACKET_TOO_LARGE ?
|
|
||||||
CR_NET_PACKET_TOO_LARGE:
|
|
||||||
CR_SERVER_LOST);
|
|
||||||
strmov(net->last_error,ER(net->last_errno));
|
|
||||||
return(packet_error);
|
|
||||||
}
|
|
||||||
if (net->read_pos[0] == 255)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (len > 3)
|
|
||||||
{
|
|
||||||
char *pos=(char*) net->read_pos+1;
|
|
||||||
if (mysql->protocol_version > 9)
|
|
||||||
{ /* New client protocol */
|
|
||||||
net->last_errno=uint2korr(pos);
|
|
||||||
pos+=2;
|
|
||||||
len-=2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
net->last_errno=CR_UNKNOWN_ERROR;
|
|
||||||
len--;
|
|
||||||
}
|
|
||||||
(void) strmake(net->last_error,(char*) pos,
|
|
||||||
min(len,sizeof(net->last_error)-1));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
net->last_errno=CR_UNKNOWN_ERROR;
|
|
||||||
(void) strmov(net->last_error,ER(net->last_errno));
|
|
||||||
}
|
|
||||||
DBUG_PRINT("error",("Got error: %d (%s)", net->last_errno,
|
|
||||||
net->last_error));
|
|
||||||
return(packet_error);
|
|
||||||
}
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Get the length of next field. Change parameter to point at fieldstart */
|
|
||||||
static ulong
|
|
||||||
net_field_length(uchar **packet)
|
|
||||||
{
|
|
||||||
reg1 uchar *pos= *packet;
|
|
||||||
if (*pos < 251)
|
|
||||||
{
|
|
||||||
(*packet)++;
|
|
||||||
return (ulong) *pos;
|
|
||||||
}
|
|
||||||
if (*pos == 251)
|
|
||||||
{
|
|
||||||
(*packet)++;
|
|
||||||
return NULL_LENGTH;
|
|
||||||
}
|
|
||||||
if (*pos == 252)
|
|
||||||
{
|
|
||||||
(*packet)+=3;
|
|
||||||
return (ulong) uint2korr(pos+1);
|
|
||||||
}
|
|
||||||
if (*pos == 253)
|
|
||||||
{
|
|
||||||
(*packet)+=4;
|
|
||||||
return (ulong) uint3korr(pos+1);
|
|
||||||
}
|
|
||||||
(*packet)+=9; /* Must be 254 when here */
|
|
||||||
return (ulong) uint4korr(pos+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Same as above, but returns ulonglong values */
|
|
||||||
|
|
||||||
static my_ulonglong
|
|
||||||
net_field_length_ll(uchar **packet)
|
|
||||||
{
|
|
||||||
reg1 uchar *pos= *packet;
|
|
||||||
if (*pos < 251)
|
|
||||||
{
|
|
||||||
(*packet)++;
|
|
||||||
return (my_ulonglong) *pos;
|
|
||||||
}
|
|
||||||
if (*pos == 251)
|
|
||||||
{
|
|
||||||
(*packet)++;
|
|
||||||
return (my_ulonglong) NULL_LENGTH;
|
|
||||||
}
|
|
||||||
if (*pos == 252)
|
|
||||||
{
|
|
||||||
(*packet)+=3;
|
|
||||||
return (my_ulonglong) uint2korr(pos+1);
|
|
||||||
}
|
|
||||||
if (*pos == 253)
|
|
||||||
{
|
|
||||||
(*packet)+=4;
|
|
||||||
return (my_ulonglong) uint3korr(pos+1);
|
|
||||||
}
|
|
||||||
(*packet)+=9; /* Must be 254 when here */
|
|
||||||
#ifdef NO_CLIENT_LONGLONG
|
|
||||||
return (my_ulonglong) uint4korr(pos+1);
|
|
||||||
#else
|
|
||||||
return (my_ulonglong) uint8korr(pos+1);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void free_rows(MYSQL_DATA *cur)
|
static void free_rows(MYSQL_DATA *cur)
|
||||||
{
|
{
|
||||||
if (cur)
|
if (cur)
|
||||||
@ -232,56 +101,6 @@ struct passwd *getpwuid(uid_t);
|
|||||||
char* getlogin(void);
|
char* getlogin(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _DUMMY
|
|
||||||
|
|
||||||
#if !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__)
|
|
||||||
static void read_user_name(char *name)
|
|
||||||
{
|
|
||||||
DBUG_ENTER("read_user_name");
|
|
||||||
if (geteuid() == 0)
|
|
||||||
(void) strmov(name,"root"); /* allow use of surun */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifdef HAVE_GETPWUID
|
|
||||||
struct passwd *skr;
|
|
||||||
const char *str;
|
|
||||||
/*#ifdef __cplusplus
|
|
||||||
extern "C" struct passwd *getpwuid(uid_t);
|
|
||||||
extern "C" { char* getlogin(void); }
|
|
||||||
#else
|
|
||||||
char * getlogin();
|
|
||||||
struct passwd *getpwuid(uid_t);
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
if ((str=getlogin()) == NULL)
|
|
||||||
{
|
|
||||||
if ((skr=getpwuid(geteuid())) != NULL)
|
|
||||||
str=skr->pw_name;
|
|
||||||
else if (!(str=getenv("USER")) && !(str=getenv("LOGNAME")) &&
|
|
||||||
!(str=getenv("LOGIN")))
|
|
||||||
str="UNKNOWN_USER";
|
|
||||||
}
|
|
||||||
(void) strmake(name,str,USERNAME_LENGTH);
|
|
||||||
#elif HAVE_CUSERID
|
|
||||||
(void) cuserid(name);
|
|
||||||
#else
|
|
||||||
strmov(name,"UNKNOWN_USER");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
DBUG_VOID_RETURN;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* If MSDOS || VMS */
|
|
||||||
|
|
||||||
static void read_user_name(char *name)
|
|
||||||
{
|
|
||||||
char *str=getenv("USER");
|
|
||||||
strmov(name,str ? str : "ODBC"); /* ODBC will send user variable */
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif /*_DUMMY */
|
|
||||||
|
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
static my_bool is_NT(void)
|
static my_bool is_NT(void)
|
||||||
{
|
{
|
||||||
@ -360,17 +179,10 @@ static void
|
|||||||
end_server(MYSQL *mysql)
|
end_server(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("end_server");
|
DBUG_ENTER("end_server");
|
||||||
if (mysql->net.vio != 0)
|
|
||||||
{
|
|
||||||
end_embedded_connection(&mysql->net);
|
|
||||||
mysql->net.vio= 0; /* Marker */
|
|
||||||
}
|
|
||||||
mysql->net.buff = NULL;
|
|
||||||
free_old_query(mysql);
|
free_old_query(mysql);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void STDCALL
|
void STDCALL
|
||||||
mysql_free_result(MYSQL_RES *result)
|
mysql_free_result(MYSQL_RES *result)
|
||||||
{
|
{
|
||||||
@ -378,19 +190,6 @@ mysql_free_result(MYSQL_RES *result)
|
|||||||
DBUG_PRINT("enter",("mysql_res: %lx",result));
|
DBUG_PRINT("enter",("mysql_res: %lx",result));
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
if (result->handle && result->handle->status == MYSQL_STATUS_USE_RESULT)
|
|
||||||
{
|
|
||||||
DBUG_PRINT("warning",("Not all rows in set were read; Ignoring rows"));
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
uint pkt_len;
|
|
||||||
if ((pkt_len=(uint) net_safe_read(result->handle)) == packet_error)
|
|
||||||
break;
|
|
||||||
if (pkt_len <= 8 && result->handle->net.read_pos[0] == 254)
|
|
||||||
break; /* End of data */
|
|
||||||
}
|
|
||||||
result->handle->status=MYSQL_STATUS_READY;
|
|
||||||
}
|
|
||||||
free_rows(result->data);
|
free_rows(result->data);
|
||||||
if (result->fields)
|
if (result->fields)
|
||||||
free_root(&result->field_alloc,MYF(0));
|
free_root(&result->field_alloc,MYF(0));
|
||||||
@ -401,7 +200,6 @@ mysql_free_result(MYSQL_RES *result)
|
|||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
** Get options from my.cnf
|
** Get options from my.cnf
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -550,174 +348,6 @@ static void mysql_read_default_options(struct st_mysql_options *options,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
** Change field rows to field structs
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
static MYSQL_FIELD *
|
|
||||||
unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
|
|
||||||
my_bool default_value, my_bool long_flag_protocol)
|
|
||||||
{
|
|
||||||
MYSQL_ROWS *row;
|
|
||||||
MYSQL_FIELD *field,*result;
|
|
||||||
DBUG_ENTER("unpack_fields");
|
|
||||||
|
|
||||||
field=result=(MYSQL_FIELD*) alloc_root(alloc,sizeof(MYSQL_FIELD)*fields);
|
|
||||||
if (!result)
|
|
||||||
DBUG_RETURN(0);
|
|
||||||
|
|
||||||
for (row=data->data; row ; row = row->next,field++)
|
|
||||||
{
|
|
||||||
field->table= strdup_root(alloc,(char*) row->data[0]);
|
|
||||||
field->name= strdup_root(alloc,(char*) row->data[1]);
|
|
||||||
field->length= (uint) uint3korr(row->data[2]);
|
|
||||||
field->type= (enum enum_field_types) (uchar) row->data[3][0];
|
|
||||||
if (long_flag_protocol)
|
|
||||||
{
|
|
||||||
field->flags= uint2korr(row->data[4]);
|
|
||||||
field->decimals=(uint) (uchar) row->data[4][2];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
field->flags= (uint) (uchar) row->data[4][0];
|
|
||||||
field->decimals=(uint) (uchar) row->data[4][1];
|
|
||||||
}
|
|
||||||
if (INTERNAL_NUM_FIELD(field))
|
|
||||||
field->flags|= NUM_FLAG;
|
|
||||||
if (default_value && row->data[5])
|
|
||||||
field->def=strdup_root(alloc,(char*) row->data[5]);
|
|
||||||
else
|
|
||||||
field->def=0;
|
|
||||||
field->max_length= 0;
|
|
||||||
}
|
|
||||||
free_rows(data); /* Free old data */
|
|
||||||
DBUG_RETURN(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Read all rows (fields or data) from server */
|
|
||||||
|
|
||||||
static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
|
|
||||||
uint fields)
|
|
||||||
{
|
|
||||||
uint field,pkt_len;
|
|
||||||
ulong len;
|
|
||||||
uchar *cp;
|
|
||||||
char *to;
|
|
||||||
MYSQL_DATA *result;
|
|
||||||
MYSQL_ROWS **prev_ptr,*cur;
|
|
||||||
NET *net = &mysql->net;
|
|
||||||
DBUG_ENTER("read_rows");
|
|
||||||
|
|
||||||
if ((pkt_len=(uint) net_safe_read(mysql)) == packet_error)
|
|
||||||
DBUG_RETURN(0);
|
|
||||||
if (!(result=(MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA),
|
|
||||||
MYF(MY_WME | MY_ZEROFILL))))
|
|
||||||
{
|
|
||||||
net->last_errno=CR_OUT_OF_MEMORY;
|
|
||||||
strmov(net->last_error,ER(net->last_errno));
|
|
||||||
DBUG_RETURN(0);
|
|
||||||
}
|
|
||||||
init_alloc_root(&result->alloc,8192,0); /* Assume rowlength < 8192 */
|
|
||||||
result->alloc.min_malloc=sizeof(MYSQL_ROWS);
|
|
||||||
prev_ptr= &result->data;
|
|
||||||
result->rows=0;
|
|
||||||
result->fields=fields;
|
|
||||||
|
|
||||||
while (*(cp=net->read_pos) != 254 || pkt_len >= 8)
|
|
||||||
{
|
|
||||||
result->rows++;
|
|
||||||
if (!(cur= (MYSQL_ROWS*) alloc_root(&result->alloc,
|
|
||||||
sizeof(MYSQL_ROWS))) ||
|
|
||||||
!(cur->data= ((MYSQL_ROW)
|
|
||||||
alloc_root(&result->alloc,
|
|
||||||
(fields+1)*sizeof(char *)+pkt_len))))
|
|
||||||
{
|
|
||||||
free_rows(result);
|
|
||||||
net->last_errno=CR_OUT_OF_MEMORY;
|
|
||||||
strmov(net->last_error,ER(net->last_errno));
|
|
||||||
DBUG_RETURN(0);
|
|
||||||
}
|
|
||||||
*prev_ptr=cur;
|
|
||||||
prev_ptr= &cur->next;
|
|
||||||
to= (char*) (cur->data+fields+1);
|
|
||||||
for (field=0 ; field < fields ; field++)
|
|
||||||
{
|
|
||||||
if ((len=(ulong) net_field_length(&cp)) == NULL_LENGTH)
|
|
||||||
{ /* null field */
|
|
||||||
cur->data[field] = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cur->data[field] = to;
|
|
||||||
memcpy(to,(char*) cp,len); to[len]=0;
|
|
||||||
to+=len+1;
|
|
||||||
cp+=len;
|
|
||||||
if (mysql_fields)
|
|
||||||
{
|
|
||||||
if (mysql_fields[field].max_length < len)
|
|
||||||
mysql_fields[field].max_length=len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cur->data[field]=to; /* End of last field */
|
|
||||||
if ((pkt_len=net_safe_read(mysql)) == packet_error)
|
|
||||||
{
|
|
||||||
free_rows(result);
|
|
||||||
DBUG_RETURN(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*prev_ptr=0; /* last pointer is null */
|
|
||||||
mysql->warning_count= uint2korr(cp+1);
|
|
||||||
DBUG_PRINT("info",("warning_count: %ld", mysql->warning_count));
|
|
||||||
DBUG_PRINT("exit",("Got %d rows",result->rows));
|
|
||||||
DBUG_RETURN(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Read one row. Uses packet buffer as storage for fields.
|
|
||||||
** When next packet is read, the previous field values are destroyed
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
|
|
||||||
{
|
|
||||||
uint field;
|
|
||||||
ulong pkt_len,len;
|
|
||||||
uchar *pos,*prev_pos;
|
|
||||||
|
|
||||||
if ((pkt_len=net_safe_read(mysql)) == packet_error)
|
|
||||||
return -1;
|
|
||||||
if (pkt_len <= 8 && mysql->net.read_pos[0] == 254)
|
|
||||||
{
|
|
||||||
mysql->warning_count= uint2korr(mysql->net.read_pos+1);
|
|
||||||
return 1; /* End of data */
|
|
||||||
}
|
|
||||||
prev_pos= 0; /* allowed to write at packet[-1] */
|
|
||||||
pos=mysql->net.read_pos;
|
|
||||||
for (field=0 ; field < fields ; field++)
|
|
||||||
{
|
|
||||||
if ((len=(ulong) net_field_length(&pos)) == NULL_LENGTH)
|
|
||||||
{ /* null field */
|
|
||||||
row[field] = 0;
|
|
||||||
*lengths++=0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
row[field] = (char*) pos;
|
|
||||||
pos+=len;
|
|
||||||
*lengths++=len;
|
|
||||||
}
|
|
||||||
if (prev_pos)
|
|
||||||
*prev_pos=0; /* Terminate prev field */
|
|
||||||
prev_pos=pos;
|
|
||||||
}
|
|
||||||
row[field]=(char*) prev_pos+1; /* End of last field */
|
|
||||||
*prev_pos=0; /* Terminate last field */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
** Init MySQL structure or allocate one
|
** Init MySQL structure or allocate one
|
||||||
@ -732,7 +362,6 @@ mysql_init(MYSQL *mysql)
|
|||||||
if (!(mysql=(MYSQL*) my_malloc(sizeof(*mysql),MYF(MY_WME | MY_ZEROFILL))))
|
if (!(mysql=(MYSQL*) my_malloc(sizeof(*mysql),MYF(MY_WME | MY_ZEROFILL))))
|
||||||
return 0;
|
return 0;
|
||||||
mysql->free_me=1;
|
mysql->free_me=1;
|
||||||
mysql->net.vio = 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
bzero((char*) (mysql),sizeof(*(mysql)));
|
bzero((char*) (mysql),sizeof(*(mysql)));
|
||||||
@ -779,12 +408,6 @@ mysql_connect(MYSQL *mysql,const char *host,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int create_vio(NET *net, int separate_thread);
|
|
||||||
void set_thd(Vio *vio, void *thd);
|
|
||||||
|
|
||||||
/************/
|
|
||||||
|
|
||||||
static inline int mysql_init_charset(MYSQL *mysql)
|
static inline int mysql_init_charset(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
char charset_name_buff[16], *charset_name;
|
char charset_name_buff[16], *charset_name;
|
||||||
@ -809,20 +432,20 @@ static inline int mysql_init_charset(MYSQL *mysql)
|
|||||||
|
|
||||||
if (!mysql->charset)
|
if (!mysql->charset)
|
||||||
{
|
{
|
||||||
mysql->net.last_errno=CR_CANT_READ_CHARSET;
|
mysql->last_errno=CR_CANT_READ_CHARSET;
|
||||||
if (mysql->options.charset_dir)
|
if (mysql->options.charset_dir)
|
||||||
sprintf(mysql->net.last_error,ER(mysql->net.last_errno),
|
sprintf(mysql->last_error,ER(mysql->last_errno),
|
||||||
charset_name ? charset_name : "unknown",
|
charset_name ? charset_name : "unknown",
|
||||||
mysql->options.charset_dir);
|
mysql->options.charset_dir);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char cs_dir_name[FN_REFLEN];
|
char cs_dir_name[FN_REFLEN];
|
||||||
get_charsets_dir(cs_dir_name);
|
get_charsets_dir(cs_dir_name);
|
||||||
sprintf(mysql->net.last_error,ER(mysql->net.last_errno),
|
sprintf(mysql->last_error,ER(mysql->last_errno),
|
||||||
charset_name ? charset_name : "unknown",
|
charset_name ? charset_name : "unknown",
|
||||||
cs_dir_name);
|
cs_dir_name);
|
||||||
}
|
}
|
||||||
return mysql->net.last_errno;
|
return mysql->last_errno;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -837,8 +460,6 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
|
|||||||
const char *passwd __attribute__((unused)), const char *db,
|
const char *passwd __attribute__((unused)), const char *db,
|
||||||
uint port, const char *unix_socket,uint client_flag)
|
uint port, const char *unix_socket,uint client_flag)
|
||||||
{
|
{
|
||||||
ulong max_allowed_packet;
|
|
||||||
NET *net= &mysql->net;
|
|
||||||
char *db_name;
|
char *db_name;
|
||||||
DBUG_ENTER("mysql_real_connect");
|
DBUG_ENTER("mysql_real_connect");
|
||||||
DBUG_PRINT("enter",("host: %s db: %s user: %s",
|
DBUG_PRINT("enter",("host: %s db: %s user: %s",
|
||||||
@ -865,16 +486,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
|
|||||||
unix_socket=0;
|
unix_socket=0;
|
||||||
db_name = db ? my_strdup(db,MYF(MY_WME)) : NULL;
|
db_name = db ? my_strdup(db,MYF(MY_WME)) : NULL;
|
||||||
|
|
||||||
create_vio(net, mysql->options.separate_thread);
|
mysql->thd= create_embedded_thd(client_flag, db_name);
|
||||||
if (my_net_init(net, net->vio))
|
|
||||||
{
|
|
||||||
vio_delete(net->vio);
|
|
||||||
net->last_errno=CR_OUT_OF_MEMORY;
|
|
||||||
strmov(net->last_error,ER(net->last_errno));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
set_thd(net->vio, create_embedded_thd(net->vio, net->buff, client_flag, db_name));
|
|
||||||
|
|
||||||
init_embedded_mysql(mysql, client_flag, db_name);
|
init_embedded_mysql(mysql, client_flag, db_name);
|
||||||
|
|
||||||
@ -886,25 +498,12 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
|
|||||||
client_flag&= ~CLIENT_COMPRESS;
|
client_flag&= ~CLIENT_COMPRESS;
|
||||||
if (db)
|
if (db)
|
||||||
client_flag|=CLIENT_CONNECT_WITH_DB;
|
client_flag|=CLIENT_CONNECT_WITH_DB;
|
||||||
max_allowed_packet=net->max_packet_size;
|
|
||||||
|
|
||||||
if (db)
|
|
||||||
{
|
|
||||||
mysql->db=my_strdup(db,MYF(MY_WME));
|
|
||||||
db=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****
|
|
||||||
net->timeout=net_read_timeout;
|
|
||||||
*/
|
|
||||||
if (mysql->options.init_command)
|
if (mysql->options.init_command)
|
||||||
{
|
{
|
||||||
my_bool reconnect=mysql->reconnect;
|
|
||||||
mysql->reconnect=0;
|
|
||||||
if (mysql_query(mysql,mysql->options.init_command))
|
if (mysql_query(mysql,mysql->options.init_command))
|
||||||
goto error;
|
goto error;
|
||||||
mysql_free_result(mysql_use_result(mysql));
|
mysql_free_result(mysql_use_result(mysql));
|
||||||
mysql->reconnect=reconnect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DBUG_PRINT("exit",("Mysql handler: %lx",mysql));
|
DBUG_PRINT("exit",("Mysql handler: %lx",mysql));
|
||||||
@ -913,7 +512,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
reset_sigpipe(mysql);
|
reset_sigpipe(mysql);
|
||||||
DBUG_PRINT("error",("message: %u (%s)",net->last_errno,net->last_error));
|
DBUG_PRINT("error",("message: %u (%s)",mysql->last_errno,mysql->last_error));
|
||||||
{
|
{
|
||||||
/* Free alloced memory */
|
/* Free alloced memory */
|
||||||
my_bool free_me=mysql->free_me;
|
my_bool free_me=mysql->free_me;
|
||||||
@ -930,9 +529,10 @@ error:
|
|||||||
** Change user and database
|
** Change user and database
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
|
my_bool STDCALL mysql_change_user(MYSQL *mysql __attribute__((unused)), const char *user __attribute__((unused)),
|
||||||
const char *passwd, const char *db)
|
const char *passwd __attribute__((unused)), const char *db __attribute__((unused)))
|
||||||
{
|
{
|
||||||
|
#ifdef DUMMY
|
||||||
char buff[512],*pos=buff;
|
char buff[512],*pos=buff;
|
||||||
DBUG_ENTER("mysql_change_user");
|
DBUG_ENTER("mysql_change_user");
|
||||||
|
|
||||||
@ -956,6 +556,8 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
|
|||||||
mysql->passwd=my_strdup(passwd,MYF(MY_WME));
|
mysql->passwd=my_strdup(passwd,MYF(MY_WME));
|
||||||
mysql->db= db ? my_strdup(db,MYF(MY_WME)) : 0;
|
mysql->db= db ? my_strdup(db,MYF(MY_WME)) : 0;
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -972,8 +574,6 @@ mysql_select_db(MYSQL *mysql, const char *db)
|
|||||||
|
|
||||||
if ((error=simple_command(mysql,COM_INIT_DB,db,(ulong) 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));
|
|
||||||
mysql->db=my_strdup(db,MYF(MY_WME));
|
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -989,17 +589,6 @@ mysql_close(MYSQL *mysql)
|
|||||||
DBUG_ENTER("mysql_close");
|
DBUG_ENTER("mysql_close");
|
||||||
if (mysql) /* Some simple safety */
|
if (mysql) /* Some simple safety */
|
||||||
{
|
{
|
||||||
if (mysql->net.vio != 0)
|
|
||||||
{
|
|
||||||
free_old_query(mysql);
|
|
||||||
mysql->status=MYSQL_STATUS_READY; /* Force command */
|
|
||||||
simple_command(mysql,COM_QUIT,"",0,1);
|
|
||||||
end_server(mysql);
|
|
||||||
}
|
|
||||||
my_free((gptr) mysql->host_info,MYF(MY_ALLOW_ZERO_PTR));
|
|
||||||
my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
|
|
||||||
my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR));
|
|
||||||
my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
|
|
||||||
my_free(mysql->options.init_command,MYF(MY_ALLOW_ZERO_PTR));
|
my_free(mysql->options.init_command,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
my_free(mysql->options.user,MYF(MY_ALLOW_ZERO_PTR));
|
my_free(mysql->options.user,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
my_free(mysql->options.host,MYF(MY_ALLOW_ZERO_PTR));
|
my_free(mysql->options.host,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
@ -1011,9 +600,7 @@ mysql_close(MYSQL *mysql)
|
|||||||
my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR));
|
my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
|
my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
/* Clear pointers for better safety */
|
/* Clear pointers for better safety */
|
||||||
mysql->host_info=mysql->user=mysql->passwd=mysql->db=0;
|
|
||||||
bzero((char*) &mysql->options,sizeof(mysql->options));
|
bzero((char*) &mysql->options,sizeof(mysql->options));
|
||||||
mysql->net.vio = 0;
|
|
||||||
#ifdef HAVE_OPENSSL
|
#ifdef HAVE_OPENSSL
|
||||||
((VioConnectorFd*)(mysql->connector_fd))->delete();
|
((VioConnectorFd*)(mysql->connector_fd))->delete();
|
||||||
mysql->connector_fd = 0;
|
mysql->connector_fd = 0;
|
||||||
@ -1039,9 +626,7 @@ mysql_query(MYSQL *mysql, const char *query)
|
|||||||
my_bool STDCALL
|
my_bool STDCALL
|
||||||
mysql_read_query_result(MYSQL *mysql)
|
mysql_read_query_result(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
NET *net= get_mysql_net(mysql);
|
if (mysql->last_errno)
|
||||||
|
|
||||||
if (net->last_errno)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (mysql->field_count)
|
if (mysql->field_count)
|
||||||
@ -1154,6 +739,23 @@ my_bool my_connect(my_socket s, const struct sockaddr *name, uint namelen,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int STDCALL
|
||||||
|
mysql_send_query(MYSQL* mysql, const char* query, ulong length)
|
||||||
|
{
|
||||||
|
DBUG_ENTER("mysql_send_query");
|
||||||
|
|
||||||
|
if (mysql->options.separate_thread)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
mysql->result= NULL;
|
||||||
|
|
||||||
|
free_old_query(mysql); /* Free old result */
|
||||||
|
|
||||||
|
DBUG_RETURN(simple_command(mysql, COM_QUERY, query, length, 1));
|
||||||
|
}
|
||||||
|
|
||||||
int STDCALL
|
int STDCALL
|
||||||
mysql_real_query(MYSQL *mysql, const char *query, ulong length)
|
mysql_real_query(MYSQL *mysql, const char *query, ulong length)
|
||||||
{
|
{
|
||||||
@ -1176,63 +778,6 @@ mysql_real_query(MYSQL *mysql, const char *query, ulong length)
|
|||||||
DBUG_RETURN(mysql_read_query_result(mysql));
|
DBUG_RETURN(mysql_read_query_result(mysql));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
send_file_to_server(MYSQL *mysql, const char *filename)
|
|
||||||
{
|
|
||||||
int fd, readcount;
|
|
||||||
char buf[IO_SIZE*15],*tmp_name;
|
|
||||||
DBUG_ENTER("send_file_to_server");
|
|
||||||
|
|
||||||
fn_format(buf,filename,"","",4); /* Convert to client format */
|
|
||||||
if (!(tmp_name=my_strdup(buf,MYF(0))))
|
|
||||||
{
|
|
||||||
strmov(mysql->net.last_error, ER(mysql->net.last_errno=CR_OUT_OF_MEMORY));
|
|
||||||
DBUG_RETURN(-1);
|
|
||||||
}
|
|
||||||
if ((fd = my_open(tmp_name,O_RDONLY, MYF(0))) < 0)
|
|
||||||
{
|
|
||||||
mysql->net.last_errno=EE_FILENOTFOUND;
|
|
||||||
sprintf(buf,EE(mysql->net.last_errno),tmp_name,errno);
|
|
||||||
strmake(mysql->net.last_error,buf,sizeof(mysql->net.last_error)-1);
|
|
||||||
my_net_write(&mysql->net,"",0); net_flush(&mysql->net);
|
|
||||||
my_free(tmp_name,MYF(0));
|
|
||||||
DBUG_RETURN(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((readcount = (int) my_read(fd,buf,sizeof(buf),MYF(0))) > 0)
|
|
||||||
{
|
|
||||||
if (my_net_write(&mysql->net,buf,readcount))
|
|
||||||
{
|
|
||||||
mysql->net.last_errno=CR_SERVER_LOST;
|
|
||||||
strmov(mysql->net.last_error,ER(mysql->net.last_errno));
|
|
||||||
DBUG_PRINT("error",("Lost connection to MySQL server during LOAD DATA of local file"));
|
|
||||||
(void) my_close(fd,MYF(0));
|
|
||||||
my_free(tmp_name,MYF(0));
|
|
||||||
DBUG_RETURN(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(void) my_close(fd,MYF(0));
|
|
||||||
/* Send empty packet to mark end of file */
|
|
||||||
if (my_net_write(&mysql->net,"",0) || net_flush(&mysql->net))
|
|
||||||
{
|
|
||||||
mysql->net.last_errno=CR_SERVER_LOST;
|
|
||||||
sprintf(mysql->net.last_error,ER(mysql->net.last_errno),errno);
|
|
||||||
my_free(tmp_name,MYF(0));
|
|
||||||
DBUG_RETURN(-1);
|
|
||||||
}
|
|
||||||
if (readcount < 0)
|
|
||||||
{
|
|
||||||
mysql->net.last_errno=EE_READ; /* the errmsg for not entire file read */
|
|
||||||
sprintf(buf,EE(mysql->net.last_errno),tmp_name,errno);
|
|
||||||
strmake(mysql->net.last_error,buf,sizeof(mysql->net.last_error)-1);
|
|
||||||
my_free(tmp_name,MYF(0));
|
|
||||||
DBUG_RETURN(-1);
|
|
||||||
}
|
|
||||||
DBUG_RETURN(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
** Alloc result struct for buffered results. All rows are read to buffer.
|
** Alloc result struct for buffered results. All rows are read to buffer.
|
||||||
** mysql_data_seek may be used.
|
** mysql_data_seek may be used.
|
||||||
@ -1296,24 +841,6 @@ MYSQL_ROW STDCALL
|
|||||||
mysql_fetch_row(MYSQL_RES *res)
|
mysql_fetch_row(MYSQL_RES *res)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("mysql_fetch_row");
|
DBUG_ENTER("mysql_fetch_row");
|
||||||
if (!res->data)
|
|
||||||
{ /* Unbufferred fetch */
|
|
||||||
if (!res->eof)
|
|
||||||
{
|
|
||||||
if (!(read_one_row(res->handle,res->field_count,res->row, res->lengths)))
|
|
||||||
{
|
|
||||||
res->row_count++;
|
|
||||||
DBUG_RETURN(res->current_row=res->row);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DBUG_PRINT("info",("end of data"));
|
|
||||||
res->eof=1;
|
|
||||||
res->handle->status=MYSQL_STATUS_READY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DBUG_RETURN((MYSQL_ROW) NULL);
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
MYSQL_ROW tmp;
|
MYSQL_ROW tmp;
|
||||||
if (!res->data_cursor)
|
if (!res->data_cursor)
|
||||||
@ -1327,6 +854,7 @@ mysql_fetch_row(MYSQL_RES *res)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
** Get column lengths of the current row
|
** Get column lengths of the current row
|
||||||
** If one uses mysql_use_result, res->lengths contains the length information,
|
** If one uses mysql_use_result, res->lengths contains the length information,
|
||||||
@ -1434,8 +962,9 @@ mysql_list_tables(MYSQL *mysql, const char *wild)
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
MYSQL_RES * STDCALL
|
MYSQL_RES * STDCALL
|
||||||
mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)
|
mysql_list_fields(MYSQL *mysql __attribute__((unused)), const char *table __attribute__((unused)), const char *wild __attribute__((unused)))
|
||||||
{
|
{
|
||||||
|
#ifdef DUMMY
|
||||||
MYSQL_RES *result;
|
MYSQL_RES *result;
|
||||||
MYSQL_DATA *query;
|
MYSQL_DATA *query;
|
||||||
char buff[257],*end;
|
char buff[257],*end;
|
||||||
@ -1465,9 +994,12 @@ mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)
|
|||||||
CLIENT_LONG_FLAG));
|
CLIENT_LONG_FLAG));
|
||||||
result->eof=1;
|
result->eof=1;
|
||||||
DBUG_RETURN(result);
|
DBUG_RETURN(result);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* List all running processes (threads) in server */
|
/* List all running processes (threads) in server */
|
||||||
|
#ifdef DUMMY
|
||||||
|
|
||||||
MYSQL_RES * STDCALL
|
MYSQL_RES * STDCALL
|
||||||
mysql_list_processes(MYSQL *mysql)
|
mysql_list_processes(MYSQL *mysql)
|
||||||
@ -1492,7 +1024,9 @@ mysql_list_processes(MYSQL *mysql)
|
|||||||
mysql->status=MYSQL_STATUS_GET_RESULT;
|
mysql->status=MYSQL_STATUS_GET_RESULT;
|
||||||
mysql->field_count=field_count;
|
mysql->field_count=field_count;
|
||||||
DBUG_RETURN(mysql_store_result(mysql));
|
DBUG_RETURN(mysql_store_result(mysql));
|
||||||
|
return (MYSQL_RES*)mysql;
|
||||||
}
|
}
|
||||||
|
#endif /*DUMMY*/
|
||||||
|
|
||||||
|
|
||||||
int STDCALL
|
int STDCALL
|
||||||
@ -1550,9 +1084,10 @@ mysql_dump_debug_info(MYSQL *mysql)
|
|||||||
const char * STDCALL
|
const char * STDCALL
|
||||||
mysql_stat(MYSQL *mysql)
|
mysql_stat(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
|
#ifdef DUMMY
|
||||||
DBUG_ENTER("mysql_stat");
|
DBUG_ENTER("mysql_stat");
|
||||||
if (simple_command(mysql,COM_STATISTICS,"",0,0))
|
if (simple_command(mysql,COM_STATISTICS,"",0,0))
|
||||||
return mysql->net.last_error;
|
return mysql->last_error;
|
||||||
mysql->net.read_pos[mysql->packet_length]=0; /* End of stat string */
|
mysql->net.read_pos[mysql->packet_length]=0; /* End of stat string */
|
||||||
if (!mysql->net.read_pos[0])
|
if (!mysql->net.read_pos[0])
|
||||||
{
|
{
|
||||||
@ -1561,6 +1096,8 @@ mysql_stat(MYSQL *mysql)
|
|||||||
return mysql->net.last_error;
|
return mysql->net.last_error;
|
||||||
}
|
}
|
||||||
DBUG_RETURN((char*) mysql->net.read_pos);
|
DBUG_RETURN((char*) mysql->net.read_pos);
|
||||||
|
#endif
|
||||||
|
return (char *)mysql;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1573,23 +1110,23 @@ mysql_ping(MYSQL *mysql)
|
|||||||
|
|
||||||
|
|
||||||
const char * STDCALL
|
const char * STDCALL
|
||||||
mysql_get_server_info(MYSQL *mysql)
|
mysql_get_server_info(MYSQL *mysql __attribute__((unused)))
|
||||||
{
|
{
|
||||||
return((char*) mysql->server_version);
|
return MYSQL_SERVER_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char * STDCALL
|
const char * STDCALL
|
||||||
mysql_get_host_info(MYSQL *mysql)
|
mysql_get_host_info(MYSQL *mysql __attribute__((unused)))
|
||||||
{
|
{
|
||||||
return(mysql->host_info);
|
return "localhost";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint STDCALL
|
uint STDCALL
|
||||||
mysql_get_proto_info(MYSQL *mysql)
|
mysql_get_proto_info(MYSQL *mysql __attribute__((unused)))
|
||||||
{
|
{
|
||||||
return (mysql->protocol_version);
|
return PROTOCOL_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * STDCALL
|
const char * STDCALL
|
||||||
@ -1714,27 +1251,28 @@ my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql)
|
|||||||
|
|
||||||
uint STDCALL mysql_errno(MYSQL *mysql)
|
uint STDCALL mysql_errno(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
return get_mysql_net(mysql)->last_errno;
|
return mysql->last_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * STDCALL mysql_error(MYSQL *mysql)
|
const char * STDCALL mysql_error(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
return get_mysql_net(mysql)->last_error;
|
return mysql->last_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint STDCALL mysql_warning_count(MYSQL *mysql)
|
const char *STDCALL mysql_info(MYSQL *mysql __attribute__((unused)))
|
||||||
{
|
|
||||||
return mysql->warning_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *STDCALL mysql_info(MYSQL *mysql)
|
|
||||||
{
|
{
|
||||||
|
#ifdef DUMMY
|
||||||
return (mysql)->info;
|
return (mysql)->info;
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ulong STDCALL mysql_thread_id(MYSQL *mysql)
|
ulong STDCALL mysql_thread_id(MYSQL *mysql __attribute__((unused)))
|
||||||
{
|
{
|
||||||
|
#ifdef DUMMY
|
||||||
return (mysql)->thread_id;
|
return (mysql)->thread_id;
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * STDCALL mysql_character_set_name(MYSQL *mysql)
|
const char * STDCALL mysql_character_set_name(MYSQL *mysql)
|
||||||
@ -1757,10 +1295,9 @@ MYSQL_RES *STDCALL mysql_warnings(MYSQL *mysql)
|
|||||||
uint warning_count;
|
uint warning_count;
|
||||||
DBUG_ENTER("mysql_warnings");
|
DBUG_ENTER("mysql_warnings");
|
||||||
/* Save warning count as mysql_real_query may change this */
|
/* Save warning count as mysql_real_query may change this */
|
||||||
warning_count= mysql->warning_count;
|
warning_count= mysql_warning_count(mysql);
|
||||||
if (mysql_real_query(mysql, "SHOW WARNINGS", 13))
|
if (mysql_real_query(mysql, "SHOW WARNINGS", 13))
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
mysql->warning_count= warning_count;
|
|
||||||
DBUG_RETURN(mysql_store_result(mysql));
|
DBUG_RETURN(mysql_store_result(mysql));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +268,8 @@ int berkeley_show_logs(THD *thd)
|
|||||||
else
|
else
|
||||||
net_store_data(packet, SHOW_LOG_STATUS_INUSE);
|
net_store_data(packet, SHOW_LOG_STATUS_INUSE);
|
||||||
|
|
||||||
if (my_net_write(&thd->net,(char*) packet->ptr(),packet->length()))
|
|
||||||
|
if (SEND_ROW(thd, 3, (char*) packet->ptr(),packet->length()))
|
||||||
{
|
{
|
||||||
error=1;
|
error=1;
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -871,6 +871,7 @@ innobase_commit_low(
|
|||||||
/*================*/
|
/*================*/
|
||||||
trx_t* trx) /* in: transaction handle */
|
trx_t* trx) /* in: transaction handle */
|
||||||
{
|
{
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (current_thd->slave_thread) {
|
if (current_thd->slave_thread) {
|
||||||
/* Update the replication position info inside InnoDB */
|
/* Update the replication position info inside InnoDB */
|
||||||
#ifdef NEED_TO_BE_FIXED
|
#ifdef NEED_TO_BE_FIXED
|
||||||
@ -884,6 +885,7 @@ innobase_commit_low(
|
|||||||
active_mi->rli.event_len +
|
active_mi->rli.event_len +
|
||||||
active_mi->rli.pending));
|
active_mi->rli.pending));
|
||||||
}
|
}
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
trx_commit_for_mysql(trx);
|
trx_commit_for_mysql(trx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3953,8 +3955,7 @@ innodb_show_status(
|
|||||||
|
|
||||||
net_store_data(packet, buf);
|
net_store_data(packet, buf);
|
||||||
|
|
||||||
if (my_net_write(&thd->net, (char*)thd->packet.ptr(),
|
if (SEND_ROW(thd, field_list.elements, (char*)thd->packet.ptr(), packet->length())) {
|
||||||
packet->length())) {
|
|
||||||
ut_free(buf);
|
ut_free(buf);
|
||||||
|
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
|
@ -62,11 +62,14 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
|
|||||||
|
|
||||||
DBUG_PRINT(msg_type,("message: %s",msgbuf));
|
DBUG_PRINT(msg_type,("message: %s",msgbuf));
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (thd->net.vio == 0)
|
if (thd->net.vio == 0)
|
||||||
{
|
{
|
||||||
sql_print_error(msgbuf);
|
sql_print_error(msgbuf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (param->testflag & (T_CREATE_MISSING_KEYS | T_SAFE_REPAIR | T_AUTO_REPAIR))
|
if (param->testflag & (T_CREATE_MISSING_KEYS | T_SAFE_REPAIR | T_AUTO_REPAIR))
|
||||||
{
|
{
|
||||||
my_message(ER_NOT_KEYFILE,msgbuf,MYF(MY_WME));
|
my_message(ER_NOT_KEYFILE,msgbuf,MYF(MY_WME));
|
||||||
@ -139,6 +142,7 @@ const char *ha_myisam::index_type(uint key_number)
|
|||||||
|
|
||||||
int ha_myisam::net_read_dump(NET* net)
|
int ha_myisam::net_read_dump(NET* net)
|
||||||
{
|
{
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
int data_fd = file->dfile;
|
int data_fd = file->dfile;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
@ -161,14 +165,17 @@ int ha_myisam::net_read_dump(NET* net)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err:
|
err:
|
||||||
return error;
|
return error;
|
||||||
|
#else
|
||||||
|
return (int)net;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ha_myisam::dump(THD* thd, int fd)
|
int ha_myisam::dump(THD* thd, int fd)
|
||||||
{
|
{
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
MYISAM_SHARE* share = file->s;
|
MYISAM_SHARE* share = file->s;
|
||||||
NET* net = &thd->net;
|
NET* net = &thd->net;
|
||||||
uint blocksize = share->blocksize;
|
uint blocksize = share->blocksize;
|
||||||
@ -217,6 +224,9 @@ int ha_myisam::dump(THD* thd, int fd)
|
|||||||
err:
|
err:
|
||||||
my_free((gptr) buf, MYF(0));
|
my_free((gptr) buf, MYF(0));
|
||||||
return error;
|
return error;
|
||||||
|
#else
|
||||||
|
return (int)thd - fd;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Name is here without an extension */
|
/* Name is here without an extension */
|
||||||
|
@ -1656,6 +1656,7 @@ longlong Item_master_pos_wait::val_int()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ulong pos = (ulong)args[1]->val_int();
|
ulong pos = (ulong)args[1]->val_int();
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
LOCK_ACTIVE_MI;
|
LOCK_ACTIVE_MI;
|
||||||
if ((event_count = active_mi->rli.wait_for_pos(thd, log_name, pos)) == -1)
|
if ((event_count = active_mi->rli.wait_for_pos(thd, log_name, pos)) == -1)
|
||||||
{
|
{
|
||||||
@ -1663,6 +1664,7 @@ longlong Item_master_pos_wait::val_int()
|
|||||||
event_count=0;
|
event_count=0;
|
||||||
}
|
}
|
||||||
UNLOCK_ACTIVE_MI;
|
UNLOCK_ACTIVE_MI;
|
||||||
|
#endif
|
||||||
return event_count;
|
return event_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
sql/log.cc
14
sql/log.cc
@ -23,6 +23,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mysql_priv.h"
|
#include "mysql_priv.h"
|
||||||
|
#include <mysql.h>
|
||||||
|
|
||||||
#include "sql_acl.h"
|
#include "sql_acl.h"
|
||||||
#include "sql_repl.h"
|
#include "sql_repl.h"
|
||||||
|
|
||||||
@ -31,6 +33,7 @@
|
|||||||
#include <m_ctype.h> // For test_if_number
|
#include <m_ctype.h> // For test_if_number
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log;
|
MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log;
|
||||||
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
|
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
|
||||||
|
|
||||||
@ -610,6 +613,8 @@ err:
|
|||||||
LOG_INFO_IO Got IO error while reading file
|
LOG_INFO_IO Got IO error while reading file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
|
||||||
int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli)
|
int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
@ -739,6 +744,8 @@ err:
|
|||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Create a new log file name
|
Create a new log file name
|
||||||
@ -1048,6 +1055,7 @@ bool MYSQL_LOG::write(Log_event* event_info)
|
|||||||
#else
|
#else
|
||||||
IO_CACHE *file = &log_file;
|
IO_CACHE *file = &log_file;
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if ((thd && !(thd->options & OPTION_BIN_LOG) &&
|
if ((thd && !(thd->options & OPTION_BIN_LOG) &&
|
||||||
(thd->master_access & SUPER_ACL)) ||
|
(thd->master_access & SUPER_ACL)) ||
|
||||||
(local_db && !db_ok(local_db, binlog_do_db, binlog_ignore_db)))
|
(local_db && !db_ok(local_db, binlog_do_db, binlog_ignore_db)))
|
||||||
@ -1056,6 +1064,7 @@ bool MYSQL_LOG::write(Log_event* event_info)
|
|||||||
DBUG_PRINT("error",("!db_ok"));
|
DBUG_PRINT("error",("!db_ok"));
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
error=1;
|
error=1;
|
||||||
/*
|
/*
|
||||||
@ -1419,6 +1428,7 @@ void MYSQL_LOG::close(bool exiting)
|
|||||||
DBUG_PRINT("enter",("exiting: %d", (int) exiting));
|
DBUG_PRINT("enter",("exiting: %d", (int) exiting));
|
||||||
if (is_open())
|
if (is_open())
|
||||||
{
|
{
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (log_type == LOG_BIN && !no_auto_events && exiting)
|
if (log_type == LOG_BIN && !no_auto_events && exiting)
|
||||||
{
|
{
|
||||||
Stop_log_event s;
|
Stop_log_event s;
|
||||||
@ -1426,6 +1436,7 @@ void MYSQL_LOG::close(bool exiting)
|
|||||||
s.write(&log_file);
|
s.write(&log_file);
|
||||||
signal_update();
|
signal_update();
|
||||||
}
|
}
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
end_io_cache(&log_file);
|
end_io_cache(&log_file);
|
||||||
if (my_close(log_file.file,MYF(0)) < 0 && ! write_error)
|
if (my_close(log_file.file,MYF(0)) < 0 && ! write_error)
|
||||||
{
|
{
|
||||||
@ -1549,3 +1560,6 @@ void sql_perror(const char *message)
|
|||||||
perror(message);
|
perror(message);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,12 +80,14 @@ static void pretty_print_str(FILE* file, char* str, int len)
|
|||||||
ignored_error_code()
|
ignored_error_code()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
inline int ignored_error_code(int err_code)
|
inline int ignored_error_code(int err_code)
|
||||||
{
|
{
|
||||||
return use_slave_mask && bitmap_is_set(&slave_error_mask, err_code);
|
return use_slave_mask && bitmap_is_set(&slave_error_mask, err_code);
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
@ -122,6 +124,7 @@ static void pretty_print_str(String* packet, char* str, int len)
|
|||||||
slave_load_file_stem()
|
slave_load_file_stem()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
static inline char* slave_load_file_stem(char*buf, uint file_id,
|
static inline char* slave_load_file_stem(char*buf, uint file_id,
|
||||||
int event_server_id)
|
int event_server_id)
|
||||||
@ -135,6 +138,7 @@ static inline char* slave_load_file_stem(char*buf, uint file_id,
|
|||||||
return int10_to_str(file_id, buf, 10);
|
return int10_to_str(file_id, buf, 10);
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
@ -148,6 +152,7 @@ static inline char* slave_load_file_stem(char*buf, uint file_id,
|
|||||||
Easily fixable by adding server_id as a prefix to the log files.
|
Easily fixable by adding server_id as a prefix to the log files.
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
static void cleanup_load_tmpdir()
|
static void cleanup_load_tmpdir()
|
||||||
{
|
{
|
||||||
@ -167,6 +172,7 @@ static void cleanup_load_tmpdir()
|
|||||||
my_dirend(dirp);
|
my_dirend(dirp);
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
@ -284,6 +290,7 @@ Log_event::Log_event(const char* buf, bool old_format)
|
|||||||
|
|
||||||
|
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
@ -310,6 +317,7 @@ void Log_event::pack_info(String* packet)
|
|||||||
{
|
{
|
||||||
net_store_data(packet, "", 0);
|
net_store_data(packet, "", 0);
|
||||||
}
|
}
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
@ -333,6 +341,7 @@ void Log_event::init_show_field_list(List<Item>* field_list)
|
|||||||
Only called by SHOW BINLOG EVENTS
|
Only called by SHOW BINLOG EVENTS
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
int Log_event::net_send(THD* thd_arg, const char* log_name, my_off_t pos)
|
int Log_event::net_send(THD* thd_arg, const char* log_name, my_off_t pos)
|
||||||
{
|
{
|
||||||
String* packet = &thd_arg->packet;
|
String* packet = &thd_arg->packet;
|
||||||
@ -349,8 +358,9 @@ int Log_event::net_send(THD* thd_arg, const char* log_name, my_off_t pos)
|
|||||||
net_store_data(packet, server_id);
|
net_store_data(packet, server_id);
|
||||||
net_store_data(packet, (longlong) log_pos);
|
net_store_data(packet, (longlong) log_pos);
|
||||||
pack_info(packet);
|
pack_info(packet);
|
||||||
return my_net_write(&thd_arg->net, (char*) packet->ptr(), packet->length());
|
return SEND_ROW(thd_arg, 5, (char*) packet->ptr(), packet->length());
|
||||||
}
|
}
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -558,9 +568,11 @@ Log_event* Log_event::read_log_event(const char* buf, int event_len,
|
|||||||
case ROTATE_EVENT:
|
case ROTATE_EVENT:
|
||||||
ev = new Rotate_log_event(buf, event_len, old_format);
|
ev = new Rotate_log_event(buf, event_len, old_format);
|
||||||
break;
|
break;
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
case SLAVE_EVENT:
|
case SLAVE_EVENT:
|
||||||
ev = new Slave_log_event(buf, event_len);
|
ev = new Slave_log_event(buf, event_len);
|
||||||
break;
|
break;
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
case CREATE_FILE_EVENT:
|
case CREATE_FILE_EVENT:
|
||||||
ev = new Create_file_log_event(buf, event_len, old_format);
|
ev = new Create_file_log_event(buf, event_len, old_format);
|
||||||
break;
|
break;
|
||||||
@ -576,9 +588,11 @@ Log_event* Log_event::read_log_event(const char* buf, int event_len,
|
|||||||
case START_EVENT:
|
case START_EVENT:
|
||||||
ev = new Start_log_event(buf, old_format);
|
ev = new Start_log_event(buf, old_format);
|
||||||
break;
|
break;
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
case STOP_EVENT:
|
case STOP_EVENT:
|
||||||
ev = new Stop_log_event(buf, old_format);
|
ev = new Stop_log_event(buf, old_format);
|
||||||
break;
|
break;
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
case INTVAR_EVENT:
|
case INTVAR_EVENT:
|
||||||
ev = new Intvar_log_event(buf, old_format);
|
ev = new Intvar_log_event(buf, old_format);
|
||||||
break;
|
break;
|
||||||
@ -665,6 +679,7 @@ void Log_event::set_log_pos(MYSQL_LOG* log)
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
@ -688,6 +703,7 @@ void Query_log_event::pack_info(String* packet)
|
|||||||
net_store_data(packet, (char*)tmp.ptr(), tmp.length());
|
net_store_data(packet, (char*)tmp.ptr(), tmp.length());
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
@ -820,6 +836,7 @@ void Query_log_event::print(FILE* file, bool short_form, char* last_db)
|
|||||||
Query_log_event::exec_event()
|
Query_log_event::exec_event()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
int Query_log_event::exec_event(struct st_relay_log_info* rli)
|
int Query_log_event::exec_event(struct st_relay_log_info* rli)
|
||||||
{
|
{
|
||||||
@ -909,6 +926,7 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
|
|||||||
return Log_event::exec_event(rli);
|
return Log_event::exec_event(rli);
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -924,6 +942,7 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
|
|||||||
Start_log_event::pack_info()
|
Start_log_event::pack_info()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
void Start_log_event::pack_info(String* packet)
|
void Start_log_event::pack_info(String* packet)
|
||||||
{
|
{
|
||||||
@ -939,6 +958,7 @@ void Start_log_event::pack_info(String* packet)
|
|||||||
net_store_data(packet, tmp.ptr(), tmp.length());
|
net_store_data(packet, tmp.ptr(), tmp.length());
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
@ -1007,6 +1027,7 @@ int Start_log_event::write_data(IO_CACHE* file)
|
|||||||
In this case we should stop the slave.
|
In this case we should stop the slave.
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
int Start_log_event::exec_event(struct st_relay_log_info* rli)
|
int Start_log_event::exec_event(struct st_relay_log_info* rli)
|
||||||
{
|
{
|
||||||
@ -1020,6 +1041,7 @@ int Start_log_event::exec_event(struct st_relay_log_info* rli)
|
|||||||
return Log_event::exec_event(rli);
|
return Log_event::exec_event(rli);
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -1035,6 +1057,7 @@ int Start_log_event::exec_event(struct st_relay_log_info* rli)
|
|||||||
Load_log_event::pack_info()
|
Load_log_event::pack_info()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
void Load_log_event::pack_info(String* packet)
|
void Load_log_event::pack_info(String* packet)
|
||||||
{
|
{
|
||||||
@ -1112,6 +1135,7 @@ void Load_log_event::pack_info(String* packet)
|
|||||||
net_store_data(packet, tmp.ptr(), tmp.length());
|
net_store_data(packet, tmp.ptr(), tmp.length());
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
@ -1415,6 +1439,7 @@ void Load_log_event::set_fields(List<Item> &field_list)
|
|||||||
Load_log_event::exec_event()
|
Load_log_event::exec_event()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
|
int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
|
||||||
{
|
{
|
||||||
@ -1526,6 +1551,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
|
|||||||
return Log_event::exec_event(rli);
|
return Log_event::exec_event(rli);
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -1541,6 +1567,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
|
|||||||
Rotate_log_event::pack_info()
|
Rotate_log_event::pack_info()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
void Rotate_log_event::pack_info(String* packet)
|
void Rotate_log_event::pack_info(String* packet)
|
||||||
{
|
{
|
||||||
@ -1555,6 +1582,7 @@ void Rotate_log_event::pack_info(String* packet)
|
|||||||
net_store_data(packet, tmp.ptr(), tmp.length());
|
net_store_data(packet, tmp.ptr(), tmp.length());
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
@ -1647,6 +1675,7 @@ int Rotate_log_event::write_data(IO_CACHE* file)
|
|||||||
0 ok
|
0 ok
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
|
int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
|
||||||
{
|
{
|
||||||
@ -1664,6 +1693,7 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -1679,6 +1709,7 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
|
|||||||
Intvar_log_event::pack_info()
|
Intvar_log_event::pack_info()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
void Intvar_log_event::pack_info(String* packet)
|
void Intvar_log_event::pack_info(String* packet)
|
||||||
{
|
{
|
||||||
@ -1691,6 +1722,7 @@ void Intvar_log_event::pack_info(String* packet)
|
|||||||
net_store_data(packet, tmp.ptr(), tmp.length());
|
net_store_data(packet, tmp.ptr(), tmp.length());
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
@ -1769,6 +1801,7 @@ void Intvar_log_event::print(FILE* file, bool short_form, char* last_db)
|
|||||||
Intvar_log_event::exec_event()
|
Intvar_log_event::exec_event()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
int Intvar_log_event::exec_event(struct st_relay_log_info* rli)
|
int Intvar_log_event::exec_event(struct st_relay_log_info* rli)
|
||||||
{
|
{
|
||||||
@ -1785,6 +1818,7 @@ int Intvar_log_event::exec_event(struct st_relay_log_info* rli)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -1800,6 +1834,7 @@ int Intvar_log_event::exec_event(struct st_relay_log_info* rli)
|
|||||||
Rand_log_event::pack_info()
|
Rand_log_event::pack_info()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
void Rand_log_event::pack_info(String* packet)
|
void Rand_log_event::pack_info(String* packet)
|
||||||
{
|
{
|
||||||
@ -1811,6 +1846,7 @@ void Rand_log_event::pack_info(String* packet)
|
|||||||
net_store_data(packet, buf1, (uint) (pos-buf1));
|
net_store_data(packet, buf1, (uint) (pos-buf1));
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
@ -1863,6 +1899,7 @@ void Rand_log_event::print(FILE* file, bool short_form, char* last_db)
|
|||||||
Rand_log_event::exec_event()
|
Rand_log_event::exec_event()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
int Rand_log_event::exec_event(struct st_relay_log_info* rli)
|
int Rand_log_event::exec_event(struct st_relay_log_info* rli)
|
||||||
{
|
{
|
||||||
@ -1872,6 +1909,7 @@ int Rand_log_event::exec_event(struct st_relay_log_info* rli)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -1887,6 +1925,8 @@ int Rand_log_event::exec_event(struct st_relay_log_info* rli)
|
|||||||
Slave_log_event::pack_info()
|
Slave_log_event::pack_info()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
void Slave_log_event::pack_info(String* packet)
|
void Slave_log_event::pack_info(String* packet)
|
||||||
{
|
{
|
||||||
@ -2110,6 +2150,7 @@ int Stop_log_event::exec_event(struct st_relay_log_info* rli)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -2235,6 +2276,7 @@ void Create_file_log_event::print(FILE* file, bool short_form,
|
|||||||
Create_file_log_event::pack_info()
|
Create_file_log_event::pack_info()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
void Create_file_log_event::pack_info(String* packet)
|
void Create_file_log_event::pack_info(String* packet)
|
||||||
{
|
{
|
||||||
@ -2254,12 +2296,14 @@ void Create_file_log_event::pack_info(String* packet)
|
|||||||
net_store_data(packet, (char*) tmp.ptr(), tmp.length());
|
net_store_data(packet, (char*) tmp.ptr(), tmp.length());
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Create_file_log_event::exec_event()
|
Create_file_log_event::exec_event()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
|
int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
|
||||||
{
|
{
|
||||||
@ -2318,6 +2362,7 @@ err:
|
|||||||
return error ? 1 : Log_event::exec_event(rli);
|
return error ? 1 : Log_event::exec_event(rli);
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -2394,6 +2439,7 @@ void Append_block_log_event::print(FILE* file, bool short_form,
|
|||||||
Append_block_log_event::pack_info()
|
Append_block_log_event::pack_info()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
void Append_block_log_event::pack_info(String* packet)
|
void Append_block_log_event::pack_info(String* packet)
|
||||||
{
|
{
|
||||||
@ -2405,12 +2451,14 @@ void Append_block_log_event::pack_info(String* packet)
|
|||||||
net_store_data(packet, buf, (int32) length);
|
net_store_data(packet, buf, (int32) length);
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Append_block_log_event::exec_event()
|
Append_block_log_event::exec_event()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
int Append_block_log_event::exec_event(struct st_relay_log_info* rli)
|
int Append_block_log_event::exec_event(struct st_relay_log_info* rli)
|
||||||
{
|
{
|
||||||
@ -2440,6 +2488,7 @@ err:
|
|||||||
return error ? error : Log_event::exec_event(rli);
|
return error ? error : Log_event::exec_event(rli);
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -2509,6 +2558,7 @@ void Delete_file_log_event::print(FILE* file, bool short_form,
|
|||||||
Delete_file_log_event::pack_info()
|
Delete_file_log_event::pack_info()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
void Delete_file_log_event::pack_info(String* packet)
|
void Delete_file_log_event::pack_info(String* packet)
|
||||||
{
|
{
|
||||||
@ -2518,12 +2568,14 @@ void Delete_file_log_event::pack_info(String* packet)
|
|||||||
net_store_data(packet, buf, (int32) length);
|
net_store_data(packet, buf, (int32) length);
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Delete_file_log_event::exec_event()
|
Delete_file_log_event::exec_event()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
int Delete_file_log_event::exec_event(struct st_relay_log_info* rli)
|
int Delete_file_log_event::exec_event(struct st_relay_log_info* rli)
|
||||||
{
|
{
|
||||||
@ -2538,6 +2590,7 @@ int Delete_file_log_event::exec_event(struct st_relay_log_info* rli)
|
|||||||
return Log_event::exec_event(rli);
|
return Log_event::exec_event(rli);
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -2608,6 +2661,7 @@ void Execute_load_log_event::print(FILE* file, bool short_form,
|
|||||||
Execute_load_log_event::pack_info()
|
Execute_load_log_event::pack_info()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
void Execute_load_log_event::pack_info(String* packet)
|
void Execute_load_log_event::pack_info(String* packet)
|
||||||
{
|
{
|
||||||
@ -2617,12 +2671,14 @@ void Execute_load_log_event::pack_info(String* packet)
|
|||||||
net_store_data(packet, buf, (int32) length);
|
net_store_data(packet, buf, (int32) length);
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Execute_load_log_event::exec_event()
|
Execute_load_log_event::exec_event()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
|
int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
|
||||||
{
|
{
|
||||||
@ -2683,6 +2739,7 @@ err:
|
|||||||
return error ? error : Log_event::exec_event(rli);
|
return error ? error : Log_event::exec_event(rli);
|
||||||
}
|
}
|
||||||
#endif // !MYSQL_CLIENT
|
#endif // !MYSQL_CLIENT
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -2774,8 +2831,3 @@ char* sql_ex_info::init(char* buf,char* buf_end,bool use_new_format)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -267,10 +267,12 @@ public:
|
|||||||
static int read_log_event(IO_CACHE* file, String* packet,
|
static int read_log_event(IO_CACHE* file, String* packet,
|
||||||
pthread_mutex_t* log_lock);
|
pthread_mutex_t* log_lock);
|
||||||
void set_log_pos(MYSQL_LOG* log);
|
void set_log_pos(MYSQL_LOG* log);
|
||||||
virtual void pack_info(String* packet);
|
|
||||||
int net_send(THD* thd, const char* log_name, my_off_t pos);
|
|
||||||
static void init_show_field_list(List<Item>* field_list);
|
static void init_show_field_list(List<Item>* field_list);
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
int net_send(THD* thd, const char* log_name, my_off_t pos);
|
||||||
|
virtual void pack_info(String* packet);
|
||||||
virtual int exec_event(struct st_relay_log_info* rli);
|
virtual int exec_event(struct st_relay_log_info* rli);
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
virtual const char* get_db()
|
virtual const char* get_db()
|
||||||
{
|
{
|
||||||
return thd ? thd->db : 0;
|
return thd ? thd->db : 0;
|
||||||
@ -355,8 +357,10 @@ public:
|
|||||||
Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length,
|
Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length,
|
||||||
bool using_trans);
|
bool using_trans);
|
||||||
const char* get_db() { return db; }
|
const char* get_db() { return db; }
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
void pack_info(String* packet);
|
void pack_info(String* packet);
|
||||||
int exec_event(struct st_relay_log_info* rli);
|
int exec_event(struct st_relay_log_info* rli);
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
#else
|
#else
|
||||||
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
||||||
#endif
|
#endif
|
||||||
@ -383,6 +387,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
@ -404,8 +409,10 @@ public:
|
|||||||
|
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
Slave_log_event(THD* thd_arg, struct st_relay_log_info* rli);
|
Slave_log_event(THD* thd_arg, struct st_relay_log_info* rli);
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
void pack_info(String* packet);
|
void pack_info(String* packet);
|
||||||
int exec_event(struct st_relay_log_info* rli);
|
int exec_event(struct st_relay_log_info* rli);
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
#else
|
#else
|
||||||
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
||||||
#endif
|
#endif
|
||||||
@ -418,6 +425,8 @@ public:
|
|||||||
int write_data(IO_CACHE* file );
|
int write_data(IO_CACHE* file );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
@ -454,13 +463,15 @@ public:
|
|||||||
List<Item>& fields_arg, enum enum_duplicates handle_dup,
|
List<Item>& fields_arg, enum enum_duplicates handle_dup,
|
||||||
bool using_trans);
|
bool using_trans);
|
||||||
void set_fields(List<Item> &fields_arg);
|
void set_fields(List<Item> &fields_arg);
|
||||||
void pack_info(String* packet);
|
|
||||||
const char* get_db() { return db; }
|
const char* get_db() { return db; }
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
void pack_info(String* packet);
|
||||||
int exec_event(struct st_relay_log_info* rli)
|
int exec_event(struct st_relay_log_info* rli)
|
||||||
{
|
{
|
||||||
return exec_event(thd->slave_net,rli);
|
return exec_event(thd->slave_net,rli);
|
||||||
}
|
}
|
||||||
int exec_event(NET* net, struct st_relay_log_info* rli);
|
int exec_event(NET* net, struct st_relay_log_info* rli);
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
#else
|
#else
|
||||||
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
||||||
#endif
|
#endif
|
||||||
@ -507,8 +518,10 @@ public:
|
|||||||
created = (uint32) when;
|
created = (uint32) when;
|
||||||
memcpy(server_version, ::server_version, ST_SERVER_VER_LEN);
|
memcpy(server_version, ::server_version, ST_SERVER_VER_LEN);
|
||||||
}
|
}
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
void pack_info(String* packet);
|
void pack_info(String* packet);
|
||||||
int exec_event(struct st_relay_log_info* rli);
|
int exec_event(struct st_relay_log_info* rli);
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
#else
|
#else
|
||||||
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
||||||
#endif
|
#endif
|
||||||
@ -542,8 +555,10 @@ public:
|
|||||||
Intvar_log_event(THD* thd_arg,uchar type_arg, ulonglong val_arg)
|
Intvar_log_event(THD* thd_arg,uchar type_arg, ulonglong val_arg)
|
||||||
:Log_event(),val(val_arg),type(type_arg)
|
:Log_event(),val(val_arg),type(type_arg)
|
||||||
{}
|
{}
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
void pack_info(String* packet);
|
void pack_info(String* packet);
|
||||||
int exec_event(struct st_relay_log_info* rli);
|
int exec_event(struct st_relay_log_info* rli);
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
#else
|
#else
|
||||||
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
||||||
#endif
|
#endif
|
||||||
@ -574,8 +589,10 @@ class Rand_log_event: public Log_event
|
|||||||
Rand_log_event(THD* thd_arg, ulonglong seed1_arg, ulonglong seed2_arg)
|
Rand_log_event(THD* thd_arg, ulonglong seed1_arg, ulonglong seed2_arg)
|
||||||
:Log_event(thd_arg,0,0),seed1(seed1_arg),seed2(seed2_arg)
|
:Log_event(thd_arg,0,0),seed1(seed1_arg),seed2(seed2_arg)
|
||||||
{}
|
{}
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
void pack_info(String* packet);
|
void pack_info(String* packet);
|
||||||
int exec_event(struct st_relay_log_info* rli);
|
int exec_event(struct st_relay_log_info* rli);
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
#else
|
#else
|
||||||
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
||||||
#endif
|
#endif
|
||||||
@ -594,13 +611,17 @@ class Rand_log_event: public Log_event
|
|||||||
Stop Log Event class
|
Stop Log Event class
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
|
||||||
class Stop_log_event: public Log_event
|
class Stop_log_event: public Log_event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
Stop_log_event() :Log_event()
|
Stop_log_event() :Log_event()
|
||||||
{}
|
{}
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
int exec_event(struct st_relay_log_info* rli);
|
int exec_event(struct st_relay_log_info* rli);
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
#else
|
#else
|
||||||
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
||||||
#endif
|
#endif
|
||||||
@ -613,6 +634,8 @@ public:
|
|||||||
bool is_valid() { return 1; }
|
bool is_valid() { return 1; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
@ -636,8 +659,10 @@ public:
|
|||||||
pos(pos_arg),ident_len(ident_len_arg ? ident_len_arg :
|
pos(pos_arg),ident_len(ident_len_arg ? ident_len_arg :
|
||||||
(uint) strlen(new_log_ident_arg)), alloced(0)
|
(uint) strlen(new_log_ident_arg)), alloced(0)
|
||||||
{}
|
{}
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
void pack_info(String* packet);
|
void pack_info(String* packet);
|
||||||
int exec_event(struct st_relay_log_info* rli);
|
int exec_event(struct st_relay_log_info* rli);
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
#else
|
#else
|
||||||
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
||||||
#endif
|
#endif
|
||||||
@ -683,8 +708,10 @@ public:
|
|||||||
enum enum_duplicates handle_dup,
|
enum enum_duplicates handle_dup,
|
||||||
char* block_arg, uint block_len_arg,
|
char* block_arg, uint block_len_arg,
|
||||||
bool using_trans);
|
bool using_trans);
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
void pack_info(String* packet);
|
void pack_info(String* packet);
|
||||||
int exec_event(struct st_relay_log_info* rli);
|
int exec_event(struct st_relay_log_info* rli);
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
#else
|
#else
|
||||||
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
||||||
#endif
|
#endif
|
||||||
@ -733,8 +760,10 @@ public:
|
|||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
Append_block_log_event(THD* thd, char* block_arg,
|
Append_block_log_event(THD* thd, char* block_arg,
|
||||||
uint block_len_arg, bool using_trans);
|
uint block_len_arg, bool using_trans);
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
int exec_event(struct st_relay_log_info* rli);
|
int exec_event(struct st_relay_log_info* rli);
|
||||||
void pack_info(String* packet);
|
void pack_info(String* packet);
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
#else
|
#else
|
||||||
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
||||||
#endif
|
#endif
|
||||||
@ -759,8 +788,10 @@ public:
|
|||||||
|
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
Delete_file_log_event(THD* thd, bool using_trans);
|
Delete_file_log_event(THD* thd, bool using_trans);
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
void pack_info(String* packet);
|
void pack_info(String* packet);
|
||||||
int exec_event(struct st_relay_log_info* rli);
|
int exec_event(struct st_relay_log_info* rli);
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
#else
|
#else
|
||||||
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
||||||
#endif
|
#endif
|
||||||
@ -785,8 +816,10 @@ public:
|
|||||||
|
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
Execute_load_log_event(THD* thd, bool using_trans);
|
Execute_load_log_event(THD* thd, bool using_trans);
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
void pack_info(String* packet);
|
void pack_info(String* packet);
|
||||||
int exec_event(struct st_relay_log_info* rli);
|
int exec_event(struct st_relay_log_info* rli);
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
#else
|
#else
|
||||||
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
void print(FILE* file, bool short_form = 0, char* last_db = 0);
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
flush_io_cache().
|
flush_io_cache().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
|
||||||
#define MAP_TO_USE_RAID
|
#define MAP_TO_USE_RAID
|
||||||
#include "mysql_priv.h"
|
#include "mysql_priv.h"
|
||||||
#ifdef HAVE_AIOWAIT
|
#ifdef HAVE_AIOWAIT
|
||||||
@ -81,3 +83,6 @@ int _my_b_net_read(register IO_CACHE *info, byte *Buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
in case we decide to make them external at some point
|
in case we decide to make them external at some point
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
/* my_pthread must be included early to be able to fix things */
|
/* my_pthread must be included early to be able to fix things */
|
||||||
#if defined(THREAD)
|
#if defined(THREAD)
|
||||||
@ -1471,3 +1472,5 @@ MYSQL_RES *mc_mysql_store_result(MYSQL *mysql)
|
|||||||
mysql->fields=0; /* fields is now in result */
|
mysql->fields=0; /* fields is now in result */
|
||||||
DBUG_RETURN(result); /* Data fetched */
|
DBUG_RETURN(result); /* Data fetched */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /*EMBEDDED_LIBRARY*/
|
||||||
|
522
sql/mysqld.cc
522
sql/mysqld.cc
@ -486,6 +486,8 @@ static uint set_maximum_open_files(uint max_file_limit);
|
|||||||
#endif
|
#endif
|
||||||
static ulong find_bit_type(const char *x, TYPELIB *bit_lib);
|
static ulong find_bit_type(const char *x, TYPELIB *bit_lib);
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
** Code to end mysqld
|
** Code to end mysqld
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -661,6 +663,7 @@ static void close_connections(void)
|
|||||||
DBUG_PRINT("quit",("close_connections thread"));
|
DBUG_PRINT("quit",("close_connections thread"));
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
#endif /*EMBEDDED_LIBRARY*/
|
||||||
|
|
||||||
static void close_server_sock()
|
static void close_server_sock()
|
||||||
{
|
{
|
||||||
@ -752,6 +755,7 @@ void kill_mysql(void)
|
|||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
|
||||||
/* Force server down. kill all connections and threads and exit */
|
/* Force server down. kill all connections and threads and exit */
|
||||||
|
|
||||||
@ -792,13 +796,16 @@ static void __cdecl kill_server(int sig_ptr)
|
|||||||
RETURN_FROM_KILL_SERVER;
|
RETURN_FROM_KILL_SERVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
#ifdef USE_ONE_SIGNAL_HAND
|
#ifdef USE_ONE_SIGNAL_HAND
|
||||||
extern "C" pthread_handler_decl(kill_server_thread,arg __attribute__((unused)))
|
extern "C" pthread_handler_decl(kill_server_thread,arg __attribute__((unused)))
|
||||||
{
|
{
|
||||||
SHUTDOWN_THD;
|
SHUTDOWN_THD;
|
||||||
my_thread_init(); // Initialize new thread
|
my_thread_init(); // Initialize new thread
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
kill_server(0);
|
kill_server(0);
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
my_thread_end(); // Normally never reached
|
my_thread_end(); // Normally never reached
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -869,8 +876,10 @@ void clean_up(bool print_message)
|
|||||||
DBUG_PRINT("exit",("clean_up"));
|
DBUG_PRINT("exit",("clean_up"));
|
||||||
if (cleanup_done++)
|
if (cleanup_done++)
|
||||||
return; /* purecov: inspected */
|
return; /* purecov: inspected */
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (use_slave_mask)
|
if (use_slave_mask)
|
||||||
bitmap_free(&slave_error_mask);
|
bitmap_free(&slave_error_mask);
|
||||||
|
#endif
|
||||||
acl_free(1);
|
acl_free(1);
|
||||||
grant_free();
|
grant_free();
|
||||||
query_cache_destroy();
|
query_cache_destroy();
|
||||||
@ -892,12 +901,16 @@ void clean_up(bool print_message)
|
|||||||
free_defaults(defaults_argv);
|
free_defaults(defaults_argv);
|
||||||
my_free(charsets_list, MYF(MY_ALLOW_ZERO_PTR));
|
my_free(charsets_list, MYF(MY_ALLOW_ZERO_PTR));
|
||||||
free_tmpdir(&mysql_tmpdir_list);
|
free_tmpdir(&mysql_tmpdir_list);
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
my_free(slave_load_tmpdir,MYF(MY_ALLOW_ZERO_PTR));
|
my_free(slave_load_tmpdir,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
|
#endif
|
||||||
x_free(opt_bin_logname);
|
x_free(opt_bin_logname);
|
||||||
x_free(opt_relay_logname);
|
x_free(opt_relay_logname);
|
||||||
bitmap_free(&temp_pool);
|
bitmap_free(&temp_pool);
|
||||||
free_max_user_conn();
|
free_max_user_conn();
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
end_slave_list();
|
end_slave_list();
|
||||||
|
#endif
|
||||||
#ifdef USE_REGEX
|
#ifdef USE_REGEX
|
||||||
regex_end();
|
regex_end();
|
||||||
#endif
|
#endif
|
||||||
@ -1179,7 +1192,7 @@ void yyerror(const char *s)
|
|||||||
thd->lex.yylineno);
|
thd->lex.yylineno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
void close_connection(NET *net,uint errcode,bool lock)
|
void close_connection(NET *net,uint errcode,bool lock)
|
||||||
{
|
{
|
||||||
st_vio* vio;
|
st_vio* vio;
|
||||||
@ -1199,6 +1212,7 @@ void close_connection(NET *net,uint errcode,bool lock)
|
|||||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Called when a thread is aborted */
|
/* Called when a thread is aborted */
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
@ -1714,7 +1728,7 @@ extern "C" int my_message_sql(uint error, const char *str,
|
|||||||
|
|
||||||
void clear_error_message(THD *thd)
|
void clear_error_message(THD *thd)
|
||||||
{
|
{
|
||||||
thd->net.last_error[0]= 0;
|
thd->clear_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1935,7 +1949,9 @@ static int init_thread_environement()
|
|||||||
(void) pthread_mutex_init(&LOCK_bytes_received,MY_MUTEX_INIT_FAST);
|
(void) pthread_mutex_init(&LOCK_bytes_received,MY_MUTEX_INIT_FAST);
|
||||||
(void) pthread_mutex_init(&LOCK_timezone,MY_MUTEX_INIT_FAST);
|
(void) pthread_mutex_init(&LOCK_timezone,MY_MUTEX_INIT_FAST);
|
||||||
(void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST);
|
(void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST);
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
(void) pthread_mutex_init(&LOCK_rpl_status, MY_MUTEX_INIT_FAST);
|
(void) pthread_mutex_init(&LOCK_rpl_status, MY_MUTEX_INIT_FAST);
|
||||||
|
#endif
|
||||||
(void) pthread_mutex_init(&LOCK_active_mi, MY_MUTEX_INIT_FAST);
|
(void) pthread_mutex_init(&LOCK_active_mi, MY_MUTEX_INIT_FAST);
|
||||||
(void) pthread_mutex_init(&LOCK_global_system_variables, MY_MUTEX_INIT_FAST);
|
(void) pthread_mutex_init(&LOCK_global_system_variables, MY_MUTEX_INIT_FAST);
|
||||||
(void) my_rwlock_init(&LOCK_grant, NULL);
|
(void) my_rwlock_init(&LOCK_grant, NULL);
|
||||||
@ -1944,7 +1960,9 @@ static int init_thread_environement()
|
|||||||
(void) pthread_cond_init(&COND_thread_cache,NULL);
|
(void) pthread_cond_init(&COND_thread_cache,NULL);
|
||||||
(void) pthread_cond_init(&COND_flush_thread_cache,NULL);
|
(void) pthread_cond_init(&COND_flush_thread_cache,NULL);
|
||||||
(void) pthread_cond_init(&COND_manager,NULL);
|
(void) pthread_cond_init(&COND_manager,NULL);
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
(void) pthread_cond_init(&COND_rpl_status, NULL);
|
(void) pthread_cond_init(&COND_rpl_status, NULL);
|
||||||
|
#endif
|
||||||
/* Parameter for threads created for connections */
|
/* Parameter for threads created for connections */
|
||||||
(void) pthread_attr_init(&connection_attrib);
|
(void) pthread_attr_init(&connection_attrib);
|
||||||
(void) pthread_attr_setdetachstate(&connection_attrib,
|
(void) pthread_attr_setdetachstate(&connection_attrib,
|
||||||
@ -1991,7 +2009,9 @@ static int init_server_components()
|
|||||||
randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2);
|
randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2);
|
||||||
reset_floating_point_exceptions();
|
reset_floating_point_exceptions();
|
||||||
init_thr_lock();
|
init_thr_lock();
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
init_slave_list();
|
init_slave_list();
|
||||||
|
#endif
|
||||||
/* Setup log files */
|
/* Setup log files */
|
||||||
if (opt_log)
|
if (opt_log)
|
||||||
open_log(&mysql_log, glob_hostname, opt_logname, ".log", NullS,
|
open_log(&mysql_log, glob_hostname, opt_logname, ".log", NullS,
|
||||||
@ -2126,6 +2146,7 @@ void create_named_pipe_thread()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
int win_main(int argc, char **argv)
|
int win_main(int argc, char **argv)
|
||||||
#else
|
#else
|
||||||
@ -2316,474 +2337,7 @@ The server will not act as a slave.");
|
|||||||
return(0); /* purecov: deadcode */
|
return(0); /* purecov: deadcode */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DUMMY
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
#ifdef __WIN__
|
|
||||||
int win_main(int argc, char **argv)
|
|
||||||
#else
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
DEBUGGER_OFF;
|
|
||||||
|
|
||||||
my_umask=0660; // Default umask for new files
|
|
||||||
my_umask_dir=0700; // Default umask for new directories
|
|
||||||
MAIN_THD;
|
|
||||||
/*
|
|
||||||
Initialize signal_th and shutdown_th to main_th for default value
|
|
||||||
as we need to initialize them to something safe. They are used
|
|
||||||
when compiled with safemalloc.
|
|
||||||
*/
|
|
||||||
SIGNAL_THD;
|
|
||||||
SHUTDOWN_THD;
|
|
||||||
MY_INIT(argv[0]); // init my_sys library & pthreads
|
|
||||||
tzset(); // Set tzname
|
|
||||||
|
|
||||||
start_time=time((time_t*) 0);
|
|
||||||
#ifdef OS2
|
|
||||||
{
|
|
||||||
// fix timezone for daylight saving
|
|
||||||
struct tm *ts = localtime(&start_time);
|
|
||||||
if (ts->tm_isdst > 0)
|
|
||||||
_timezone -= 3600;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_TZNAME
|
|
||||||
#if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT)
|
|
||||||
{
|
|
||||||
struct tm tm_tmp;
|
|
||||||
localtime_r(&start_time,&tm_tmp);
|
|
||||||
strmov(time_zone,tzname[tm_tmp.tm_isdst != 0 ? 1 : 0]);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
{
|
|
||||||
struct tm *start_tm;
|
|
||||||
start_tm=localtime(&start_time);
|
|
||||||
strmov(time_zone,tzname[start_tm->tm_isdst != 0 ? 1 : 0]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (gethostname(glob_hostname,sizeof(glob_hostname)-4) < 0)
|
|
||||||
strmov(glob_hostname,"mysql");
|
|
||||||
strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
|
|
||||||
strmov(fn_ext(pidfile_name),".pid"); // Add proper extension
|
|
||||||
#ifndef DBUG_OFF
|
|
||||||
strxmov(strend(server_version),MYSQL_SERVER_SUFFIX,"-debug",NullS);
|
|
||||||
#else
|
|
||||||
strmov(strend(server_version),MYSQL_SERVER_SUFFIX);
|
|
||||||
#endif
|
|
||||||
#ifdef _CUSTOMSTARTUPCONFIG_
|
|
||||||
if (_cust_check_startup())
|
|
||||||
{
|
|
||||||
/* _cust_check_startup will report startup failure error */
|
|
||||||
exit( 1 );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
load_defaults(MYSQL_CONFIG_NAME,load_default_groups,&argc,&argv);
|
|
||||||
defaults_argv=argv;
|
|
||||||
|
|
||||||
set_options();
|
|
||||||
get_options(argc,argv);
|
|
||||||
if (opt_log || opt_update_log || opt_slow_log || opt_bin_log)
|
|
||||||
strcat(server_version,"-log");
|
|
||||||
DBUG_PRINT("info",("%s Ver %s for %s on %s\n",my_progname,
|
|
||||||
server_version, SYSTEM_TYPE,MACHINE_TYPE));
|
|
||||||
|
|
||||||
/* These must be set early */
|
|
||||||
|
|
||||||
(void) pthread_mutex_init(&LOCK_mysql_create_db,MY_MUTEX_INIT_SLOW);
|
|
||||||
(void) pthread_mutex_init(&LOCK_Acl,MY_MUTEX_INIT_SLOW);
|
|
||||||
(void) pthread_mutex_init(&LOCK_open,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_mapped_file,MY_MUTEX_INIT_SLOW);
|
|
||||||
(void) pthread_mutex_init(&LOCK_status,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_error_log,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_delayed_insert,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_delayed_status,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_delayed_create,MY_MUTEX_INIT_SLOW);
|
|
||||||
(void) pthread_mutex_init(&LOCK_manager,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_crypt,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_bytes_sent,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_bytes_received,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_timezone,MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_rpl_status, MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_active_mi, MY_MUTEX_INIT_FAST);
|
|
||||||
(void) pthread_mutex_init(&LOCK_global_system_variables, MY_MUTEX_INIT_FAST);
|
|
||||||
(void) my_rwlock_init(&LOCK_grant, NULL);
|
|
||||||
(void) pthread_cond_init(&COND_thread_count,NULL);
|
|
||||||
(void) pthread_cond_init(&COND_refresh,NULL);
|
|
||||||
(void) pthread_cond_init(&COND_thread_cache,NULL);
|
|
||||||
(void) pthread_cond_init(&COND_flush_thread_cache,NULL);
|
|
||||||
(void) pthread_cond_init(&COND_manager,NULL);
|
|
||||||
(void) pthread_cond_init(&COND_rpl_status, NULL);
|
|
||||||
init_signals();
|
|
||||||
|
|
||||||
if (set_default_charset_by_name(sys_charset.value, MYF(MY_WME)))
|
|
||||||
exit(1);
|
|
||||||
charsets_list= list_charsets(MYF(MY_CS_COMPILED | MY_CS_CONFIG));
|
|
||||||
|
|
||||||
#ifdef HAVE_OPENSSL
|
|
||||||
if (opt_use_ssl)
|
|
||||||
{
|
|
||||||
/* having ssl_acceptor_fd != 0 signals the use of SSL */
|
|
||||||
ssl_acceptor_fd= new_VioSSLAcceptorFd(opt_ssl_key, opt_ssl_cert,
|
|
||||||
opt_ssl_ca, opt_ssl_capath,
|
|
||||||
opt_ssl_cipher);
|
|
||||||
DBUG_PRINT("info",("ssl_acceptor_fd: %lx", (long) ssl_acceptor_fd));
|
|
||||||
if (!ssl_acceptor_fd)
|
|
||||||
opt_use_ssl = 0;
|
|
||||||
}
|
|
||||||
#endif /* HAVE_OPENSSL */
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBWRAP
|
|
||||||
libwrapName= my_progname+dirname_length(my_progname);
|
|
||||||
openlog(libwrapName, LOG_PID, LOG_AUTH);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!(opt_specialflag & SPECIAL_NO_PRIOR))
|
|
||||||
my_pthread_setprio(pthread_self(),CONNECT_PRIOR);
|
|
||||||
/* Parameter for threads created for connections */
|
|
||||||
(void) pthread_attr_init(&connection_attrib);
|
|
||||||
(void) pthread_attr_setdetachstate(&connection_attrib,
|
|
||||||
PTHREAD_CREATE_DETACHED);
|
|
||||||
pthread_attr_setstacksize(&connection_attrib,thread_stack);
|
|
||||||
|
|
||||||
if (!(opt_specialflag & SPECIAL_NO_PRIOR))
|
|
||||||
my_pthread_attr_setprio(&connection_attrib,WAIT_PRIOR);
|
|
||||||
pthread_attr_setscope(&connection_attrib, PTHREAD_SCOPE_SYSTEM);
|
|
||||||
|
|
||||||
#if defined( SET_RLIMIT_NOFILE) || defined( OS2)
|
|
||||||
/* connections and databases needs lots of files */
|
|
||||||
{
|
|
||||||
uint wanted_files=10+(uint) max(max_connections*5,
|
|
||||||
max_connections+table_cache_size*2);
|
|
||||||
set_if_bigger(wanted_files, open_files_limit);
|
|
||||||
// Note that some system returns 0 if we succeed here:
|
|
||||||
uint files=set_maximum_open_files(wanted_files);
|
|
||||||
if (files && files < wanted_files && ! open_files_limit)
|
|
||||||
{
|
|
||||||
max_connections= (ulong) min((files-10),max_connections);
|
|
||||||
table_cache_size= (ulong) max((files-10-max_connections)/2,64);
|
|
||||||
DBUG_PRINT("warning",
|
|
||||||
("Changed limits: max_connections: %ld table_cache: %ld",
|
|
||||||
max_connections,table_cache_size));
|
|
||||||
sql_print_error("Warning: Changed limits: max_connections: %ld table_cache: %ld",max_connections,table_cache_size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
unireg_init(opt_specialflag); /* Set up extern variabels */
|
|
||||||
init_errmessage(); /* Read error messages from file */
|
|
||||||
lex_init();
|
|
||||||
item_init();
|
|
||||||
set_var_init();
|
|
||||||
mysys_uses_curses=0;
|
|
||||||
#ifdef USE_REGEX
|
|
||||||
regex_init();
|
|
||||||
#endif
|
|
||||||
select_thread=pthread_self();
|
|
||||||
select_thread_in_use=1;
|
|
||||||
if (use_temp_pool && bitmap_init(&temp_pool,1024,1))
|
|
||||||
unireg_abort(1);
|
|
||||||
|
|
||||||
/*
|
|
||||||
We have enough space for fiddling with the argv, continue
|
|
||||||
*/
|
|
||||||
if (my_setwd(mysql_real_data_home,MYF(MY_WME)))
|
|
||||||
{
|
|
||||||
unireg_abort(1); /* purecov: inspected */
|
|
||||||
}
|
|
||||||
mysql_data_home= mysql_data_home_buff;
|
|
||||||
mysql_data_home[0]=FN_CURLIB; // all paths are relative from here
|
|
||||||
mysql_data_home[1]=0;
|
|
||||||
server_init();
|
|
||||||
table_cache_init();
|
|
||||||
hostname_cache_init();
|
|
||||||
query_cache_result_size_limit(query_cache_limit);
|
|
||||||
query_cache_resize(query_cache_size);
|
|
||||||
randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2);
|
|
||||||
reset_floating_point_exceptions();
|
|
||||||
init_thr_lock();
|
|
||||||
init_slave_list();
|
|
||||||
#ifdef HAVE_OPENSSL
|
|
||||||
if (des_key_file)
|
|
||||||
load_des_key_file(des_key_file);
|
|
||||||
#endif /* HAVE_OPENSSL */
|
|
||||||
|
|
||||||
/* Setup log files */
|
|
||||||
if (opt_log)
|
|
||||||
open_log(&mysql_log, glob_hostname, opt_logname, ".log", NullS,
|
|
||||||
LOG_NORMAL);
|
|
||||||
if (opt_update_log)
|
|
||||||
{
|
|
||||||
open_log(&mysql_update_log, glob_hostname, opt_update_logname, "",
|
|
||||||
NullS, LOG_NEW);
|
|
||||||
using_update_log=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opt_slow_log)
|
|
||||||
open_log(&mysql_slow_log, glob_hostname, opt_slow_logname, "-slow.log",
|
|
||||||
NullS, LOG_NORMAL);
|
|
||||||
#ifdef __WIN__
|
|
||||||
#define MYSQL_ERR_FILE "mysql.err"
|
|
||||||
if (!opt_console)
|
|
||||||
{
|
|
||||||
freopen(MYSQL_ERR_FILE,"a+",stdout);
|
|
||||||
freopen(MYSQL_ERR_FILE,"a+",stderr);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (ha_init())
|
|
||||||
{
|
|
||||||
sql_print_error("Can't init databases");
|
|
||||||
if (unix_sock != INVALID_SOCKET)
|
|
||||||
unlink(mysql_unix_port);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
ha_key_cache();
|
|
||||||
#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT)
|
|
||||||
if (locked_in_memory && !geteuid())
|
|
||||||
{
|
|
||||||
if (mlockall(MCL_CURRENT))
|
|
||||||
{
|
|
||||||
sql_print_error("Warning: Failed to lock memory. Errno: %d\n",errno);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
locked_in_memory=1;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
locked_in_memory=0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (opt_myisam_log)
|
|
||||||
(void) mi_log( 1 );
|
|
||||||
ft_init_stopwords(ft_precompiled_stopwords);
|
|
||||||
|
|
||||||
#ifdef __WIN__
|
|
||||||
if (!opt_console)
|
|
||||||
FreeConsole(); // Remove window
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
init signals & alarm
|
|
||||||
After this we can't quit by a simple unireg_abort
|
|
||||||
*/
|
|
||||||
error_handler_hook = my_message_sql;
|
|
||||||
if (pthread_key_create(&THR_THD,NULL) ||
|
|
||||||
pthread_key_create(&THR_MALLOC,NULL))
|
|
||||||
{
|
|
||||||
sql_print_error("Can't create thread-keys");
|
|
||||||
if (unix_sock != INVALID_SOCKET)
|
|
||||||
unlink(mysql_unix_port);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
start_signal_handler(); // Creates pidfile
|
|
||||||
if (acl_init((THD*) 0, opt_noacl))
|
|
||||||
{
|
|
||||||
abort_loop=1;
|
|
||||||
select_thread_in_use=0;
|
|
||||||
(void) pthread_kill(signal_thread,MYSQL_KILL_SIGNAL);
|
|
||||||
#ifndef __WIN__
|
|
||||||
if (!opt_bootstrap)
|
|
||||||
(void) my_delete(pidfile_name,MYF(MY_WME)); // Not needed anymore
|
|
||||||
#endif
|
|
||||||
if (unix_sock != INVALID_SOCKET)
|
|
||||||
unlink(mysql_unix_port);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (!opt_noacl)
|
|
||||||
(void) grant_init((THD*) 0);
|
|
||||||
init_max_user_conn();
|
|
||||||
init_update_queries();
|
|
||||||
DBUG_ASSERT(current_thd == 0);
|
|
||||||
|
|
||||||
#ifdef HAVE_DLOPEN
|
|
||||||
if (!opt_noacl)
|
|
||||||
udf_init();
|
|
||||||
#endif
|
|
||||||
/* init_slave() must be called after the thread keys are created */
|
|
||||||
init_slave();
|
|
||||||
|
|
||||||
DBUG_ASSERT(current_thd == 0);
|
|
||||||
if (opt_bin_log && !server_id)
|
|
||||||
{
|
|
||||||
server_id= !master_host ? 1 : 2;
|
|
||||||
switch (server_id) {
|
|
||||||
#ifdef EXTRA_DEBUG
|
|
||||||
case 1:
|
|
||||||
sql_print_error("\
|
|
||||||
Warning: You have enabled the binary log, but you haven't set server-id:\n\
|
|
||||||
Updates will be logged to the binary log, but connections to slaves will\n\
|
|
||||||
not be accepted.");
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case 2:
|
|
||||||
sql_print_error("\
|
|
||||||
Warning: You should set server-id to a non-0 value if master_host is set.\n\
|
|
||||||
The server will not act as a slave.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (opt_bin_log)
|
|
||||||
{
|
|
||||||
open_log(&mysql_bin_log, glob_hostname, opt_bin_logname, "-bin",
|
|
||||||
opt_binlog_index_name,LOG_BIN);
|
|
||||||
using_update_log=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (opt_bootstrap)
|
|
||||||
{
|
|
||||||
int error=bootstrap(stdin);
|
|
||||||
end_thr_alarm(); // Don't allow alarms
|
|
||||||
unireg_abort(error ? 1 : 0);
|
|
||||||
}
|
|
||||||
if (opt_init_file)
|
|
||||||
{
|
|
||||||
if (read_init_file(opt_init_file))
|
|
||||||
{
|
|
||||||
end_thr_alarm(); // Don't allow alarms
|
|
||||||
unireg_abort(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(void) thr_setconcurrency(concurrency); // 10 by default
|
|
||||||
#if defined(__WIN__) && !defined(EMBEDDED_LIBRARY) //IRENA
|
|
||||||
{
|
|
||||||
hEventShutdown=CreateEvent(0, FALSE, FALSE, event_name);
|
|
||||||
pthread_t hThread;
|
|
||||||
if (pthread_create(&hThread,&connection_attrib,handle_shutdown,0))
|
|
||||||
sql_print_error("Warning: Can't create thread to handle shutdown requests");
|
|
||||||
|
|
||||||
// On "Stop Service" we have to do regular shutdown
|
|
||||||
Service.SetShutdownEvent(hEventShutdown);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef OS2
|
|
||||||
{
|
|
||||||
pthread_cond_init( &eventShutdown, NULL);
|
|
||||||
pthread_t hThread;
|
|
||||||
if (pthread_create(&hThread,&connection_attrib,handle_shutdown,0))
|
|
||||||
sql_print_error("Warning: Can't create thread to handle shutdown requests");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (
|
|
||||||
#ifdef HAVE_BERKELEY_DB
|
|
||||||
!berkeley_skip ||
|
|
||||||
#endif
|
|
||||||
(flush_time && flush_time != ~(ulong) 0L))
|
|
||||||
{
|
|
||||||
pthread_t hThread;
|
|
||||||
if (pthread_create(&hThread,&connection_attrib,handle_manager,0))
|
|
||||||
sql_print_error("Warning: Can't create thread to manage maintenance");
|
|
||||||
}
|
|
||||||
|
|
||||||
printf(ER(ER_READY),my_progname,server_version,"");
|
|
||||||
fflush(stdout);
|
|
||||||
#if defined(__NT__) || defined(HAVE_SMEM)
|
|
||||||
#ifdef __NT__
|
|
||||||
if (hPipe == INVALID_HANDLE_VALUE &&
|
|
||||||
(!have_tcpip || opt_disable_networking) &&
|
|
||||||
!opt_enable_shared_memory)
|
|
||||||
{
|
|
||||||
sql_print_error("TCP/IP,--shared-memory or --named-pipe should be configured on NT OS");
|
|
||||||
unireg_abort(1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
pthread_mutex_lock(&LOCK_thread_count);
|
|
||||||
(void) pthread_cond_init(&COND_handler_count,NULL);
|
|
||||||
{
|
|
||||||
pthread_t hThread;
|
|
||||||
handler_count=0;
|
|
||||||
#ifdef __NT__
|
|
||||||
if (hPipe != INVALID_HANDLE_VALUE && opt_enable_named_pipe)
|
|
||||||
{
|
|
||||||
handler_count++;
|
|
||||||
if (pthread_create(&hThread,&connection_attrib,
|
|
||||||
handle_connections_namedpipes, 0))
|
|
||||||
{
|
|
||||||
sql_print_error("Warning: Can't create thread to handle named pipes");
|
|
||||||
handler_count--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SMEM
|
|
||||||
if (opt_enable_shared_memory)
|
|
||||||
{
|
|
||||||
handler_count++;
|
|
||||||
if (pthread_create(&hThread,&connection_attrib,
|
|
||||||
handle_connections_shared_memory, 0))
|
|
||||||
{
|
|
||||||
sql_print_error("Warning: Can't create thread to handle shared memory");
|
|
||||||
handler_count--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (have_tcpip && !opt_disable_networking)
|
|
||||||
{
|
|
||||||
handler_count++;
|
|
||||||
if (pthread_create(&hThread,&connection_attrib,
|
|
||||||
handle_connections_sockets, 0))
|
|
||||||
{
|
|
||||||
sql_print_error("Warning: Can't create thread to handle tcp/ip");
|
|
||||||
handler_count--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (handler_count > 0)
|
|
||||||
{
|
|
||||||
pthread_cond_wait(&COND_handler_count,&LOCK_thread_count);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pthread_mutex_unlock(&LOCK_thread_count);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
handle_connections_sockets(0);
|
|
||||||
#ifdef EXTRA_DEBUG2
|
|
||||||
sql_print_error("Exiting main thread");
|
|
||||||
#endif
|
|
||||||
#endif /* __NT__ */
|
|
||||||
|
|
||||||
/* (void) pthread_attr_destroy(&connection_attrib); */
|
|
||||||
|
|
||||||
DBUG_PRINT("quit",("Exiting main thread"));
|
|
||||||
|
|
||||||
#ifndef __WIN__
|
|
||||||
#ifdef EXTRA_DEBUG2
|
|
||||||
sql_print_error("Before Lock_thread_count");
|
|
||||||
#endif
|
|
||||||
(void) pthread_mutex_lock(&LOCK_thread_count);
|
|
||||||
DBUG_PRINT("quit", ("Got thread_count mutex"));
|
|
||||||
select_thread_in_use=0; // For close_connections
|
|
||||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
|
||||||
(void) pthread_cond_broadcast(&COND_thread_count);
|
|
||||||
#ifdef EXTRA_DEBUG2
|
|
||||||
sql_print_error("After lock_thread_count");
|
|
||||||
#endif
|
|
||||||
#endif /* __WIN__ */
|
|
||||||
|
|
||||||
/* Wait until cleanup is done */
|
|
||||||
(void) pthread_mutex_lock(&LOCK_thread_count);
|
|
||||||
while (!ready_to_exit)
|
|
||||||
pthread_cond_wait(&COND_thread_count,&LOCK_thread_count);
|
|
||||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
|
||||||
|
|
||||||
#if defined(__WIN__) && !defined(EMBEDDED_LIBRARY)
|
|
||||||
if (Service.IsNT() && start_mode)
|
|
||||||
Service.Stop();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Service.SetShutdownEvent(0);
|
|
||||||
if (hEventShutdown)
|
|
||||||
CloseHandle(hEventShutdown);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
|
|
||||||
exit(0);
|
|
||||||
return(0); /* purecov: deadcode */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
Main and thread entry function for Win32
|
Main and thread entry function for Win32
|
||||||
@ -2922,7 +2476,7 @@ int main(int argc, char **argv)
|
|||||||
Execute all commands from a file. Used by the mysql_install_db script to
|
Execute all commands from a file. Used by the mysql_install_db script to
|
||||||
create MySQL privilege tables without having to start a full MySQL server.
|
create MySQL privilege tables without having to start a full MySQL server.
|
||||||
*/
|
*/
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
static int bootstrap(FILE *file)
|
static int bootstrap(FILE *file)
|
||||||
{
|
{
|
||||||
THD *thd= new THD;
|
THD *thd= new THD;
|
||||||
@ -2959,6 +2513,8 @@ static int bootstrap(FILE *file)
|
|||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool read_init_file(char *file_name)
|
static bool read_init_file(char *file_name)
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
@ -2966,11 +2522,14 @@ static bool read_init_file(char *file_name)
|
|||||||
DBUG_PRINT("enter",("name: %s",file_name));
|
DBUG_PRINT("enter",("name: %s",file_name));
|
||||||
if (!(file=my_fopen(file_name,O_RDONLY,MYF(MY_WME))))
|
if (!(file=my_fopen(file_name,O_RDONLY,MYF(MY_WME))))
|
||||||
return(1);
|
return(1);
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
bootstrap(file); /* Ignore errors from this */
|
bootstrap(file); /* Ignore errors from this */
|
||||||
|
#endif
|
||||||
(void) my_fclose(file,MYF(MY_WME));
|
(void) my_fclose(file,MYF(MY_WME));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
|
||||||
static void create_new_thread(THD *thd)
|
static void create_new_thread(THD *thd)
|
||||||
{
|
{
|
||||||
@ -3052,6 +2611,7 @@ static void create_new_thread(THD *thd)
|
|||||||
DBUG_PRINT("info",("Thread created"));
|
DBUG_PRINT("info",("Thread created"));
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef SIGNALS_DONT_BREAK_READ
|
#ifdef SIGNALS_DONT_BREAK_READ
|
||||||
inline void kill_broken_server()
|
inline void kill_broken_server()
|
||||||
@ -3069,6 +2629,7 @@ inline void kill_broken_server()
|
|||||||
#define MAYBE_BROKEN_SYSCALL
|
#define MAYBE_BROKEN_SYSCALL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
/* Handle new connections and spawn new process to handle them */
|
/* Handle new connections and spawn new process to handle them */
|
||||||
|
|
||||||
extern "C" pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused)))
|
extern "C" pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused)))
|
||||||
@ -3573,6 +3134,7 @@ error:
|
|||||||
}
|
}
|
||||||
#endif /* HAVE_SMEM */
|
#endif /* HAVE_SMEM */
|
||||||
|
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
** handle start options
|
** handle start options
|
||||||
@ -3937,6 +3499,7 @@ struct my_option my_long_options[] =
|
|||||||
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"memlock", OPT_MEMLOCK, "Lock mysqld in memory", (gptr*) &locked_in_memory,
|
{"memlock", OPT_MEMLOCK, "Lock mysqld in memory", (gptr*) &locked_in_memory,
|
||||||
(gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
{"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT,
|
{"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT,
|
||||||
"Option used by mysql-test for debugging and testing of replication",
|
"Option used by mysql-test for debugging and testing of replication",
|
||||||
(gptr*) &disconnect_slave_event_count,
|
(gptr*) &disconnect_slave_event_count,
|
||||||
@ -3955,6 +3518,7 @@ struct my_option my_long_options[] =
|
|||||||
(gptr*) &opt_sporadic_binlog_dump_fail,
|
(gptr*) &opt_sporadic_binlog_dump_fail,
|
||||||
(gptr*) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
|
(gptr*) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
|
||||||
0},
|
0},
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
{"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT,
|
{"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT,
|
||||||
"Simulate memory shortage when compiled with the --with-debug=full option",
|
"Simulate memory shortage when compiled with the --with-debug=full option",
|
||||||
0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
@ -4097,12 +3661,14 @@ struct my_option my_long_options[] =
|
|||||||
{"relay-log-info-file", OPT_RELAY_LOG_INFO_FILE, "Undocumented",
|
{"relay-log-info-file", OPT_RELAY_LOG_INFO_FILE, "Undocumented",
|
||||||
(gptr*) &relay_log_info_file, (gptr*) &relay_log_info_file, 0, GET_STR,
|
(gptr*) &relay_log_info_file, (gptr*) &relay_log_info_file, 0, GET_STR,
|
||||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
{"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR, "Undocumented",
|
{"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR, "Undocumented",
|
||||||
(gptr*) &slave_load_tmpdir, (gptr*) &slave_load_tmpdir, 0, GET_STR_ALLOC,
|
(gptr*) &slave_load_tmpdir, (gptr*) &slave_load_tmpdir, 0, GET_STR_ALLOC,
|
||||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"slave-skip-errors", OPT_SLAVE_SKIP_ERRORS,
|
{"slave-skip-errors", OPT_SLAVE_SKIP_ERRORS,
|
||||||
"Tells the slave thread to continue replication when a query returns an error from the provided list",
|
"Tells the slave thread to continue replication when a query returns an error from the provided list",
|
||||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
|
#endif
|
||||||
{"socket", OPT_SOCKET, "Socket file to use for connection",
|
{"socket", OPT_SOCKET, "Socket file to use for connection",
|
||||||
(gptr*) &mysql_unix_port, (gptr*) &mysql_unix_port, 0, GET_STR,
|
(gptr*) &mysql_unix_port, (gptr*) &mysql_unix_port, 0, GET_STR,
|
||||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
@ -4430,6 +3996,7 @@ struct my_option my_long_options[] =
|
|||||||
(gptr*) &global_system_variables.read_buff_size,
|
(gptr*) &global_system_variables.read_buff_size,
|
||||||
(gptr*) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG,
|
(gptr*) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG,
|
||||||
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE, 0},
|
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE, 0},
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
{"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT,
|
{"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT,
|
||||||
"Max space to use for all relay logs",
|
"Max space to use for all relay logs",
|
||||||
(gptr*) &relay_log_space_limit,
|
(gptr*) &relay_log_space_limit,
|
||||||
@ -4444,6 +4011,7 @@ struct my_option my_long_options[] =
|
|||||||
"Number of seconds to wait for more data from a master/slave connection before aborting the read.",
|
"Number of seconds to wait for more data from a master/slave connection before aborting the read.",
|
||||||
(gptr*) &slave_net_timeout, (gptr*) &slave_net_timeout, 0,
|
(gptr*) &slave_net_timeout, (gptr*) &slave_net_timeout, 0,
|
||||||
GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
|
GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
|
||||||
|
#endif
|
||||||
{"slow_launch_time", OPT_SLOW_LAUNCH_TIME,
|
{"slow_launch_time", OPT_SLOW_LAUNCH_TIME,
|
||||||
"If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented.",
|
"If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented.",
|
||||||
(gptr*) &slow_launch_time, (gptr*) &slow_launch_time, 0, GET_ULONG,
|
(gptr*) &slow_launch_time, (gptr*) &slow_launch_time, 0, GET_ULONG,
|
||||||
@ -4787,9 +4355,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
case 'o':
|
case 'o':
|
||||||
protocol_version=PROTOCOL_VERSION-1;
|
protocol_version=PROTOCOL_VERSION-1;
|
||||||
break;
|
break;
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
case OPT_SLAVE_SKIP_ERRORS:
|
case OPT_SLAVE_SKIP_ERRORS:
|
||||||
init_slave_skip_errors(argument);
|
init_slave_skip_errors(argument);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case OPT_SAFEMALLOC_MEM_LIMIT:
|
case OPT_SAFEMALLOC_MEM_LIMIT:
|
||||||
#if !defined(DBUG_OFF) && defined(SAFEMALLOC)
|
#if !defined(DBUG_OFF) && defined(SAFEMALLOC)
|
||||||
safemalloc_mem_limit = atoi(argument);
|
safemalloc_mem_limit = atoi(argument);
|
||||||
@ -4829,6 +4399,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
case (int) OPT_BIN_LOG:
|
case (int) OPT_BIN_LOG:
|
||||||
opt_bin_log=1;
|
opt_bin_log=1;
|
||||||
break;
|
break;
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
case (int) OPT_INIT_RPL_ROLE:
|
case (int) OPT_INIT_RPL_ROLE:
|
||||||
{
|
{
|
||||||
int role;
|
int role;
|
||||||
@ -4949,13 +4520,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
table_rules_on = 1;
|
table_rules_on = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (int) OPT_SLOW_QUERY_LOG:
|
|
||||||
opt_slow_log=1;
|
|
||||||
break;
|
|
||||||
case (int)OPT_RECKLESS_SLAVE:
|
case (int)OPT_RECKLESS_SLAVE:
|
||||||
opt_reckless_slave = 1;
|
opt_reckless_slave = 1;
|
||||||
init_slave_skip_errors("all");
|
init_slave_skip_errors("all");
|
||||||
break;
|
break;
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
case (int) OPT_SLOW_QUERY_LOG:
|
||||||
|
opt_slow_log=1;
|
||||||
|
break;
|
||||||
case (int) OPT_SKIP_NEW:
|
case (int) OPT_SKIP_NEW:
|
||||||
opt_specialflag|= SPECIAL_NO_NEW_FUNC;
|
opt_specialflag|= SPECIAL_NO_NEW_FUNC;
|
||||||
delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE;
|
delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE;
|
||||||
@ -5329,11 +4901,13 @@ static void fix_paths(void)
|
|||||||
|
|
||||||
if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir))
|
if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir))
|
||||||
exit(1);
|
exit(1);
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (!slave_load_tmpdir)
|
if (!slave_load_tmpdir)
|
||||||
{
|
{
|
||||||
if (!(slave_load_tmpdir = (char*) my_strdup(mysql_tmpdir, MYF(MY_FAE))))
|
if (!(slave_load_tmpdir = (char*) my_strdup(mysql_tmpdir, MYF(MY_FAE))))
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,9 @@ void send_error(THD *thd, uint sql_errno, const char *err)
|
|||||||
err ? err : net->last_error[0] ?
|
err ? err : net->last_error[0] ?
|
||||||
net->last_error : "NULL"));
|
net->last_error : "NULL"));
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
query_cache_abort(net);
|
query_cache_abort(net);
|
||||||
|
#endif
|
||||||
thd->query_error= 1; // needed to catch query errors during replication
|
thd->query_error= 1; // needed to catch query errors during replication
|
||||||
if (!err)
|
if (!err)
|
||||||
{
|
{
|
||||||
@ -86,6 +88,7 @@ void send_error(THD *thd, uint sql_errno, const char *err)
|
|||||||
This is used by mysqld.cc, which doesn't have a THD
|
This is used by mysqld.cc, which doesn't have a THD
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
void net_send_error(NET *net, uint sql_errno, const char *err)
|
void net_send_error(NET *net, uint sql_errno, const char *err)
|
||||||
{
|
{
|
||||||
char buff[2];
|
char buff[2];
|
||||||
@ -98,7 +101,7 @@ void net_send_error(NET *net, uint sql_errno, const char *err)
|
|||||||
net_write_command(net,(uchar) 255, buff, 2, err, length);
|
net_write_command(net,(uchar) 255, buff, 2, err, length);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Send a warning to the end user
|
Send a warning to the end user
|
||||||
@ -135,14 +138,22 @@ net_printf(THD *thd, uint errcode, ...)
|
|||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
uint length,offset;
|
uint length,offset;
|
||||||
const char *format,*text_pos;
|
const char *format;
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
const char *text_pos;
|
||||||
|
#else
|
||||||
|
char text_pos[500];
|
||||||
|
#endif
|
||||||
int head_length= NET_HEADER_SIZE;
|
int head_length= NET_HEADER_SIZE;
|
||||||
NET *net= &thd->net;
|
NET *net= &thd->net;
|
||||||
|
|
||||||
DBUG_ENTER("net_printf");
|
DBUG_ENTER("net_printf");
|
||||||
DBUG_PRINT("enter",("message: %u",errcode));
|
DBUG_PRINT("enter",("message: %u",errcode));
|
||||||
|
|
||||||
thd->query_error= 1; // needed to catch query errors during replication
|
thd->query_error= 1; // needed to catch query errors during replication
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
query_cache_abort(net); // Safety
|
query_cache_abort(net); // Safety
|
||||||
|
#endif
|
||||||
va_start(args,errcode);
|
va_start(args,errcode);
|
||||||
/*
|
/*
|
||||||
The following is needed to make net_printf() work with 0 argument for
|
The following is needed to make net_printf() work with 0 argument for
|
||||||
@ -158,7 +169,9 @@ net_printf(THD *thd, uint errcode, ...)
|
|||||||
errcode= ER_UNKNOWN_ERROR;
|
errcode= ER_UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
offset= net->return_errno ? 2 : 0;
|
offset= net->return_errno ? 2 : 0;
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
text_pos=(char*) net->buff+head_length+offset+1;
|
text_pos=(char*) net->buff+head_length+offset+1;
|
||||||
|
#endif
|
||||||
(void) vsprintf(my_const_cast(char*) (text_pos),format,args);
|
(void) vsprintf(my_const_cast(char*) (text_pos),format,args);
|
||||||
length=(uint) strlen((char*) text_pos);
|
length=(uint) strlen((char*) text_pos);
|
||||||
if (length >= sizeof(net->last_error))
|
if (length >= sizeof(net->last_error))
|
||||||
@ -191,6 +204,28 @@ net_printf(THD *thd, uint errcode, ...)
|
|||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function called by my_net_init() to set some check variables
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
extern "C" {
|
||||||
|
void my_net_local_init(NET *net)
|
||||||
|
{
|
||||||
|
net->max_packet= (uint) global_system_variables.net_buffer_length;
|
||||||
|
net->read_timeout= (uint) global_system_variables.net_read_timeout;
|
||||||
|
net->write_timeout=(uint) global_system_variables.net_write_timeout;
|
||||||
|
net->retry_count= (uint) global_system_variables.net_retry_count;
|
||||||
|
net->max_packet_size= max(global_system_variables.net_buffer_length,
|
||||||
|
global_system_variables.max_allowed_packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* EMBEDDED_LIBRARY */
|
||||||
|
void my_net_local_init(NET *net __attribute__(unused))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Return ok to the client.
|
Return ok to the client.
|
||||||
@ -488,19 +523,3 @@ net_store_data(String *packet, CONVERT *convert, const char *from)
|
|||||||
return convert->store(packet, from, length);
|
return convert->store(packet, from, length);
|
||||||
return net_store_data(packet,from,length);
|
return net_store_data(packet,from,length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Function called by my_net_init() to set some check variables
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
void my_net_local_init(NET *net)
|
|
||||||
{
|
|
||||||
net->max_packet= (uint) global_system_variables.net_buffer_length;
|
|
||||||
net->read_timeout= (uint) global_system_variables.net_read_timeout;
|
|
||||||
net->write_timeout=(uint) global_system_variables.net_write_timeout;
|
|
||||||
net->retry_count= (uint) global_system_variables.net_retry_count;
|
|
||||||
net->max_packet_size= max(global_system_variables.net_buffer_length,
|
|
||||||
global_system_variables.max_allowed_packet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
3 byte length & 1 byte package-number.
|
3 byte length & 1 byte package-number.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
#endif
|
#endif
|
||||||
@ -852,3 +853,6 @@ my_net_read(NET *net)
|
|||||||
#endif /* HAVE_COMPRESS */
|
#endif /* HAVE_COMPRESS */
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
// Sasha Pachev <sasha@mysql.com> is currently in charge of this file
|
// Sasha Pachev <sasha@mysql.com> is currently in charge of this file
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
|
||||||
#include "mysql_priv.h"
|
#include "mysql_priv.h"
|
||||||
#include "repl_failsafe.h"
|
#include "repl_failsafe.h"
|
||||||
#include "sql_repl.h"
|
#include "sql_repl.h"
|
||||||
@ -889,3 +891,6 @@ err:
|
|||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#ifndef REPL_FAILSAFE_H
|
#ifndef REPL_FAILSAFE_H
|
||||||
#define REPL_FAILSAFE_H
|
#define REPL_FAILSAFE_H
|
||||||
|
|
||||||
@ -35,3 +36,4 @@ int register_slave(THD* thd, uchar* packet, uint packet_length);
|
|||||||
void unregister_slave(THD* thd, bool only_mine, bool need_mutex);
|
void unregister_slave(THD* thd, bool only_mine, bool need_mutex);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mysql_priv.h"
|
#include "mysql_priv.h"
|
||||||
|
#include <mysql.h>
|
||||||
#include "slave.h"
|
#include "slave.h"
|
||||||
#include "sql_acl.h"
|
#include "sql_acl.h"
|
||||||
#include <my_getopt.h>
|
#include <my_getopt.h>
|
||||||
@ -205,8 +206,10 @@ sys_var_thd_enum sys_query_cache_type("query_cache_type",
|
|||||||
sys_var_long_ptr sys_server_id("server_id",&server_id);
|
sys_var_long_ptr sys_server_id("server_id",&server_id);
|
||||||
sys_var_bool_ptr sys_slave_compressed_protocol("slave_compressed_protocol",
|
sys_var_bool_ptr sys_slave_compressed_protocol("slave_compressed_protocol",
|
||||||
&opt_slave_compressed_protocol);
|
&opt_slave_compressed_protocol);
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
sys_var_long_ptr sys_slave_net_timeout("slave_net_timeout",
|
sys_var_long_ptr sys_slave_net_timeout("slave_net_timeout",
|
||||||
&slave_net_timeout);
|
&slave_net_timeout);
|
||||||
|
#endif
|
||||||
sys_var_long_ptr sys_slow_launch_time("slow_launch_time",
|
sys_var_long_ptr sys_slow_launch_time("slow_launch_time",
|
||||||
&slow_launch_time);
|
&slow_launch_time);
|
||||||
sys_var_thd_ulong sys_sort_buffer("sort_buffer_size",
|
sys_var_thd_ulong sys_sort_buffer("sort_buffer_size",
|
||||||
@ -296,7 +299,9 @@ static sys_var_readonly sys_warning_count("warning_count",
|
|||||||
get_warning_count);
|
get_warning_count);
|
||||||
|
|
||||||
/* alias for last_insert_id() to be compatible with Sybase */
|
/* alias for last_insert_id() to be compatible with Sybase */
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
static sys_var_slave_skip_counter sys_slave_skip_counter("sql_slave_skip_counter");
|
static sys_var_slave_skip_counter sys_slave_skip_counter("sql_slave_skip_counter");
|
||||||
|
#endif
|
||||||
static sys_var_rand_seed1 sys_rand_seed1("rand_seed1");
|
static sys_var_rand_seed1 sys_rand_seed1("rand_seed1");
|
||||||
static sys_var_rand_seed2 sys_rand_seed2("rand_seed2");
|
static sys_var_rand_seed2 sys_rand_seed2("rand_seed2");
|
||||||
|
|
||||||
@ -378,9 +383,11 @@ sys_var *sys_variables[]=
|
|||||||
&sys_safe_updates,
|
&sys_safe_updates,
|
||||||
&sys_select_limit,
|
&sys_select_limit,
|
||||||
&sys_server_id,
|
&sys_server_id,
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
&sys_slave_compressed_protocol,
|
&sys_slave_compressed_protocol,
|
||||||
&sys_slave_net_timeout,
|
&sys_slave_net_timeout,
|
||||||
&sys_slave_skip_counter,
|
&sys_slave_skip_counter,
|
||||||
|
#endif
|
||||||
&sys_slow_launch_time,
|
&sys_slow_launch_time,
|
||||||
&sys_sort_buffer,
|
&sys_sort_buffer,
|
||||||
&sys_sql_big_tables,
|
&sys_sql_big_tables,
|
||||||
@ -473,7 +480,9 @@ struct show_var_st init_vars[]= {
|
|||||||
{"log", (char*) &opt_log, SHOW_BOOL},
|
{"log", (char*) &opt_log, SHOW_BOOL},
|
||||||
{"log_update", (char*) &opt_update_log, SHOW_BOOL},
|
{"log_update", (char*) &opt_update_log, SHOW_BOOL},
|
||||||
{"log_bin", (char*) &opt_bin_log, SHOW_BOOL},
|
{"log_bin", (char*) &opt_bin_log, SHOW_BOOL},
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
{"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_MY_BOOL},
|
{"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_MY_BOOL},
|
||||||
|
#endif
|
||||||
{"log_slow_queries", (char*) &opt_slow_log, SHOW_BOOL},
|
{"log_slow_queries", (char*) &opt_slow_log, SHOW_BOOL},
|
||||||
{sys_log_warnings.name, (char*) &sys_log_warnings, SHOW_SYS},
|
{sys_log_warnings.name, (char*) &sys_log_warnings, SHOW_SYS},
|
||||||
{sys_long_query_time.name, (char*) &sys_long_query_time, SHOW_SYS},
|
{sys_long_query_time.name, (char*) &sys_long_query_time, SHOW_SYS},
|
||||||
@ -525,7 +534,9 @@ struct show_var_st init_vars[]= {
|
|||||||
{"shared_memory_base_name", (char*) &shared_memory_base_name, SHOW_CHAR_PTR},
|
{"shared_memory_base_name", (char*) &shared_memory_base_name, SHOW_CHAR_PTR},
|
||||||
#endif
|
#endif
|
||||||
{sys_server_id.name, (char*) &sys_server_id, SHOW_SYS},
|
{sys_server_id.name, (char*) &sys_server_id, SHOW_SYS},
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
{sys_slave_net_timeout.name,(char*) &sys_slave_net_timeout, SHOW_SYS},
|
{sys_slave_net_timeout.name,(char*) &sys_slave_net_timeout, SHOW_SYS},
|
||||||
|
#endif
|
||||||
{"skip_external_locking", (char*) &my_disable_locking, SHOW_MY_BOOL},
|
{"skip_external_locking", (char*) &my_disable_locking, SHOW_MY_BOOL},
|
||||||
{"skip_networking", (char*) &opt_disable_networking, SHOW_BOOL},
|
{"skip_networking", (char*) &opt_disable_networking, SHOW_BOOL},
|
||||||
{"skip_show_database", (char*) &opt_skip_show_db, SHOW_BOOL},
|
{"skip_show_database", (char*) &opt_skip_show_db, SHOW_BOOL},
|
||||||
@ -625,6 +636,7 @@ static void fix_tx_isolation(THD *thd, enum_var_type type)
|
|||||||
If we are changing the thread variable, we have to copy it to NET too
|
If we are changing the thread variable, we have to copy it to NET too
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
static void fix_net_read_timeout(THD *thd, enum_var_type type)
|
static void fix_net_read_timeout(THD *thd, enum_var_type type)
|
||||||
{
|
{
|
||||||
if (type != OPT_GLOBAL)
|
if (type != OPT_GLOBAL)
|
||||||
@ -643,6 +655,14 @@ static void fix_net_retry_count(THD *thd, enum_var_type type)
|
|||||||
if (type != OPT_GLOBAL)
|
if (type != OPT_GLOBAL)
|
||||||
thd->net.retry_count=thd->variables.net_retry_count;
|
thd->net.retry_count=thd->variables.net_retry_count;
|
||||||
}
|
}
|
||||||
|
#else /* EMBEDDED_LIBRARY */
|
||||||
|
static void fix_net_read_timeout(THD *thd __attribute__(unused), enum_var_type type __attribute__(unused))
|
||||||
|
{}
|
||||||
|
static void fix_net_write_timeout(THD *thd __attribute__(unused), enum_var_type type __attribute__(unused))
|
||||||
|
{}
|
||||||
|
static void fix_net_retry_count(THD *thd __attribute__(unused), enum_var_type type __attribute__(unused))
|
||||||
|
{}
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
|
||||||
static void fix_query_cache_size(THD *thd, enum_var_type type)
|
static void fix_query_cache_size(THD *thd, enum_var_type type)
|
||||||
@ -1055,6 +1075,7 @@ byte *sys_var_insert_id::value_ptr(THD *thd, enum_var_type type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
bool sys_var_slave_skip_counter::check(THD *thd, set_var *var)
|
bool sys_var_slave_skip_counter::check(THD *thd, set_var *var)
|
||||||
{
|
{
|
||||||
int result= 0;
|
int result= 0;
|
||||||
@ -1090,7 +1111,7 @@ bool sys_var_slave_skip_counter::update(THD *thd, set_var *var)
|
|||||||
UNLOCK_ACTIVE_MI;
|
UNLOCK_ACTIVE_MI;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
bool sys_var_rand_seed1::update(THD *thd, set_var *var)
|
bool sys_var_rand_seed1::update(THD *thd, set_var *var)
|
||||||
{
|
{
|
||||||
|
@ -339,6 +339,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
class sys_var_slave_skip_counter :public sys_var
|
class sys_var_slave_skip_counter :public sys_var
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -351,7 +352,7 @@ public:
|
|||||||
type() or value_ptr()
|
type() or value_ptr()
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
class sys_var_rand_seed1 :public sys_var
|
class sys_var_rand_seed1 :public sys_var
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#include "mysql_priv.h"
|
#include "mysql_priv.h"
|
||||||
#include <mysql.h>
|
#include <mysql.h>
|
||||||
#include <myisam.h>
|
#include <myisam.h>
|
||||||
@ -3177,3 +3177,5 @@ err:
|
|||||||
template class I_List_iterator<i_string>;
|
template class I_List_iterator<i_string>;
|
||||||
template class I_List_iterator<i_string_pair>;
|
template class I_List_iterator<i_string_pair>;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
|
||||||
#ifndef SLAVE_H
|
#ifndef SLAVE_H
|
||||||
#define SLAVE_H
|
#define SLAVE_H
|
||||||
|
|
||||||
@ -461,3 +463,7 @@ extern I_List<i_string_pair> replicate_rewrite_db;
|
|||||||
extern I_List<THD> threads;
|
extern I_List<THD> threads;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
#define SLAVE_IO 1
|
||||||
|
#define SLAVE_SQL 2
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
@ -2937,7 +2937,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
|
|||||||
}
|
}
|
||||||
thd->packet.length(0);
|
thd->packet.length(0);
|
||||||
net_store_data(&thd->packet,global.ptr(),global.length());
|
net_store_data(&thd->packet,global.ptr(),global.length());
|
||||||
if (my_net_write(&thd->net,(char*) thd->packet.ptr(),
|
if (SEND_ROW(thd, field_list.elements, (char*) thd->packet.ptr(),
|
||||||
thd->packet.length()))
|
thd->packet.length()))
|
||||||
{
|
{
|
||||||
error=-1; goto end;
|
error=-1; goto end;
|
||||||
@ -2993,7 +2993,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
|
|||||||
db.append(" WITH GRANT OPTION",18);
|
db.append(" WITH GRANT OPTION",18);
|
||||||
thd->packet.length(0);
|
thd->packet.length(0);
|
||||||
net_store_data(&thd->packet,db.ptr(),db.length());
|
net_store_data(&thd->packet,db.ptr(),db.length());
|
||||||
if (my_net_write(&thd->net,(char*) thd->packet.ptr(),
|
if (SEND_ROW(thd, field_list.elements, (char*) thd->packet.ptr(),
|
||||||
thd->packet.length()))
|
thd->packet.length()))
|
||||||
{
|
{
|
||||||
error=-1;
|
error=-1;
|
||||||
@ -3081,7 +3081,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
|
|||||||
global.append(" WITH GRANT OPTION",18);
|
global.append(" WITH GRANT OPTION",18);
|
||||||
thd->packet.length(0);
|
thd->packet.length(0);
|
||||||
net_store_data(&thd->packet,global.ptr(),global.length());
|
net_store_data(&thd->packet,global.ptr(),global.length());
|
||||||
if (my_net_write(&thd->net,(char*) thd->packet.ptr(),
|
if (SEND_ROW(thd, field_list.elements, (char*) thd->packet.ptr(),
|
||||||
thd->packet.length()))
|
thd->packet.length()))
|
||||||
{
|
{
|
||||||
error= -1;
|
error= -1;
|
||||||
|
@ -1022,11 +1022,13 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
|
|||||||
ALIGN_SIZE(sizeof(Query_cache_result))));
|
ALIGN_SIZE(sizeof(Query_cache_result))));
|
||||||
|
|
||||||
Query_cache_result *result = result_block->result();
|
Query_cache_result *result = result_block->result();
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (net_real_write(&thd->net, result->data(),
|
if (net_real_write(&thd->net, result->data(),
|
||||||
result_block->used -
|
result_block->used -
|
||||||
result_block->headers_len() -
|
result_block->headers_len() -
|
||||||
ALIGN_SIZE(sizeof(Query_cache_result))))
|
ALIGN_SIZE(sizeof(Query_cache_result))))
|
||||||
break; // Client aborted
|
break; // Client aborted
|
||||||
|
#endif
|
||||||
result_block = result_block->next;
|
result_block = result_block->next;
|
||||||
} while (result_block != first_result_block);
|
} while (result_block != first_result_block);
|
||||||
|
|
||||||
|
@ -110,7 +110,9 @@ THD::THD():user_time(0), fatal_error(0),
|
|||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
dbug_sentry=THD_SENTRY_MAGIC;
|
dbug_sentry=THD_SENTRY_MAGIC;
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
net.vio=0;
|
net.vio=0;
|
||||||
|
#endif
|
||||||
net.last_error[0]=0; // If error on boot
|
net.last_error[0]=0; // If error on boot
|
||||||
ull=0;
|
ull=0;
|
||||||
system_thread=cleanup_done=0;
|
system_thread=cleanup_done=0;
|
||||||
@ -263,11 +265,13 @@ THD::~THD()
|
|||||||
pthread_mutex_unlock(&LOCK_delete);
|
pthread_mutex_unlock(&LOCK_delete);
|
||||||
|
|
||||||
/* Close connection */
|
/* Close connection */
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (net.vio)
|
if (net.vio)
|
||||||
{
|
{
|
||||||
vio_delete(net.vio);
|
vio_delete(net.vio);
|
||||||
net_end(&net);
|
net_end(&net);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (!cleanup_done)
|
if (!cleanup_done)
|
||||||
cleanup();
|
cleanup();
|
||||||
#ifdef USING_TRANSACTIONS
|
#ifdef USING_TRANSACTIONS
|
||||||
|
@ -388,9 +388,11 @@ struct system_variables
|
|||||||
For each client connection we create a separate thread with THD serving as
|
For each client connection we create a separate thread with THD serving as
|
||||||
a thread/connection descriptor
|
a thread/connection descriptor
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class THD :public ilink {
|
class THD :public ilink {
|
||||||
public:
|
public:
|
||||||
|
#ifdef EMBEDDED_LIBRARY
|
||||||
|
struct st_mysql *mysql;
|
||||||
|
#endif
|
||||||
NET net; // client connection descriptor
|
NET net; // client connection descriptor
|
||||||
LEX lex; // parse tree descriptor
|
LEX lex; // parse tree descriptor
|
||||||
MEM_ROOT mem_root; // 1 command-life memory pool
|
MEM_ROOT mem_root; // 1 command-life memory pool
|
||||||
@ -403,9 +405,6 @@ public:
|
|||||||
struct rand_struct rand; // used for authentication
|
struct rand_struct rand; // used for authentication
|
||||||
struct system_variables variables; // Changeable local variables
|
struct system_variables variables; // Changeable local variables
|
||||||
pthread_mutex_t LOCK_delete; // Locked before thd is deleted
|
pthread_mutex_t LOCK_delete; // Locked before thd is deleted
|
||||||
#ifdef EMBEDDED_LIBRARY
|
|
||||||
struct st_mysql *mysql;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char *query; // Points to the current query,
|
char *query; // Points to the current query,
|
||||||
/*
|
/*
|
||||||
@ -548,6 +547,7 @@ public:
|
|||||||
|
|
||||||
THD();
|
THD();
|
||||||
~THD();
|
~THD();
|
||||||
|
|
||||||
void init(void);
|
void init(void);
|
||||||
void change_user(void);
|
void change_user(void);
|
||||||
void cleanup(void);
|
void cleanup(void);
|
||||||
@ -643,12 +643,17 @@ public:
|
|||||||
void add_changed_table(const char *key, long key_length);
|
void add_changed_table(const char *key, long key_length);
|
||||||
CHANGED_TABLE_LIST * changed_table_dup(const char *key, long key_length);
|
CHANGED_TABLE_LIST * changed_table_dup(const char *key, long key_length);
|
||||||
int send_explain_fields(select_result *result);
|
int send_explain_fields(select_result *result);
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
inline void clear_error()
|
inline void clear_error()
|
||||||
{
|
{
|
||||||
net.last_error[0]= 0;
|
net.last_error[0]= 0;
|
||||||
net.last_errno= 0;
|
net.last_errno= 0;
|
||||||
net.report_error= 0;
|
net.report_error= 0;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
void clear_error();
|
||||||
|
#endif
|
||||||
|
|
||||||
void add_possible_loop(Item *);
|
void add_possible_loop(Item *);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -680,7 +680,7 @@ int mysqld_show_create_db(THD *thd, const char *dbname, HA_CREATE_INFO *create_i
|
|||||||
|
|
||||||
net_store_data(packet, convert, path, (uint) (to-path));
|
net_store_data(packet, convert, path, (uint) (to-path));
|
||||||
|
|
||||||
if (my_net_write(&thd->net,(char*) packet->ptr(), packet->length()))
|
if (SEND_ROW(thd, field_list.elements, (char*) packet->ptr(), packet->length()))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
|
|
||||||
send_eof(thd);
|
send_eof(thd);
|
||||||
|
@ -183,7 +183,7 @@ my_bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
|
|||||||
net_store_data(&thd->packet,warning_level_names[err->level]);
|
net_store_data(&thd->packet,warning_level_names[err->level]);
|
||||||
net_store_data(&thd->packet,(uint32) err->code);
|
net_store_data(&thd->packet,(uint32) err->code);
|
||||||
net_store_data(&thd->packet,err->msg);
|
net_store_data(&thd->packet,err->msg);
|
||||||
if (my_net_write(&thd->net,(char*)thd->packet.ptr(),thd->packet.length()))
|
if (SEND_ROW(thd, field_list.elements, (char*)thd->packet.ptr(),thd->packet.length()))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
if (!--limit)
|
if (!--limit)
|
||||||
break;
|
break;
|
||||||
|
@ -231,7 +231,7 @@ int send_variant_2_list(THD *thd, List<String> *names, my_bool is_category)
|
|||||||
packet->length(0);
|
packet->length(0);
|
||||||
net_store_data(packet, cur_name->ptr());
|
net_store_data(packet, cur_name->ptr());
|
||||||
net_store_data(packet, is_category ? "Y" : "N");
|
net_store_data(packet, is_category ? "Y" : "N");
|
||||||
if (my_net_write(&thd->net,(char*) packet->ptr(),packet->length()))
|
if (SEND_ROW(thd,2,(char*) packet->ptr(),packet->length()))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,7 +316,7 @@ int send_answer_1(THD *thd, const char *s1, const char *s2,
|
|||||||
net_store_data(packet, s3);
|
net_store_data(packet, s3);
|
||||||
net_store_data(packet, s4);
|
net_store_data(packet, s4);
|
||||||
|
|
||||||
if (my_net_write(&thd->net,(char*) packet->ptr(),packet->length()))
|
if (SEND_ROW(thd,field_list.elements,(char*) packet->ptr(),packet->length()))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
|
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
|
@ -77,6 +77,8 @@ static int read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
|
|||||||
String &enclosed);
|
String &enclosed);
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
|
||||||
int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||||
List<Item> &fields, enum enum_duplicates handle_duplicates,
|
List<Item> &fields, enum enum_duplicates handle_duplicates,
|
||||||
bool read_file_from_client,thr_lock_type lock_type)
|
bool read_file_from_client,thr_lock_type lock_type)
|
||||||
@ -156,12 +158,14 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
|||||||
if (read_file_from_client && handle_duplicates == DUP_ERROR)
|
if (read_file_from_client && handle_duplicates == DUP_ERROR)
|
||||||
handle_duplicates=DUP_IGNORE;
|
handle_duplicates=DUP_IGNORE;
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (read_file_from_client)
|
if (read_file_from_client)
|
||||||
{
|
{
|
||||||
(void)net_request_file(&thd->net,ex->file_name);
|
(void)net_request_file(&thd->net,ex->file_name);
|
||||||
file = -1;
|
file = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
read_file_from_client=0;
|
read_file_from_client=0;
|
||||||
#ifdef DONT_ALLOW_FULL_LOAD_DATA_PATHS
|
#ifdef DONT_ALLOW_FULL_LOAD_DATA_PATHS
|
||||||
@ -329,6 +333,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
|||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
** Read of rows of fixed size + optional garage + optonal newline
|
** Read of rows of fixed size + optional garage + optonal newline
|
||||||
@ -563,9 +568,11 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, String &field_term,
|
|||||||
cache.read_function = _my_b_net_read;
|
cache.read_function = _my_b_net_read;
|
||||||
|
|
||||||
need_end_io_cache = 1;
|
need_end_io_cache = 1;
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (!opt_old_rpl_compat && mysql_bin_log.is_open())
|
if (!opt_old_rpl_compat && mysql_bin_log.is_open())
|
||||||
cache.pre_read = cache.pre_close =
|
cache.pre_read = cache.pre_close =
|
||||||
(IO_CACHE_CALLBACK) log_loaded_block;
|
(IO_CACHE_CALLBACK) log_loaded_block;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -476,6 +476,7 @@ static void reset_mqh(THD *thd, LEX_USER *lu, bool get_them= 0)
|
|||||||
Returns 0 on ok, -1 < if error is given > 0 on error.
|
Returns 0 on ok, -1 < if error is given > 0 on error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
static int
|
static int
|
||||||
check_connections(THD *thd)
|
check_connections(THD *thd)
|
||||||
{
|
{
|
||||||
@ -622,7 +623,7 @@ check_connections(THD *thd)
|
|||||||
thd->variables.net_wait_timeout= thd->variables.net_interactive_timeout;
|
thd->variables.net_wait_timeout= thd->variables.net_interactive_timeout;
|
||||||
if ((thd->client_capabilities & CLIENT_TRANSACTIONS) &&
|
if ((thd->client_capabilities & CLIENT_TRANSACTIONS) &&
|
||||||
opt_using_transactions)
|
opt_using_transactions)
|
||||||
thd->net.return_status= &thd->server_status;
|
net->return_status= &thd->server_status;
|
||||||
net->read_timeout=(uint) thd->variables.net_read_timeout;
|
net->read_timeout=(uint) thd->variables.net_read_timeout;
|
||||||
|
|
||||||
char prepared_scramble[SCRAMBLE41_LENGTH+4]; /* Buffer for scramble and hash */
|
char prepared_scramble[SCRAMBLE41_LENGTH+4]; /* Buffer for scramble and hash */
|
||||||
@ -685,7 +686,6 @@ check_connections(THD *thd)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pthread_handler_decl(handle_one_connection,arg)
|
pthread_handler_decl(handle_one_connection,arg)
|
||||||
{
|
{
|
||||||
THD *thd=(THD*) arg;
|
THD *thd=(THD*) arg;
|
||||||
@ -876,6 +876,8 @@ end:
|
|||||||
DBUG_RETURN(0); // Never reached
|
DBUG_RETURN(0); // Never reached
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
/* This works because items are allocated with sql_alloc() */
|
/* This works because items are allocated with sql_alloc() */
|
||||||
|
|
||||||
void free_items(Item *item)
|
void free_items(Item *item)
|
||||||
@ -920,7 +922,9 @@ int mysql_table_dump(THD* thd, char* db, char* tbl_name, int fd)
|
|||||||
my_error(ER_GET_ERRNO, MYF(0));
|
my_error(ER_GET_ERRNO, MYF(0));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
net_flush(&thd->net);
|
net_flush(&thd->net);
|
||||||
|
#endif
|
||||||
if ((error = table->file->dump(thd,fd)))
|
if ((error = table->file->dump(thd,fd)))
|
||||||
my_error(ER_GET_ERRNO, MYF(0));
|
my_error(ER_GET_ERRNO, MYF(0));
|
||||||
|
|
||||||
@ -1000,12 +1004,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
if (!mysql_change_db(thd,packet))
|
if (!mysql_change_db(thd,packet))
|
||||||
mysql_log.write(thd,command,"%s",thd->db);
|
mysql_log.write(thd,command,"%s",thd->db);
|
||||||
break;
|
break;
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
case COM_REGISTER_SLAVE:
|
case COM_REGISTER_SLAVE:
|
||||||
{
|
{
|
||||||
if (!register_slave(thd, (uchar*)packet, packet_length))
|
if (!register_slave(thd, (uchar*)packet, packet_length))
|
||||||
send_ok(thd);
|
send_ok(thd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
case COM_TABLE_DUMP:
|
case COM_TABLE_DUMP:
|
||||||
{
|
{
|
||||||
statistic_increment(com_other, &LOCK_status);
|
statistic_increment(com_other, &LOCK_status);
|
||||||
@ -1023,6 +1029,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
case COM_CHANGE_USER:
|
case COM_CHANGE_USER:
|
||||||
{
|
{
|
||||||
thd->change_user();
|
thd->change_user();
|
||||||
@ -1139,7 +1146,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
thd->priv_user=save_priv_user;
|
thd->priv_user=save_priv_user;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
case COM_EXECUTE:
|
case COM_EXECUTE:
|
||||||
{
|
{
|
||||||
mysql_stmt_execute(thd, packet);
|
mysql_stmt_execute(thd, packet);
|
||||||
@ -1252,6 +1259,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
mysql_rm_db(thd,db,0,0);
|
mysql_rm_db(thd,db,0,0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
case COM_BINLOG_DUMP:
|
case COM_BINLOG_DUMP:
|
||||||
{
|
{
|
||||||
statistic_increment(com_other,&LOCK_status);
|
statistic_increment(com_other,&LOCK_status);
|
||||||
@ -1276,6 +1284,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
net->error = 0;
|
net->error = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
case COM_REFRESH:
|
case COM_REFRESH:
|
||||||
{
|
{
|
||||||
statistic_increment(com_stat[SQLCOM_FLUSH],&LOCK_status);
|
statistic_increment(com_stat[SQLCOM_FLUSH],&LOCK_status);
|
||||||
@ -1289,6 +1298,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
send_eof(thd);
|
send_eof(thd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
case COM_SHUTDOWN:
|
case COM_SHUTDOWN:
|
||||||
statistic_increment(com_other,&LOCK_status);
|
statistic_increment(com_other,&LOCK_status);
|
||||||
if (check_global_access(thd,SHUTDOWN_ACL))
|
if (check_global_access(thd,SHUTDOWN_ACL))
|
||||||
@ -1309,7 +1319,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
kill_mysql();
|
kill_mysql();
|
||||||
error=TRUE;
|
error=TRUE;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
case COM_STATISTICS:
|
case COM_STATISTICS:
|
||||||
{
|
{
|
||||||
mysql_log.write(thd,command,NullS);
|
mysql_log.write(thd,command,NullS);
|
||||||
@ -1331,6 +1342,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
VOID(net_flush(net));
|
VOID(net_flush(net));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
case COM_PING:
|
case COM_PING:
|
||||||
statistic_increment(com_other,&LOCK_status);
|
statistic_increment(com_other,&LOCK_status);
|
||||||
send_ok(thd); // Tell client we are alive
|
send_ok(thd); // Tell client we are alive
|
||||||
@ -1480,6 +1492,7 @@ mysql_execute_command(THD *thd)
|
|||||||
*/
|
*/
|
||||||
thd->old_total_warn_count= thd->total_warn_count;
|
thd->old_total_warn_count= thd->total_warn_count;
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (thd->slave_thread)
|
if (thd->slave_thread)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -1501,7 +1514,7 @@ mysql_execute_command(THD *thd)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
/*
|
/*
|
||||||
TODO: make derived tables processing 'inside' SELECT processing.
|
TODO: make derived tables processing 'inside' SELECT processing.
|
||||||
TODO: solve problem with depended derived tables in subselects
|
TODO: solve problem with depended derived tables in subselects
|
||||||
@ -1525,9 +1538,13 @@ mysql_execute_command(THD *thd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((&lex->select_lex != lex->all_selects_list &&
|
if ((&lex->select_lex != lex->all_selects_list &&
|
||||||
lex->unit.create_total_list(thd, lex, &tables)) ||
|
lex->unit.create_total_list(thd, lex, &tables))
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
||
|
||||||
(table_rules_on && tables && thd->slave_thread &&
|
(table_rules_on && tables && thd->slave_thread &&
|
||||||
!tables_ok(thd,tables)))
|
!tables_ok(thd,tables))
|
||||||
|
#endif
|
||||||
|
)
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
|
|
||||||
statistic_increment(com_stat[lex->sql_command],&LOCK_status);
|
statistic_increment(com_stat[lex->sql_command],&LOCK_status);
|
||||||
@ -1610,6 +1627,7 @@ mysql_execute_command(THD *thd)
|
|||||||
res= mysqld_help(thd,lex->help_arg);
|
res= mysqld_help(thd,lex->help_arg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
case SQLCOM_PURGE:
|
case SQLCOM_PURGE:
|
||||||
{
|
{
|
||||||
if (check_global_access(thd, SUPER_ACL))
|
if (check_global_access(thd, SUPER_ACL))
|
||||||
@ -1617,6 +1635,8 @@ mysql_execute_command(THD *thd)
|
|||||||
res = purge_master_logs(thd, lex->to_log);
|
res = purge_master_logs(thd, lex->to_log);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
case SQLCOM_SHOW_WARNS:
|
case SQLCOM_SHOW_WARNS:
|
||||||
{
|
{
|
||||||
res= mysqld_show_warnings(thd, (ulong)
|
res= mysqld_show_warnings(thd, (ulong)
|
||||||
@ -1642,6 +1662,8 @@ mysql_execute_command(THD *thd)
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
case SQLCOM_SHOW_SLAVE_HOSTS:
|
case SQLCOM_SHOW_SLAVE_HOSTS:
|
||||||
{
|
{
|
||||||
if (check_global_access(thd, REPL_SLAVE_ACL))
|
if (check_global_access(thd, REPL_SLAVE_ACL))
|
||||||
@ -1656,6 +1678,8 @@ mysql_execute_command(THD *thd)
|
|||||||
res = show_binlog_events(thd);
|
res = show_binlog_events(thd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
case SQLCOM_BACKUP_TABLE:
|
case SQLCOM_BACKUP_TABLE:
|
||||||
{
|
{
|
||||||
if (check_db_used(thd,tables) ||
|
if (check_db_used(thd,tables) ||
|
||||||
@ -1675,6 +1699,8 @@ mysql_execute_command(THD *thd)
|
|||||||
res = mysql_restore_table(thd, tables);
|
res = mysql_restore_table(thd, tables);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
case SQLCOM_CHANGE_MASTER:
|
case SQLCOM_CHANGE_MASTER:
|
||||||
{
|
{
|
||||||
if (check_global_access(thd, SUPER_ACL))
|
if (check_global_access(thd, SUPER_ACL))
|
||||||
@ -1709,6 +1735,7 @@ mysql_execute_command(THD *thd)
|
|||||||
else
|
else
|
||||||
res = load_master_data(thd);
|
res = load_master_data(thd);
|
||||||
break;
|
break;
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
#ifdef HAVE_INNOBASE_DB
|
#ifdef HAVE_INNOBASE_DB
|
||||||
case SQLCOM_SHOW_INNODB_STATUS:
|
case SQLCOM_SHOW_INNODB_STATUS:
|
||||||
@ -1720,6 +1747,7 @@ mysql_execute_command(THD *thd)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
case SQLCOM_LOAD_MASTER_TABLE:
|
case SQLCOM_LOAD_MASTER_TABLE:
|
||||||
{
|
{
|
||||||
if (!tables->db)
|
if (!tables->db)
|
||||||
@ -1751,6 +1779,8 @@ mysql_execute_command(THD *thd)
|
|||||||
UNLOCK_ACTIVE_MI;
|
UNLOCK_ACTIVE_MI;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
case SQLCOM_CREATE_TABLE:
|
case SQLCOM_CREATE_TABLE:
|
||||||
{
|
{
|
||||||
ulong want_priv= ((lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) ?
|
ulong want_priv= ((lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) ?
|
||||||
@ -1852,6 +1882,7 @@ mysql_execute_command(THD *thd)
|
|||||||
res = mysql_create_index(thd, tables, lex->key_list);
|
res = mysql_create_index(thd, tables, lex->key_list);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
case SQLCOM_SLAVE_START:
|
case SQLCOM_SLAVE_START:
|
||||||
{
|
{
|
||||||
LOCK_ACTIVE_MI;
|
LOCK_ACTIVE_MI;
|
||||||
@ -1866,6 +1897,8 @@ mysql_execute_command(THD *thd)
|
|||||||
UNLOCK_ACTIVE_MI;
|
UNLOCK_ACTIVE_MI;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
case SQLCOM_ALTER_TABLE:
|
case SQLCOM_ALTER_TABLE:
|
||||||
#if defined(DONT_ALLOW_SHOW_COMMANDS)
|
#if defined(DONT_ALLOW_SHOW_COMMANDS)
|
||||||
send_error(thd,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */
|
send_error(thd,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */
|
||||||
@ -1956,6 +1989,7 @@ mysql_execute_command(THD *thd)
|
|||||||
res= -1;
|
res= -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
case SQLCOM_SHOW_BINLOGS:
|
case SQLCOM_SHOW_BINLOGS:
|
||||||
#ifdef DONT_ALLOW_SHOW_COMMANDS
|
#ifdef DONT_ALLOW_SHOW_COMMANDS
|
||||||
send_error(thd,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */
|
send_error(thd,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */
|
||||||
@ -1968,6 +2002,7 @@ mysql_execute_command(THD *thd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
case SQLCOM_SHOW_CREATE:
|
case SQLCOM_SHOW_CREATE:
|
||||||
#ifdef DONT_ALLOW_SHOW_COMMANDS
|
#ifdef DONT_ALLOW_SHOW_COMMANDS
|
||||||
send_error(thd,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */
|
send_error(thd,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */
|
||||||
@ -2423,6 +2458,7 @@ mysql_execute_command(THD *thd)
|
|||||||
case SQLCOM_CHANGE_DB:
|
case SQLCOM_CHANGE_DB:
|
||||||
mysql_change_db(thd,select_lex->db);
|
mysql_change_db(thd,select_lex->db);
|
||||||
break;
|
break;
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
case SQLCOM_LOAD:
|
case SQLCOM_LOAD:
|
||||||
{
|
{
|
||||||
uint privilege= (lex->duplicates == DUP_REPLACE ?
|
uint privilege= (lex->duplicates == DUP_REPLACE ?
|
||||||
@ -2449,6 +2485,7 @@ mysql_execute_command(THD *thd)
|
|||||||
lex->duplicates, (bool) lex->local_file, lex->lock_option);
|
lex->duplicates, (bool) lex->local_file, lex->lock_option);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
case SQLCOM_SET_OPTION:
|
case SQLCOM_SET_OPTION:
|
||||||
if (!(res=sql_set_variables(thd, &lex->var_list)))
|
if (!(res=sql_set_variables(thd, &lex->var_list)))
|
||||||
send_ok(thd);
|
send_ok(thd);
|
||||||
@ -3124,7 +3161,9 @@ mysql_parse(THD *thd, char *inBuf, uint length)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
mysql_execute_command(thd);
|
mysql_execute_command(thd);
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
query_cache_end_of_result(&thd->net);
|
query_cache_end_of_result(&thd->net);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3132,7 +3171,9 @@ mysql_parse(THD *thd, char *inBuf, uint length)
|
|||||||
{
|
{
|
||||||
DBUG_PRINT("info",("Command aborted. Fatal_error: %d",
|
DBUG_PRINT("info",("Command aborted. Fatal_error: %d",
|
||||||
thd->fatal_error));
|
thd->fatal_error));
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
query_cache_abort(&thd->net);
|
query_cache_abort(&thd->net);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
thd->proc_info="freeing items";
|
thd->proc_info="freeing items";
|
||||||
free_items(thd->free_list); /* Free strings used by items */
|
free_items(thd->free_list); /* Free strings used by items */
|
||||||
@ -3712,9 +3753,11 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables)
|
|||||||
refresh_status();
|
refresh_status();
|
||||||
if (options & REFRESH_THREADS)
|
if (options & REFRESH_THREADS)
|
||||||
flush_thread_cache();
|
flush_thread_cache();
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (options & REFRESH_MASTER)
|
if (options & REFRESH_MASTER)
|
||||||
if (reset_master(thd))
|
if (reset_master(thd))
|
||||||
result=1;
|
result=1;
|
||||||
|
#endif
|
||||||
#ifdef OPENSSL
|
#ifdef OPENSSL
|
||||||
if (options & REFRESH_DES_KEY_FILE)
|
if (options & REFRESH_DES_KEY_FILE)
|
||||||
{
|
{
|
||||||
@ -3722,6 +3765,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables)
|
|||||||
result=load_des_key_file(des_key_file);
|
result=load_des_key_file(des_key_file);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (options & REFRESH_SLAVE)
|
if (options & REFRESH_SLAVE)
|
||||||
{
|
{
|
||||||
LOCK_ACTIVE_MI;
|
LOCK_ACTIVE_MI;
|
||||||
@ -3729,6 +3773,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables)
|
|||||||
result=1;
|
result=1;
|
||||||
UNLOCK_ACTIVE_MI;
|
UNLOCK_ACTIVE_MI;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (options & REFRESH_USER_RESOURCES)
|
if (options & REFRESH_USER_RESOURCES)
|
||||||
reset_mqh(thd,(LEX_USER *) NULL);
|
reset_mqh(thd,(LEX_USER *) NULL);
|
||||||
return result;
|
return result;
|
||||||
|
@ -140,7 +140,11 @@ static bool send_prep_stmt(PREP_STMT *stmt, uint columns)
|
|||||||
int4store(buff, stmt->stmt_id);
|
int4store(buff, stmt->stmt_id);
|
||||||
int2store(buff+4, columns);
|
int2store(buff+4, columns);
|
||||||
int2store(buff+6, stmt->param_count);
|
int2store(buff+6, stmt->param_count);
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
return (my_net_write(net, buff, sizeof(buff)) || net_flush(net));
|
return (my_net_write(net, buff, sizeof(buff)) || net_flush(net));
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -299,7 +303,11 @@ static bool setup_params_data(PREP_STMT *stmt)
|
|||||||
Item_param *param;
|
Item_param *param;
|
||||||
DBUG_ENTER("setup_params_data");
|
DBUG_ENTER("setup_params_data");
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
uchar *pos=(uchar*) thd->net.read_pos+1+MYSQL_STMT_HEADER; //skip header
|
uchar *pos=(uchar*) thd->net.read_pos+1+MYSQL_STMT_HEADER; //skip header
|
||||||
|
#else
|
||||||
|
uchar *pos= 0; //just to compile TODO code for embedded case
|
||||||
|
#endif
|
||||||
uchar *read_pos= pos+(stmt->param_count+7) / 8; //skip null bits
|
uchar *read_pos= pos+(stmt->param_count+7) / 8; //skip null bits
|
||||||
|
|
||||||
if (*read_pos++) //types supplied / first execute
|
if (*read_pos++) //types supplied / first execute
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
// Sasha Pachev <sasha@mysql.com> is currently in charge of this file
|
// Sasha Pachev <sasha@mysql.com> is currently in charge of this file
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
|
||||||
#include "mysql_priv.h"
|
#include "mysql_priv.h"
|
||||||
#include "sql_repl.h"
|
#include "sql_repl.h"
|
||||||
#include "sql_acl.h"
|
#include "sql_acl.h"
|
||||||
@ -1149,3 +1151,7 @@ int log_loaded_block(IO_CACHE* file)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
#include "slave.h"
|
#include "slave.h"
|
||||||
|
|
||||||
typedef struct st_slave_info
|
typedef struct st_slave_info
|
||||||
@ -53,3 +54,6 @@ typedef struct st_load_file_info
|
|||||||
} LOAD_FILE_INFO;
|
} LOAD_FILE_INFO;
|
||||||
|
|
||||||
int log_loaded_block(IO_CACHE* file);
|
int log_loaded_block(IO_CACHE* file);
|
||||||
|
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
@ -3621,7 +3621,9 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value)
|
|||||||
(thd->options & OPTION_AUTO_IS_NULL) &&
|
(thd->options & OPTION_AUTO_IS_NULL) &&
|
||||||
thd->insert_id())
|
thd->insert_id())
|
||||||
{
|
{
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
query_cache_abort(&thd->net);
|
query_cache_abort(&thd->net);
|
||||||
|
#endif
|
||||||
COND *new_cond;
|
COND *new_cond;
|
||||||
if ((new_cond= new Item_func_eq(args[0],
|
if ((new_cond= new Item_func_eq(args[0],
|
||||||
new Item_int("last_insert_id()",
|
new Item_int("last_insert_id()",
|
||||||
|
@ -234,7 +234,7 @@ int mysqld_show_table_types(THD *thd)
|
|||||||
option_name= "DEFAULT";
|
option_name= "DEFAULT";
|
||||||
net_store_data(packet, option_name);
|
net_store_data(packet, option_name);
|
||||||
net_store_data(packet, types->comment);
|
net_store_data(packet, types->comment);
|
||||||
if (my_net_write(&thd->net, (char*) packet->ptr(), packet->length()))
|
if (SEND_ROW(thd, field_list.elements, (char*) packet->ptr(), packet->length()))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
}
|
}
|
||||||
send_eof(thd);
|
send_eof(thd);
|
||||||
@ -296,7 +296,7 @@ int mysqld_show_privileges(THD *thd)
|
|||||||
net_store_data(packet,privilege->privilege);
|
net_store_data(packet,privilege->privilege);
|
||||||
net_store_data(packet,privilege->context);
|
net_store_data(packet,privilege->context);
|
||||||
net_store_data(packet,privilege->comment);
|
net_store_data(packet,privilege->comment);
|
||||||
if (my_net_write(&thd->net,(char*) packet->ptr(),packet->length()))
|
if (SEND_ROW(thd,field_list.elements,(char*) packet->ptr(),packet->length()))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
}
|
}
|
||||||
send_eof(thd);
|
send_eof(thd);
|
||||||
@ -382,7 +382,7 @@ int mysqld_show_column_types(THD *thd)
|
|||||||
net_store_data(packet,sys_column_types[i].case_sensitivity);
|
net_store_data(packet,sys_column_types[i].case_sensitivity);
|
||||||
net_store_data(packet,sys_column_types[i].default_value);
|
net_store_data(packet,sys_column_types[i].default_value);
|
||||||
net_store_data(packet,sys_column_types[i].comment);
|
net_store_data(packet,sys_column_types[i].comment);
|
||||||
if (my_net_write(&thd->net,(char*) packet->ptr(),packet->length()))
|
if (SEND_ROW(thd,field_list.elements,(char*) packet->ptr(),packet->length()))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
}
|
}
|
||||||
send_eof(thd);
|
send_eof(thd);
|
||||||
@ -997,7 +997,9 @@ mysqld_list_fields(THD *thd, TABLE_LIST *table_list, const char *wild)
|
|||||||
restore_record(table,2); // Get empty record
|
restore_record(table,2); // Get empty record
|
||||||
if (send_fields(thd,field_list,2))
|
if (send_fields(thd,field_list,2))
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
VOID(net_flush(&thd->net));
|
VOID(net_flush(&thd->net));
|
||||||
|
#endif
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1016,6 +1018,7 @@ mysqld_dump_create_info(THD *thd, TABLE *table, int fd)
|
|||||||
|
|
||||||
if (convert)
|
if (convert)
|
||||||
convert->convert((char*) packet->ptr(), packet->length());
|
convert->convert((char*) packet->ptr(), packet->length());
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
if (my_net_write(&thd->net, (char*)packet->ptr(), packet->length()))
|
if (my_net_write(&thd->net, (char*)packet->ptr(), packet->length()))
|
||||||
@ -1028,6 +1031,7 @@ mysqld_dump_create_info(THD *thd, TABLE *table, int fd)
|
|||||||
MYF(MY_WME)))
|
MYF(MY_WME)))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1273,7 +1277,7 @@ public:
|
|||||||
template class I_List<thread_info>;
|
template class I_List<thread_info>;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
void mysqld_list_processes(THD *thd,const char *user, bool verbose)
|
void mysqld_list_processes(THD *thd,const char *user, bool verbose)
|
||||||
{
|
{
|
||||||
Item *field;
|
Item *field;
|
||||||
@ -1398,7 +1402,12 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
|
|||||||
send_eof(thd);
|
send_eof(thd);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
#else /* EMBEDDED_LIBRARY */
|
||||||
|
void mysqld_list_processes(THD *thd __attribute__(unused),
|
||||||
|
const char *user __attribute__(unused),
|
||||||
|
bool verbose __attribute__(unused))
|
||||||
|
{}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
Status functions
|
Status functions
|
||||||
@ -1434,7 +1443,7 @@ int mysqld_show_charsets(THD *thd, const char *wild)
|
|||||||
net_store_data(&packet2,(uint32) cs[0]->strxfrm_multiply);
|
net_store_data(&packet2,(uint32) cs[0]->strxfrm_multiply);
|
||||||
net_store_data(&packet2,(uint32) (cs[0]->mbmaxlen));
|
net_store_data(&packet2,(uint32) (cs[0]->mbmaxlen));
|
||||||
|
|
||||||
if (my_net_write(&thd->net, (char*) packet2.ptr(),packet2.length()))
|
if (SEND_ROW(thd, field_list.elements, (char*) packet2.ptr(),packet2.length()))
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1510,6 +1519,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
|
|||||||
case SHOW_QUESTION:
|
case SHOW_QUESTION:
|
||||||
net_store_data(&packet2,(uint32) thd->query_id);
|
net_store_data(&packet2,(uint32) thd->query_id);
|
||||||
break;
|
break;
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
case SHOW_RPL_STATUS:
|
case SHOW_RPL_STATUS:
|
||||||
net_store_data(&packet2, rpl_status_type[(int)rpl_status]);
|
net_store_data(&packet2, rpl_status_type[(int)rpl_status]);
|
||||||
break;
|
break;
|
||||||
@ -1522,6 +1532,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
|
|||||||
UNLOCK_ACTIVE_MI;
|
UNLOCK_ACTIVE_MI;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
case SHOW_OPENTABLES:
|
case SHOW_OPENTABLES:
|
||||||
net_store_data(&packet2,(uint32) cached_tables());
|
net_store_data(&packet2,(uint32) cached_tables());
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user