Commit a6ebe74e authored by serg@serg.mysql.com's avatar serg@serg.mysql.com
Browse files

Preliminary commit of HANDLER syntax (w/o LIMIT or column-list)

parent 306ab7dd
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
a	b
14	aaa
a	b
15	bbb
a	b
16	ccc
a	b
15	bbb
a	b
22	iii
a	b
21	hhh
a	b
20	ggg
a	b
14	aaa
a	b
a	b
22	iii
a	b
21	hhh
a	b
22	iii
a	b
a	b
15	bbb
+32 −0
Original line number Diff line number Diff line
#
# test of HANDLER ...
#

drop table if exists t1;
create table t1 (a int, b char(10), key a(a));
insert into t1 values
(14,"aaa"),(15,"bbb"),(16,"ccc"),
(17,"ddd"),(18,"eee"),(19,"fff"),
(20,"ggg"),(21,"hhh"),(22,"iii");
handler t1 open;
handler t1 read a first;
handler t1 read a next;
handler t1 read a next;
handler t1 read a prev;
handler t1 read a last;
handler t1 read a prev;
handler t1 read a prev;

handler t1 read a first;
handler t1 read a prev;

handler t1 read a last;
handler t1 read a prev;
handler t1 read a next;
handler t1 read a next;

handler t1 read a=(15);

handler t1 close;
drop table if exists t1;
+1 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
			sql_select.h structs.h table.h sql_udf.h hash_filo.h\
			lex.h lex_symbol.h sql_acl.h sql_crypt.h md5.h \
                        log_event.h mini_client.h sql_repl.h slave.h
mysqld_SOURCES =	sql_lex.cc \
mysqld_SOURCES =	sql_lex.cc sql_handler.cc \
			item.cc item_sum.cc item_buff.cc item_func.cc \
			item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \
			thr_malloc.cc item_create.cc \
+6 −1
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ static SYMBOL symbols[] = {
  { "CHANGED",		SYM(CHANGED),0,0},
  { "CHECK",		SYM(CHECK_SYM),0,0},
  { "CHECKSUM",		SYM(CHECKSUM_SYM),0,0},
  { "CLOSE",		SYM(CLOSE_SYM),0,0},
  { "COLUMN",		SYM(COLUMN_SYM),0,0},
  { "COLUMNS",		SYM(COLUMNS),0,0},
  { "COMMENT",		SYM(COMMENT_SYM),0,0},
@@ -152,6 +153,7 @@ static SYMBOL symbols[] = {
  { "GRANTS",	        SYM(GRANTS),0,0},
  { "GROUP",		SYM(GROUP),0,0},
  { "HAVING",		SYM(HAVING),0,0},
  { "HANDLER",		SYM(HANDLER_SYM),0,0},
  { "HEAP",		SYM(HEAP_SYM),0,0},
  { "HIGH_PRIORITY",	SYM(HIGH_PRIORITY),0,0},
  { "HOUR",		SYM(HOUR_SYM),0,0},
@@ -184,6 +186,7 @@ static SYMBOL symbols[] = {
  { "KEY",		SYM(KEY_SYM),0,0},
  { "KEYS",		SYM(KEYS),0,0},
  { "KILL",		SYM(KILL_SYM),0,0},
  { "LAST",		SYM(LAST_SYM),0,0},
  { "LAST_INSERT_ID",	SYM(LAST_INSERT_ID),0,0},
  { "LEADING",		SYM(LEADING),0,0},
  { "LEFT",		SYM(LEFT),0,0},
@@ -225,11 +228,12 @@ static SYMBOL symbols[] = {
  { "MYISAM",		SYM(MYISAM_SYM),0,0},
  { "NATURAL",		SYM(NATURAL),0,0},
  { "NATIONAL",		SYM(NATIONAL_SYM),0,0},
  { "NEXT",		SYM(NEXT_SYM),0,0},
  { "NCHAR",		SYM(NCHAR_SYM),0,0},
  { "NUMERIC",		SYM(NUMERIC_SYM),0,0},
  { "NO",		SYM(NO_SYM),0,0},
  { "NOT",		SYM(NOT),0,0},
  { "NULL",		SYM(NULL_SYM),0,0},
  { "NUMERIC",		SYM(NUMERIC_SYM),0,0},
  { "ON",		SYM(ON),0,0},
  { "OPEN",		SYM(OPEN_SYM),0,0},
  { "OPTIMIZE",		SYM(OPTIMIZE),0,0},
@@ -244,6 +248,7 @@ static SYMBOL symbols[] = {
  { "PASSWORD",		SYM(PASSWORD),0,0},
  { "PURGE",		SYM(PURGE),0,0},
  { "PRECISION",	SYM(PRECISION),0,0},
  { "PREV",		SYM(PREV_SYM),0,0},
  { "PRIMARY",		SYM(PRIMARY_SYM),0,0},
  { "PROCEDURE",	SYM(PROCEDURE),0,0},
  { "PROCESS"	,	SYM(PROCESS),0,0},
+8 −0
Original line number Diff line number Diff line
@@ -381,6 +381,12 @@ int mysqld_show_status(THD *thd);
int mysqld_show_variables(THD *thd,const char *wild);
int mysqld_show(THD *thd, const char *wild, show_var_st *variables);

/* sql_handler.cc */
int mysql_ha_open(THD *thd, TABLE_LIST *tables);
int mysql_ha_close(THD *thd, TABLE_LIST *tables);
int mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,
                          char *,List<Item> *,enum ha_rkey_function);

/* sql_base.cc */
void set_item_name(Item *item,char *pos,uint length);
bool add_field_to_list(char *field_name, enum enum_field_types type,
@@ -402,6 +408,8 @@ TABLE *unlink_open_table(THD *thd,TABLE *list,TABLE *find);
SQL_SELECT *make_select(TABLE *head, table_map const_tables,
			table_map read_tables, COND *conds, int *error);
Item ** find_item_in_list(Item *item,List<Item> &items);
bool insert_fields(THD *thd,TABLE_LIST *tables, const char *table_name,
	      List_iterator<Item> *it);
bool setup_tables(TABLE_LIST *tables);
int setup_fields(THD *thd,TABLE_LIST *tables,List<Item> &item,
		 bool set_query_id,List<Item> *sum_func_list);
Loading