summaryrefslogtreecommitdiff
path: root/sql/ha_berkeley.cc
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2002-12-11 09:17:51 +0200
committerunknown <monty@mashka.mysql.fi>2002-12-11 09:17:51 +0200
commitf918dfc8b2e449fc55c6f8466bc1a923f47e5a44 (patch)
tree2f31768712119785f5bf2520a2d7e6dd4dfe37b5 /sql/ha_berkeley.cc
parentb392b78400abf319550eedd636faa9eae66b9510 (diff)
downloadmariadb-git-f918dfc8b2e449fc55c6f8466bc1a923f47e5a44.tar.gz
rename of net_pkg.cc to protocol.cc
Class for sending data from server to client (Protocol) This handles both the old ( <= 4.0 ) protocol and then new binary protocol that is used for prepared statements. libmysql/libmysql.c: Jump over reserved bits in the binary protocol libmysqld/Makefile.am: rename of net_pkg.cc to protocol.cc mysql-test/r/case.result: Fixed previously wrong test mysql-test/r/cast.result: Fixed previously wrong test sql/Makefile.am: Rename of net_pkg.cc to protocol.cc sql/field.cc: Binary protocol Added key handling functions for new VARCHAR type sql/field.h: New protocol sql/ha_berkeley.cc: New protocol sql/ha_berkeley.h: New protocol sql/ha_innodb.cc: New protocol sql/ha_myisam.cc: New protocol sql/item.cc: New protocol sql/item.h: New protocol sql/item_func.cc: Removed old code from 3.23 sql/item_func.h: Set cached_result_type as it was previosly used before set sql/item_subselect.cc: Standard make_field() is now good enough sql/item_subselect.h: Use default make_field() sql/item_sum.cc: Clean up Item_sum::make_field() sql/item_sum.h: Use standard make_field() sql/item_timefunc.h: return correct types for casts() Use standard make_field() sql/log_event.cc: New protocol sql/log_event.h: New protocol sql/mysql_priv.h: Move things to protocol.h sql/opt_range.cc: Indentation cleanups + small optimization sql/procedure.h: Use MYSQL_TYPE instead of FIELD_TYPE sql/protocol.cc: Class for sending data from server to client. This handles both the old ( <= 4.0 ) protocol and then new binary protocol that is used for prepared statements. sql/repl_failsafe.cc: New protocol sql/slave.cc: New protocol sql/sql_acl.cc: New protocol sql/sql_base.cc: Move send_fields() to protocol.cc sql/sql_class.cc: New protocol sql/sql_class.h: New protocol sql/sql_db.cc: New protocol sql/sql_error.cc: New protocol sql/sql_handler.cc: New protocol sql/sql_help.cc: New protocol sql/sql_parse.cc: Remove wrong assert (variable was not initalized at this point) sql/sql_prepare.cc: New protocol sql/sql_repl.cc: New protocol sql/sql_select.cc: New protocol sql/sql_show.cc: New protocol sql/sql_string.h: New functions used by the protocol functions sql/sql_table.cc: New protocol sql/structs.h: Make second_part ulong to prepare for ANSI sub-seconds sql/time.cc: New convert function needed by the new protocol functions
Diffstat (limited to 'sql/ha_berkeley.cc')
-rw-r--r--sql/ha_berkeley.cc38
1 files changed, 18 insertions, 20 deletions
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 8edb63b23d6..1b8a2d9b3f8 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -231,10 +231,9 @@ int berkeley_rollback(THD *thd, void *trans)
}
-int berkeley_show_logs(THD *thd)
+int berkeley_show_logs(Protocol *protocol)
{
char **all_logs, **free_logs, **a, **f;
- String *packet= &thd->packet;
int error=1;
MEM_ROOT show_logs_root;
MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
@@ -243,8 +242,9 @@ int berkeley_show_logs(THD *thd)
init_alloc_root(&show_logs_root, 1024, 1024);
my_pthread_setspecific_ptr(THR_MALLOC,&show_logs_root);
- if ((error= db_env->log_archive(db_env, &all_logs, DB_ARCH_ABS | DB_ARCH_LOG))
- || (error= db_env->log_archive(db_env, &free_logs, DB_ARCH_ABS)))
+ if ((error= db_env->log_archive(db_env, &all_logs,
+ DB_ARCH_ABS | DB_ARCH_LOG)) ||
+ (error= db_env->log_archive(db_env, &free_logs, DB_ARCH_ABS)))
{
DBUG_PRINT("error", ("log_archive failed (error %d)", error));
db_env->err(db_env, error, "log_archive: DB_ARCH_ABS");
@@ -257,18 +257,18 @@ int berkeley_show_logs(THD *thd)
{
for (a = all_logs, f = free_logs; *a; ++a)
{
- packet->length(0);
- net_store_data(packet,*a);
- net_store_data(packet,"BDB");
+ protocol->prepare_for_resend();
+ protocol->store(*a);
+ protocol->store("BDB", 3);
if (f && *f && strcmp(*a, *f) == 0)
{
- ++f;
- net_store_data(packet, SHOW_LOG_STATUS_FREE);
+ f++;
+ protocol->store(SHOW_LOG_STATUS_FREE);
}
else
- net_store_data(packet, SHOW_LOG_STATUS_INUSE);
+ protocol->store(SHOW_LOG_STATUS_INUSE);
- if (my_net_write(&thd->net,(char*) packet->ptr(),packet->length()))
+ if (protocol->write())
{
error=1;
goto err;
@@ -2065,8 +2065,7 @@ void ha_berkeley::print_error(int error, myf errflag)
static void print_msg(THD *thd, const char *table_name, const char *op_name,
const char *msg_type, const char *fmt, ...)
{
- String* packet = &thd->packet;
- packet->length(0);
+ Protocol *protocol= thd->protocol;
char msgbuf[256];
msgbuf[0] = 0;
va_list args;
@@ -2074,15 +2073,14 @@ static void print_msg(THD *thd, const char *table_name, const char *op_name,
my_vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
msgbuf[sizeof(msgbuf) - 1] = 0; // healthy paranoia
-
DBUG_PRINT(msg_type,("message: %s",msgbuf));
- net_store_data(packet, table_name);
- net_store_data(packet, op_name);
- net_store_data(packet, msg_type);
- net_store_data(packet, msgbuf);
- if (my_net_write(&thd->net, (char*)thd->packet.ptr(),
- thd->packet.length()))
+ protocol->prepare_for_resend();
+ protocol->store(table_name);
+ protocol->store(op_name);
+ protocol->store(msg_type);
+ protocol->store(msgbuf);
+ if (protocol->write())
thd->killed=1;
}
#endif