summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <serg@serg.mysql.com>2001-12-21 13:28:51 +0000
committerunknown <serg@serg.mysql.com>2001-12-21 13:28:51 +0000
commitad24c890aca8a505f384225507b0561c60b2401b (patch)
tree19da197d0ad22cdfac95cf8ec8fa782f87653220
parente506cef831eef9dfad4513337f85a2d85fef2906 (diff)
downloadmariadb-git-ad24c890aca8a505f384225507b0561c60b2401b.tar.gz
HANDLER works only with MyISAM tables
HA_NO_FULLTEXT_KEY property -> HA_CAN_FULLTEXT sql/ha_berkeley.h: HA_NO_FULLTEXT_KEY property -> HA_CAN_FULLTEXT sql/ha_heap.h: HA_NO_FULLTEXT_KEY property -> HA_CAN_FULLTEXT sql/ha_innobase.h: HA_NO_FULLTEXT_KEY property -> HA_CAN_FULLTEXT sql/ha_isam.h: HA_NO_FULLTEXT_KEY property -> HA_CAN_FULLTEXT sql/ha_isammrg.h: HA_NO_FULLTEXT_KEY property -> HA_CAN_FULLTEXT sql/ha_myisammrg.h: HA_NO_FULLTEXT_KEY property -> HA_CAN_FULLTEXT sql/sql_handler.cc: HANDLER works only with MyISAM tables sql/sql_table.cc: HA_NO_FULLTEXT_KEY property -> HA_CAN_FULLTEXT
-rw-r--r--sql/ha_berkeley.h2
-rw-r--r--sql/ha_heap.h2
-rw-r--r--sql/ha_innobase.h2
-rw-r--r--sql/ha_isam.h2
-rw-r--r--sql/ha_isammrg.h2
-rw-r--r--sql/ha_myisam.h5
-rw-r--r--sql/ha_myisammrg.h2
-rw-r--r--sql/handler.h3
-rw-r--r--sql/sql_handler.cc21
-rw-r--r--sql/sql_table.cc2
10 files changed, 26 insertions, 17 deletions
diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h
index ab1ead5a3e9..65116f908ac 100644
--- a/sql/ha_berkeley.h
+++ b/sql/ha_berkeley.h
@@ -90,7 +90,7 @@ class ha_berkeley: public handler
HA_REC_NOT_IN_SEQ |
HA_KEYPOS_TO_RNDPOS | HA_READ_ORDER | HA_LASTKEY_ORDER |
HA_LONGLONG_KEYS | HA_NULL_KEY | HA_HAVE_KEY_READ_ONLY |
- HA_BLOB_KEY | HA_NOT_EXACT_COUNT | HA_NO_FULLTEXT_KEY |
+ HA_BLOB_KEY | HA_NOT_EXACT_COUNT |
HA_PRIMARY_KEY_IN_READ_INDEX | HA_DROP_BEFORE_CREATE |
HA_AUTO_PART_KEY),
changed_rows(0),last_dup_key((uint) -1),version(0),using_ignore(0)
diff --git a/sql/ha_heap.h b/sql/ha_heap.h
index 93deedb65d2..9b041411012 100644
--- a/sql/ha_heap.h
+++ b/sql/ha_heap.h
@@ -35,7 +35,7 @@ class ha_heap: public handler
ulong option_flag() const
{ return (HA_READ_RND_SAME | HA_NO_INDEX | HA_ONLY_WHOLE_INDEX |
HA_WRONG_ASCII_ORDER | HA_KEYPOS_TO_RNDPOS | HA_NO_BLOBS |
- HA_REC_NOT_IN_SEQ | HA_NO_FULLTEXT_KEY); }
+ HA_REC_NOT_IN_SEQ); }
uint max_record_length() const { return HA_MAX_REC_LENGTH; }
uint max_keys() const { return MAX_KEY; }
uint max_key_parts() const { return MAX_REF_PARTS; }
diff --git a/sql/ha_innobase.h b/sql/ha_innobase.h
index 83e43b1d662..b6419a5e74e 100644
--- a/sql/ha_innobase.h
+++ b/sql/ha_innobase.h
@@ -79,7 +79,7 @@ class ha_innobase: public handler
HA_KEYPOS_TO_RNDPOS | HA_LASTKEY_ORDER |
HA_HAVE_KEY_READ_ONLY | HA_READ_NOT_EXACT_KEY |
HA_LONGLONG_KEYS | HA_NULL_KEY |
- HA_NOT_EXACT_COUNT | HA_NO_FULLTEXT_KEY |
+ HA_NOT_EXACT_COUNT |
HA_NO_WRITE_DELAYED |
HA_PRIMARY_KEY_IN_READ_INDEX |
HA_DROP_BEFORE_CREATE |
diff --git a/sql/ha_isam.h b/sql/ha_isam.h
index d839a6b1141..33ca99b5063 100644
--- a/sql/ha_isam.h
+++ b/sql/ha_isam.h
@@ -34,7 +34,7 @@ class ha_isam: public handler
HA_KEYPOS_TO_RNDPOS | HA_READ_ORDER | HA_LASTKEY_ORDER |
HA_HAVE_KEY_READ_ONLY | HA_READ_NOT_EXACT_KEY |
HA_LONGLONG_KEYS | HA_KEY_READ_WRONG_STR | HA_DUPP_POS |
- HA_NOT_DELETE_WITH_CACHE | HA_NO_FULLTEXT_KEY)
+ HA_NOT_DELETE_WITH_CACHE)
{}
~ha_isam() {}
const char *table_type() const { return "ISAM"; }
diff --git a/sql/ha_isammrg.h b/sql/ha_isammrg.h
index 5e0eaa1b2aa..888ecf0ca37 100644
--- a/sql/ha_isammrg.h
+++ b/sql/ha_isammrg.h
@@ -33,7 +33,7 @@ class ha_isammrg: public handler
const char *table_type() const { return "MRG_ISAM"; }
const char **bas_ext() const;
ulong option_flag() const { return HA_READ_RND_SAME | HA_KEYPOS_TO_RNDPOS
- | HA_REC_NOT_IN_SEQ | HA_NO_FULLTEXT_KEY;}
+ | HA_REC_NOT_IN_SEQ;}
uint max_record_length() const { return HA_MAX_REC_LENGTH; }
uint max_keys() const { return 0; }
uint max_key_parts() const { return 0; }
diff --git a/sql/ha_myisam.h b/sql/ha_myisam.h
index eba2bde7d59..7b5c959ccfa 100644
--- a/sql/ha_myisam.h
+++ b/sql/ha_myisam.h
@@ -45,9 +45,10 @@ class ha_myisam: public handler
public:
ha_myisam(TABLE *table): handler(table), file(0),
int_option_flag(HA_READ_NEXT | HA_READ_PREV | HA_READ_RND_SAME |
- HA_KEYPOS_TO_RNDPOS | HA_READ_ORDER | HA_LASTKEY_ORDER |
+ HA_KEYPOS_TO_RNDPOS | HA_READ_ORDER | HA_LASTKEY_ORDER |
HA_HAVE_KEY_READ_ONLY | HA_READ_NOT_EXACT_KEY |
- HA_LONGLONG_KEYS | HA_NULL_KEY |
+ HA_LONGLONG_KEYS | HA_NULL_KEY |
+ HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER |
HA_DUPP_POS | HA_BLOB_KEY | HA_AUTO_PART_KEY),
enable_activate_all_index(1)
{}
diff --git a/sql/ha_myisammrg.h b/sql/ha_myisammrg.h
index 7d696162de0..e18c520c803 100644
--- a/sql/ha_myisammrg.h
+++ b/sql/ha_myisammrg.h
@@ -35,7 +35,7 @@ class ha_myisammrg: public handler
ulong option_flag() const
{ return (HA_REC_NOT_IN_SEQ | HA_READ_NEXT |
HA_READ_PREV | HA_READ_RND_SAME |
- HA_HAVE_KEY_READ_ONLY | HA_NO_FULLTEXT_KEY |
+ HA_HAVE_KEY_READ_ONLY |
HA_KEYPOS_TO_RNDPOS | HA_READ_ORDER |
HA_LASTKEY_ORDER | HA_READ_NOT_EXACT_KEY |
HA_LONGLONG_KEYS | HA_NULL_KEY | HA_BLOB_KEY); }
diff --git a/sql/handler.h b/sql/handler.h
index 98358c3b3e4..1e2c0074475 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -76,7 +76,8 @@
#define HA_NOT_DELETE_WITH_CACHE (HA_NOT_READ_AFTER_KEY*2)
#define HA_NO_TEMP_TABLES (HA_NOT_DELETE_WITH_CACHE*2)
#define HA_NO_PREFIX_CHAR_KEYS (HA_NO_TEMP_TABLES*2)
-#define HA_NO_FULLTEXT_KEY (HA_NO_PREFIX_CHAR_KEYS*2)
+#define HA_CAN_FULLTEXT (HA_NO_PREFIX_CHAR_KEYS*2)
+#define HA_CAN_SQL_HANDLER (HA_CAN_FULLTEXT*2)
/* Parameters for open() (in register form->filestat) */
/* HA_GET_INFO does an implicit HA_ABORT_IF_LOCKED */
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index 8de74adae45..cd225552dad 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -43,7 +43,7 @@
thd->open_tables=thd->handler_tables; \
thd->handler_tables=tmp; }
-static TABLE **find_table_ptr_by_name(THD *thd, const char *db,
+static TABLE **find_table_ptr_by_name(THD *thd, const char *db,
const char *table_name);
int mysql_ha_open(THD *thd, TABLE_LIST *tables)
@@ -54,6 +54,13 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables)
if (err)
return -1;
+ // there can be only one table in *tables
+ if (!(tables->table->file->option_flag() & HA_CAN_SQL_HANDLER))
+ {
+ my_printf_error(ER_ILLEGAL_HA,ER(ER_ILLEGAL_HA),MYF(0), tables->name);
+ return -1;
+ }
+
send_ok(&thd->net);
return 0;
}
@@ -73,7 +80,7 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables)
return 0;
}
-static enum enum_ha_read_modes rkey_to_rnext[]=
+static enum enum_ha_read_modes rkey_to_rnext[]=
{ RNEXT, RNEXT, RPREV, RNEXT, RPREV, RNEXT, RPREV };
int mysql_ha_read(THD *thd, TABLE_LIST *tables,
@@ -166,7 +173,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
if (!(key= (byte*) sql_calloc(ALIGN_SIZE(key_len))))
{
send_error(&thd->net,ER_OUTOFMEMORY);
- goto err;
+ goto err;
}
key_copy(key, table, keyno, key_len);
err=table->file->index_read(table->record[0],
@@ -176,7 +183,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
}
default:
send_error(&thd->net,ER_ILLEGAL_HA);
- goto err;
+ goto err;
}
if (err)
@@ -191,7 +198,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
goto ok;
}
if (cond)
- {
+ {
err=err;
if(!cond->val_int())
continue;
@@ -234,7 +241,7 @@ err:
**************************************************************************/
/* Note: this function differs from find_locked_table() because we're looking
- here for alias, not real table name
+ here for alias, not real table name
*/
static TABLE **find_table_ptr_by_name(THD *thd, const char *db,
const char *table_name)
@@ -244,7 +251,7 @@ static TABLE **find_table_ptr_by_name(THD *thd, const char *db,
if (!db || ! *db)
db= thd->db ? thd->db : "";
- dblen=strlen(db)+1;
+ dblen=strlen(db)+1;
ptr=&(thd->handler_tables);
for (TABLE *table=*ptr; table ; table=*ptr)
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index d4324a4e5ac..d3c11ab8716 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -430,7 +430,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
if (key->type == Key::FULLTEXT)
{
- if (file->option_flag() & HA_NO_FULLTEXT_KEY)
+ if (!(file->option_flag() & HA_CAN_FULLTEXT))
{
my_error(ER_TABLE_CANT_HANDLE_FULLTEXT, MYF(0));
DBUG_RETURN(-1);