diff options
author | unknown <sergefp@mysql.com> | 2004-05-19 23:20:42 +0400 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2004-05-19 23:20:42 +0400 |
commit | 32f2ecd4751968104fa5c07f5311683e92632c08 (patch) | |
tree | dbdbcf11780f6466655401b96976884f9d720c96 /sql/sql_handler.cc | |
parent | 6e8252a534ae419f1209bb717631849656f5e7eb (diff) | |
parent | ea44ccb00f770387bad01eff938866a38d013a75 (diff) | |
download | mariadb-git-32f2ecd4751968104fa5c07f5311683e92632c08.tar.gz |
Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/dbdata/psergey/mysql-4.0-root
Diffstat (limited to 'sql/sql_handler.cc')
-rw-r--r-- | sql/sql_handler.cc | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index a80b4040882..022ca76a0af 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -103,7 +103,7 @@ int mysql_ha_closeall(THD *thd, TABLE_LIST *tables) } static enum enum_ha_read_modes rkey_to_rnext[]= - { RNEXT, RNEXT, RPREV, RNEXT, RPREV, RNEXT, RPREV }; + { RNEXT_SAME, RNEXT, RPREV, RNEXT, RPREV, RNEXT, RPREV }; int mysql_ha_read(THD *thd, TABLE_LIST *tables, @@ -151,6 +151,11 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, HANDLER_TABLES_HACK(thd); MYSQL_LOCK *lock=mysql_lock_tables(thd,&tables->table,1); HANDLER_TABLES_HACK(thd); + + byte *key; + uint key_len; + LINT_INIT(key); + LINT_INIT(key_len); if (!lock) goto err0; // mysql_lock_tables() printed error message already @@ -183,41 +188,44 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, DBUG_ASSERT(keyname != 0); err=table->file->index_prev(table->record[0]); break; + 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; case RKEY: { DBUG_ASSERT(keyname != 0); KEY *keyinfo=table->key_info+keyno; KEY_PART_INFO *key_part=keyinfo->key_part; - uint key_len; - byte *key; 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; + my_printf_error(ER_TOO_MANY_KEY_PARTS,ER(ER_TOO_MANY_KEY_PARTS), + MYF(0),keyinfo->key_parts); + goto err; } List_iterator_fast<Item> it_ke(*key_expr); Item *item; for (key_len=0 ; (item=it_ke++) ; key_part++) { - if (item->fix_fields(thd, tables)) - goto err; - if (item->used_tables() & ~RAND_TABLE_BIT) + if (item->fix_fields(thd, tables)) + goto err; + if (item->used_tables() & ~RAND_TABLE_BIT) { my_error(ER_WRONG_ARGUMENTS,MYF(0),"HANDLER ... READ"); - goto err; + goto err; } - item->save_in_field(key_part->field, 1); - key_len+=key_part->store_length; + item->save_in_field(key_part->field, 1); + key_len+=key_part->store_length; } if (!(key= (byte*) thd->calloc(ALIGN_SIZE(key_len)))) { - send_error(&thd->net,ER_OUTOFMEMORY); - goto err; + send_error(&thd->net,ER_OUTOFMEMORY); + goto err; } key_copy(key, table, keyno, key_len); err=table->file->index_read(table->record[0], - key,key_len,ha_rkey_mode); + key,key_len,ha_rkey_mode); mode=rkey_to_rnext[(int)ha_rkey_mode]; break; } |