summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authormonty@mysql.com <>2004-06-25 18:49:36 +0300
committermonty@mysql.com <>2004-06-25 18:49:36 +0300
commitf6765146c1b97bbb71f79adbd275dc2b6ca79333 (patch)
tree3a9126456bcc45a3caaf4b6c53da125de2769da8 /sql
parent00dc9a0e91835f4cae34d287b4351667fe7fe4dc (diff)
downloadmariadb-git-f6765146c1b97bbb71f79adbd275dc2b6ca79333.tar.gz
Added missing root user to mysql.user on windows. (Bug #4242)
Set default max_allowed_packet to be able to read help tables even if an my.cnf file with this option is present. (Bug #3938) Don't use default arguments for ha_rnd_init() Simple code cleanups since last pull
Diffstat (limited to 'sql')
-rw-r--r--sql/filesort.cc2
-rw-r--r--sql/ha_berkeley.cc8
-rw-r--r--sql/ha_berkeley.h2
-rw-r--r--sql/ha_heap.h2
-rw-r--r--sql/ha_innodb.h2
-rw-r--r--sql/ha_isam.h2
-rw-r--r--sql/ha_isammrg.h2
-rw-r--r--sql/ha_myisam.cc47
-rw-r--r--sql/ha_myisam.h2
-rw-r--r--sql/ha_myisammrg.h2
-rw-r--r--sql/ha_ndbcluster.h2
-rw-r--r--sql/handler.cc6
-rw-r--r--sql/handler.h4
-rw-r--r--sql/records.cc2
-rw-r--r--sql/sql_select.cc6
15 files changed, 47 insertions, 44 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 90129dd4d51..a84fa4fe6f4 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -373,7 +373,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
if (sort_form->key_read) // QQ Can be removed after the reset
file->extra(HA_EXTRA_KEYREAD); // QQ is removed
next_pos=(byte*) 0; /* Find records in sequence */
- file->ha_rnd_init();
+ file->ha_rnd_init(1);
file->extra_opt(HA_EXTRA_CACHE,
current_thd->variables.read_buff_size);
}
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index d5a41328a37..42ff3d4dca6 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -1583,14 +1583,18 @@ int ha_berkeley::index_last(byte * buf)
int ha_berkeley::rnd_init(bool scan)
{
DBUG_ENTER("rnd_init");
- //DBUG_ASSERT(active_index==MAX_KEY);
+#ifdef NOT_YET
+ DBUG_ASSERT(active_index == MAX_KEY);
+#endif
current_row.flags=DB_DBT_REALLOC;
DBUG_RETURN(index_init(primary_key));
}
int ha_berkeley::rnd_end()
{
- active_index= MAX_KEY;
+#ifdef NOT_YET
+ DBUG_ASSERT(active_index == MAX_KEY);
+#endif
return index_end();
}
diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h
index d4823ce3239..3afb73808fc 100644
--- a/sql/ha_berkeley.h
+++ b/sql/ha_berkeley.h
@@ -129,7 +129,7 @@ class ha_berkeley: public handler
int index_prev(byte * buf);
int index_first(byte * buf);
int index_last(byte * buf);
- int rnd_init(bool scan=1);
+ int rnd_init(bool scan);
int rnd_end();
int rnd_next(byte *buf);
int rnd_pos(byte * buf, byte *pos);
diff --git a/sql/ha_heap.h b/sql/ha_heap.h
index 0c3483c7f66..f05146acdc4 100644
--- a/sql/ha_heap.h
+++ b/sql/ha_heap.h
@@ -72,7 +72,7 @@ class ha_heap: public handler
int index_prev(byte * buf);
int index_first(byte * buf);
int index_last(byte * buf);
- int rnd_init(bool scan=1);
+ int rnd_init(bool scan);
int rnd_next(byte *buf);
int rnd_pos(byte * buf, byte *pos);
void position(const byte *record);
diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h
index 2e210b819ea..7e05488289e 100644
--- a/sql/ha_innodb.h
+++ b/sql/ha_innodb.h
@@ -134,7 +134,7 @@ class ha_innobase: public handler
int index_first(byte * buf);
int index_last(byte * buf);
- int rnd_init(bool scan=1);
+ int rnd_init(bool scan);
int rnd_end();
int rnd_next(byte *buf);
int rnd_pos(byte * buf, byte *pos);
diff --git a/sql/ha_isam.h b/sql/ha_isam.h
index ac7a0c52548..521946a17b5 100644
--- a/sql/ha_isam.h
+++ b/sql/ha_isam.h
@@ -63,7 +63,7 @@ class ha_isam: public handler
int index_prev(byte * buf);
int index_first(byte * buf);
int index_last(byte * buf);
- int rnd_init(bool scan=1);
+ int rnd_init(bool scan);
int rnd_next(byte *buf);
int rnd_pos(byte * buf, byte *pos);
void position(const byte *record);
diff --git a/sql/ha_isammrg.h b/sql/ha_isammrg.h
index bf4a7c329ef..166a96cf9e4 100644
--- a/sql/ha_isammrg.h
+++ b/sql/ha_isammrg.h
@@ -53,7 +53,7 @@ class ha_isammrg: public handler
int index_prev(byte * buf);
int index_first(byte * buf);
int index_last(byte * buf);
- int rnd_init(bool scan=1);
+ int rnd_init(bool scan);
int rnd_next(byte *buf);
int rnd_pos(byte * buf, byte *pos);
void position(const byte *record);
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index fc203d14d19..77615d68fe4 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -1004,8 +1004,10 @@ bool ha_myisam::check_and_repair(THD *thd)
{
int error=0;
int marked_crashed;
+ char *old_query;
+ uint old_query_length;
HA_CHECK_OPT check_opt;
- DBUG_ENTER("ha_myisam::auto_check_and_repair");
+ DBUG_ENTER("ha_myisam::check_and_repair");
check_opt.init();
check_opt.flags= T_MEDIUM | T_AUTO_REPAIR;
@@ -1013,30 +1015,29 @@ bool ha_myisam::check_and_repair(THD *thd)
if (!file->state->del && (myisam_recover_options & HA_RECOVER_QUICK))
check_opt.flags|=T_QUICK;
sql_print_error("Warning: Checking table: '%s'",table->path);
- if ((marked_crashed=mi_is_crashed(file)))
+
+ old_query= thd->query;
+ old_query_length= thd->query_length;
+ pthread_mutex_lock(&LOCK_thread_count);
+ thd->query= table->real_name;
+ thd->query_length= strlen(table->real_name);
+ pthread_mutex_unlock(&LOCK_thread_count);
+
+ if ((marked_crashed= mi_is_crashed(file)) || check(thd, &check_opt))
{
- char *old_query= thd->query;
- uint old_query_length= thd->query_length;
- pthread_mutex_lock(&LOCK_thread_count);
- thd->query= table->real_name;
- thd->query_length= strlen(table->real_name);
- pthread_mutex_unlock(&LOCK_thread_count);
- if (check(thd, &check_opt))
- {
- sql_print_error("Warning: Recovering table: '%s'",table->path);
- check_opt.flags=
- ((myisam_recover_options & HA_RECOVER_BACKUP ? T_BACKUP_DATA : 0) |
- (marked_crashed ? 0 : T_QUICK) |
- (myisam_recover_options & HA_RECOVER_FORCE ? 0 : T_SAFE_REPAIR) |
- T_AUTO_REPAIR);
- if (repair(thd, &check_opt))
- error=1;
- }
- pthread_mutex_lock(&LOCK_thread_count);
- thd->query= old_query;
- thd->query_length= old_query_length;
- pthread_mutex_unlock(&LOCK_thread_count);
+ sql_print_error("Warning: Recovering table: '%s'",table->path);
+ check_opt.flags=
+ ((myisam_recover_options & HA_RECOVER_BACKUP ? T_BACKUP_DATA : 0) |
+ (marked_crashed ? 0 : T_QUICK) |
+ (myisam_recover_options & HA_RECOVER_FORCE ? 0 : T_SAFE_REPAIR) |
+ T_AUTO_REPAIR);
+ if (repair(thd, &check_opt))
+ error=1;
}
+ pthread_mutex_lock(&LOCK_thread_count);
+ thd->query= old_query;
+ thd->query_length= old_query_length;
+ pthread_mutex_unlock(&LOCK_thread_count);
DBUG_RETURN(error);
}
diff --git a/sql/ha_myisam.h b/sql/ha_myisam.h
index 72ff6024109..ef3f00577dd 100644
--- a/sql/ha_myisam.h
+++ b/sql/ha_myisam.h
@@ -92,7 +92,7 @@ class ha_myisam: public handler
FT_INFO *ft_init_ext(uint flags, uint inx,const byte *key, uint keylen)
{ return ft_init_search(flags,file,inx,(byte*) key,keylen, table->record[0]); }
int ft_read(byte *buf);
- int rnd_init(bool scan=1);
+ int rnd_init(bool scan);
int rnd_next(byte *buf);
int rnd_pos(byte * buf, byte *pos);
int restart_rnd_next(byte *buf, byte *pos);
diff --git a/sql/ha_myisammrg.h b/sql/ha_myisammrg.h
index 9a663db148c..995cfe9ad4a 100644
--- a/sql/ha_myisammrg.h
+++ b/sql/ha_myisammrg.h
@@ -65,7 +65,7 @@ class ha_myisammrg: public handler
int index_first(byte * buf);
int index_last(byte * buf);
int index_next_same(byte *buf, const byte *key, uint keylen);
- int rnd_init(bool scan=1);
+ int rnd_init(bool scan);
int rnd_next(byte *buf);
int rnd_pos(byte * buf, byte *pos);
void position(const byte *record);
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index 3efb1144d81..39c1779a27a 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -73,7 +73,7 @@ class ha_ndbcluster: public handler
int index_prev(byte *buf);
int index_first(byte *buf);
int index_last(byte *buf);
- int rnd_init(bool scan=1);
+ int rnd_init(bool scan);
int rnd_end();
int rnd_next(byte *buf);
int rnd_pos(byte *buf, byte *pos);
diff --git a/sql/handler.cc b/sql/handler.cc
index e76bda1a6cc..e278d1a5308 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -222,11 +222,9 @@ bool ha_caching_allowed(THD* thd, char* table_key,
{
#ifdef HAVE_INNOBASE_DB
if (cache_type == HA_CACHE_TBL_ASKTRANSACT)
- return innobase_query_caching_of_table_permitted(thd, table_key,
- key_length);
- else
+ return innobase_query_caching_of_table_permitted(thd, table_key, key_length);
#endif
- return 1;
+ return 1;
}
int ha_init()
diff --git a/sql/handler.h b/sql/handler.h
index fb728ef6999..ca452b6dedf 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -271,8 +271,8 @@ public:
uint block_size; /* index block size */
uint raid_type,raid_chunks;
FT_INFO *ft_handler;
- bool auto_increment_column_changed;
enum {NONE=0, INDEX, RND} inited;
+ bool auto_increment_column_changed;
bool implicit_emptied; /* Can be !=0 only if HEAP */
@@ -316,7 +316,7 @@ public:
inited=NONE;
return index_end();
}
- int ha_rnd_init(bool scan=1)
+ int ha_rnd_init(bool scan)
{
DBUG_ASSERT(inited==NONE || (inited==RND && scan));
inited=RND;
diff --git a/sql/records.cc b/sql/records.cc
index 104fe99de0b..94634d30759 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -117,7 +117,7 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
{
DBUG_PRINT("info",("using rr_sequential"));
info->read_record=rr_sequential;
- table->file->ha_rnd_init();
+ table->file->ha_rnd_init(1);
/* We can use record cache if we don't update dynamic length tables */
if (!table->no_cache &&
(use_record_cache > 0 ||
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index d8662af1d39..932ceff2f43 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -5552,7 +5552,7 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
if (table->file->indexes_are_disabled())
new_table.file->disable_indexes(HA_KEY_SWITCH_ALL);
table->file->ha_index_or_rnd_end();
- table->file->ha_rnd_init();
+ table->file->ha_rnd_init(1);
if (table->no_rows)
{
new_table.file->extra(HA_EXTRA_NO_ROWS);
@@ -7504,7 +7504,7 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field,
org_record=(char*) (record=table->record[0])+offset;
new_record=(char*) table->record[1]+offset;
- file->ha_rnd_init();
+ file->ha_rnd_init(1);
error=file->rnd_next(record);
for (;;)
{
@@ -7616,7 +7616,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table,
(*field_length++)= (*ptr)->pack_length();
}
- file->ha_rnd_init();
+ file->ha_rnd_init(1);
key_pos=key_buffer;
for (;;)
{