diff options
author | unknown <hf@deer.mysql.r18.ru> | 2003-01-15 12:11:44 +0400 |
---|---|---|
committer | unknown <hf@deer.mysql.r18.ru> | 2003-01-15 12:11:44 +0400 |
commit | 09b79b65f225e7e7f66077f95b00e095cf454c3a (patch) | |
tree | 5a4ad419f88f794ce2bdff28466653d3de9f4156 /libmysqld | |
parent | 1bc932384b2043a326f2ce71a4e71ac2aba47580 (diff) | |
download | mariadb-git-09b79b65f225e7e7f66077f95b00e095cf454c3a.tar.gz |
SCRUM
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
Diffstat (limited to 'libmysqld')
-rw-r--r-- | libmysqld/lib_sql.cc | 73 |
1 files changed, 63 insertions, 10 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 78025cb2b65..31fff815373 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -424,21 +424,20 @@ bool Protocol::send_fields(List<Item> *list, uint flag) { List_iterator_fast<Item> it(*list); Item *item; - MEM_ROOT *alloc; MYSQL_FIELD *field, *client_field; MYSQL *mysql= thd->mysql; - set_nfields(list->elements); + DBUG_ENTER("send_fields"); 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)))) goto err; mysql->result->lengths= (ulong *)(mysql->result + 1); - mysql->field_count=n_fields; + mysql->field_count=field_count; 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) 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 */ mysql->result->data->alloc.min_malloc=sizeof(MYSQL_ROWS); mysql->result->data->rows=0; - mysql->result->data->fields=n_fields; - mysql->result->field_count=n_fields; + mysql->result->data->fields=field_count; + mysql->result->field_count=field_count; mysql->result->data->prev_ptr= &mysql->result->data->data; mysql->result->field_alloc= mysql->field_alloc; mysql->result->current_field=0; mysql->result->current_row=0; - return 0; + DBUG_RETURN(prepare_for_send(list)); err: 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 */ static ulong net_field_length(uchar **packet) @@ -525,6 +531,7 @@ net_field_length(uchar **packet) return (ulong) uint4korr(pos+1); } + bool select_send::send_data(List<Item> &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) { 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); } +#endif uint STDCALL mysql_warning_count(MYSQL *mysql) { 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; +} |