embedded library trimming


include/my_global.h:
  HAVE_REPLICATION & HAVE_EXTERNAL_CLIENT macro definitions
libmysqld/lib_sql.cc:
  Protocol:: methods implementation for embedded case
sql/field.cc:
  geometry type methods implementations
sql/ha_berkeley.cc:
  set_nfields deletion
sql/ha_innodb.cc:
  macro changed
sql/ha_myisam.cc:
  set_nfields deletion
sql/ha_myisam.h:
  code #ifdef-ed
sql/item.cc:
  bugfix
sql/item_func.cc:
  macro changed
sql/item_strfunc.cc:
  superfluous code deleted
sql/log.cc:
  HAVE_REPLICATION instead of EMBEDDED_LIBRARY
sql/log_event.cc:
  #ifdef constructions changed
sql/log_event.h:
  #ifdef-s changed
sql/mf_iocache.cc:
  HAVE_REPLICATION instead of EMBEDDED_LIBRARY
sql/mini_client.cc:
  HAVE_REPLICATION instead of EMBEDDED_LIBRARY
sql/mysql_priv.h:
  code removation
sql/mysqld.cc:
  HAVE_REPLICATION instead of EMBEDDED_LIBRARY
sql/opt_range.cc:
  code trimming
sql/protocol.cc:
  net_store_data becomes a member of Protocol
sql/protocol.h:
  changes to make Protocol working in embedded library
sql/repl_failsafe.cc:
  HAVE_REPLICATION instead of EMBEDDED_LIBRARY
sql/repl_failsafe.h:
  HAVE_REPLICATION instead of EMBEDDED_LIBRARY
sql/set_var.cc:
  HAVE_REPLICATION instead of EMBEDDED_LIBRARY
sql/slave.cc:
  HAVE_REPLICATION instead of EMBEDDED_LIBRARY
sql/slave.h:
  HAVE_REPLICATION instead of EMBEDDED_LIBRARY
sql/sql_parse.cc:
  code trimming
sql/sql_prepare.cc:
  comment added
sql/sql_repl.cc:
  HAVE_REPLICATION instead of EMBEDDED_LIBRARY
sql/sql_repl.h:
  HAVE_REPLICATION instead of EMBEDDED_LIBRARY
sql/sql_show.cc:
  mysql_list_processes to work in embedded library
sql/sql_table.cc:
  set_nfields deletion
This commit is contained in:
unknown 2003-01-15 12:11:44 +04:00
parent 1bc932384b
commit 09b79b65f2
31 changed files with 326 additions and 331 deletions

View File

@ -19,6 +19,11 @@
#ifndef _global_h #ifndef _global_h
#define _global_h #define _global_h
#ifndef EMBEDDED_LIBRARY
#define HAVE_REPLICATION
#define HAVE_EXTERNAL_CLIENT
#endif
#if defined( __EMX__) && !defined( MYSQL_SERVER) #if defined( __EMX__) && !defined( MYSQL_SERVER)
/* moved here to use below VOID macro redefinition */ /* moved here to use below VOID macro redefinition */
#define INCL_BASE #define INCL_BASE

View File

@ -424,21 +424,20 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
{ {
List_iterator_fast<Item> it(*list); List_iterator_fast<Item> it(*list);
Item *item; Item *item;
MEM_ROOT *alloc;
MYSQL_FIELD *field, *client_field; MYSQL_FIELD *field, *client_field;
MYSQL *mysql= thd->mysql; MYSQL *mysql= thd->mysql;
set_nfields(list->elements); DBUG_ENTER("send_fields");
if (!(mysql->result=(MYSQL_RES*) my_malloc(sizeof(MYSQL_RES)+ if (!(mysql->result=(MYSQL_RES*) my_malloc(sizeof(MYSQL_RES)+
sizeof(ulong) * (n_fields + 1), sizeof(ulong) * (field_count + 1),
MYF(MY_WME | MY_ZEROFILL)))) MYF(MY_WME | MY_ZEROFILL))))
goto err; goto err;
mysql->result->lengths= (ulong *)(mysql->result + 1); mysql->result->lengths= (ulong *)(mysql->result + 1);
mysql->field_count=n_fields; mysql->field_count=field_count;
alloc= &mysql->field_alloc; alloc= &mysql->field_alloc;
field= (MYSQL_FIELD *)alloc_root(alloc, sizeof(MYSQL_FIELD) * n_fields); field= (MYSQL_FIELD *)alloc_root(alloc, sizeof(MYSQL_FIELD) * field_count);
if (!field) if (!field)
goto err; goto err;
@ -482,20 +481,27 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
init_alloc_root(&mysql->result->data->alloc,8192,0); /* Assume rowlength < 8192 */ init_alloc_root(&mysql->result->data->alloc,8192,0); /* Assume rowlength < 8192 */
mysql->result->data->alloc.min_malloc=sizeof(MYSQL_ROWS); mysql->result->data->alloc.min_malloc=sizeof(MYSQL_ROWS);
mysql->result->data->rows=0; mysql->result->data->rows=0;
mysql->result->data->fields=n_fields; mysql->result->data->fields=field_count;
mysql->result->field_count=n_fields; mysql->result->field_count=field_count;
mysql->result->data->prev_ptr= &mysql->result->data->data; mysql->result->data->prev_ptr= &mysql->result->data->data;
mysql->result->field_alloc= mysql->field_alloc; mysql->result->field_alloc= mysql->field_alloc;
mysql->result->current_field=0; mysql->result->current_field=0;
mysql->result->current_row=0; mysql->result->current_row=0;
return 0; DBUG_RETURN(prepare_for_send(list));
err: err:
send_error(thd, ER_OUT_OF_RESOURCES); /* purecov: inspected */ send_error(thd, ER_OUT_OF_RESOURCES); /* purecov: inspected */
return 1; /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */
} }
bool Protocol::write()
{
*next_field= 0;
return false;
}
/* Get the length of next field. Change parameter to point at fieldstart */ /* Get the length of next field. Change parameter to point at fieldstart */
static ulong static ulong
net_field_length(uchar **packet) net_field_length(uchar **packet)
@ -525,6 +531,7 @@ net_field_length(uchar **packet)
return (ulong) uint4korr(pos+1); return (ulong) uint4korr(pos+1);
} }
bool select_send::send_data(List<Item> &items) bool select_send::send_data(List<Item> &items)
{ {
List_iterator_fast<Item> li(items); List_iterator_fast<Item> li(items);
@ -617,7 +624,7 @@ send_eof(THD *thd, bool no_flush)
*/ */
} }
#ifdef DUMMY
int embedded_send_row(THD *thd, int n_fields, const char *data, int data_len) int embedded_send_row(THD *thd, int n_fields, const char *data, int data_len)
{ {
MYSQL *mysql= thd->mysql; MYSQL *mysql= thd->mysql;
@ -669,8 +676,54 @@ int embedded_send_row(THD *thd, int n_fields, const char *data, int data_len)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
#endif
uint STDCALL mysql_warning_count(MYSQL *mysql) uint STDCALL mysql_warning_count(MYSQL *mysql)
{ {
return ((THD *)mysql->thd)->total_warn_count; return ((THD *)mysql->thd)->total_warn_count;
} }
void Protocol_simple::prepare_for_resend()
{
MYSQL_ROWS *cur;
ulong len;
MYSQL_DATA *result= thd->mysql->result->data;
MEM_ROOT *alloc= &result->alloc;
MYSQL_FIELD *mysql_fields= thd->mysql->result->fields;
DBUG_ENTER("send_data");
result->rows++;
if (!(cur= (MYSQL_ROWS *)alloc_root(alloc, sizeof(MYSQL_ROWS)+(field_count + 1) * sizeof(char *))))
{
my_error(ER_OUT_OF_RESOURCES,MYF(0));
DBUG_VOID_RETURN;
}
cur->data= (MYSQL_ROW)(((char *)cur) + sizeof(MYSQL_ROWS));
*result->prev_ptr= cur;
result->prev_ptr= &cur->next;
next_field=cur->data;
DBUG_VOID_RETURN;
}
bool Protocol::net_store_data(const char *from, uint length)
{
MYSQL_FIELD *mysql_fields= thd->mysql->result->fields;
if (!length)
{
*next_field= NULL;
}
else
{
if (!(*next_field=alloc_root(alloc, length + 1)))
return true;
memcpy(*next_field, from, length);
(*next_field)[length]= 0;
}
++next_field;
if (mysql_fields->max_length < length)
mysql_fields->max_length=length;
return false;
}

View File

@ -4586,7 +4586,7 @@ void Field_blob::set_key_image(char *buff,uint length)
void Field_geom::get_key_image(char *buff,uint length, imagetype type) void Field_geom::get_key_image(char *buff,uint length, imagetype type)
{ {
/* length-=HA_KEY_BLOB_LENGTH; length-=HA_KEY_BLOB_LENGTH;
ulong blob_length=get_length(ptr); ulong blob_length=get_length(ptr);
char *blob; char *blob;
get_ptr(&blob); get_ptr(&blob);
@ -4601,8 +4601,6 @@ void Field_geom::get_key_image(char *buff,uint length, imagetype type)
float8store(buff+16, mbr.ymin); float8store(buff+16, mbr.ymin);
float8store(buff+24, mbr.ymax); float8store(buff+24, mbr.ymax);
return; return;
*/
Field_blob::get_key_image(buff, length, type);
} }
void Field_geom::set_key_image(char *buff,uint length) void Field_geom::set_key_image(char *buff,uint length)
@ -4612,7 +4610,7 @@ void Field_geom::set_key_image(char *buff,uint length)
void Field_geom::sql_type(String &res) const void Field_geom::sql_type(String &res) const
{ {
res.set("geometry", 8U, default_charset_info); res.set("geometry", 8, default_charset_info);
} }
int Field_blob::key_cmp(const byte *key_ptr, uint max_key_length) int Field_blob::key_cmp(const byte *key_ptr, uint max_key_length)
@ -5255,10 +5253,10 @@ uint32 calc_pack_length(enum_field_types type,uint32 length)
case FIELD_TYPE_LONGLONG: return 8; /* Don't crash if no longlong */ case FIELD_TYPE_LONGLONG: return 8; /* Don't crash if no longlong */
case FIELD_TYPE_NULL : return 0; case FIELD_TYPE_NULL : return 0;
case FIELD_TYPE_TINY_BLOB: return 1+portable_sizeof_char_ptr; case FIELD_TYPE_TINY_BLOB: return 1+portable_sizeof_char_ptr;
case FIELD_TYPE_BLOB: return 2+portable_sizeof_char_ptr; case FIELD_TYPE_BLOB:
case FIELD_TYPE_GEOMETRY: return 2+portable_sizeof_char_ptr;
case FIELD_TYPE_MEDIUM_BLOB: return 3+portable_sizeof_char_ptr; case FIELD_TYPE_MEDIUM_BLOB: return 3+portable_sizeof_char_ptr;
case FIELD_TYPE_LONG_BLOB: return 4+portable_sizeof_char_ptr; case FIELD_TYPE_LONG_BLOB: return 4+portable_sizeof_char_ptr;
case FIELD_TYPE_GEOMETRY: return 2+portable_sizeof_char_ptr;
case FIELD_TYPE_SET: case FIELD_TYPE_SET:
case FIELD_TYPE_ENUM: abort(); return 0; // This shouldn't happen case FIELD_TYPE_ENUM: abort(); return 0; // This shouldn't happen
default: return 0; default: return 0;

View File

@ -255,7 +255,6 @@ int berkeley_show_logs(Protocol *protocol)
/* Error is 0 here */ /* Error is 0 here */
if (all_logs) if (all_logs)
{ {
protocol->set_nfields(3);
for (a = all_logs, f = free_logs; *a; ++a) for (a = all_logs, f = free_logs; *a; ++a)
{ {
protocol->prepare_for_resend(); protocol->prepare_for_resend();

View File

@ -871,7 +871,7 @@ innobase_commit_low(
/*================*/ /*================*/
trx_t* trx) /* in: transaction handle */ trx_t* trx) /* in: transaction handle */
{ {
#ifndef EMBEDDED_LIBRARY #ifdef HAVE_REPLICATION
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
@ -885,7 +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 */ #endif /* HAVE_REPLICATION */
trx_commit_for_mysql(trx); trx_commit_for_mysql(trx);
} }

View File

@ -76,7 +76,6 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
} }
length=(uint) (strxmov(name, param->db_name,".",param->table_name,NullS) - length=(uint) (strxmov(name, param->db_name,".",param->table_name,NullS) -
name); name);
protocol->set_nfields(4);
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(name, length); protocol->store(name, length);
protocol->store(param->op_name); protocol->store(param->op_name);
@ -140,9 +139,9 @@ const char *ha_myisam::index_type(uint key_number)
"BTREE"); "BTREE");
} }
#ifdef HAVE_REPLICATION
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;
@ -167,15 +166,11 @@ int ha_myisam::net_read_dump(NET* net)
} }
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;
@ -224,10 +219,8 @@ 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
} }
#endif /* HAVE_REPLICATION */
/* Name is here without an extension */ /* Name is here without an extension */
@ -1056,8 +1049,9 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
for (i=0; i < table_arg->keys ; i++, pos++) for (i=0; i < table_arg->keys ; i++, pos++)
{ {
keydef[i].flag= (pos->flags & (HA_NOSAME | HA_FULLTEXT | HA_SPATIAL)); keydef[i].flag= (pos->flags & (HA_NOSAME | HA_FULLTEXT | HA_SPATIAL));
keydef[i].key_alg=pos->algorithm == HA_KEY_ALG_UNDEF ? keydef[i].key_alg= pos->algorithm == HA_KEY_ALG_UNDEF ?
HA_KEY_ALG_BTREE : pos->algorithm; (pos->flags & HA_SPATIAL ? HA_KEY_ALG_RTREE : HA_KEY_ALG_BTREE) :
pos->algorithm;
keydef[i].seg=keyseg; keydef[i].seg=keyseg;
keydef[i].keysegs=pos->key_parts; keydef[i].keysegs=pos->key_parts;
for (j=0 ; j < pos->key_parts ; j++) for (j=0 ; j < pos->key_parts ; j++)

View File

@ -127,6 +127,8 @@ class ha_myisam: public handler
int optimize(THD* thd, HA_CHECK_OPT* check_opt); int optimize(THD* thd, HA_CHECK_OPT* check_opt);
int restore(THD* thd, HA_CHECK_OPT* check_opt); int restore(THD* thd, HA_CHECK_OPT* check_opt);
int backup(THD* thd, HA_CHECK_OPT* check_opt); int backup(THD* thd, HA_CHECK_OPT* check_opt);
#ifdef HAVE_REPLICATION
int dump(THD* thd, int fd); int dump(THD* thd, int fd);
int net_read_dump(NET* net); int net_read_dump(NET* net);
#endif
}; };

View File

@ -1014,8 +1014,7 @@ bool Item::embedded_send(const CONVERT *convert, CHARSET_INFO *charset, MEM_ROOT
{ {
char buff[MAX_FIELD_WIDTH]; char buff[MAX_FIELD_WIDTH];
String s(buff, sizeof(buff), charset), *value; String s(buff, sizeof(buff), charset), *value;
if (!(value=val_str(&s)) || if (!(value=val_str(&s)))
!(*result=alloc_root(alloc, value->length() + 1)))
{ {
*result= NULL; *result= NULL;
*length= 0; *length= 0;

View File

@ -1656,7 +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 #ifdef HAVE_REPLICATION
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)
{ {

View File

@ -1394,11 +1394,6 @@ String *Item_func_user::val_str(String *str)
const char *host=thd->host ? thd->host : thd->ip ? thd->ip : ""; const char *host=thd->host ? thd->host : thd->ip ? thd->ip : "";
uint32 res_length=(strlen(thd->user)+strlen(host)+10) * cs->mbmaxlen; uint32 res_length=(strlen(thd->user)+strlen(host)+10) * cs->mbmaxlen;
#ifdef EMBEDDED_LIBRARY
if (str->copy("localuser@localhost", (uint)strlen("localuser@localhost"), cs))
return &empty_string;
#else
if (str->alloc(res_length)) if (str->alloc(res_length))
{ {
null_value=1; null_value=1;
@ -1406,7 +1401,6 @@ String *Item_func_user::val_str(String *str)
} }
res_length=cs->snprintf(cs, (char*)str->ptr(), res_length, "%s@%s",thd->user,host); res_length=cs->snprintf(cs, (char*)str->ptr(), res_length, "%s@%s",thd->user,host);
str->length(res_length); str->length(res_length);
#endif
str->set_charset(cs); str->set_charset(cs);
return str; return str;
} }

View File

@ -24,7 +24,6 @@
#include "mysql_priv.h" #include "mysql_priv.h"
#include <mysql.h> #include <mysql.h>
#include "sql_acl.h" #include "sql_acl.h"
#include "sql_repl.h" #include "sql_repl.h"
@ -614,7 +613,7 @@ err:
LOG_INFO_IO Got IO error while reading file LOG_INFO_IO Got IO error while reading file
*/ */
#ifndef EMBEDDED_LIBRARY #ifdef HAVE_REPLICATION
int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli) int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli)
{ {
@ -745,7 +744,7 @@ err:
DBUG_RETURN(error); DBUG_RETURN(error);
} }
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */
/* /*
@ -1056,7 +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 #ifdef HAVE_REPLICATION
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)))
@ -1065,7 +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 */ #endif /* HAVE_REPLICATION */
error=1; error=1;
/* /*
@ -1429,7 +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 #ifdef HAVE_REPLICATION
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;
@ -1437,7 +1436,7 @@ void MYSQL_LOG::close(bool exiting)
s.write(&log_file); s.write(&log_file);
signal_update(); signal_update();
} }
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */
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)
{ {

View File

@ -82,14 +82,12 @@ static void pretty_print_str(FILE* file, char* str, int len)
ignored_error_code() ignored_error_code()
****************************************************************************/ ****************************************************************************/
#ifndef EMBEDDED_LIBRARY #if defined(HAVE_REPLICATION) && !defined(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
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
@ -126,8 +124,7 @@ static void pretty_print_str(String* packet, char* str, int len)
slave_load_file_stem() slave_load_file_stem()
****************************************************************************/ ****************************************************************************/
#ifndef EMBEDDED_LIBRARY #if defined(HAVE_REPLICATION) && !defined(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)
{ {
@ -139,8 +136,7 @@ static inline char* slave_load_file_stem(char*buf, uint file_id,
*buf++ = '-'; *buf++ = '-';
return int10_to_str(file_id, buf, 10); return int10_to_str(file_id, buf, 10);
} }
#endif // !MYSQL_CLIENT #endif
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
@ -154,8 +150,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 #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
#ifndef MYSQL_CLIENT
static void cleanup_load_tmpdir() static void cleanup_load_tmpdir()
{ {
MY_DIR *dirp; MY_DIR *dirp;
@ -173,8 +168,7 @@ static void cleanup_load_tmpdir()
my_dirend(dirp); my_dirend(dirp);
} }
#endif // !MYSQL_CLIENT #endif
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
@ -292,7 +286,7 @@ Log_event::Log_event(const char* buf, bool old_format)
#ifndef MYSQL_CLIENT #ifndef MYSQL_CLIENT
#ifndef EMBEDDED_LIBRARY #ifdef HAVE_REPLICATION
/***************************************************************************** /*****************************************************************************
@ -319,7 +313,34 @@ void Log_event::pack_info(Protocol *protocol)
{ {
protocol->store("",0); protocol->store("",0);
} }
#endif /* EMBEDDED_LIBRARY */
/*****************************************************************************
Log_event::net_send()
Only called by SHOW BINLOG EVENTS
****************************************************************************/
int Log_event::net_send(Protocol *protocol, const char* log_name, my_off_t pos)
{
const char *p= strrchr(log_name, FN_LIBCHAR);
const char *event_type;
if (p)
log_name = p + 1;
protocol->prepare_for_resend();
protocol->store(log_name);
protocol->store((ulonglong) pos);
event_type = get_type_str();
protocol->store(event_type, strlen(event_type));
protocol->store((uint32) server_id);
protocol->store((ulonglong) log_pos);
pack_info(protocol);
return protocol->write();
}
#endif /* HAVE_REPLICATION */
/***************************************************************************** /*****************************************************************************
@ -339,32 +360,6 @@ void Log_event::init_show_field_list(List<Item>* field_list)
field_list->push_back(new Item_empty_string("Info", 20)); field_list->push_back(new Item_empty_string("Info", 20));
} }
/*****************************************************************************
Log_event::net_send()
Only called by SHOW BINLOG EVENTS
****************************************************************************/
#ifndef EMBEDDED_LIBRARY
int Log_event::net_send(Protocol *protocol, const char* log_name, my_off_t pos)
{
const char *p= strrchr(log_name, FN_LIBCHAR);
const char *event_type;
if (p)
log_name = p + 1;
protocol->prepare_for_resend();
protocol->store(log_name);
protocol->store((ulonglong) pos);
event_type = get_type_str();
protocol->store(event_type, strlen(event_type));
protocol->store((uint32) server_id);
protocol->store((ulonglong) log_pos);
pack_info(protocol);
return protocol->write();
}
#endif /* EMBEDDED_LIBRARY */
#endif // !MYSQL_CLIENT #endif // !MYSQL_CLIENT
/***************************************************************************** /*****************************************************************************
@ -572,11 +567,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 #ifdef HAVE_REPLICATION
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 */ #endif /* HAVE_REPLICATION */
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;
@ -592,11 +587,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 #ifdef HAVE_REPLICATION
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 */ #endif /* HAVE_REPLICATION */
case INTVAR_EVENT: case INTVAR_EVENT:
ev = new Intvar_log_event(buf, old_format); ev = new Intvar_log_event(buf, old_format);
break; break;
@ -683,8 +678,7 @@ void Log_event::set_log_pos(MYSQL_LOG* log)
***************************************************************************** *****************************************************************************
****************************************************************************/ ****************************************************************************/
#ifndef EMBEDDED_LIBRARY #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
#ifndef MYSQL_CLIENT
/***************************************************************************** /*****************************************************************************
Query_log_event::pack_info() Query_log_event::pack_info()
@ -706,8 +700,7 @@ void Query_log_event::pack_info(Protocol *protocol)
tmp.append(query, q_len); tmp.append(query, q_len);
protocol->store((char*) tmp.ptr(), tmp.length()); protocol->store((char*) tmp.ptr(), tmp.length());
} }
#endif // !MYSQL_CLIENT #endif
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
@ -840,8 +833,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 #if defined(HAVE_REPLICATION) && !defined(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)
{ {
int expected_error,actual_error = 0; int expected_error,actual_error = 0;
@ -929,8 +921,7 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
free_root(&thd->mem_root,0); free_root(&thd->mem_root,0);
return Log_event::exec_event(rli); return Log_event::exec_event(rli);
} }
#endif // !MYSQL_CLIENT #endif
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
@ -946,8 +937,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 #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
#ifndef MYSQL_CLIENT
void Start_log_event::pack_info(Protocol *protocol) void Start_log_event::pack_info(Protocol *protocol)
{ {
char buf1[256]; char buf1[256];
@ -961,8 +951,7 @@ void Start_log_event::pack_info(Protocol *protocol)
tmp.append(llstr(binlog_version, buf)); tmp.append(llstr(binlog_version, buf));
protocol->store(tmp.ptr(), tmp.length()); protocol->store(tmp.ptr(), tmp.length());
} }
#endif // !MYSQL_CLIENT #endif
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
@ -1031,8 +1020,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 #if defined(HAVE_REPLICATION) && !defined(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)
{ {
/* All temporary tables was deleted on the master */ /* All temporary tables was deleted on the master */
@ -1044,8 +1032,7 @@ int Start_log_event::exec_event(struct st_relay_log_info* rli)
cleanup_load_tmpdir(); cleanup_load_tmpdir();
return Log_event::exec_event(rli); return Log_event::exec_event(rli);
} }
#endif // !MYSQL_CLIENT #endif
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
@ -1061,8 +1048,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 #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
#ifndef MYSQL_CLIENT
void Load_log_event::pack_info(Protocol *protocol) void Load_log_event::pack_info(Protocol *protocol)
{ {
char buf[256]; char buf[256];
@ -1138,8 +1124,7 @@ void Load_log_event::pack_info(Protocol *protocol)
protocol->store(tmp.ptr(), tmp.length()); protocol->store(tmp.ptr(), tmp.length());
} }
#endif // !MYSQL_CLIENT #endif
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
@ -1443,8 +1428,7 @@ void Load_log_event::set_fields(List<Item> &field_list)
Load_log_event::exec_event() Load_log_event::exec_event()
****************************************************************************/ ****************************************************************************/
#ifndef EMBEDDED_LIBRARY #if defined(HAVE_REPLICATION) && !defined(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)
{ {
init_sql_alloc(&thd->mem_root, 8192,0); init_sql_alloc(&thd->mem_root, 8192,0);
@ -1550,8 +1534,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
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
@ -1567,8 +1550,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 #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
#ifndef MYSQL_CLIENT
void Rotate_log_event::pack_info(Protocol *protocol) void Rotate_log_event::pack_info(Protocol *protocol)
{ {
char buf1[256], buf[22]; char buf1[256], buf[22];
@ -1581,8 +1563,7 @@ void Rotate_log_event::pack_info(Protocol *protocol)
tmp.append("; forced by master"); tmp.append("; forced by master");
protocol->store(tmp.ptr(), tmp.length()); protocol->store(tmp.ptr(), tmp.length());
} }
#endif // !MYSQL_CLIENT #endif
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
@ -1675,8 +1656,7 @@ int Rotate_log_event::write_data(IO_CACHE* file)
0 ok 0 ok
****************************************************************************/ ****************************************************************************/
#ifndef EMBEDDED_LIBRARY #if defined(HAVE_REPLICATION) && !defined(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)
{ {
char* log_name = rli->master_log_name; char* log_name = rli->master_log_name;
@ -1692,8 +1672,7 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
flush_relay_log_info(rli); flush_relay_log_info(rli);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
#endif // !MYSQL_CLIENT #endif
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
@ -1709,8 +1688,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 #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
#ifndef MYSQL_CLIENT
void Intvar_log_event::pack_info(Protocol *protocol) void Intvar_log_event::pack_info(Protocol *protocol)
{ {
char buf1[256], buf[22]; char buf1[256], buf[22];
@ -1721,8 +1699,7 @@ void Intvar_log_event::pack_info(Protocol *protocol)
tmp.append(llstr(val, buf)); tmp.append(llstr(val, buf));
protocol->store(tmp.ptr(), tmp.length()); protocol->store(tmp.ptr(), tmp.length());
} }
#endif // !MYSQL_CLIENT #endif
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
@ -1801,8 +1778,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 #if defined(HAVE_REPLICATION)&& !defined(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)
{ {
switch (type) { switch (type) {
@ -1817,8 +1793,7 @@ int Intvar_log_event::exec_event(struct st_relay_log_info* rli)
rli->inc_pending(get_event_len()); rli->inc_pending(get_event_len());
return 0; return 0;
} }
#endif // !MYSQL_CLIENT #endif
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
@ -1834,8 +1809,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 #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
#ifndef MYSQL_CLIENT
void Rand_log_event::pack_info(Protocol *protocol) void Rand_log_event::pack_info(Protocol *protocol)
{ {
char buf1[256], *pos; char buf1[256], *pos;
@ -1845,8 +1819,7 @@ void Rand_log_event::pack_info(Protocol *protocol)
pos= int10_to_str((long) seed2, pos, 10); pos= int10_to_str((long) seed2, pos, 10);
protocol->store(buf1, (uint) (pos-buf1)); protocol->store(buf1, (uint) (pos-buf1));
} }
#endif // !MYSQL_CLIENT #endif
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
@ -1899,8 +1872,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 #if defined(HAVE_REPLICATION) && !defined(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)
{ {
thd->rand.seed1= (ulong) seed1; thd->rand.seed1= (ulong) seed1;
@ -1908,8 +1880,7 @@ int Rand_log_event::exec_event(struct st_relay_log_info* rli)
rli->inc_pending(get_event_len()); rli->inc_pending(get_event_len());
return 0; return 0;
} }
#endif // !MYSQL_CLIENT #endif
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
@ -1925,7 +1896,7 @@ 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 #ifdef HAVE_REPLICATION
#ifndef MYSQL_CLIENT #ifndef MYSQL_CLIENT
void Slave_log_event::pack_info(Protocol *protocol) void Slave_log_event::pack_info(Protocol *protocol)
@ -2150,7 +2121,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 */ #endif /* HAVE_REPLICATION */
/***************************************************************************** /*****************************************************************************
@ -2276,8 +2247,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 #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
#ifndef MYSQL_CLIENT
void Create_file_log_event::pack_info(Protocol *protocol) void Create_file_log_event::pack_info(Protocol *protocol)
{ {
char buf1[256],buf[22], *end; char buf1[256],buf[22], *end;
@ -2295,16 +2265,14 @@ void Create_file_log_event::pack_info(Protocol *protocol)
tmp.append(buf, (uint32) (end-buf)); tmp.append(buf, (uint32) (end-buf));
protocol->store((char*) tmp.ptr(), tmp.length()); protocol->store((char*) tmp.ptr(), tmp.length());
} }
#endif // !MYSQL_CLIENT #endif
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
Create_file_log_event::exec_event() Create_file_log_event::exec_event()
****************************************************************************/ ****************************************************************************/
#ifndef EMBEDDED_LIBRARY #if defined(HAVE_REPLICATION) && !defined(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)
{ {
char fname_buf[FN_REFLEN+10]; char fname_buf[FN_REFLEN+10];
@ -2361,8 +2329,7 @@ err:
my_close(fd, MYF(0)); my_close(fd, MYF(0));
return error ? 1 : Log_event::exec_event(rli); return error ? 1 : Log_event::exec_event(rli);
} }
#endif // !MYSQL_CLIENT #endif
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
@ -2439,8 +2406,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 #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
#ifndef MYSQL_CLIENT
void Append_block_log_event::pack_info(Protocol *protocol) void Append_block_log_event::pack_info(Protocol *protocol)
{ {
char buf[256]; char buf[256];
@ -2450,16 +2416,14 @@ void Append_block_log_event::pack_info(Protocol *protocol)
block_len)); block_len));
protocol->store(buf, (int32) length); protocol->store(buf, (int32) length);
} }
#endif // !MYSQL_CLIENT #endif
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
Append_block_log_event::exec_event() Append_block_log_event::exec_event()
****************************************************************************/ ****************************************************************************/
#ifndef EMBEDDED_LIBRARY #if defined( HAVE_REPLICATION) && !defined(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)
{ {
char fname[FN_REFLEN+10]; char fname[FN_REFLEN+10];
@ -2487,8 +2451,7 @@ err:
my_close(fd, MYF(0)); my_close(fd, MYF(0));
return error ? error : Log_event::exec_event(rli); return error ? error : Log_event::exec_event(rli);
} }
#endif // !MYSQL_CLIENT #endif
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
@ -2558,8 +2521,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 #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
#ifndef MYSQL_CLIENT
void Delete_file_log_event::pack_info(Protocol *protocol) void Delete_file_log_event::pack_info(Protocol *protocol)
{ {
char buf[64]; char buf[64];
@ -2567,16 +2529,14 @@ void Delete_file_log_event::pack_info(Protocol *protocol)
length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id)); length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id));
protocol->store(buf, (int32) length); protocol->store(buf, (int32) length);
} }
#endif // !MYSQL_CLIENT #endif
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
Delete_file_log_event::exec_event() Delete_file_log_event::exec_event()
****************************************************************************/ ****************************************************************************/
#ifndef EMBEDDED_LIBRARY #if defined(HAVE_REPLICATION) && !defined(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)
{ {
char fname[FN_REFLEN+10]; char fname[FN_REFLEN+10];
@ -2589,8 +2549,7 @@ int Delete_file_log_event::exec_event(struct st_relay_log_info* rli)
mysql_bin_log.write(this); mysql_bin_log.write(this);
return Log_event::exec_event(rli); return Log_event::exec_event(rli);
} }
#endif // !MYSQL_CLIENT #endif
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
@ -2661,8 +2620,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 #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
#ifndef MYSQL_CLIENT
void Execute_load_log_event::pack_info(Protocol *protocol) void Execute_load_log_event::pack_info(Protocol *protocol)
{ {
char buf[64]; char buf[64];
@ -2670,16 +2628,13 @@ void Execute_load_log_event::pack_info(Protocol *protocol)
length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id)); length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id));
protocol->store(buf, (int32) length); protocol->store(buf, (int32) length);
} }
#endif // !MYSQL_CLIENT
#endif /* EMBEDDED_LIBRARY */
/***************************************************************************** /*****************************************************************************
Execute_load_log_event::exec_event() Execute_load_log_event::exec_event()
****************************************************************************/ ****************************************************************************/
#ifndef EMBEDDED_LIBRARY
#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)
{ {
char fname[FN_REFLEN+10]; char fname[FN_REFLEN+10];
@ -2738,8 +2693,8 @@ err:
} }
return error ? error : Log_event::exec_event(rli); return error ? error : Log_event::exec_event(rli);
} }
#endif // !MYSQL_CLIENT
#endif /* EMBEDDED_LIBRARY */ #endif
/***************************************************************************** /*****************************************************************************

View File

@ -268,11 +268,11 @@ public:
pthread_mutex_t* log_lock); pthread_mutex_t* log_lock);
void set_log_pos(MYSQL_LOG* log); void set_log_pos(MYSQL_LOG* log);
static void init_show_field_list(List<Item>* field_list); static void init_show_field_list(List<Item>* field_list);
#ifndef EMBEDDED_LIBRARY #ifdef HAVE_REPLICATION
int net_send(Protocol *protocol, const char* log_name, my_off_t pos); int net_send(Protocol *protocol, const char* log_name, my_off_t pos);
virtual void pack_info(Protocol *protocol); virtual void pack_info(Protocol *protocol);
virtual int exec_event(struct st_relay_log_info* rli); virtual int exec_event(struct st_relay_log_info* rli);
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */
virtual const char* get_db() virtual const char* get_db()
{ {
return thd ? thd->db : 0; return thd ? thd->db : 0;
@ -357,10 +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 #ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol); void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli); int exec_event(struct st_relay_log_info* rli);
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */
#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
@ -387,7 +387,7 @@ public:
} }
}; };
#ifndef EMBEDDED_LIBRARY #ifdef HAVE_REPLICATION
/***************************************************************************** /*****************************************************************************
@ -409,10 +409,8 @@ 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(Protocol* protocol); void pack_info(Protocol* protocol);
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
@ -425,7 +423,7 @@ public:
int write_data(IO_CACHE* file ); int write_data(IO_CACHE* file );
}; };
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */
/***************************************************************************** /*****************************************************************************
@ -464,14 +462,14 @@ public:
bool using_trans); bool using_trans);
void set_fields(List<Item> &fields_arg); void set_fields(List<Item> &fields_arg);
const char* get_db() { return db; } const char* get_db() { return db; }
#ifndef EMBEDDED_LIBRARY #ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol); void pack_info(Protocol* protocol);
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 */ #endif /* HAVE_REPLICATION */
#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
@ -518,10 +516,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 #ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol); void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli); int exec_event(struct st_relay_log_info* rli);
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */
#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
@ -555,10 +553,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 #ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol); void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli); int exec_event(struct st_relay_log_info* rli);
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */
#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
@ -589,10 +587,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 #ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol); void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli); int exec_event(struct st_relay_log_info* rli);
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */
#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
@ -611,7 +609,7 @@ class Rand_log_event: public Log_event
Stop Log Event class Stop Log Event class
****************************************************************************/ ****************************************************************************/
#ifndef EMBEDDED_LIBRARY #ifdef HAVE_REPLICATION
class Stop_log_event: public Log_event class Stop_log_event: public Log_event
{ {
@ -619,9 +617,7 @@ 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
@ -634,7 +630,7 @@ public:
bool is_valid() { return 1; } bool is_valid() { return 1; }
}; };
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */
/***************************************************************************** /*****************************************************************************
@ -659,10 +655,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 #ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol); void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli); int exec_event(struct st_relay_log_info* rli);
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */
#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
@ -708,10 +704,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 #ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol); void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli); int exec_event(struct st_relay_log_info* rli);
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */
#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
@ -760,10 +756,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 #ifdef HAVE_REPLICATION
int exec_event(struct st_relay_log_info* rli); int exec_event(struct st_relay_log_info* rli);
void pack_info(Protocol* protocol); void pack_info(Protocol* protocol);
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */
#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
@ -788,10 +784,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 #ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol); void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli); int exec_event(struct st_relay_log_info* rli);
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */
#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
@ -816,10 +812,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 #ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol); void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli); int exec_event(struct st_relay_log_info* rli);
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */
#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

View File

@ -30,10 +30,9 @@
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_REPLICATION
#ifdef HAVE_AIOWAIT #ifdef HAVE_AIOWAIT
#include <mysys_err.h> #include <mysys_err.h>
#include <errno.h> #include <errno.h>
@ -83,6 +82,6 @@ int _my_b_net_read(register IO_CACHE *info, byte *Buffer,
} }
} /* extern "C" */ } /* extern "C" */
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */

View File

@ -22,8 +22,9 @@
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>
#ifdef HAVE_EXTERNAL_CLIENT
/* 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)
#include <my_pthread.h> /* because of signal() */ #include <my_pthread.h> /* because of signal() */
@ -1473,4 +1474,4 @@ MYSQL_RES *mc_mysql_store_result(MYSQL *mysql)
DBUG_RETURN(result); /* Data fetched */ DBUG_RETURN(result); /* Data fetched */
} }
#endif /*EMBEDDED_LIBRARY*/ #endif /* HAVE_EXTERNAL_CLIENT */

View File

@ -879,14 +879,6 @@ inline void mark_as_null_row(TABLE *table)
bfill(table->null_flags,table->null_bytes,255); bfill(table->null_flags,table->null_bytes,255);
} }
#ifdef EMBEDDED_LIBRARY
int embedded_send_row(THD *thd, int n_fields, const char *data, int data_len);
#define SEND_ROW(thd, n_fields, data, data_len)\
embedded_send_row(thd, n_fields, data, data_len)
#else
#define SEND_ROW(thd, n_fields, data, data_len)\
my_net_write(&thd->net, data, data_len)
#endif
compare_func_creator comp_eq_creator(bool invert); compare_func_creator comp_eq_creator(bool invert);
compare_func_creator comp_ge_creator(bool invert); compare_func_creator comp_ge_creator(bool invert);
compare_func_creator comp_gt_creator(bool invert); compare_func_creator comp_gt_creator(bool invert);

View File

@ -875,7 +875,7 @@ 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 #ifdef HAVE_REPLICATION
if (use_slave_mask) if (use_slave_mask)
bitmap_free(&slave_error_mask); bitmap_free(&slave_error_mask);
#endif #endif
@ -900,14 +900,14 @@ 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 #ifdef HAVE_REPLICATION
my_free(slave_load_tmpdir,MYF(MY_ALLOW_ZERO_PTR)); my_free(slave_load_tmpdir,MYF(MY_ALLOW_ZERO_PTR));
#endif #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 #ifdef HAVE_REPLICATION
end_slave_list(); end_slave_list();
#endif #endif
#ifdef USE_REGEX #ifdef USE_REGEX
@ -1948,7 +1948,7 @@ 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 #ifdef HAVE_REPLICATION
(void) pthread_mutex_init(&LOCK_rpl_status, MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_rpl_status, MY_MUTEX_INIT_FAST);
#endif #endif
(void) pthread_mutex_init(&LOCK_active_mi, MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_active_mi, MY_MUTEX_INIT_FAST);
@ -1959,7 +1959,7 @@ 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 #ifdef HAVE_REPLICATION
(void) pthread_cond_init(&COND_rpl_status, NULL); (void) pthread_cond_init(&COND_rpl_status, NULL);
#endif #endif
/* Parameter for threads created for connections */ /* Parameter for threads created for connections */
@ -2008,7 +2008,7 @@ 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 #ifdef HAVE_REPLICATION
init_slave_list(); init_slave_list();
#endif #endif
/* Setup log files */ /* Setup log files */
@ -2269,6 +2269,7 @@ The server will not act as a slave.");
if (opt_bootstrap) if (opt_bootstrap)
{ {
printf("###stdin as bootstrap\n");
int error=bootstrap(stdin); int error=bootstrap(stdin);
end_thr_alarm(); // Don't allow alarms end_thr_alarm(); // Don't allow alarms
unireg_abort(error ? 1 : 0); unireg_abort(error ? 1 : 0);
@ -2338,6 +2339,7 @@ The server will not act as a slave.");
#endif /* EMBEDDED_LIBRARY */ #endif /* EMBEDDED_LIBRARY */
/**************************************************************************** /****************************************************************************
Main and thread entry function for Win32 Main and thread entry function for Win32
(all this is needed only to run mysqld as a service on WinNT) (all this is needed only to run mysqld as a service on WinNT)
@ -3498,7 +3500,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 #ifdef HAVE_REPLICATION
{"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,
@ -3517,7 +3519,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 */ #endif /* HAVE_REPLICATION */
{"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},
@ -3660,7 +3662,7 @@ 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 #ifdef HAVE_REPLICATION
{"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},
@ -3995,7 +3997,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 #ifdef HAVE_REPLICATION
{"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,
@ -4354,7 +4356,7 @@ 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 #ifdef HAVE_REPLICATION
case OPT_SLAVE_SKIP_ERRORS: case OPT_SLAVE_SKIP_ERRORS:
init_slave_skip_errors(argument); init_slave_skip_errors(argument);
break; break;
@ -4398,7 +4400,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 #ifdef HAVE_REPLICATION
case (int) OPT_INIT_RPL_ROLE: case (int) OPT_INIT_RPL_ROLE:
{ {
int role; int role;
@ -4523,7 +4525,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_reckless_slave = 1; opt_reckless_slave = 1;
init_slave_skip_errors("all"); init_slave_skip_errors("all");
break; break;
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */
case (int) OPT_SLOW_QUERY_LOG: case (int) OPT_SLOW_QUERY_LOG:
opt_slow_log=1; opt_slow_log=1;
break; break;
@ -4900,7 +4902,7 @@ 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 #ifdef HAVE_REPLICATION
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))))

View File

@ -2162,28 +2162,18 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree,
tmp=1; // Max one record tmp=1; // Max one record
else else
{ {
if(tmp_min_flag & GEOM_FLAG) tmp=param->table->file->
{ records_in_range((int) keynr,
tmp=param->table->file-> (byte*) (!min_key_length ? NullS :
records_in_range((int) keynr,(byte*)(param->min_key + 1), param->min_key),
min_key_length, (ha_rkey_function)(tmp_min_flag ^ GEOM_FLAG), min_key_length,
(byte *)NullS,0,HA_READ_KEY_EXACT); tmp_min_flag & NEAR_MIN ?
} HA_READ_AFTER_KEY : HA_READ_KEY_EXACT,
else (byte*) (!max_key_length ? NullS :
{ param->max_key),
tmp=param->table->file-> max_key_length,
records_in_range((int) keynr, (tmp_max_flag & NEAR_MAX ?
(byte*) (!min_key_length ? NullS : HA_READ_BEFORE_KEY : HA_READ_AFTER_KEY));
param->min_key),
min_key_length,
tmp_min_flag & NEAR_MIN ?
HA_READ_AFTER_KEY : HA_READ_KEY_EXACT,
(byte*) (!max_key_length ? NullS :
param->max_key),
max_key_length,
(tmp_max_flag & NEAR_MAX ?
HA_READ_BEFORE_KEY : HA_READ_AFTER_KEY));
}
} }
end: end:
if (tmp == HA_POS_ERROR) // Impossible range if (tmp == HA_POS_ERROR) // Impossible range

View File

@ -27,6 +27,23 @@
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#ifndef EMBEDDED_LIBRARY
bool Protocol::net_store_data(const char *from, uint length)
{
ulong packet_length=packet->length();
if (packet_length+5+length > packet->alloced_length() &&
packet->realloc(packet_length+5+length))
return 1;
char *to=(char*) net_store_length((char*) packet->ptr()+packet_length,
(ulonglong) length);
memcpy(to,from,length);
packet->length((uint) (to+length-packet->ptr()));
return 0;
}
#endif
/* Send a error string to client */ /* Send a error string to client */
void send_error(THD *thd, uint sql_errno, const char *err) void send_error(THD *thd, uint sql_errno, const char *err)
@ -402,23 +419,6 @@ char *net_store_length(char *pkg, uint length)
} }
/*
Used internally for storing strings in packet
*/
static bool net_store_data(String *packet, const char *from, uint length)
{
ulong packet_length=packet->length();
if (packet_length+5+length > packet->alloced_length() &&
packet->realloc(packet_length+5+length))
return 1;
char *to=(char*) net_store_length((char*) packet->ptr()+packet_length,
(ulonglong) length);
memcpy(to,from,length);
packet->length((uint) (to+length-packet->ptr()));
return 0;
}
/**************************************************************************** /****************************************************************************
Functions used by the protocol functions (like send_ok) to store strings Functions used by the protocol functions (like send_ok) to store strings
and numbers in the header result packet. and numbers in the header result packet.
@ -574,15 +574,16 @@ err:
DBUG_RETURN(1); /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */
} }
#endif
bool Protocol::write() bool Protocol::write()
{ {
DBUG_ENTER("Protocol::write"); DBUG_ENTER("Protocol::write");
DBUG_RETURN(SEND_ROW(thd, n_fields, packet->ptr(), packet->length())); DBUG_RETURN(my_net_write(&thd->net, packet->ptr(), packet->length()));
} }
#endif /* EMBEDDED_LIBRARY */
/* /*
Send \0 end terminated string Send \0 end terminated string
@ -640,6 +641,7 @@ bool Protocol::store(I_List<i_string>* str_list)
****************************************************************************/ ****************************************************************************/
#ifndef EMBEDDED_LIBRARY
void Protocol_simple::prepare_for_resend() void Protocol_simple::prepare_for_resend()
{ {
packet->length(0); packet->length(0);
@ -647,6 +649,7 @@ void Protocol_simple::prepare_for_resend()
field_pos= 0; field_pos= 0;
#endif #endif
} }
#endif
bool Protocol_simple::store_null() bool Protocol_simple::store_null()
{ {
@ -669,7 +672,7 @@ bool Protocol_simple::store(const char *from, uint length)
#endif #endif
if (convert) if (convert)
return convert->store(packet, from, length); return convert->store(packet, from, length);
return net_store_data(packet, from, length); return net_store_data(from, length);
} }
@ -679,7 +682,7 @@ bool Protocol_simple::store_tiny(longlong from)
DBUG_ASSERT(field_types == 0 || field_types[field_pos++] == MYSQL_TYPE_TINY); DBUG_ASSERT(field_types == 0 || field_types[field_pos++] == MYSQL_TYPE_TINY);
#endif #endif
char buff[20]; char buff[20];
return net_store_data(packet,(char*) buff, return net_store_data((char*) buff,
(uint) (int10_to_str((int) from,buff, -10)-buff)); (uint) (int10_to_str((int) from,buff, -10)-buff));
} }
@ -690,7 +693,7 @@ bool Protocol_simple::store_short(longlong from)
field_types[field_pos++] == MYSQL_TYPE_SHORT); field_types[field_pos++] == MYSQL_TYPE_SHORT);
#endif #endif
char buff[20]; char buff[20];
return net_store_data(packet,(char*) buff, return net_store_data((char*) buff,
(uint) (int10_to_str((int) from,buff, -10)-buff)); (uint) (int10_to_str((int) from,buff, -10)-buff));
} }
@ -700,7 +703,7 @@ bool Protocol_simple::store_long(longlong from)
DBUG_ASSERT(field_types == 0 || field_types[field_pos++] == MYSQL_TYPE_LONG); DBUG_ASSERT(field_types == 0 || field_types[field_pos++] == MYSQL_TYPE_LONG);
#endif #endif
char buff[20]; char buff[20];
return net_store_data(packet,(char*) buff, return net_store_data((char*) buff,
(uint) (int10_to_str((int) from,buff, -10)-buff)); (uint) (int10_to_str((int) from,buff, -10)-buff));
} }
@ -712,7 +715,7 @@ bool Protocol_simple::store_longlong(longlong from, bool unsigned_flag)
field_types[field_pos++] == MYSQL_TYPE_LONGLONG); field_types[field_pos++] == MYSQL_TYPE_LONGLONG);
#endif #endif
char buff[22]; char buff[22];
return net_store_data(packet,(char*) buff, return net_store_data((char*) buff,
(uint) (longlong10_to_str(from,buff, (uint) (longlong10_to_str(from,buff,
unsigned_flag ? 10 : -10)- unsigned_flag ? 10 : -10)-
buff)); buff));
@ -726,7 +729,7 @@ bool Protocol_simple::store(float from, uint32 decimals, String *buffer)
field_types[field_pos++] == MYSQL_TYPE_FLOAT); field_types[field_pos++] == MYSQL_TYPE_FLOAT);
#endif #endif
buffer->set((double) from, decimals, thd->variables.thd_charset); buffer->set((double) from, decimals, thd->variables.thd_charset);
return net_store_data(packet,(char*) buffer->ptr(), buffer->length()); return net_store_data((char*) buffer->ptr(), buffer->length());
} }
bool Protocol_simple::store(double from, uint32 decimals, String *buffer) bool Protocol_simple::store(double from, uint32 decimals, String *buffer)
@ -736,7 +739,7 @@ bool Protocol_simple::store(double from, uint32 decimals, String *buffer)
field_types[field_pos++] == MYSQL_TYPE_DOUBLE); field_types[field_pos++] == MYSQL_TYPE_DOUBLE);
#endif #endif
buffer->set(from, decimals, thd->variables.thd_charset); buffer->set(from, decimals, thd->variables.thd_charset);
return net_store_data(packet,(char*) buffer->ptr(), buffer->length()); return net_store_data((char*) buffer->ptr(), buffer->length());
} }
@ -752,7 +755,7 @@ bool Protocol_simple::store(Field *field)
field->val_str(&tmp,&tmp); field->val_str(&tmp,&tmp);
if (convert) if (convert)
return convert->store(packet, tmp.ptr(), tmp.length()); return convert->store(packet, tmp.ptr(), tmp.length());
return net_store_data(packet, tmp.ptr(), tmp.length()); return net_store_data(tmp.ptr(), tmp.length());
} }
@ -773,7 +776,7 @@ bool Protocol_simple::store(TIME *tm)
(int) tm->hour, (int) tm->hour,
(int) tm->minute, (int) tm->minute,
(int) tm->second)); (int) tm->second));
return net_store_data(packet, (char*) buff, length); return net_store_data((char*) buff, length);
} }
@ -789,7 +792,7 @@ bool Protocol_simple::store_date(TIME *tm)
(int) tm->year, (int) tm->year,
(int) tm->month, (int) tm->month,
(int) tm->day)); (int) tm->day));
return net_store_data(packet, (char*) buff, length); return net_store_data((char*) buff, length);
} }
@ -806,7 +809,7 @@ bool Protocol_simple::store_time(TIME *tm)
(long) tm->day*3600L+(long) tm->hour, (long) tm->day*3600L+(long) tm->hour,
(int) tm->minute, (int) tm->minute,
(int) tm->second)); (int) tm->second));
return net_store_data(packet, (char*) buff, length); return net_store_data((char*) buff, length);
} }
@ -816,8 +819,7 @@ bool Protocol_simple::store_time(TIME *tm)
bool Protocol_prep::prepare_for_send(List<Item> *item_list) bool Protocol_prep::prepare_for_send(List<Item> *item_list)
{ {
field_count=item_list->elements; Protocol::prepare_for_send(item_list);
set_nfields(item_list->elements);
bit_fields= (field_count+3)/8; bit_fields= (field_count+3)/8;
if (packet->alloc(bit_fields)) if (packet->alloc(bit_fields))
return 1; return 1;
@ -846,7 +848,7 @@ bool Protocol_prep::store(const char *from,uint length)
field_pos++; field_pos++;
if (convert) if (convert)
return convert->store(packet, from, length); return convert->store(packet, from, length);
return net_store_data(packet, from, length); return net_store_data(from, length);
} }

View File

@ -33,8 +33,11 @@ protected:
#ifndef DEBUG_OFF #ifndef DEBUG_OFF
enum enum_field_types *field_types; enum enum_field_types *field_types;
#endif #endif
uint field_count;
bool net_store_data(const char *from, uint length);
#ifdef EMBEDDED_LIBRARY #ifdef EMBEDDED_LIBRARY
uint n_fields; char **next_field;
MEM_ROOT *alloc;
#endif #endif
public: public:
@ -56,13 +59,11 @@ public:
inline bool store(ulonglong from) inline bool store(ulonglong from)
{ return store_longlong((longlong) from, 1); } { return store_longlong((longlong) from, 1); }
#ifdef EMBEDDED_LIBRARY virtual bool prepare_for_send(List<Item> *item_list)
inline void set_nfields(uint fields_count) { n_fields= fields_count; } {
#else field_count=item_list->elements;
inline void set_nfields(uint fields_count) {} return 0;
#endif }
virtual bool prepare_for_send(List<Item> *item_list) { return 0;}
virtual void prepare_for_resend()=0; virtual void prepare_for_resend()=0;
virtual bool store_null()=0; virtual bool store_null()=0;
@ -106,7 +107,7 @@ public:
class Protocol_prep :public Protocol class Protocol_prep :public Protocol
{ {
private: private:
uint field_count, bit_fields; uint bit_fields;
public: public:
Protocol_prep() {} Protocol_prep() {}
Protocol_prep(THD *thd) :Protocol(thd) {} Protocol_prep(THD *thd) :Protocol(thd) {}
@ -126,7 +127,6 @@ public:
virtual bool store(Field *field); virtual bool store(Field *field);
}; };
void send_warning(THD *thd, uint sql_errno, const char *err=0); void send_warning(THD *thd, uint sql_errno, const char *err=0);
void net_printf(THD *thd,uint sql_errno, ...); void net_printf(THD *thd,uint sql_errno, ...);
void send_ok(THD *thd, ha_rows affected_rows=0L, ulonglong id=0L, void send_ok(THD *thd, ha_rows affected_rows=0L, ulonglong id=0L,

View File

@ -16,9 +16,9 @@
// 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"
#ifdef HAVE_REPLICATION
#include "repl_failsafe.h" #include "repl_failsafe.h"
#include "sql_repl.h" #include "sql_repl.h"
#include "slave.h" #include "slave.h"
@ -896,5 +896,5 @@ err:
return error; return error;
} }
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */

View File

@ -1,4 +1,4 @@
#ifndef EMBEDDED_LIBRARY #ifdef HAVE_REPLICATION
#ifndef REPL_FAILSAFE_H #ifndef REPL_FAILSAFE_H
#define REPL_FAILSAFE_H #define REPL_FAILSAFE_H
@ -36,4 +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 */ #endif /* HAVE_REPLICATION */

View File

@ -206,7 +206,7 @@ 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 #ifdef HAVE_REPLICATION
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 #endif
@ -299,7 +299,7 @@ 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 #ifdef HAVE_REPLICATION
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 #endif
static sys_var_rand_seed1 sys_rand_seed1("rand_seed1"); static sys_var_rand_seed1 sys_rand_seed1("rand_seed1");
@ -383,7 +383,7 @@ 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 #ifdef HAVE_REPLICATION
&sys_slave_compressed_protocol, &sys_slave_compressed_protocol,
&sys_slave_net_timeout, &sys_slave_net_timeout,
&sys_slave_skip_counter, &sys_slave_skip_counter,
@ -480,7 +480,7 @@ 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 #ifdef HAVE_REPLICATION
{"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_MY_BOOL}, {"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_MY_BOOL},
#endif #endif
{"log_slow_queries", (char*) &opt_slow_log, SHOW_BOOL}, {"log_slow_queries", (char*) &opt_slow_log, SHOW_BOOL},
@ -534,7 +534,7 @@ 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 #ifdef HAVE_REPLICATION
{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 #endif
{"skip_external_locking", (char*) &my_disable_locking, SHOW_MY_BOOL}, {"skip_external_locking", (char*) &my_disable_locking, SHOW_MY_BOOL},
@ -636,7 +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 #ifdef HAVE_REPLICATION
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)
@ -655,14 +655,17 @@ 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 */ #else /* HAVE_REPLICATION */
static void fix_net_read_timeout(THD *thd __attribute__(unused), enum_var_type type __attribute__(unused)) 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_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)) static void fix_net_retry_count(THD *thd __attribute__(unused),
enum_var_type type __attribute__(unused))
{} {}
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */
static void fix_query_cache_size(THD *thd, enum_var_type type) static void fix_query_cache_size(THD *thd, enum_var_type type)
@ -1079,7 +1082,7 @@ byte *sys_var_insert_id::value_ptr(THD *thd, enum_var_type type)
} }
#ifndef EMBEDDED_LIBRARY #ifdef HAVE_REPLICATION
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;
@ -1115,7 +1118,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 */ #endif /* HAVE_REPLICATION */
bool sys_var_rand_seed1::update(THD *thd, set_var *var) bool sys_var_rand_seed1::update(THD *thd, set_var *var)
{ {

View File

@ -14,8 +14,10 @@
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"
#ifdef HAVE_REPLICATION
#include <mysql.h> #include <mysql.h>
#include <myisam.h> #include <myisam.h>
#include "mini_client.h" #include "mini_client.h"
@ -26,6 +28,7 @@
#include <my_dir.h> #include <my_dir.h>
#include <assert.h> #include <assert.h>
bool use_slave_mask = 0; bool use_slave_mask = 0;
MY_BITMAP slave_error_mask; MY_BITMAP slave_error_mask;
@ -3182,4 +3185,4 @@ 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 */ #endif /* HAVE_REPLICATION */

View File

@ -1,4 +1,4 @@
#ifndef EMBEDDED_LIBRARY #ifdef HAVE_REPLICATION
#ifndef SLAVE_H #ifndef SLAVE_H
#define SLAVE_H #define SLAVE_H
@ -466,4 +466,4 @@ extern I_List<THD> threads;
#else #else
#define SLAVE_IO 1 #define SLAVE_IO 1
#define SLAVE_SQL 2 #define SLAVE_SQL 2
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */

View File

@ -842,6 +842,7 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
TRANS_MEM_ROOT_BLOCK_SIZE, TRANS_MEM_ROOT_PREALLOC); TRANS_MEM_ROOT_BLOCK_SIZE, TRANS_MEM_ROOT_PREALLOC);
while (fgets(buff, thd->net.max_packet, file)) while (fgets(buff, thd->net.max_packet, file))
{ {
printf("%s", buff);
uint length=(uint) strlen(buff); uint length=(uint) strlen(buff);
while (length && (my_isspace(system_charset_info, buff[length-1]) || while (length && (my_isspace(system_charset_info, buff[length-1]) ||
buff[length-1] == ';')) buff[length-1] == ';'))
@ -3469,7 +3470,8 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
if (new_field->length >= MAX_FIELD_WIDTH || if (new_field->length >= MAX_FIELD_WIDTH ||
(!new_field->length && !(new_field->flags & BLOB_FLAG) && (!new_field->length && !(new_field->flags & BLOB_FLAG) &&
type != FIELD_TYPE_STRING && type != FIELD_TYPE_VAR_STRING && type != FIELD_TYPE_GEOMETRY)) type != FIELD_TYPE_STRING &&
type != FIELD_TYPE_VAR_STRING && type != FIELD_TYPE_GEOMETRY))
{ {
net_printf(thd,ER_TOO_BIG_FIELDLENGTH,field_name, net_printf(thd,ER_TOO_BIG_FIELDLENGTH,field_name,
MAX_FIELD_WIDTH-1); /* purecov: inspected */ MAX_FIELD_WIDTH-1); /* purecov: inspected */

View File

@ -141,6 +141,8 @@ static bool send_prep_stmt(PREP_STMT *stmt, uint columns)
int2store(buff+4, columns); int2store(buff+4, columns);
int2store(buff+6, stmt->param_count); int2store(buff+6, stmt->param_count);
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
/* This should be fixed to work with prepared statements
*/
return (my_net_write(net, buff, sizeof(buff)) || net_flush(net)); return (my_net_write(net, buff, sizeof(buff)) || net_flush(net));
#else #else
return true; return true;

View File

@ -16,9 +16,9 @@
// 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"
#ifdef HAVE_REPLICATION
#include "sql_repl.h" #include "sql_repl.h"
#include "sql_acl.h" #include "sql_acl.h"
#include "log_event.h" #include "log_event.h"
@ -1156,6 +1156,6 @@ int log_loaded_block(IO_CACHE* file)
return 0; return 0;
} }
#endif #endif /* HAVE_REPLICATION */

View File

@ -1,4 +1,4 @@
#ifndef EMBEDDED_LIBRARY #ifdef HAVE_REPLICATION
#include "slave.h" #include "slave.h"
typedef struct st_slave_info typedef struct st_slave_info
@ -55,5 +55,5 @@ typedef struct st_load_file_info
int log_loaded_block(IO_CACHE* file); int log_loaded_block(IO_CACHE* file);
#endif /* EMBEDDED_LIBRARY */ #endif /* HAVE_REPLICATION */

View File

@ -52,6 +52,7 @@ extern struct st_VioSSLAcceptorFd * ssl_acceptor_fd;
** Send list of databases ** Send list of databases
** A database is a directory in the mysql_data_home directory ** A database is a directory in the mysql_data_home directory
****************************************************************************/ ****************************************************************************/
int int
mysqld_show_dbs(THD *thd,const char *wild) mysqld_show_dbs(THD *thd,const char *wild)
{ {
@ -648,6 +649,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
/*************************************************************************** /***************************************************************************
** List all columns in a table_list->real_name ** List all columns in a table_list->real_name
***************************************************************************/ ***************************************************************************/
int int
mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
bool verbose) bool verbose)
@ -1240,7 +1242,6 @@ 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;
@ -1272,8 +1273,13 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
THD *tmp; THD *tmp;
while ((tmp=it++)) while ((tmp=it++))
{ {
#ifndef EMBEDDED_LIBRARY
if ((tmp->net.vio || tmp->system_thread) && if ((tmp->net.vio || tmp->system_thread) &&
(!user || (tmp->user && !strcmp(tmp->user,user)))) (!user || (tmp->user && !strcmp(tmp->user,user))))
#else
if (tmp->system_thread &&
(!user || (tmp->user && !strcmp(tmp->user,user))))
#endif
{ {
thread_info *thd_info=new thread_info; thread_info *thd_info=new thread_info;
@ -1291,6 +1297,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
if (tmp->mysys_var) if (tmp->mysys_var)
pthread_mutex_lock(&tmp->mysys_var->mutex); pthread_mutex_lock(&tmp->mysys_var->mutex);
thd_info->proc_info= (char*) (tmp->killed ? "Killed" : 0); thd_info->proc_info= (char*) (tmp->killed ? "Killed" : 0);
#ifndef EMBEDDED_LIBRARY
thd_info->state_info= (char*) (tmp->locked ? "Locked" : thd_info->state_info= (char*) (tmp->locked ? "Locked" :
tmp->net.reading_or_writing ? tmp->net.reading_or_writing ?
(tmp->net.reading_or_writing == 2 ? (tmp->net.reading_or_writing == 2 ?
@ -1301,6 +1308,9 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
tmp->mysys_var && tmp->mysys_var &&
tmp->mysys_var->current_cond ? tmp->mysys_var->current_cond ?
"Waiting on cond" : NullS); "Waiting on cond" : NullS);
#else
thd_info->state_info= (char*)"Writing to net";
#endif
if (tmp->mysys_var) if (tmp->mysys_var)
pthread_mutex_unlock(&tmp->mysys_var->mutex); pthread_mutex_unlock(&tmp->mysys_var->mutex);
@ -1353,12 +1363,6 @@ 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
@ -1666,6 +1670,8 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
case SHOW_UNDEF: // Show never happen case SHOW_UNDEF: // Show never happen
case SHOW_SYS: case SHOW_SYS:
break; // Return empty string break; // Return empty string
default:
break;
} }
if (protocol->store(pos, (uint32) (end - pos)) || if (protocol->store(pos, (uint32) (end - pos)) ||
protocol->write()) protocol->write())

View File

@ -1032,7 +1032,6 @@ static int send_check_errmsg(THD *thd, TABLE_LIST* table,
{ {
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
protocol->set_nfields(4);
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(table->alias); protocol->store(table->alias);
protocol->store((char*) operator_name); protocol->store((char*) operator_name);