summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-08-26 23:24:48 +0300
committerunknown <monty@hundin.mysql.fi>2001-08-26 23:24:48 +0300
commit30774b35493d3ad14ee40b73d4b9ffff51dd6cd1 (patch)
tree7df1f3b7860b5ebb86cad40aa765d858dcbe716b
parent0733b85d75c560cc2e9cca84e490a4ccde5a945a (diff)
downloadmariadb-git-30774b35493d3ad14ee40b73d4b9ffff51dd6cd1.tar.gz
Fixed bug in auto-increment handling with InnoDB
Some small speedups Docs/manual.texi: Changelog client/mysqldump.c: Fixed quoting problem for table names when using --opt mysys/mf_casecnv.c: Speed up some common string functions sql-bench/test-insert.sh: Small changes that shouldn't affect results sql-bench/test-select.sh: Small changes that shouldn't affect results sql/field.h: Added reset() functions to speed up some common things sql/gen_lex_hash.cc: Smaller hash table sql/ha_innobase.cc: Fixed bug in auto-increment handling with InnoDB
-rw-r--r--Docs/manual.texi2
-rw-r--r--client/mysqldump.c8
-rw-r--r--mysys/mf_casecnv.c32
-rw-r--r--sql-bench/test-insert.sh4
-rw-r--r--sql-bench/test-select.sh6
-rw-r--r--sql/field.h14
-rw-r--r--sql/gen_lex_hash.cc2
-rw-r--r--sql/ha_innobase.cc2
8 files changed, 49 insertions, 21 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index ee58f786b29..a3397de70a6 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -46672,6 +46672,8 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.42
@itemize @bullet
@item
+Fixed bug in @code{InnoDB} and @code{AUTO_INCREMENT} columns.
+@item
Applied large patch for OS/2 from Yuri Dario.
@item
Fixed problem with InnoDB when one could get the error @code{Can't
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 29629940fb5..9038c88e085 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -37,7 +37,7 @@
** Tõnu Samuel <tonu@please.do.not.remove.this.spam.ee>
**/
-#define DUMP_VERSION "8.14"
+#define DUMP_VERSION "8.15"
#include <global.h>
#include <my_sys.h>
@@ -1224,6 +1224,7 @@ static int dump_all_tables_in_db(char *database)
{
char *table;
uint numrows;
+ char table_buff[NAME_LEN+3];
if (init_dumping(database))
return 1;
@@ -1233,7 +1234,7 @@ static int dump_all_tables_in_db(char *database)
init_dynamic_string(&query, "LOCK TABLES ", 256, 1024);
for (numrows=0 ; (table = getTableName(1)) ; numrows++)
{
- dynstr_append(&query, table);
+ dynstr_append(&query, quote_name(table,table_buff));
dynstr_append(&query, " READ /*!32311 LOCAL */,");
}
if (numrows && mysql_real_query(sock, query.str, query.length-1))
@@ -1263,6 +1264,7 @@ static int dump_all_tables_in_db(char *database)
static int dump_selected_tables(char *db, char **table_names, int tables)
{
uint numrows;
+ char table_buff[NAME_LEN+3];
if (init_dumping(db))
return 1;
@@ -1274,7 +1276,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
init_dynamic_string(&query, "LOCK TABLES ", 256, 1024);
for (i=0 ; i < tables ; i++)
{
- dynstr_append(&query, table_names[i]);
+ dynstr_append(&query, quote_name(table_names[i],table_buff));
dynstr_append(&query, " READ /*!32311 LOCAL */,");
}
if (mysql_real_query(sock, query.str, query.length-1))
diff --git a/mysys/mf_casecnv.c b/mysys/mf_casecnv.c
index 1d63527eb7b..4ec3b66d9cb 100644
--- a/mysys/mf_casecnv.c
+++ b/mysys/mf_casecnv.c
@@ -31,14 +31,16 @@
void caseup_str(my_string str)
{
#ifdef USE_MB
- register uint32 l;
- register char *end=str+(uint) strlen(str);
if (use_mb(default_charset_info))
+ {
+ register uint32 l;
+ register char *end=str+(uint) strlen(str);
while (*str)
{
if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
else *str=toupper(*str),++str;
}
+ }
else
#endif
while ((*str = toupper(*str)) != 0)
@@ -50,14 +52,16 @@ void caseup_str(my_string str)
void casedn_str(my_string str)
{
#ifdef USE_MB
- register uint32 l;
- register char *end=str+(uint) strlen(str);
if (use_mb(default_charset_info))
+ {
+ register uint32 l;
+ register char *end=str+(uint) strlen(str);
while (*str)
{
if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
else *str=tolower(*str),++str;
}
+ }
else
#endif
while ((*str= tolower(*str)) != 0)
@@ -70,14 +74,16 @@ void casedn_str(my_string str)
void caseup(my_string str, uint length)
{
#ifdef USE_MB
- register uint32 l;
- register char *end=str+length;
if (use_mb(default_charset_info))
+ {
+ register uint32 l;
+ register char *end=str+length;
while (str<end)
{
if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
else *str=toupper(*str),++str;
}
+ }
else
#endif
for ( ; length>0 ; length--, str++)
@@ -89,14 +95,16 @@ void caseup(my_string str, uint length)
void casedn(my_string str, uint length)
{
#ifdef USE_MB
- register uint32 l;
- register char *end=str+length;
if (use_mb(default_charset_info))
+ {
+ register uint32 l;
+ register char *end=str+length;
while (str<end)
{
if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
else *str=tolower(*str),++str;
}
+ }
else
#endif
for ( ; length>0 ; length--, str++)
@@ -143,10 +151,10 @@ skipp:
int my_strcasecmp(const char *s, const char *t)
{
#ifdef USE_MB
- register uint32 l;
- register const char *end=s+(uint) strlen(s);
if (use_mb(default_charset_info))
{
+ register uint32 l;
+ register const char *end=s+(uint) strlen(s);
while (s<end)
{
if ((l=my_ismbchar(default_charset_info, s,end)))
@@ -172,10 +180,10 @@ int my_strcasecmp(const char *s, const char *t)
int my_casecmp(const char *s, const char *t, uint len)
{
#ifdef USE_MB
- register uint32 l;
- register const char *end=s+len;
if (use_mb(default_charset_info))
{
+ register uint32 l;
+ register const char *end=s+len;
while (s<end)
{
if ((l=my_ismbchar(default_charset_info, s,end)))
diff --git a/sql-bench/test-insert.sh b/sql-bench/test-insert.sh
index b8f20b123a5..9d1adda1fc3 100644
--- a/sql-bench/test-insert.sh
+++ b/sql-bench/test-insert.sh
@@ -562,7 +562,7 @@ if ($limits->{'group_functions'})
fetch_all_rows($dbh,"select min(id) from bench1");
fetch_all_rows($dbh,"select max(id) from bench1");
fetch_all_rows($dbh,"select sum(id+0.0) from bench1");
- fetch_all_rows($dbh,"select min(id3),max(id3),sum(id3 +0.0) from bench1");
+ fetch_all_rows($dbh,"select min(id3),max(id3),sum(id3-0.0) from bench1");
if ($limits->{'group_func_sql_min_str'})
{
fetch_all_rows($dbh,"select min(dummy1),max(dummy1) from bench1");
@@ -579,7 +579,7 @@ if ($limits->{'group_functions'})
$count++;
- $sth=$dbh->prepare($query="select count(*),sum(id+0.0),min(id),max(id),avg(id+0.0) from bench1") or die $DBI::errstr;
+ $sth=$dbh->prepare($query="select count(*),sum(id+0.0),min(id),max(id),avg(id-0.0) from bench1") or die $DBI::errstr;
$sth->execute or die $DBI::errstr;
@row=$sth->fetchrow_array;
if ($row[0] != $total_rows ||
diff --git a/sql-bench/test-select.sh b/sql-bench/test-select.sh
index 3c7efe3c5c2..1ecad5804c5 100644
--- a/sql-bench/test-select.sh
+++ b/sql-bench/test-select.sh
@@ -136,12 +136,12 @@ if ($limits->{'group_functions'})
print "Test if the database has a query cache\n";
# First ensure that the table is read into memory
- fetch_all_rows($dbh,"select sum(idn+$tmp),sum(rev_idn+$tmp) from bench1");
+ fetch_all_rows($dbh,"select sum(idn+$tmp),sum(rev_idn-$tmp) from bench1");
$loop_time=new Benchmark;
for ($tests=0 ; $tests < $opt_loop_count ; $tests++)
{
- fetch_all_rows($dbh,"select sum(idn+$tests),sum(rev_idn+$tests) from bench1");
+ fetch_all_rows($dbh,"select sum(idn+$tests),sum(rev_idn-$tests) from bench1");
}
$end_time=new Benchmark;
print "Time for select_query_cache ($opt_loop_count): " .
@@ -153,7 +153,7 @@ if ($limits->{'group_functions'})
$loop_time=new Benchmark;
for ($tests=0 ; $tests < $opt_loop_count ; $tests++)
{
- fetch_all_rows($dbh,"select sum(idn+$tests),sum(rev_idn+$tests) from bench1");
+ fetch_all_rows($dbh,"select sum(idn+$tests),sum(rev_idn-$tests) from bench1");
}
$end_time=new Benchmark;
print "Time for select_query_cache2 ($opt_loop_count): " .
diff --git a/sql/field.h b/sql/field.h
index fc0bfdc75d5..b9d8e1957c9 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -300,6 +300,7 @@ public:
void store(const char *to,uint length);
void store(double nr);
void store(longlong nr);
+ void reset(void) { ptr[0]=0; }
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
@@ -328,6 +329,7 @@ public:
void store(const char *to,uint length);
void store(double nr);
void store(longlong nr);
+ void reset(void) { ptr[0]=ptr[1]=0; }
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
@@ -356,6 +358,7 @@ public:
void store(const char *to,uint length);
void store(double nr);
void store(longlong nr);
+ void reset(void) { ptr[0]=ptr[1]=ptr[2]=0; }
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
@@ -389,6 +392,7 @@ public:
void store(const char *to,uint length);
void store(double nr);
void store(longlong nr);
+ void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; }
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
@@ -423,6 +427,7 @@ public:
void store(const char *to,uint length);
void store(double nr);
void store(longlong nr);
+ void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0; }
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
@@ -449,6 +454,7 @@ public:
void store(const char *to,uint length);
void store(double nr);
void store(longlong nr);
+ void reset(void) { bzero(ptr,sizeof(float)); }
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
@@ -480,6 +486,7 @@ public:
void store(const char *to,uint length);
void store(double nr);
void store(longlong nr);
+ void reset(void) { bzero(ptr,sizeof(double)); }
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
@@ -505,6 +512,7 @@ public:
void store(const char *to, uint length) { null[0]=1; }
void store(double nr) { null[0]=1; }
void store(longlong nr) { null[0]=1; }
+ void reset(void) {}
double val_real(void) { return 0.0;}
longlong val_int(void) { return 0;}
String *val_str(String *value,String *value2)
@@ -528,6 +536,7 @@ public:
void store(const char *to,uint length);
void store(double nr);
void store(longlong nr);
+ void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; }
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
@@ -588,6 +597,7 @@ public:
void store(const char *to,uint length);
void store(double nr);
void store(longlong nr);
+ void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; }
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
@@ -615,6 +625,7 @@ public:
void store(double nr);
void store(longlong nr);
void store_time(TIME *ltime,timestamp_type type);
+ void reset(void) { ptr[0]=ptr[1]=ptr[2]=0; }
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
@@ -643,6 +654,7 @@ public:
void store(const char *to,uint length);
void store(double nr);
void store(longlong nr);
+ void reset(void) { ptr[0]=ptr[1]=ptr[2]=0; }
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
@@ -673,6 +685,7 @@ public:
void store(double nr);
void store(longlong nr);
void store_time(TIME *ltime,timestamp_type type);
+ void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0; }
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
@@ -922,6 +935,7 @@ public:
void store(const char *to,uint length);
void store(double nr);
void store(longlong nr);
+ void reset() { bzero(ptr,packlength); }
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc
index 5eee5c6163a..d55197a8b60 100644
--- a/sql/gen_lex_hash.cc
+++ b/sql/gen_lex_hash.cc
@@ -472,7 +472,7 @@ int main(int argc,char **argv)
int error;
MY_INIT(argv[0]);
- start_value=487844L; best_t1=4969454L; best_t2=2266538L; best_type=2; /* mode=4567 add=5 type: 0 */
+ start_value=4597269L; best_t1=6001982L; best_t2=5063828L; best_type=4; /* mode=4513 add=8 type: 0 */
if (get_options(argc,(char **) argv))
exit(1);
diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc
index fdbc0b107f5..061371eb5d4 100644
--- a/sql/ha_innobase.cc
+++ b/sql/ha_innobase.cc
@@ -1334,6 +1334,8 @@ ha_innobase::write_row(
autoincrement field */
auto_inc = table->next_number_field->val_int();
+ if (auto_inc == 0)
+ auto_inc= user_thd->next_insert_id;
if (auto_inc != 0) {
/* This call will calculate the max of the