summaryrefslogtreecommitdiff
path: root/sql/sql_handler.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/sql_handler.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/sql_handler.cc')
-rw-r--r--sql/sql_handler.cc33
1 files changed, 18 insertions, 15 deletions
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index 6ea319a72e4..97703cd6b20 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -123,6 +123,9 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
List<Item> list;
list.push_front(new Item_field(NULL,NULL,"*"));
List_iterator<Item> it(list);
+ Protocol *protocol= thd->protocol;
+ char buff[MAX_FIELD_WIDTH];
+ String buffer(buff, sizeof(buff), system_charset_info);
uint num_rows;
it++;
@@ -131,7 +134,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
table->file->init_table_handle_for_HANDLER(); // Only InnoDB requires it
select_limit+=offset_limit;
- send_fields(thd,list,1);
+ protocol->send_fields(&list,1);
HANDLER_TABLES_HACK(thd);
MYSQL_LOCK *lock=mysql_lock_tables(thd,&tables->table,1);
@@ -141,7 +144,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
for (num_rows=0; num_rows < select_limit; )
{
- switch(mode) {
+ switch (mode) {
case RFIRST:
err=keyname ?
table->file->index_first(table->record[0]) :
@@ -216,24 +219,24 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
if (!cond->val_int())
continue;
}
- if (num_rows>=offset_limit)
+ if (num_rows >= offset_limit)
{
if (!err)
{
String *packet = &thd->packet;
Item *item;
- packet->length(0);
+ protocol->prepare_for_resend();
it.rewind();
while ((item=it++))
{
- if (item->send(thd,packet))
+ if (item->send(thd->protocol, &buffer))
{
- packet->free(); // Free used
+ protocol->free(); // Free used
my_error(ER_OUT_OF_RESOURCES,MYF(0));
goto err;
}
}
- my_net_write(&thd->net, (char*)packet->ptr(), packet->length());
+ protocol->write();
}
}
num_rows++;
@@ -249,26 +252,26 @@ err0:
}
/**************************************************************************
- 2Monty: It could easily happen, that the following service functions are
+ Monty: It could easily happen, that the following service functions are
already defined somewhere in the code, but I failed to find them.
If this is the case, just say a word and I'll use old functions here.
**************************************************************************/
-/* Note: this function differs from find_locked_table() because we're looking
- here for alias, not real table name
- */
+/*
+ Note: this function differs from find_locked_table() because we're looking
+ here for alias, not real table name
+*/
+
static TABLE **find_table_ptr_by_name(THD *thd, const char *db,
const char *alias)
{
int dblen;
TABLE **ptr;
- if (!db || ! *db)
- db= thd->db ? thd->db : "";
dblen=strlen(db)+1;
- ptr=&(thd->handler_tables);
+ ptr= &(thd->handler_tables);
- for (TABLE *table=*ptr; table ; table=*ptr)
+ for (TABLE *table= *ptr; table ; table= *ptr)
{
if (!memcmp(table->table_cache_key, db, dblen) &&
!my_strcasecmp(system_charset_info,table->table_name,alias))