2003-02-04 20:52:14 +01:00
|
|
|
/* Copyright (C) 2000-2003 MySQL AB
|
2001-04-07 00:18:33 +02:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
|
|
|
|
|
|
|
|
/* HANDLER ... commands - direct access to ISAM */
|
|
|
|
|
|
|
|
#include "mysql_priv.h"
|
|
|
|
#include "sql_select.h"
|
|
|
|
|
2001-04-13 16:18:44 +02:00
|
|
|
/* TODO:
|
|
|
|
HANDLER blabla OPEN [ AS foobar ] [ (column-list) ]
|
2001-12-06 13:10:51 +01:00
|
|
|
|
2001-04-13 16:18:44 +02:00
|
|
|
the most natural (easiest, fastest) way to do it is to
|
|
|
|
compute List<Item> field_list not in mysql_ha_read
|
|
|
|
but in mysql_ha_open, and then store it in TABLE structure.
|
2001-12-06 13:10:51 +01:00
|
|
|
|
2001-04-13 16:18:44 +02:00
|
|
|
The problem here is that mysql_parse calls free_item to free all the
|
|
|
|
items allocated at the end of every query. The workaround would to
|
|
|
|
keep two item lists per THD - normal free_list and handler_items.
|
|
|
|
The second is to be freeed only on thread end. mysql_ha_open should
|
|
|
|
then do { handler_items=concat(handler_items, free_list); free_list=0; }
|
2001-12-06 13:10:51 +01:00
|
|
|
|
2003-09-09 19:23:01 +02:00
|
|
|
But !!! do_command calls free_root at the end of every query and frees up
|
2001-04-13 16:18:44 +02:00
|
|
|
all the sql_alloc'ed memory. It's harder to work around...
|
2004-03-10 12:46:11 +01:00
|
|
|
*/
|
2001-04-13 16:18:44 +02:00
|
|
|
|
|
|
|
#define HANDLER_TABLES_HACK(thd) { \
|
|
|
|
TABLE *tmp=thd->open_tables; \
|
|
|
|
thd->open_tables=thd->handler_tables; \
|
|
|
|
thd->handler_tables=tmp; }
|
|
|
|
|
2003-01-28 14:36:22 +01:00
|
|
|
static TABLE **find_table_ptr_by_name(THD *thd,const char *db,
|
|
|
|
const char *table_name, bool is_alias);
|
2001-04-07 00:18:33 +02:00
|
|
|
|
|
|
|
int mysql_ha_open(THD *thd, TABLE_LIST *tables)
|
|
|
|
{
|
2001-04-13 16:18:44 +02:00
|
|
|
HANDLER_TABLES_HACK(thd);
|
2004-02-09 13:44:03 +01:00
|
|
|
uint counter;
|
|
|
|
int err=open_tables(thd, tables, &counter);
|
2001-04-13 16:18:44 +02:00
|
|
|
HANDLER_TABLES_HACK(thd);
|
|
|
|
if (err)
|
|
|
|
return -1;
|
2001-12-06 13:10:51 +01:00
|
|
|
|
2001-12-21 14:28:51 +01:00
|
|
|
// there can be only one table in *tables
|
2002-04-12 20:35:46 +02:00
|
|
|
if (!(tables->table->file->table_flags() & HA_CAN_SQL_HANDLER))
|
2001-12-21 14:28:51 +01:00
|
|
|
{
|
2002-09-20 13:05:18 +02:00
|
|
|
my_printf_error(ER_ILLEGAL_HA,ER(ER_ILLEGAL_HA),MYF(0), tables->alias);
|
2001-12-22 14:44:44 +01:00
|
|
|
mysql_ha_close(thd, tables,1);
|
2001-12-21 14:28:51 +01:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2002-10-02 12:33:08 +02:00
|
|
|
send_ok(thd);
|
2001-04-13 16:18:44 +02:00
|
|
|
return 0;
|
2001-04-07 00:18:33 +02:00
|
|
|
}
|
|
|
|
|
2001-12-22 14:44:44 +01:00
|
|
|
int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok)
|
2001-04-07 00:18:33 +02:00
|
|
|
{
|
2003-01-28 14:36:22 +01:00
|
|
|
TABLE **ptr=find_table_ptr_by_name(thd, tables->db, tables->alias, 1);
|
2001-04-15 22:56:20 +02:00
|
|
|
|
|
|
|
if (*ptr)
|
2001-11-29 20:46:51 +01:00
|
|
|
{
|
|
|
|
VOID(pthread_mutex_lock(&LOCK_open));
|
2003-09-09 19:23:01 +02:00
|
|
|
if (close_thread_table(thd, ptr))
|
|
|
|
{
|
|
|
|
/* Tell threads waiting for refresh that something has happened */
|
|
|
|
VOID(pthread_cond_broadcast(&COND_refresh));
|
|
|
|
}
|
2001-11-29 20:46:51 +01:00
|
|
|
VOID(pthread_mutex_unlock(&LOCK_open));
|
|
|
|
}
|
2001-12-22 19:40:26 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
my_printf_error(ER_UNKNOWN_TABLE,ER(ER_UNKNOWN_TABLE),MYF(0),
|
2002-09-20 13:05:18 +02:00
|
|
|
tables->alias, "HANDLER");
|
2001-12-22 19:40:26 +01:00
|
|
|
return -1;
|
|
|
|
}
|
2001-12-22 14:44:44 +01:00
|
|
|
if (!dont_send_ok)
|
2002-10-02 12:33:08 +02:00
|
|
|
send_ok(thd);
|
2001-04-07 00:18:33 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-02-17 01:14:37 +01:00
|
|
|
int mysql_ha_closeall(THD *thd, TABLE_LIST *tables)
|
2003-01-28 14:36:22 +01:00
|
|
|
{
|
|
|
|
TABLE **ptr=find_table_ptr_by_name(thd, tables->db, tables->real_name, 0);
|
2003-09-09 19:23:01 +02:00
|
|
|
if (*ptr && close_thread_table(thd, ptr))
|
|
|
|
{
|
|
|
|
/* Tell threads waiting for refresh that something has happened */
|
|
|
|
VOID(pthread_cond_broadcast(&COND_refresh));
|
|
|
|
}
|
2003-01-28 14:36:22 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2001-12-21 14:28:51 +01:00
|
|
|
static enum enum_ha_read_modes rkey_to_rnext[]=
|
2004-05-19 23:54:52 +02:00
|
|
|
{ RNEXT_SAME, RNEXT, RPREV, RNEXT, RPREV, RNEXT, RPREV, RPREV };
|
2001-12-06 13:10:51 +01:00
|
|
|
|
2002-01-29 17:32:16 +01:00
|
|
|
|
2001-04-07 00:18:33 +02:00
|
|
|
int mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
|
|
|
enum enum_ha_read_modes mode, char *keyname, List<Item> *key_expr,
|
2001-04-13 16:18:44 +02:00
|
|
|
enum ha_rkey_function ha_rkey_mode, Item *cond,
|
2001-04-09 15:37:19 +02:00
|
|
|
ha_rows select_limit,ha_rows offset_limit)
|
2001-04-07 00:18:33 +02:00
|
|
|
{
|
2001-04-13 16:18:44 +02:00
|
|
|
int err, keyno=-1;
|
2003-01-28 14:36:22 +01:00
|
|
|
TABLE *table=*find_table_ptr_by_name(thd, tables->db, tables->alias, 1);
|
2001-04-07 00:18:33 +02:00
|
|
|
if (!table)
|
|
|
|
{
|
|
|
|
my_printf_error(ER_UNKNOWN_TABLE,ER(ER_UNKNOWN_TABLE),MYF(0),
|
2002-09-20 13:05:18 +02:00
|
|
|
tables->alias,"HANDLER");
|
2001-04-07 00:18:33 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
tables->table=table;
|
2001-04-13 16:18:44 +02:00
|
|
|
|
2003-01-21 12:55:26 +01:00
|
|
|
if (cond && (cond->fix_fields(thd, tables, &cond) || cond->check_cols(1)))
|
2001-04-13 16:18:44 +02:00
|
|
|
return -1;
|
2001-12-06 13:10:51 +01:00
|
|
|
|
2003-01-13 17:20:59 +01:00
|
|
|
/* InnoDB needs to know that this table handle is used in the HANDLER */
|
|
|
|
|
|
|
|
table->file->init_table_handle_for_HANDLER();
|
|
|
|
|
2001-04-13 16:18:44 +02:00
|
|
|
if (keyname)
|
2001-04-07 00:18:33 +02:00
|
|
|
{
|
2001-04-13 16:18:44 +02:00
|
|
|
if ((keyno=find_type(keyname, &table->keynames, 1+2)-1)<0)
|
|
|
|
{
|
|
|
|
my_printf_error(ER_KEY_DOES_NOT_EXITS,ER(ER_KEY_DOES_NOT_EXITS),MYF(0),
|
2002-09-20 13:05:18 +02:00
|
|
|
keyname,tables->alias);
|
2001-04-13 16:18:44 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2002-08-21 22:55:34 +02:00
|
|
|
table->file->index_init(keyno);
|
2001-04-07 00:18:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
List<Item> list;
|
|
|
|
list.push_front(new Item_field(NULL,NULL,"*"));
|
|
|
|
List_iterator<Item> it(list);
|
2002-12-11 08:17:51 +01:00
|
|
|
Protocol *protocol= thd->protocol;
|
|
|
|
char buff[MAX_FIELD_WIDTH];
|
|
|
|
String buffer(buff, sizeof(buff), system_charset_info);
|
2002-01-29 17:32:16 +01:00
|
|
|
uint num_rows;
|
2004-05-19 23:54:52 +02:00
|
|
|
byte *key;
|
|
|
|
uint key_len;
|
|
|
|
LINT_INIT(key);
|
|
|
|
LINT_INIT(key_len);
|
|
|
|
|
|
|
|
it++; // Skip first NULL field
|
2001-04-07 00:18:33 +02:00
|
|
|
|
2002-09-20 13:05:18 +02:00
|
|
|
insert_fields(thd,tables,tables->db,tables->alias,&it);
|
2001-04-13 16:18:44 +02:00
|
|
|
|
|
|
|
select_limit+=offset_limit;
|
2002-12-11 08:17:51 +01:00
|
|
|
protocol->send_fields(&list,1);
|
2001-12-06 13:10:51 +01:00
|
|
|
|
2002-01-03 15:31:54 +01:00
|
|
|
HANDLER_TABLES_HACK(thd);
|
2001-04-13 16:18:44 +02:00
|
|
|
MYSQL_LOCK *lock=mysql_lock_tables(thd,&tables->table,1);
|
2002-01-03 15:31:54 +01:00
|
|
|
HANDLER_TABLES_HACK(thd);
|
|
|
|
if (!lock)
|
|
|
|
goto err0; // mysql_lock_tables() printed error message already
|
2001-04-09 15:37:19 +02:00
|
|
|
|
2003-02-07 14:47:24 +01:00
|
|
|
/*
|
|
|
|
In ::external_lock InnoDB resets the fields which tell it that
|
|
|
|
the handle is used in the HANDLER interface. Tell it again that
|
|
|
|
we are using it for HANDLER.
|
|
|
|
*/
|
2003-01-13 17:20:59 +01:00
|
|
|
|
|
|
|
table->file->init_table_handle_for_HANDLER();
|
|
|
|
|
2002-01-29 17:32:16 +01:00
|
|
|
for (num_rows=0; num_rows < select_limit; )
|
2001-04-07 00:18:33 +02:00
|
|
|
{
|
2002-12-11 08:17:51 +01:00
|
|
|
switch (mode) {
|
2002-01-29 17:32:16 +01:00
|
|
|
case RFIRST:
|
2003-02-22 18:00:34 +01:00
|
|
|
if (keyname)
|
|
|
|
err=table->file->index_first(table->record[0]);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!(err=table->file->rnd_init(1)))
|
|
|
|
err=table->file->rnd_next(table->record[0]);
|
|
|
|
}
|
2002-01-29 17:32:16 +01:00
|
|
|
mode=RNEXT;
|
|
|
|
break;
|
|
|
|
case RLAST:
|
|
|
|
DBUG_ASSERT(keyname != 0);
|
|
|
|
err=table->file->index_last(table->record[0]);
|
|
|
|
mode=RPREV;
|
|
|
|
break;
|
|
|
|
case RNEXT:
|
|
|
|
err=keyname ?
|
|
|
|
table->file->index_next(table->record[0]) :
|
|
|
|
table->file->rnd_next(table->record[0]);
|
|
|
|
break;
|
|
|
|
case RPREV:
|
|
|
|
DBUG_ASSERT(keyname != 0);
|
|
|
|
err=table->file->index_prev(table->record[0]);
|
|
|
|
break;
|
2004-05-19 00:18:54 +02:00
|
|
|
case RNEXT_SAME:
|
|
|
|
/* Continue scan on "(keypart1,keypart2,...)=(c1, c2, ...) */
|
|
|
|
DBUG_ASSERT(keyname != 0);
|
|
|
|
err= table->file->index_next_same(table->record[0], key, key_len);
|
|
|
|
break;
|
2002-01-29 17:32:16 +01:00
|
|
|
case RKEY:
|
2001-04-09 15:37:19 +02:00
|
|
|
{
|
2002-01-29 17:32:16 +01:00
|
|
|
DBUG_ASSERT(keyname != 0);
|
|
|
|
KEY *keyinfo=table->key_info+keyno;
|
|
|
|
KEY_PART_INFO *key_part=keyinfo->key_part;
|
|
|
|
if (key_expr->elements > keyinfo->key_parts)
|
|
|
|
{
|
|
|
|
my_printf_error(ER_TOO_MANY_KEY_PARTS,ER(ER_TOO_MANY_KEY_PARTS),
|
|
|
|
MYF(0),keyinfo->key_parts);
|
|
|
|
goto err;
|
|
|
|
}
|
2004-02-18 00:08:52 +01:00
|
|
|
List_iterator<Item> it_ke(*key_expr);
|
2002-01-29 17:32:16 +01:00
|
|
|
Item *item;
|
|
|
|
for (key_len=0 ; (item=it_ke++) ; key_part++)
|
|
|
|
{
|
2004-02-18 00:08:52 +01:00
|
|
|
// 'item' can be changed by fix_fields() call
|
|
|
|
if (item->fix_fields(thd, tables, it_ke.ref()) ||
|
|
|
|
(item= *it_ke.ref())->check_cols(1))
|
2003-07-04 12:55:25 +02:00
|
|
|
goto err;
|
|
|
|
if (item->used_tables() & ~RAND_TABLE_BIT)
|
|
|
|
{
|
|
|
|
my_error(ER_WRONG_ARGUMENTS,MYF(0),"HANDLER ... READ");
|
|
|
|
goto err;
|
|
|
|
}
|
2002-12-05 18:38:42 +01:00
|
|
|
(void) item->save_in_field(key_part->field, 1);
|
2002-01-29 17:32:16 +01:00
|
|
|
key_len+=key_part->store_length;
|
|
|
|
}
|
2002-12-03 12:08:25 +01:00
|
|
|
if (!(key= (byte*) thd->calloc(ALIGN_SIZE(key_len))))
|
2002-01-29 17:32:16 +01:00
|
|
|
{
|
2002-10-02 12:33:08 +02:00
|
|
|
send_error(thd,ER_OUTOFMEMORY);
|
2002-01-29 17:32:16 +01:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
key_copy(key, table, keyno, key_len);
|
|
|
|
err=table->file->index_read(table->record[0],
|
|
|
|
key,key_len,ha_rkey_mode);
|
|
|
|
mode=rkey_to_rnext[(int)ha_rkey_mode];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2002-10-02 12:33:08 +02:00
|
|
|
send_error(thd,ER_ILLEGAL_HA);
|
2002-01-29 17:32:16 +01:00
|
|
|
goto err;
|
2001-04-09 15:37:19 +02:00
|
|
|
}
|
|
|
|
|
2003-07-04 11:41:01 +02:00
|
|
|
if (err == HA_ERR_RECORD_DELETED)
|
|
|
|
continue;
|
2001-04-13 16:18:44 +02:00
|
|
|
if (err)
|
2001-04-09 15:37:19 +02:00
|
|
|
{
|
2001-04-13 16:18:44 +02:00
|
|
|
if (err != HA_ERR_KEY_NOT_FOUND && err != HA_ERR_END_OF_FILE)
|
|
|
|
{
|
2003-11-12 22:33:28 +01:00
|
|
|
sql_print_error("mysql_ha_read: Got error %d when reading table '%s'",
|
|
|
|
err, tables->real_name);
|
2001-04-13 16:18:44 +02:00
|
|
|
table->file->print_error(err,MYF(0));
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
goto ok;
|
|
|
|
}
|
2003-07-04 11:41:01 +02:00
|
|
|
if (cond && !cond->val_int())
|
|
|
|
continue;
|
2003-07-04 22:06:19 +02:00
|
|
|
if (num_rows >= offset_limit)
|
2001-12-21 14:28:51 +01:00
|
|
|
{
|
2003-07-04 11:41:01 +02:00
|
|
|
Item *item;
|
|
|
|
protocol->prepare_for_resend();
|
|
|
|
it.rewind();
|
|
|
|
while ((item=it++))
|
2001-04-07 00:18:33 +02:00
|
|
|
{
|
2003-07-04 11:41:01 +02:00
|
|
|
if (item->send(thd->protocol, &buffer))
|
|
|
|
{
|
|
|
|
protocol->free(); // Free used
|
|
|
|
my_error(ER_OUT_OF_RESOURCES,MYF(0));
|
|
|
|
goto err;
|
|
|
|
}
|
2001-04-07 00:18:33 +02:00
|
|
|
}
|
2003-07-04 11:41:01 +02:00
|
|
|
protocol->write();
|
2001-04-07 00:18:33 +02:00
|
|
|
}
|
2001-04-13 16:18:44 +02:00
|
|
|
num_rows++;
|
2001-04-07 00:18:33 +02:00
|
|
|
}
|
2001-04-13 16:18:44 +02:00
|
|
|
ok:
|
|
|
|
mysql_unlock_tables(thd,lock);
|
2002-10-02 12:33:08 +02:00
|
|
|
send_eof(thd);
|
2001-04-07 00:18:33 +02:00
|
|
|
return 0;
|
2001-04-13 16:18:44 +02:00
|
|
|
err:
|
|
|
|
mysql_unlock_tables(thd,lock);
|
2002-01-03 15:31:54 +01:00
|
|
|
err0:
|
2001-04-13 16:18:44 +02:00
|
|
|
return -1;
|
2001-04-07 00:18:33 +02:00
|
|
|
}
|
|
|
|
|
2002-12-11 08:17:51 +01:00
|
|
|
|
2001-05-23 22:47:08 +02:00
|
|
|
static TABLE **find_table_ptr_by_name(THD *thd, const char *db,
|
2003-02-07 14:47:24 +01:00
|
|
|
const char *table_name, bool is_alias)
|
2001-04-07 00:18:33 +02:00
|
|
|
{
|
|
|
|
int dblen;
|
2001-04-15 22:56:20 +02:00
|
|
|
TABLE **ptr;
|
2001-12-06 13:10:51 +01:00
|
|
|
|
2004-01-13 12:31:25 +01:00
|
|
|
DBUG_ASSERT(db);
|
After merge fixes
Added more DBUG statements
Ensure that we are comparing end space with BINARY strings
Use 'any_db' instead of '' to mean any database. (For HANDLER command)
Only strip ' ' when comparing CHAR, not other space-like characters (like \t)
BitKeeper/deleted/.del-ctype_tis620.result-old~3578ceb0b8284685:
Delete: mysql-test/r/ctype_tis620.result-old
BitKeeper/deleted/.del-ctype_tis620.test-old~ffb1bbd2935d1aba:
Delete: mysql-test/t/ctype_tis620.test-old
client/mysqlbinlog.cc:
Added DBUG statements
Added call of my_end() to free all used memory on exit
heap/hp_info.c:
After merge fixes
heap/hp_open.c:
After merge fixes
include/heap.h:
After merge fixes
include/m_ctype.h:
Use pchar instead of 'int' for character parameters.
Added 'my_binary_compare()'
include/m_string.h:
Fixed wrong define
innobase/ibuf/ibuf0ibuf.c:
After merge fixes
innobase/srv/srv0start.c:
After merge fixes
mysql-test/r/alter_table.result:
Fixed results after merge
mysql-test/r/auto_increment.result:
Fixed results after merge
mysql-test/r/bdb.result:
Fixed results after merge
mysql-test/r/binary.result:
Fixed results after merge
mysql-test/r/create.result:
Fixed results after merge
mysql-test/r/ctype_mb.result:
Fixed results after merge
mysql-test/r/ctype_tis620.result:
Fixed results after merge
mysql-test/r/ctype_utf8.result:
Fixed results after merge
mysql-test/r/delete.result:
Fixed results after merge
mysql-test/r/func_compress.result:
Fixed results after merge
mysql-test/r/func_gconcat.result:
Fixed results after merge
mysql-test/r/func_group.result:
Fixed results after merge
mysql-test/r/func_str.result:
Fixed results after merge
mysql-test/r/innodb.result:
Fixed results after merge
mysql-test/r/insert.result:
Fixed results after merge
mysql-test/r/insert_select.result:
Fixed results after merge
mysql-test/r/key.result:
Fixed results after merge
mysql-test/r/loaddata.result:
Fixed results after merge
mysql-test/r/lock.result:
Fixed results after merge
mysql-test/r/myisam.result:
Fixed results after merge
mysql-test/r/null.result:
Fixed results after merge
mysql-test/r/null_key.result:
Fixed results after merge
mysql-test/r/order_by.result:
Fixed results after merge
mysql-test/r/query_cache.result:
Fixed results after merge
mysql-test/r/range.result:
Fixed results after merge
mysql-test/r/rpl_multi_delete.result:
Fixed results after merge
mysql-test/r/rpl_until.result:
Fixed results after merge
mysql-test/r/subselect.result:
Fixed results after merge
mysql-test/r/subselect_innodb.result:
Fixed results after merge
mysql-test/r/type_blob.result:
Fixed results after merge
mysql-test/r/type_datetime.result:
Fixed results after merge
mysql-test/r/type_decimal.result:
Fixed results after merge
mysql-test/r/type_enum.result:
Fixed results after merge
mysql-test/r/type_float.result:
Fixed results after merge
mysql-test/r/type_ranges.result:
Fixed results after merge
mysql-test/r/type_time.result:
Fixed results after merge
mysql-test/r/type_timestamp.result:
Fixed results after merge
mysql-test/r/type_uint.result:
Fixed results after merge
mysql-test/r/type_year.result:
Fixed results after merge
mysql-test/r/variables.result:
Fixed results after merge
mysql-test/r/warnings.result:
Fixed results after merge
mysql-test/t/case.test:
Fixed shifted error messages
mysql-test/t/create.test:
Fixed shifted error messages
mysql-test/t/ctype_collate.test:
Fixed shifted error messages
mysql-test/t/ctype_tis620.test:
Merge with 4.0 ctype_tis620 test
mysql-test/t/delete.test:
Fixed shifted error messages
mysql-test/t/derived.test:
Fixed shifted error messages
mysql-test/t/fulltext.test:
Fixed shifted error messages
mysql-test/t/func_in.test:
Fixed shifted error messages
mysql-test/t/func_str.test:
Fixed shifted error messages
mysql-test/t/func_test.test:
Fixed shifted error messages
mysql-test/t/grant.test:
Fixed shifted error messages
mysql-test/t/innodb.test:
Change to 4.1 syntax
mysql-test/t/key_cache.test:
Fixed shifted error messages
mysql-test/t/myisam.test:
New test of blob and end space
mysql-test/t/row.test:
Fixed shifted error messages
mysql-test/t/rpl_until.test:
Fixed shifted error messages
mysql-test/t/subselect.test:
Fixed shifted error messages
mysql-test/t/subselect_innodb.test:
Fix test to take into account foreign key constraints
mysql-test/t/union.test:
Fixed shifted error messages
mysql-test/t/user_var.test:
Fixed shifted error messages
mysql-test/t/variables.test:
Fixed shifted error messages
mysys/my_handler.c:
Merge with 4.0 code
sql/ha_heap.cc:
After merge fixes
sql/handler.cc:
After merge fixes
sql/item.cc:
After merge fixes
sql/item_cmpfunc.cc:
Ensure that we are comparing end space with BINARY strings
sql/item_cmpfunc.h:
Ensure that we are comparing end space with BINARY strings
sql/log_event.cc:
More DBUG statements
Ensure that we use all options to LOAD DATA in replication
sql/opt_range.cc:
After merge fixes
sql/sql_db.cc:
After merge fixes
sql/sql_handler.cc:
After merge fixes
Use 'any_db' instead of '' to mean 'no database comparison'
sql/sql_parse.cc:
After merge fixes
sql/sql_select.cc:
After merge fixes
Added function comment for setup_group()
sql/sql_string.cc:
Added stringcmp() for binary comparison.
Added function comments for sortcmp() and stringcmp()
sql/sql_string.h:
Added stringcmp()
sql/sql_table.cc:
After merge fixes
sql/sql_update.cc:
After merge fixes
sql/sql_yacc.yy:
Use 'any_db' instead of '' to mean any database. Using "" causes a 'wrong db name' error.
strings/ctype-big5.c:
Strip only end space, not other space characters.
strings/ctype-bin.c:
Removed some not needed functions.
Added function comments
Don't remove end space in comparisons
Change my_wildcmp_bin() to be 'identical' with other similar code
strings/ctype-czech.c:
Strip only end space, not other space characters.
strings/ctype-gbk.c:
Strip only end space, not other space characters.
strings/ctype-latin1.c:
Strip only end space, not other space characters.
strings/ctype-mb.c:
Strip only end space, not other space characters.
strings/ctype-simple.c:
Strip only end space, not other space characters.
strings/ctype-sjis.c:
Strip only end space, not other space characters.
strings/ctype-tis620.c:
Added usage of my_instr_simple. This needs to be cleaned up!
strings/ctype-utf8.c:
Strip only end space, not other space characters.
strings/ctype-win1250ch.c:
Strip only end space, not other space characters.
Fixed indentation
strings/strto.c:
Code cleanup
2004-02-16 09:03:25 +01:00
|
|
|
dblen= strlen(db);
|
2002-12-11 08:17:51 +01:00
|
|
|
ptr= &(thd->handler_tables);
|
2001-12-06 13:10:51 +01:00
|
|
|
|
2002-12-11 08:17:51 +01:00
|
|
|
for (TABLE *table= *ptr; table ; table= *ptr)
|
2001-04-07 00:18:33 +02:00
|
|
|
{
|
After merge fixes
Added more DBUG statements
Ensure that we are comparing end space with BINARY strings
Use 'any_db' instead of '' to mean any database. (For HANDLER command)
Only strip ' ' when comparing CHAR, not other space-like characters (like \t)
BitKeeper/deleted/.del-ctype_tis620.result-old~3578ceb0b8284685:
Delete: mysql-test/r/ctype_tis620.result-old
BitKeeper/deleted/.del-ctype_tis620.test-old~ffb1bbd2935d1aba:
Delete: mysql-test/t/ctype_tis620.test-old
client/mysqlbinlog.cc:
Added DBUG statements
Added call of my_end() to free all used memory on exit
heap/hp_info.c:
After merge fixes
heap/hp_open.c:
After merge fixes
include/heap.h:
After merge fixes
include/m_ctype.h:
Use pchar instead of 'int' for character parameters.
Added 'my_binary_compare()'
include/m_string.h:
Fixed wrong define
innobase/ibuf/ibuf0ibuf.c:
After merge fixes
innobase/srv/srv0start.c:
After merge fixes
mysql-test/r/alter_table.result:
Fixed results after merge
mysql-test/r/auto_increment.result:
Fixed results after merge
mysql-test/r/bdb.result:
Fixed results after merge
mysql-test/r/binary.result:
Fixed results after merge
mysql-test/r/create.result:
Fixed results after merge
mysql-test/r/ctype_mb.result:
Fixed results after merge
mysql-test/r/ctype_tis620.result:
Fixed results after merge
mysql-test/r/ctype_utf8.result:
Fixed results after merge
mysql-test/r/delete.result:
Fixed results after merge
mysql-test/r/func_compress.result:
Fixed results after merge
mysql-test/r/func_gconcat.result:
Fixed results after merge
mysql-test/r/func_group.result:
Fixed results after merge
mysql-test/r/func_str.result:
Fixed results after merge
mysql-test/r/innodb.result:
Fixed results after merge
mysql-test/r/insert.result:
Fixed results after merge
mysql-test/r/insert_select.result:
Fixed results after merge
mysql-test/r/key.result:
Fixed results after merge
mysql-test/r/loaddata.result:
Fixed results after merge
mysql-test/r/lock.result:
Fixed results after merge
mysql-test/r/myisam.result:
Fixed results after merge
mysql-test/r/null.result:
Fixed results after merge
mysql-test/r/null_key.result:
Fixed results after merge
mysql-test/r/order_by.result:
Fixed results after merge
mysql-test/r/query_cache.result:
Fixed results after merge
mysql-test/r/range.result:
Fixed results after merge
mysql-test/r/rpl_multi_delete.result:
Fixed results after merge
mysql-test/r/rpl_until.result:
Fixed results after merge
mysql-test/r/subselect.result:
Fixed results after merge
mysql-test/r/subselect_innodb.result:
Fixed results after merge
mysql-test/r/type_blob.result:
Fixed results after merge
mysql-test/r/type_datetime.result:
Fixed results after merge
mysql-test/r/type_decimal.result:
Fixed results after merge
mysql-test/r/type_enum.result:
Fixed results after merge
mysql-test/r/type_float.result:
Fixed results after merge
mysql-test/r/type_ranges.result:
Fixed results after merge
mysql-test/r/type_time.result:
Fixed results after merge
mysql-test/r/type_timestamp.result:
Fixed results after merge
mysql-test/r/type_uint.result:
Fixed results after merge
mysql-test/r/type_year.result:
Fixed results after merge
mysql-test/r/variables.result:
Fixed results after merge
mysql-test/r/warnings.result:
Fixed results after merge
mysql-test/t/case.test:
Fixed shifted error messages
mysql-test/t/create.test:
Fixed shifted error messages
mysql-test/t/ctype_collate.test:
Fixed shifted error messages
mysql-test/t/ctype_tis620.test:
Merge with 4.0 ctype_tis620 test
mysql-test/t/delete.test:
Fixed shifted error messages
mysql-test/t/derived.test:
Fixed shifted error messages
mysql-test/t/fulltext.test:
Fixed shifted error messages
mysql-test/t/func_in.test:
Fixed shifted error messages
mysql-test/t/func_str.test:
Fixed shifted error messages
mysql-test/t/func_test.test:
Fixed shifted error messages
mysql-test/t/grant.test:
Fixed shifted error messages
mysql-test/t/innodb.test:
Change to 4.1 syntax
mysql-test/t/key_cache.test:
Fixed shifted error messages
mysql-test/t/myisam.test:
New test of blob and end space
mysql-test/t/row.test:
Fixed shifted error messages
mysql-test/t/rpl_until.test:
Fixed shifted error messages
mysql-test/t/subselect.test:
Fixed shifted error messages
mysql-test/t/subselect_innodb.test:
Fix test to take into account foreign key constraints
mysql-test/t/union.test:
Fixed shifted error messages
mysql-test/t/user_var.test:
Fixed shifted error messages
mysql-test/t/variables.test:
Fixed shifted error messages
mysys/my_handler.c:
Merge with 4.0 code
sql/ha_heap.cc:
After merge fixes
sql/handler.cc:
After merge fixes
sql/item.cc:
After merge fixes
sql/item_cmpfunc.cc:
Ensure that we are comparing end space with BINARY strings
sql/item_cmpfunc.h:
Ensure that we are comparing end space with BINARY strings
sql/log_event.cc:
More DBUG statements
Ensure that we use all options to LOAD DATA in replication
sql/opt_range.cc:
After merge fixes
sql/sql_db.cc:
After merge fixes
sql/sql_handler.cc:
After merge fixes
Use 'any_db' instead of '' to mean 'no database comparison'
sql/sql_parse.cc:
After merge fixes
sql/sql_select.cc:
After merge fixes
Added function comment for setup_group()
sql/sql_string.cc:
Added stringcmp() for binary comparison.
Added function comments for sortcmp() and stringcmp()
sql/sql_string.h:
Added stringcmp()
sql/sql_table.cc:
After merge fixes
sql/sql_update.cc:
After merge fixes
sql/sql_yacc.yy:
Use 'any_db' instead of '' to mean any database. Using "" causes a 'wrong db name' error.
strings/ctype-big5.c:
Strip only end space, not other space characters.
strings/ctype-bin.c:
Removed some not needed functions.
Added function comments
Don't remove end space in comparisons
Change my_wildcmp_bin() to be 'identical' with other similar code
strings/ctype-czech.c:
Strip only end space, not other space characters.
strings/ctype-gbk.c:
Strip only end space, not other space characters.
strings/ctype-latin1.c:
Strip only end space, not other space characters.
strings/ctype-mb.c:
Strip only end space, not other space characters.
strings/ctype-simple.c:
Strip only end space, not other space characters.
strings/ctype-sjis.c:
Strip only end space, not other space characters.
strings/ctype-tis620.c:
Added usage of my_instr_simple. This needs to be cleaned up!
strings/ctype-utf8.c:
Strip only end space, not other space characters.
strings/ctype-win1250ch.c:
Strip only end space, not other space characters.
Fixed indentation
strings/strto.c:
Code cleanup
2004-02-16 09:03:25 +01:00
|
|
|
if ((db == any_db || !memcmp(table->table_cache_key, db, dblen)) &&
|
2003-02-04 20:52:14 +01:00
|
|
|
!my_strcasecmp(system_charset_info,
|
|
|
|
(is_alias ? table->table_name : table->real_name),
|
|
|
|
table_name))
|
2003-11-18 22:06:47 +01:00
|
|
|
{
|
|
|
|
if (table->version != refresh_version)
|
|
|
|
{
|
|
|
|
VOID(pthread_mutex_lock(&LOCK_open));
|
|
|
|
if (close_thread_table(thd, ptr))
|
|
|
|
{
|
|
|
|
/* Tell threads waiting for refresh that something has happened */
|
|
|
|
VOID(pthread_cond_broadcast(&COND_refresh));
|
|
|
|
}
|
|
|
|
VOID(pthread_mutex_unlock(&LOCK_open));
|
|
|
|
continue;
|
|
|
|
}
|
2001-04-15 22:56:20 +02:00
|
|
|
break;
|
2003-11-18 22:06:47 +01:00
|
|
|
}
|
2002-10-02 16:55:12 +02:00
|
|
|
ptr= &(table->next);
|
2001-04-07 00:18:33 +02:00
|
|
|
}
|
2001-04-15 22:56:20 +02:00
|
|
|
return ptr;
|
2001-04-07 00:18:33 +02:00
|
|
|
}
|