summaryrefslogtreecommitdiff
path: root/sql/ha_berkeley.cc
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.com>2000-08-15 20:09:37 +0300
committerunknown <monty@donna.mysql.com>2000-08-15 20:09:37 +0300
commit8b3993bc017512c3bf20315b12d1a8b7a6870381 (patch)
tree5f72e7444fbc3c8d944a66b54b26550a04e4f0be /sql/ha_berkeley.cc
parent99110483b2271095dd8b2cb655e3a054f6f7c5a5 (diff)
downloadmariadb-git-8b3993bc017512c3bf20315b12d1a8b7a6870381.tar.gz
Fixed for Ia64 + delayed key creation + a lot of small bug fixes
Docs/Makefile.am: Removed typo Docs/internals.texi: Added documentation about filesort Docs/manual.texi: Lots of changes, including information about the password in the mysql.user table config.h.in: ***MISSING WEAVE*** heap/hp_rnext.c: Fix of reading of read-next include/config-win.h: Fix for Ia64 include/global.h: Fix for Ia64 include/my_base.h: Fix for Ia64 include/myisam.h: New repair options isam/_dynrec.c: Typo fixes isam/_search.c: Fix for Ia64 merge/rrnd.c: Fix of ORDER BY for MERGE tables myisam/ft_eval.c: Fix for Ia64 myisam/ft_parser.c: Fix for Ia64 myisam/ft_static.c: Portability fixes myisam/mi_check.c: Fix for Ia64 + delay key creation myisam/mi_locking.c: Portability fixes myisam/myisamdef.h: Fixes for automatic table repair myisam/myisampack.c: Version number increment myisammrg/myrg_rrnd.c: Fix of ORDER BY for mymerge tables mysql.proj: Updated mysys/charset.c: Fix for Ia64 mysys/mf_casecnv.c: Fix for Ia64 mysys/mf_pack.c: Fix for Ia64 mysys/mf_path.c: Fix for Ia64 mysys/mf_wfile.c: Fix for Ia64 mysys/my_alloc.c: Fix for Ia64 mysys/my_lib.c: Fix for Ia64 mysys/my_lread.c: Fix for Ia64 mysys/my_lwrite.c: Fix for Ia64 mysys/my_winthread.c: Fix for Ia64 mysys/string.c: Fix for Ia64 mysys/thr_alarm.c: Fix for Ia64 mysys/thr_rwlock.c: Fix of scheduler bug for systems without rw_locks regex/regcomp.c: Fix for Ia64 regex/regex.h: Fix for Ia64 regex/regex2.h: Fix for Ia64 scripts/mysqlhotcopy.sh: Explicit version number (because of bitkeeper) sql-bench/bench-init.pl.sh: New help message sql-bench/server-cfg.sh: Updates for postgreSQL 7.0 sql/ChangeLog: Changelog sql/field.cc: Fix of datetime function handling sql/filesort.cc: More comments sql/gen_lex_hash.cc: More options sql/ha_berkeley.cc: Fix for part key reading sql/ha_berkeley.h: Indentation sql/ha_myisam.cc: Fix for delayed key creation sql/ha_myisam.h: Fix for delayed key creation sql/handler.h: Fix for delayed key creation sql/item_func.cc: Fix of crash when using constant expression with UDF functions in WHERE sql/item_timefunc.cc: Fix of datetime function handling sql/mini_client.cc: Portability fix sql/mysql_priv.h: Optimization of select initialization sql/mysqld.cc: Portability fixes, thread cache and min argument for connect_timeout sql/sql_load.cc: Delayed key handling sql/sql_parse.cc: Portability fixes and select initialization optimization sql/sql_select.cc: Small optimization + more comments sql/sql_table.cc: Fix default value adding to blob with alter table + delayed index creation sql/sql_yacc.yy: Optimized select initialization sql/structs.h: Fix for part key read strings/ctype-sjis.c: Fix for Ia64 strings/ctype-tis620.c: Fix for Ia64 strings/t_ctype.h: bk fix support-files/mysql.spec.sh: Added comment vio/viotest-ssl.cc: bk fix vio/viotest-sslconnect.cc: bk fix vio/viotest.cc: bk fix BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql/ha_berkeley.cc')
-rw-r--r--sql/ha_berkeley.cc40
1 files changed, 33 insertions, 7 deletions
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index f9cafd44839..5d76af832ae 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -228,7 +228,7 @@ berkeley_cmp_packed_key(const DBT *new_key, const DBT *saved_key)
key_length-=length;
saved_key_ptr+=key_part->field->packed_col_length(saved_key_ptr);
}
- return 0;
+ return key->handler.bdb_return_if_eq;
}
@@ -250,7 +250,7 @@ berkeley_cmp_fix_length_key(const DBT *new_key, const DBT *saved_key)
key_length-= key_part->length;
saved_key_ptr+=key_part->length;
}
- return 0;
+ return key->handler.bdb_return_if_eq;
}
@@ -964,6 +964,8 @@ int ha_berkeley::read_row(int error, char *buf, uint keynr, DBT *row,
}
+/* This is only used to read whole keys */
+
int ha_berkeley::index_read_idx(byte * buf, uint keynr, const byte * key,
uint key_len, enum ha_rkey_function find_flag)
{
@@ -982,14 +984,38 @@ int ha_berkeley::index_read(byte * buf, const byte * key,
uint key_len, enum ha_rkey_function find_flag)
{
DBT row;
+ int error;
DBUG_ENTER("index_read");
statistic_increment(ha_read_key_count,&LOCK_status);
bzero((char*) &row,sizeof(row));
- DBUG_RETURN(read_row(cursor->c_get(cursor,
- pack_key(&last_key, active_index,
- key_buff, key, key_len),
- &row, DB_SET),
- buf, active_index, &row, 0));
+ if (key_len == table->key_info[active_index].key_length)
+ {
+ error=read_row(cursor->c_get(cursor, pack_key(&last_key,
+ active_index,
+ key_buff,
+ key, key_len),
+ &row, DB_SET),
+ buf, active_index, &row, 0);
+ }
+ else
+ {
+ /* read of partial key */
+ pack_key(&last_key, active_index, key_buff, key, key_len);
+ /* Store for compare */
+ memcpy(key_buff2, key_buff, last_key.size);
+ ((KEY*) last_key.app_private)->handler.bdb_return_if_eq= -1;
+ error=read_row(cursor->c_get(cursor, &last_key, &row, DB_SET_RANGE),
+ buf, active_index, &row, 0);
+ ((KEY*) last_key.app_private)->handler.bdb_return_if_eq=0;
+ if (!error && find_flag == HA_READ_KEY_EXACT)
+ {
+ /* Check that we didn't find a key that wasn't equal to the current
+ one */
+ if (!error && ::key_cmp(table, key_buff2, active_index, key_len))
+ error=HA_ERR_KEY_NOT_FOUND;
+ }
+ }
+ DBUG_RETURN(error);
}