From 7f2aff3de469e3875d89ef8536c59350fd22a85d Mon Sep 17 00:00:00 2001
From: "monty@donna.mysql.com" <>
Date: Fri, 17 Nov 2000 14:38:53 +0200
Subject: [PATCH] Fixed bug with text key compares in BDB

---
 BitKeeper/etc/logging_ok |   1 +
 Docs/manual.texi         | 103 +++++++++++++++++++++------------------
 mysys/Makefile.am        |   2 +-
 sql-bench/test-insert.sh |  18 +++----
 sql/ha_berkeley.cc       |   2 +-
 5 files changed, 68 insertions(+), 58 deletions(-)

diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index 5ca7ce98828..18b009037d6 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -1 +1,2 @@
 jani@prima.mysql.com
+monty@donna.mysql.com
diff --git a/Docs/manual.texi b/Docs/manual.texi
index ee711dbab3e..47a7e99c834 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -19703,50 +19703,58 @@ The following columns are returned:
 below, though the format and numbers probably differ:
 
 @example
-+--------------------------+-------+
-| Variable_name            | Value |
-+--------------------------+-------+
-| Aborted_clients          | 0     |
-| Aborted_connects         | 0     |
-| Bytes_received           | 100   |
-| Bytes_sent               | 2106  |
-| Connections              | 4     |
-| Created_tmp_tables       | 0     |
-| Delayed_insert_threads   | 0     |
-| Delayed_writes           | 0     |
-| Delayed_errors           | 0     |
-| Flush_commands           | 1     |
-| Handler_delete           | 0     |
-| Handler_read_first       | 1     |
-| Handler_read_key         | 0     |
-| Handler_read_next        | 2     |
-| Handler_read_prev        | 0     |
-| Handler_read_rnd         | 0     |
-| Handler_read_rnd_next    | 25    |
-| Handler_update           | 0     |
-| Handler_write            | 0     |
-| Key_blocks_used          | 1     |
-| Key_read_requests        | 2     |
-| Key_reads                | 1     |
-| Key_write_requests       | 0     |
-| Key_writes               | 0     |
-| Max_used_connections     | 0     |
-| Not_flushed_key_blocks   | 0     |
-| Not_flushed_delayed_rows | 0     |
-| Open_tables              | 0     |
-| Open_files               | 0     |
-| Open_streams             | 0     |
-| Opened_tables            | 6     |
-| Questions                | 4     |
-| Slow_launch_threads      | 0     |
-| Slow_queries             | 0     |
-| Slave_running            | OFF   |
-| Threads_cached           | 0     |
-| Threads_connected        | 1     |
-| Threads_running          | 1     |
-| Uptime                   | 1256  |
-+--------------------------+-------+
-
++--------------------------+------------+
+| Variable_name            | Value      |
++--------------------------+------------+
+| Aborted_clients          | 0          |
+| Aborted_connects         | 0          |
+| Bytes_received           | 142160923  |
+| Bytes_sent               | 1161910370 |
+| Connections              | 30022      |
+| Created_tmp_disk_tables  | 0          |
+| Created_tmp_tables       | 8988       |
+| Delayed_insert_threads   | 0          |
+| Delayed_writes           | 0          |
+| Delayed_errors           | 0          |
+| Flush_commands           | 1          |
+| Handler_delete           | 462604     |
+| Handler_read_first       | 95882      |
+| Handler_read_key         | 27681068   |
+| Handler_read_next        | 265008218  |
+| Handler_read_prev        | 3022500    |
+| Handler_read_rnd         | 36900998   |
+| Handler_read_rnd_next    | 252097176  |
+| Handler_update           | 16945404   |
+| Handler_write            | 66826676   |
+| Key_blocks_used          | 14955      |
+| Key_read_requests        | 90131960   |
+| Key_reads                | 163268     |
+| Key_write_requests       | 7573912    |
+| Key_writes               | 3780151    |
+| Max_used_connections     | 0          |
+| Not_flushed_key_blocks   | 0          |
+| Not_flushed_delayed_rows | 0          |
+| Open_tables              | 0          |
+| Open_files               | 0          |
+| Open_streams             | 0          |
+| Opened_tables            | 44598      |
+| Questions                | 1866024    |
+| Select_full_join         | 0          |
+| Select_full_range_join   | 0          |
+| Select_range             | 68187      |
+| Select_range_check       | 0          |
+| Select_scan              | 31440      |
+| Slave_running            | OFF        |
+| Slow_launch_threads      | 0          |
+| Slow_queries             | 0          |
+| Sort_range               | 0          |
+| Sort_rows                | 36650500   |
+| Sort_scan                | 5298       |
+| Threads_cached           | 0          |
+| Threads_connected        | 1          |
+| Threads_running          | 1          |
+| Uptime                   | 39613      |
++--------------------------+------------+
 @end example
 
 @cindex variables, status
@@ -38003,8 +38011,8 @@ Raw port of an SQL mode for XEmacs. Supports completion. Original by
 Peter D. Pezaris @email{pez@@atlantic2.sbi.com} and partial
 @strong{MySQL} port by David Axmark.
 
-@item @uref{http://www.mysql.com/Downloads/Win32/myaccess97_1_3.zip, MyAccess97 1.3}
-@item @uref{http://www.mysql.com/Downloads/Win32/myaccess2000_1_3.zip, MyAccess2000 1.3}
+@item @uref{http://www.mysql.com/Downloads/Win32/myaccess97_1_4.zip, MyAccess97 1.4}
+@item @uref{http://www.mysql.com/Downloads/Win32/myaccess2000_1_4.zip, MyAccess2000 1.4}
 
 MyAccess is an AddIn for MS Access 97/2000 which allows you to manage MySQL databases from within Access. Main functions are:
 @itemize @bullet
@@ -38013,9 +38021,10 @@ MyAccess is an AddIn for MS Access 97/2000 which allows you to manage MySQL data
 @item Extract "Create Table-Scripts' from MySQL
 @item Import/Export tables from Access to MySQL and vice versa
 @item Log Changes
+@item Show a "Database Definition Report
 @end itemize
 
-Written by Hubertus Hiden. @uref{http://myaccess.fsn.net, MyAccess homepage}.
+Written by Hubertus Hiden. @uref{http://www.accessmysql.com, MyAccess homepage}.
 
 @item @uref{http://www.mysql.com/Downloads/Contrib/radius-0.3.tar.gz, radius-0.3.tar.gz}
 Patches for @code{radiusd} to make it support @strong{MySQL}. By Wim Bonis,
diff --git a/mysys/Makefile.am b/mysys/Makefile.am
index 9e9b4f8d9ed..d64f4959746 100644
--- a/mysys/Makefile.am
+++ b/mysys/Makefile.am
@@ -61,7 +61,7 @@ DEFS =			-DDEFAULT_BASEDIR=\"$(prefix)\" \
 			-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
                         @DEFS@
 
-getopt1.o:		@THREAD_LOBJECTS@
+#getopt1.o:		@THREAD_LOBJECTS@
 
 OMIT_DEPENDENCIES =	pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\
 			__math.h time.h __time.h unistd.h __unistd.h types.h \
diff --git a/sql-bench/test-insert.sh b/sql-bench/test-insert.sh
index 13bcfb2f6a9..8545f449fa6 100755
--- a/sql-bench/test-insert.sh
+++ b/sql-bench/test-insert.sh
@@ -367,38 +367,38 @@ print " for order_by_big ($small_loop_count:$rows): " .
 
 $loop_time=new Benchmark;
 $estimated=$rows=0;
-for ($i=1 ; $i <= $small_loop_count ; $i++)
+for ($i=1 ; $i <= $range_loop_count ; $i++)
 {
-  $start=$opt_loop_count/$small_loop_count*$i;
+  $start=$opt_loop_count/$range_loop_count*$i;
   $end=$start+$i;
   $rows+=fetch_all_rows($dbh,"select dummy1 from bench1 where id>=$start and id <= $end order by id",1);
   $end_time=new Benchmark;
   last if ($estimated=predict_query_time($loop_time,$end_time,\$i,$i,
-					 $small_loop_count));
+					 $range_loop_count));
 }
 if ($estimated)
 { print "Estimated time"; }
 else
 { print "Time"; }
-print " for order_by_key ($small_loop_count:$rows): " .
+print " for order_by_key ($range_loop_count:$rows): " .
   timestr(timediff($end_time, $loop_time),"all") . "\n";
 
 $loop_time=new Benchmark;
 $estimated=$rows=0;
-for ($i=1 ; $i <= $small_loop_count ; $i++)
+for ($i=1 ; $i <= $range_loop_count ; $i++)
 {
-  $start=$opt_loop_count/$small_loop_count*$i;
-  $end=$start+$small_loop_count;
+  $start=$opt_loop_count/$range_loop_count*$i;
+  $end=$start+$range_loop_count;
   $rows+=fetch_all_rows($dbh,"select id2 from bench1 where id3>=$start and id3 <= $end order by id3",1);
   $end_time=new Benchmark;
   last if ($estimated=predict_query_time($loop_time,$end_time,\$i,$i,
-					 $small_loop_count));
+					 $range_loop_count));
 }
 if ($estimated)
 { print "Estimated time"; }
 else
 { print "Time"; }
-print " for order_by_key2_diff ($small_loop_count:$rows): " .
+print " for order_by_key2_diff ($range_loop_count:$rows): " .
   timestr(timediff($end_time, $loop_time),"all") . "\n";
 
 #
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 490a6db89e5..df54bef5d52 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -1150,7 +1150,7 @@ int ha_berkeley::index_read(byte * buf, const byte * key,
     /* 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);
+    memcpy(key_buff2, key_buff, (key_len=last_key.size));
     key_info->handler.bdb_return_if_eq= -1;
     error=read_row(cursor->c_get(cursor, &last_key, &row, DB_SET_RANGE),
 		   buf, active_index, &row, (DBT*) 0, 0);
-- 
2.30.9